author | zautrix <zautrix> | 2004-10-06 20:51:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 20:51:01 (UTC) |
commit | 0afcfa29ace7bc5e42a11fae44301e1e8230a376 (patch) (side-by-side diff) | |
tree | b54f85b19ace24219be1b845469444089cacc94f /libkdepim/ksyncmanager.cpp | |
parent | ed4675de07d947f55d2672c721599e3a0af1e24b (diff) | |
download | kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.zip kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.gz kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.bz2 |
some prefs cleanups
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 07e6761..c0cc840 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -52,7 +52,7 @@ #include <kfiledialog.h> KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) - : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs), mSyncMenu(syncmenu) + : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) { bar = new QProgressBar ( 1, 0 ); bar->setCaption (""); @@ -86,7 +86,7 @@ void KSyncManager::fillSyncMenu() KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); config.setGroup("General"); QStringList prof = config.readListEntry("SyncProfileNames"); - mPrefs->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); + mLocalMachineName = config.readEntry("LocalMachineName","undefined"); if ( prof.count() < 3 ) { prof.clear(); prof << i18n("Sharp_DTM"); @@ -105,8 +105,8 @@ void KSyncManager::fillSyncMenu() config.sync(); delete temp; } - mPrefs->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); - mPrefs->mSyncProfileNames = prof; + mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); + mSyncProfileNames = prof; unsigned int i; for ( i = 0; i < prof.count(); ++i ) { mSyncMenu->insertItem( prof[i], 1000+i ); @@ -121,8 +121,6 @@ void KSyncManager::fillSyncMenu() else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { mSyncMenu->setItemEnabled( 1000, false ); } - //probaly useless - //mView->setupExternSyncProfiles(); } void KSyncManager::slotSyncMenu( int action ) @@ -150,20 +148,20 @@ void KSyncManager::slotSyncMenu( int action ) setBlockSave(true); mCurrentSyncProfile = action - 1000 ; - mCurrentSyncDevice = mPrefs->mSyncProfileNames[mCurrentSyncProfile] ; - mCurrentSyncName = mPrefs->mLocalMachineName ; + mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; + mCurrentSyncName = mLocalMachineName ; KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); KSyncProfile* temp = new KSyncProfile (); - temp->setName(mPrefs->mSyncProfileNames[mCurrentSyncProfile]); + temp->setName(mSyncProfileNames[mCurrentSyncProfile]); temp->readConfig(&config); - mPrefs->mAskForPreferences = temp->getAskForPreferences(); - mPrefs->mSyncAlgoPrefs = temp->getSyncPrefs(); - mPrefs->mWriteBackFile = temp->getWriteBackFile(); - mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting(); - mPrefs->mWriteBackInFuture = 0; + mAskForPreferences = temp->getAskForPreferences(); + mSyncAlgoPrefs = temp->getSyncPrefs(); + mWriteBackFile = temp->getWriteBackFile(); + mWriteBackExistingOnly = temp->getWriteBackExisting(); + mWriteBackInFuture = 0; if ( temp->getWriteBackFuture() ) - mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); - mPrefs->mShowSyncSummary = temp->getShowSummaryAfterSync(); + mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); + mShowSyncSummary = temp->getShowSummaryAfterSync(); if ( action == 1000 ) { syncSharp(); @@ -179,15 +177,15 @@ void KSyncManager::slotSyncMenu( int action ) { case (KAPI): if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); + mLastSyncedLocalFile = temp->getRemoteFileNameAB(); break; case (KOPI): if ( syncWithFile( temp->getRemoteFileName( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); + mLastSyncedLocalFile = temp->getRemoteFileName(); break; case (PWMPI): if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); + mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); break; default: qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); @@ -196,9 +194,9 @@ void KSyncManager::slotSyncMenu( int action ) } } else { if ( temp->getIsPhoneSync() ) { - mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ; - mPrefs->mPhoneConnection = temp->getPhoneConnection( ); - mPrefs->mPhoneModel = temp->getPhoneModel( ); + mPhoneDevice = temp->getPhoneDevice( ) ; + mPhoneConnection = temp->getPhoneConnection( ); + mPhoneModel = temp->getPhoneModel( ); syncPhone(); } else syncRemote( temp ); @@ -212,7 +210,7 @@ void KSyncManager::slotSyncMenu( int action ) void KSyncManager::syncLocalFile() { - QString fn =mPrefs->mLastSyncedLocalFile; + QString fn =mLastSyncedLocalFile; QString ext; switch(mTargetApp) @@ -263,16 +261,16 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) if ( result ) return false; } - if ( mPrefs->mAskForPreferences ) + if ( mAskForPreferences ) edit_sync_options(); if ( result == 0 ) { //qDebug("Now sycing ... "); - if ( ret = mImplementation->sync( this, fn, mPrefs->mSyncAlgoPrefs ) ) + if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) mParent->setCaption( i18n("Synchronization successful") ); else mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); if ( ! quick ) - mPrefs->mLastSyncedLocalFile = fn; + mLastSyncedLocalFile = fn; mImplementation->sync_setModified(); } return ret; @@ -280,7 +278,7 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) void KSyncManager::quickSyncLocalFile() { - if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { + if ( syncWithFile( mLastSyncedLocalFile, false ) ) { qDebug("quick syncLocalFile() successful "); } @@ -300,10 +298,10 @@ void KSyncManager::multiSync( bool askforPrefs ) return; } mCurrentSyncDevice = i18n("Multiple profiles") ; - mPrefs->mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; + mSyncAlgoPrefs = mRingSyncAlgoPrefs; if ( askforPrefs ) { edit_sync_options(); - mPrefs->mRingSyncAlgoPrefs = mPrefs->mSyncAlgoPrefs; + mRingSyncAlgoPrefs = mSyncAlgoPrefs; } mParent->setCaption(i18n("Multiple sync started.") ); qApp->processEvents(); @@ -325,9 +323,9 @@ int KSyncManager::ringSync() unsigned int i; QTime timer; KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); - QStringList syncProfileNames = mPrefs->mSyncProfileNames; + QStringList syncProfileNames = mSyncProfileNames; KSyncProfile* temp = new KSyncProfile (); - mPrefs->mAskForPreferences = false; + mAskForPreferences = false; for ( i = 0; i < syncProfileNames.count(); ++i ) { mCurrentSyncProfile = i; temp->setName(syncProfileNames[mCurrentSyncProfile]); @@ -355,15 +353,15 @@ int KSyncManager::ringSync() if ( includeInRingSync && ( i < 1 || i > 2 )) { mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); ++syncedProfiles; - // mPrefs->mAskForPreferences = temp->getAskForPreferences(); - mPrefs->mWriteBackFile = temp->getWriteBackFile(); - mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting(); - mPrefs->mWriteBackInFuture = 0; + // mAskForPreferences = temp->getAskForPreferences(); + mWriteBackFile = temp->getWriteBackFile(); + mWriteBackExistingOnly = temp->getWriteBackExisting(); + mWriteBackInFuture = 0; if ( temp->getWriteBackFuture() ) - mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); - mPrefs->mShowSyncSummary = false; + mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); + mShowSyncSummary = false; mCurrentSyncDevice = syncProfileNames[i] ; - mCurrentSyncName = mPrefs->mLocalMachineName; + mCurrentSyncName = mLocalMachineName; if ( i == 0 ) { syncSharp(); } else { @@ -372,15 +370,15 @@ int KSyncManager::ringSync() { case (KAPI): if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); + mLastSyncedLocalFile = temp->getRemoteFileNameAB(); break; case (KOPI): if ( syncWithFile( temp->getRemoteFileName( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); + mLastSyncedLocalFile = temp->getRemoteFileName(); break; case (PWMPI): if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) - mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); + mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); break; default: qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); @@ -388,9 +386,9 @@ int KSyncManager::ringSync() } } else { if ( temp->getIsPhoneSync() ) { - mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ; - mPrefs->mPhoneConnection = temp->getPhoneConnection( ); - mPrefs->mPhoneModel = temp->getPhoneModel( ); + mPhoneDevice = temp->getPhoneDevice( ) ; + mPhoneConnection = temp->getPhoneConnection( ); + mPhoneModel = temp->getPhoneModel( ); syncPhone(); } else syncRemote( temp, false ); @@ -491,7 +489,7 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) // e->setReadOnly( false ); // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); // e->setReadOnly( true ); - if ( mPrefs->mWriteBackFile ) { + if ( mWriteBackFile ) { int fi; if ( (fi = postCommand.find("$PWD$")) > 0 ) { QString pwd = getPassword(); @@ -515,7 +513,7 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) void KSyncManager::edit_sync_options() { //mDialogManager->showSyncOptions(); - //mPrefs->mSyncAlgoPrefs + //mSyncAlgoPrefs QDialog dia( mParent, "dia", true ); dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); @@ -533,7 +531,7 @@ void KSyncManager::edit_sync_options() QPushButton pb ( "OK", &dia); lay.addWidget( &pb ); connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); - switch ( mPrefs->mSyncAlgoPrefs ) { + switch ( mSyncAlgoPrefs ) { case 0: loc.setChecked( true); break; @@ -559,7 +557,7 @@ void KSyncManager::edit_sync_options() break; } if ( dia.exec() ) { - mPrefs->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; + mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; } @@ -603,8 +601,8 @@ void KSyncManager::confSync() sp->show(); #endif sp->exec(); - mPrefs->mSyncProfileNames = sp->getSyncProfileNames(); - mPrefs->mLocalMachineName = sp->getLocalMachineName (); + mSyncProfileNames = sp->getSyncProfileNames(); + mLocalMachineName = sp->getLocalMachineName (); fillSyncMenu(); } @@ -619,7 +617,7 @@ bool KSyncManager::syncExternalApplication(QString resource) if ( mImplementation->sync_isModified() ) mImplementation->sync_save(); - if ( mPrefs->mAskForPreferences ) + if ( mAskForPreferences ) edit_sync_options(); qDebug("sync %s", resource.latin1()); |