Changeset 212


Ignore:
Timestamp:
Jul 27, 2010, 1:57:58 PM (11 years ago)
Author:
Joachim Langenbach
Message:
Location:
branches/release-0.3.0-rc1/src
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • branches/release-0.3.0-rc1/src/MediaDBLib/CMakeLists.txt

    r211 r212  
    6565  mediumexport.cpp
    6666  selectexportformat.cpp
    67   shoppingcartdelegate.cpp
    6867  searchexternalapp.cpp
    6968  program.cpp
     
    10099        mpushbutton.cpp
    101100        mediumwidget.cpp
     101        shoppingcartdelegate.cpp
    102102)                     
    103103       
    104104# include with QT_USE selected library parts
    105105INCLUDE(${QT_USE_FILE})
     106SET(LINK_LIBRARIES ${QT_LIBRARIES})
    106107
    107108INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
     
    111112  ADD_DEFINITIONS(-DQT_NO_DEBUG)
    112113ENDIF()         
    113 #IF(WIN32)                       
    114 #  ADD_DEFINITIONS(-DDESUTOLIB_DLL)
    115 #ENDIF()                           
     114
     115IF(BINDINGS_KDE)
     116        ADD_DEFINITIONS(${KDE4_DEFINITIONS})
     117        INCLUDE(KDE4Defaults)
     118        INCLUDE(MacroLibrary)
     119        INCLUDE_DIRECTORIES(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR})
     120        SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${KDE_KDECORE_LIBS} ${KDE4_KPARTS_LIBS})
     121ENDIF(BINDINGS_KDE)
    116122
    117123IF(WIN32)
     
    132138
    133139ADD_LIBRARY(mediadblib SHARED
    134   ${mediadblib_CPP}
    135   ${mediadblib_UI_H}
    136   ${mediadblib_TRANS}
     140        ${mediadblib_CPP}
     141        ${mediadblib_UI_H}
     142        ${mediadblib_TRANS}
    137143)
    138144
    139145TARGET_LINK_LIBRARIES(mediadblib
    140   ${QT_LIBRARIES}
     146  ${LINK_LIBRARIES}
    141147)
    142148
     
    161167        ENDIF(BUILD_DEV)
    162168        INSTALL(TARGETS mediadblib
    163                 LIBRARY DESTINATION ${shared_DIR}
     169                LIBRARY DESTINATION ${shared_DIR}
    164170                COMPONENT library
    165171  )
     
    230236
    231237IF(BUILD_DEV)
    232         ADD_SUBDIRECTORY(DesignerPlugin)
     238        ADD_SUBDIRECTORY(DesignerPlugin)
    233239ENDIF(BUILD_DEV)
  • branches/release-0.3.0-rc1/src/MediaDBLib/DesignerPlugin/CMakeLists.txt

    r210 r212  
    3737  ${mediadblib_BINARY_DIR}
    3838)
    39 LINK_DIRECTORIES(${mediadblib_SOURCE_DIR}})
     39# LINK_DIRECTORIES(${mediadblib_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../../lib)
    4040
    4141QT4_WRAP_UI(designer_UI_H ${designer_UI})
     
    4949ENDIF()         
    5050IF(WIN32)                       
    51   ADD_DEFINITIONS(-DDESUTOLIB_DLL)
     51  ADD_DEFINITIONS(-DMEDIADBLIB_DLL)
    5252ENDIF()                           
    5353
  • branches/release-0.3.0-rc1/src/MediaDBLib/addmedium.h

    r201 r212  
    2121#define ADDMEDIUM_H
    2222
     23#include "mediadblibmacro.h"
     24
    2325#include <mdialog.h>
    2426#include "ui_addmedium.h"
     
    3638        * @todo use the specific search widget of the given MediaModel
    3739        */
    38 class AddMedium : public MDialog, private Ui::AddMedium
     40class EXPORT_DLL AddMedium : public MDialog, private Ui::AddMedium
    3941{
    4042        Q_OBJECT
  • branches/release-0.3.0-rc1/src/MediaDBLib/buydata.h

    r201 r212  
    2121#define BUYDATA_H
    2222
     23#include "mediadblibmacro.h"
     24
    2325class Medium;
    2426class SearchPlugin;
     
    2628#include <QString>
    2729
    28 class BuyData {
     30class EXPORT_DLL BuyData {
    2931  public:
    3032    BuyData();
  • branches/release-0.3.0-rc1/src/MediaDBLib/config.h.in

    r201 r212  
    2424#cmakedefine QT_VERSION_MINOR @QT_VERSION_MINOR@
    2525
     26#cmakedefine KDE @KDE@
     27
    2628#endif // CONFIG_H_IN
  • branches/release-0.3.0-rc1/src/MediaDBLib/loanmodel.cpp

    r201 r212  
    9292        items.clear();
    9393        emit layoutChanged();
     94        if(items.size() == 0)
     95                return true;
     96        return false;
    9497}
    9598
     
    152155                        return item->lastChange();
    153156        }
     157        return QVariant();
    154158}
    155159
  • branches/release-0.3.0-rc1/src/MediaDBLib/materialpersonsmodel.cpp

    r201 r212  
    5353        newPerson->setRole(sourcePerson->role(), false);
    5454        newPerson->setRole(sourcePerson->roleName(), false);
     55        return true;
    5556}
    5657
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediadblibmacro.h

    r201 r212  
    1818*/
    1919
    20 #ifdef BUILD_DLL
    21   #define EXPORT_DLL Q_DECL_EXPORT
    22 #else
    23   #define EXPORT_DLL
    24 #endif
     20// #ifdef BUILD_DLL
     21#define EXPORT_DLL Q_DECL_EXPORT
     22// #else
     23//   #define EXPORT_DLL
     24// #endif
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumexport.cpp

    r205 r212  
    234234        cell = table->cellAt(1, 1);
    235235        cell.firstCursorPosition().insertText(QDateTime::currentDateTime().toString(tr("MM/dd/yyyy hh:mm:ss")));
     236        return true;
    236237}
    237238
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumimagewidget.cpp

    r210 r212  
    1717
    1818*/
     19
     20#include "config.h"
    1921
    2022#include "mediumimagewidget.h"
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumloandialog.h

    r201 r212  
    2121#define MEDIUMLOANDIALOG_H
    2222
     23#include "mediadblibmacro.h"
     24
    2325#include <mdialog.h>
    2426#include <medium.h>
     
    2729class MediumLoanWidget;
    2830
    29 class MediumLoanDialog : public MDialog
     31class EXPORT_DLL MediumLoanDialog : public MDialog
    3032{
    3133        Q_OBJECT
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumownerdialog.h

    r201 r212  
    2020#define MEDIUMOWNERDIALOG_H
    2121
     22#include "mediadblibmacro.h"
     23
    2224#include <mdialog.h>
    2325#include <medium.h>
     
    2628class MediumOwnerWidget;
    2729
    28 class MediumOwnerDialog : public MDialog
     30class EXPORT_DLL MediumOwnerDialog : public MDialog
    2931{
    3032        Q_OBJECT
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumpersonswidget.cpp

    r210 r212  
    1717
    1818*/
     19
     20#include "config.h"
    1921
    2022#include "mediumpersonswidget.h"
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumtitlewidget.h

    r201 r212  
    2121#define MEDIUMTITLEWIDGET_H
    2222
    23 #include <mwidget.h>
     23#include "mwidget.h"
    2424#include "mediadblibmacro.h"
    2525
  • branches/release-0.3.0-rc1/src/MediaDBLib/mediumwidget.h

    r205 r212  
    6262    QBrush notFoundBrush, foundBrush, notEnoughBrush;
    6363                unsigned int maxWidth, rowHeight, titleHeight, padding, margin;
    64                 unsigned int quantity;
     64                int quantity;
    6565                BuyData buyData;
    6666                bool inShoppingCartMode;
  • branches/release-0.3.0-rc1/src/MediaDBLib/mimemodelitem.h

    r201 r212  
    2121#define MIMEMODELITEM_H
    2222
    23 #include "mediadblibmacro.h"
    24 
    25 class EXPORT_DLL MimeModelItem
     23class MimeModelItem
    2624{
    2725  public:
  • branches/release-0.3.0-rc1/src/MediaDBLib/shoppingcartdelegate.h

    r204 r212  
    2121#define SHOPPINGCARTDELEGATE_H
    2222
     23#include "mediadblibmacro.h"
     24
    2325#include <QStyledItemDelegate>
    2426
     
    3234#include <QMultiMap>
    3335
    34 class ShoppingCartDelegate : public QStyledItemDelegate
     36class EXPORT_DLL ShoppingCartDelegate : public QStyledItemDelegate
    3537{
    3638    Q_OBJECT
  • branches/release-0.3.0-rc1/src/MediaDBLib/sqlconstraint.h

    r201 r212  
    2121#define SQLCONSTRAINT_H
    2222
     23#include "mediadblibmacro.h"
     24
    2325#include <QStringList>
    2426#include <QVariant>
     
    3335        * and they must have the correct order from first to last placeholder (using positional placeholders here)
    3436        */
    35 class SqlConstraint
     37class EXPORT_DLL SqlConstraint
    3638{
    3739        public:
  • branches/release-0.3.0-rc1/src/MediaDBLib/sqllogin.cpp

    r208 r212  
    2424#include <QSqlError>
    2525
     26#ifdef KDE
     27        #include <KWallet/Wallet>
     28#endif
     29
    2630SqlLogin::SqlLogin ( QWidget *parent ) : MDialog ( parent ), m_ui ( new Ui::SqlLogin )
    2731{
     
    6165  QSettings qSettings;
    6266  qSettings.beginGroup ( "database" );
    63         if(!username.isEmpty())
     67        if(!username.isEmpty()){
    6468                this->username = username;
     69#ifdef KDE
     70                // try to set password from kwallet the user
     71                if(wallet)
     72                        if(wallet->isOpen())
     73                                wallet->readPassword(username, this->password);
     74#endif
     75        }
     76        m_ui->usernameEdit->setText(this->username);
     77       
    6578        if(!password.isEmpty())
    6679                this->password = password;
     80        m_ui->passwordEdit->setText(this->password);
    6781       
    6882        if(!host.isEmpty()){
     
    155169  }
    156170
    157         m_ui->usernameEdit->setText(username);
    158         m_ui->passwordEdit->setText(password);
    159171        // try to finish
    160172        if((!username.isEmpty()) && (!password.isEmpty())
     
    188200void SqlLogin::finish()
    189201{
     202        username = m_ui->usernameEdit->text();
     203        password = m_ui->passwordEdit->text();
     204       
    190205  if ( !driver.contains ( "SQLITE" ) ) {
    191     if ( m_ui->usernameEdit->text().isEmpty() ) {
     206    if ( username.isEmpty() ) {
    192207      displayError ( tr ( "Please enter your username" ) );
    193208      return;
    194209    }
    195210
    196     if ( m_ui->passwordEdit->text().isEmpty() ) {
     211    if ( password.isEmpty() ) {
    197212      displayError ( tr ( "Please enter your password" ) );
    198213      return;
     
    233248  if ( !driver.contains ( "SQLITE" ) ) {
    234249    db.setHostName ( host );
    235     db.setUserName ( m_ui->usernameEdit->text() );
    236     db.setPassword ( m_ui->passwordEdit->text() );
     250    db.setUserName ( username );
     251    db.setPassword ( password );
    237252  }
    238253
     
    253268    // we already tried without database and it doesn't work, so we give up
    254269    displayError ( tr ( "Can not connect to database:\n%1" ).arg ( db.lastError().text() ) );
    255     m_ui->passwordEdit->setText ( "" );
     270                password = "";
     271    m_ui->passwordEdit->setText ( password );
    256272    return;
    257273  }
    258274
     275#ifdef KDE
     276        if((!username.isEmpty()) && (!password.isEmpty()))
     277                if(wallet)
     278                        if(wallet->isOpen())
     279                                wallet->writePassword(username, password);
     280#endif
     281
    259282  accept();
    260283}
     
    263286{
    264287  emit showSettings();
     288}
     289
     290void SqlLogin::usernameChanged()
     291{
     292        username = m_ui->usernameEdit->text();
     293        password = "";
     294        m_ui->passwordEdit->setText("");
     295#ifdef KDE
     296        // try to get password for user
     297        if(!wallet)
     298                return;
     299        if(!wallet->isOpen())
     300                return;
     301        QMap<QString, QString> list;
     302        wallet->readPasswordList("*", list);
     303        foreach(QString key, list.uniqueKeys()){
     304                if(key == username){
     305                        password = list.value(key);
     306                        m_ui->passwordEdit->setText(password);
     307                }
     308        }
     309#endif
    265310}
    266311
     
    270315  setWindowModality ( Qt::WindowModal );
    271316  m_ui->setupUi ( this );
     317       
     318#ifdef KDE
     319        wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), winId());
     320        if(wallet){
     321                QSettings settings;
     322                QString myFolder = settings.value("appNameShort", "MediaDB").toString();
     323                if(!wallet->hasFolder(myFolder)){
     324                        wallet->createFolder(myFolder);
     325                }
     326                if(wallet->setFolder(myFolder) != 0){
     327                        wallet->closeWallet(myFolder, true);
     328                }
     329        }
     330#endif
    272331
    273332  connect ( m_ui->loginButton, SIGNAL ( clicked() ), this, SLOT ( finish() ) );
    274333  connect ( m_ui->cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) );
    275334  connect ( m_ui->settingsButton, SIGNAL ( clicked() ), this, SLOT ( showSettingsDialog() ) );
     335        connect ( m_ui->usernameEdit, SIGNAL (editingFinished()), this, SLOT ( usernameChanged()));
    276336
    277337  if ( !loadAndCheckSettings() ) {
  • branches/release-0.3.0-rc1/src/MediaDBLib/sqllogin.h

    r208 r212  
    2222
    2323#include "mediadblibmacro.h"
     24#include "config.h"
    2425
    2526#include "mdialog.h"
     
    2728#include <QWidget>
    2829#include <QSqlDatabase>
     30
     31namespace KWallet {
     32        class Wallet;
     33}
    2934
    3035namespace Ui
     
    5863    void finish();
    5964    void showSettingsDialog();
     65                void usernameChanged();
    6066
    6167  private:
     68                void init();
     69
     70    void displayError ( QString msg );
     71    void displayInformation ( QString msg );
     72               
    6273    Ui::SqlLogin *m_ui;
    6374    QSqlDatabase db;
     
    6879                QString username, password;
    6980    bool withoutDatabase;
    70 
    71     void init();
    72 
    73     void displayError ( QString msg );
    74     void displayInformation ( QString msg );
    75 
     81#ifdef KDE
     82                KWallet::Wallet *wallet;
     83#endif
    7684};
    7785
  • branches/release-0.3.0-rc1/src/MediaPlugins/Books/book.cpp

    r211 r212  
    113113}
    114114
    115 bool Book::select ( unsigned int searchId )
     115bool Book::select ( unsigned int searchId, unsigned int userId )
    116116{
    117117  if ( !db.open() )
  • branches/release-0.3.0-rc1/src/MediaPlugins/Books/book.h

    r205 r212  
    3333                Medium *newMedium();
    3434    bool select( QSqlRecord record);
    35     bool select ( unsigned int searchId );
     35    bool select ( unsigned int searchId, unsigned int userId = 0 );
    3636    bool store(bool addOwner = false, bool startTransaction = true);
    3737    bool setValue ( int attributeIndex, QVariant value );
  • branches/release-0.3.0-rc1/src/MediaPlugins/CDs/cd.cpp

    r205 r212  
    138138}
    139139
    140 bool CD::select ( unsigned int searchId )
     140bool CD::select ( unsigned int searchId, unsigned int userId )
    141141{
    142142        bool closeDB = !db.isOpen();
  • branches/release-0.3.0-rc1/src/MediaPlugins/CDs/cd.h

    r205 r212  
    4040                Medium *newMedium();
    4141    bool select( QSqlRecord record);
    42     bool select ( unsigned int searchId );
     42    bool select ( unsigned int searchId, unsigned int userId = 0 );
    4343    bool store(bool addOwner = false, bool startTransaction = true);
    4444                /**
  • branches/release-0.3.0-rc1/src/MediaPlugins/CDs/cdedit.cpp

    r211 r212  
    1818*/
    1919
    20 #include "mediadblibmacro.h"
     20#include "cdconfig.h"
    2121
    2222#include "cdedit.h"
  • branches/release-0.3.0-rc1/src/MediaPlugins/CDs/track.cpp

    r205 r212  
    115115}
    116116
    117 bool Track::select ( unsigned int searchId )
     117bool Track::select ( unsigned int searchId, unsigned int userId )
    118118{
    119119        bool closeDB = !db.isOpen();
  • branches/release-0.3.0-rc1/src/MediaPlugins/CDs/track.h

    r205 r212  
    3737                Medium *newMedium();
    3838    bool select( QSqlRecord record);
    39     bool select ( unsigned int searchId );
     39    bool select ( unsigned int searchId, unsigned int userId = 0 );
    4040    bool store(bool addOwner = false, bool startTransaction = true);
    4141                bool setValue ( int attributeIndex, QVariant value );
  • branches/release-0.3.0-rc1/src/SearchPlugins/Amazon/amazonconntypesettings.cpp

    r192 r212  
    9999bool AmazonConnTypeSettings::saveSettings()
    100100{
    101         connMatType->saveSettings();
     101        return connMatType->saveSettings();
    102102}
    103103
  • branches/release-0.3.0-rc1/src/mediadb/mediendb.cpp

    r209 r212  
    198198bool MedienDB::loadPlugin ( ModuleListWidgetItem* plugin, bool emitSetupWizard )
    199199{
    200   loadPlugin ( plugin->file(), emitSetupWizard );
     200  return loadPlugin ( plugin->file(), emitSetupWizard );
    201201}
    202202
     
    292292    }
    293293  }
     294  return false;
    294295}
    295296
  • branches/release-0.3.0-rc1/src/mediadb/projectsmodel.cpp

    r201 r212  
    8282        // fetch userId if needed
    8383        if(userId != 0)
    84                 myUsersId == userId;
     84                myUsersId = userId;
    8585        if(myUsersId == 0){
    8686                query.prepare("SELECT id FROM users WHERE userName=:userName");
Note: See TracChangeset for help on using the changeset viewer.