author | zautrix <zautrix> | 2004-10-20 16:27:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 16:27:05 (UTC) |
commit | 46ea2933c9f67e77fb5c6cd93237efc755f28b62 (patch) (side-by-side diff) | |
tree | 8025e9caceb2f62cd5b1d4b78b359545d38b39c5 /libkdepim | |
parent | 5cf3c1bce58a6487af166e637e54571e98156fd0 (diff) | |
download | kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.zip kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.tar.gz kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.tar.bz2 |
made KDE sync perfect
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 63 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 4 |
2 files changed, 48 insertions, 19 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 7ca3ee0..554c6e5 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -182,4 +182,10 @@ void KSyncManager::slotSyncMenu( int action ) setBlockSave(true); + bool silent = false; + if ( action == 999 ) { + //special mode for silent syncing + action = 1000; + silent = true; + } mCurrentSyncProfile = action - 1000 ; @@ -190,7 +196,16 @@ void KSyncManager::slotSyncMenu( int action ) temp->setName(mSyncProfileNames[mCurrentSyncProfile]); temp->readConfig(&config); - mAskForPreferences = temp->getAskForPreferences(); - mSyncAlgoPrefs = temp->getSyncPrefs(); - mWriteBackFile = temp->getWriteBackFile(); + if (silent) { + mAskForPreferences = false; + mShowSyncSummary = false; + mWriteBackFile = true; + mSyncAlgoPrefs = 2;// take newest + } + else { + mAskForPreferences = temp->getAskForPreferences(); + mShowSyncSummary = temp->getShowSummaryAfterSync(); + mWriteBackFile = temp->getWriteBackFile(); + mSyncAlgoPrefs = temp->getSyncPrefs(); + } mWriteBackExistingOnly = temp->getWriteBackExisting(); mIsKapiFile = temp->getIsKapiFile(); @@ -198,5 +213,5 @@ void KSyncManager::slotSyncMenu( int action ) if ( temp->getWriteBackFuture() ) mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); - mShowSyncSummary = temp->getShowSummaryAfterSync(); + if ( action == 1000 ) { #ifdef DESKTOP_VERSION @@ -303,4 +318,5 @@ void KSyncManager::enableQuick( bool ask ) lay.addWidget( &syncdesktop); #else + mPrefs->mPassiveSyncWithDesktop = false; QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); syncdesktop.hide(); @@ -417,5 +433,8 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) } if ( mAskForPreferences ) - edit_sync_options(); + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return false; + } if ( result == 0 ) { //qDebug("Now sycing ... "); @@ -456,5 +475,8 @@ void KSyncManager::multiSync( bool askforPrefs ) mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; if ( askforPrefs ) { - edit_sync_options(); + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return; + } mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; } @@ -688,5 +710,5 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) return; } -void KSyncManager::edit_pisync_options() +bool KSyncManager::edit_pisync_options() { QDialog dia( mParent, "dia", true ); @@ -717,8 +739,9 @@ void KSyncManager::edit_pisync_options() mActiveSyncPort = le3.text(); mActiveSyncIP = le2.text(); + return true; } - + return false; } -void KSyncManager::edit_sync_options() +bool KSyncManager::edit_sync_options() { @@ -767,7 +790,7 @@ void KSyncManager::edit_sync_options() if ( dia.exec() ) { mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; + return true; } - - + return false; } @@ -865,6 +888,9 @@ bool KSyncManager::syncExternalApplication(QString resource) emit save(); - if ( mAskForPreferences ) - edit_sync_options(); + if ( mAskForPreferences ) + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return false; + } qDebug("Sync extern %s", resource.latin1()); @@ -936,5 +962,8 @@ void KSyncManager::syncPi() qApp->processEvents(); if ( mAskForPreferences ) - edit_pisync_options(); + if ( !edit_pisync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return; + } bool ok; Q_UINT16 port = mActiveSyncPort.toUInt(&ok); @@ -1167,9 +1196,9 @@ void KServerSocket::readBackFileFromSocket() QTimer::singleShot( 10, this , SLOT ( discardClient())); file.close(); + piFileString = ""; + emit file_received( true ); delete mSyncActionDialog; mSyncActionDialog = 0; - piFileString = ""; blockRC = false; - emit file_received( true ); } @@ -1200,5 +1229,5 @@ void KCommandSocket::readFile( QString fn ) os.setEncoding( QTextStream::Latin1 ); os << "GET " << mPassWord << "\r\n"; - mTimerSocket->start( 10000 ); + mTimerSocket->start( 20000 ); } diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 7b9c499..4a610fa 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -175,6 +175,6 @@ class KSyncManager : public QObject int mCurrentSyncProfile ; void syncRemote( KSyncProfile* prof, bool ask = true); - void edit_sync_options(); - void edit_pisync_options(); + bool edit_sync_options(); + bool edit_pisync_options(); int ringSync(); QString getPassword( ); |