author | zautrix <zautrix> | 2005-01-13 03:53:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-13 03:53:45 (UTC) |
commit | 7d00f1441b5e1270dcd447bfb7920dbd3a21503d (patch) (unidiff) | |
tree | 8eb3b053e8104914021eff6f39772024784fff64 /libkdepim/ksyncmanager.cpp | |
parent | 7a4a866cded40032766acb4fe8d02b6347b1d12e (diff) | |
download | kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.zip kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.gz kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.bz2 |
sync dialog fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6f68d84..33b4a65 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -35,65 +35,65 @@ | |||
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <qbuttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | 52 | ||
53 | #include <klocale.h> | 53 | #include <klocale.h> |
54 | #include <kglobal.h> | 54 | #include <kglobal.h> |
55 | #include <kconfig.h> | 55 | #include <kconfig.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | 57 | ||
58 | QDateTime KSyncManager::mRequestedSyncEvent; | 58 | QDateTime KSyncManager::mRequestedSyncEvent; |
59 | 59 | ||
60 | 60 | ||
61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) |
62 | : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) | 62 | : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) |
63 | { | 63 | { |
64 | mServerSocket = 0; | 64 | mServerSocket = 0; |
65 | bar = new QProgressBar ( 1, 0 ); | 65 | bar = new QProgressBar ( 1, 0 ); |
66 | bar->setCaption (""); | 66 | bar->setCaption (""); |
67 | 67 | mWriteBackInPast = 2; | |
68 | int w = 300; | 68 | int w = 300; |
69 | if ( QApplication::desktop()->width() < 320 ) | 69 | if ( QApplication::desktop()->width() < 320 ) |
70 | w = 220; | 70 | w = 220; |
71 | int h = bar->sizeHint().height() ; | 71 | int h = bar->sizeHint().height() ; |
72 | int dw = QApplication::desktop()->width(); | 72 | int dw = QApplication::desktop()->width(); |
73 | int dh = QApplication::desktop()->height(); | 73 | int dh = QApplication::desktop()->height(); |
74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
75 | if ( mPrefs->mPassiveSyncAutoStart ) | 75 | if ( mPrefs->mPassiveSyncAutoStart ) |
76 | enableQuick( false ); | 76 | enableQuick( false ); |
77 | 77 | ||
78 | } | 78 | } |
79 | 79 | ||
80 | KSyncManager::~KSyncManager() | 80 | KSyncManager::~KSyncManager() |
81 | { | 81 | { |
82 | delete bar; | 82 | delete bar; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | void KSyncManager::fillSyncMenu() | 86 | void KSyncManager::fillSyncMenu() |
87 | { | 87 | { |
88 | if ( mSyncMenu->count() ) | 88 | if ( mSyncMenu->count() ) |
89 | mSyncMenu->clear(); | 89 | mSyncMenu->clear(); |
90 | 90 | ||
91 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 91 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
92 | mSyncMenu->insertSeparator(); | 92 | mSyncMenu->insertSeparator(); |
93 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | 93 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); |
94 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | 94 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); |
95 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | 95 | clearMenu->insertItem( i18n("For all profiles"), 1 ); |
96 | clearMenu->insertSeparator(); | 96 | clearMenu->insertSeparator(); |
97 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); | 97 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); |
98 | mSyncMenu->insertSeparator(); | 98 | mSyncMenu->insertSeparator(); |
99 | if ( mServerSocket == 0 ) { | 99 | if ( mServerSocket == 0 ) { |
@@ -219,66 +219,68 @@ void KSyncManager::slotSyncMenu( int action ) | |||
219 | return; | 219 | return; |
220 | 220 | ||
221 | setBlockSave(true); | 221 | setBlockSave(true); |
222 | bool silent = false; | 222 | bool silent = false; |
223 | if ( action == 999 ) { | 223 | if ( action == 999 ) { |
224 | //special mode for silent syncing | 224 | //special mode for silent syncing |
225 | action = 1000; | 225 | action = 1000; |
226 | silent = true; | 226 | silent = true; |
227 | } | 227 | } |
228 | 228 | ||
229 | mCurrentSyncProfile = action - 1000 ; | 229 | mCurrentSyncProfile = action - 1000 ; |
230 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 230 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
231 | mCurrentSyncName = mLocalMachineName ; | 231 | mCurrentSyncName = mLocalMachineName ; |
232 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 232 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
233 | KSyncProfile* temp = new KSyncProfile (); | 233 | KSyncProfile* temp = new KSyncProfile (); |
234 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 234 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
235 | temp->readConfig(&config); | 235 | temp->readConfig(&config); |
236 | if (silent) { | 236 | if (silent) { |
237 | mAskForPreferences = false; | 237 | mAskForPreferences = false; |
238 | mShowSyncSummary = false; | 238 | mShowSyncSummary = false; |
239 | mWriteBackFile = true; | 239 | mWriteBackFile = true; |
240 | mSyncAlgoPrefs = 2;// take newest | 240 | mSyncAlgoPrefs = 2;// take newest |
241 | } | 241 | } |
242 | else { | 242 | else { |
243 | mAskForPreferences = temp->getAskForPreferences(); | 243 | mAskForPreferences = temp->getAskForPreferences(); |
244 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 244 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
245 | mWriteBackFile = temp->getWriteBackFile(); | 245 | mWriteBackFile = temp->getWriteBackFile(); |
246 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 246 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
247 | } | 247 | } |
248 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 248 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
249 | mIsKapiFile = temp->getIsKapiFile(); | 249 | mIsKapiFile = temp->getIsKapiFile(); |
250 | mWriteBackInFuture = 0; | 250 | mWriteBackInFuture = 0; |
251 | if ( temp->getWriteBackFuture() ) | 251 | if ( temp->getWriteBackFuture() ) { |
252 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 252 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
253 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | ||
254 | } | ||
253 | 255 | ||
254 | if ( action == 1000 ) { | 256 | if ( action == 1000 ) { |
255 | mIsKapiFile = false; | 257 | mIsKapiFile = false; |
256 | #ifdef DESKTOP_VERSION | 258 | #ifdef DESKTOP_VERSION |
257 | syncKDE(); | 259 | syncKDE(); |
258 | #else | 260 | #else |
259 | syncSharp(); | 261 | syncSharp(); |
260 | #endif | 262 | #endif |
261 | 263 | ||
262 | } else if ( action == 1001 ) { | 264 | } else if ( action == 1001 ) { |
263 | syncLocalFile(); | 265 | syncLocalFile(); |
264 | 266 | ||
265 | } else if ( action == 1002 ) { | 267 | } else if ( action == 1002 ) { |
266 | mWriteBackFile = false; | 268 | mWriteBackFile = false; |
267 | mAskForPreferences = false; | 269 | mAskForPreferences = false; |
268 | mShowSyncSummary = false; | 270 | mShowSyncSummary = false; |
269 | mSyncAlgoPrefs = 3; | 271 | mSyncAlgoPrefs = 3; |
270 | quickSyncLocalFile(); | 272 | quickSyncLocalFile(); |
271 | 273 | ||
272 | } else if ( action >= 1003 ) { | 274 | } else if ( action >= 1003 ) { |
273 | if ( temp->getIsLocalFileSync() ) { | 275 | if ( temp->getIsLocalFileSync() ) { |
274 | switch(mTargetApp) | 276 | switch(mTargetApp) |
275 | { | 277 | { |
276 | case (KAPI): | 278 | case (KAPI): |
277 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 279 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
278 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 280 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
279 | break; | 281 | break; |
280 | case (KOPI): | 282 | case (KOPI): |
281 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 283 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
282 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 284 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
283 | break; | 285 | break; |
284 | case (PWMPI): | 286 | case (PWMPI): |
@@ -549,66 +551,68 @@ int KSyncManager::ringSync() | |||
549 | mCurrentSyncProfile = i; | 551 | mCurrentSyncProfile = i; |
550 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 552 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
551 | temp->readConfig(&config); | 553 | temp->readConfig(&config); |
552 | 554 | ||
553 | bool includeInRingSync; | 555 | bool includeInRingSync; |
554 | switch(mTargetApp) | 556 | switch(mTargetApp) |
555 | { | 557 | { |
556 | case (KAPI): | 558 | case (KAPI): |
557 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 559 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
558 | break; | 560 | break; |
559 | case (KOPI): | 561 | case (KOPI): |
560 | includeInRingSync = temp->getIncludeInRingSync(); | 562 | includeInRingSync = temp->getIncludeInRingSync(); |
561 | break; | 563 | break; |
562 | case (PWMPI): | 564 | case (PWMPI): |
563 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 565 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
564 | break; | 566 | break; |
565 | default: | 567 | default: |
566 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 568 | qDebug("KSyncManager::ringSync: invalid apptype selected"); |
567 | break; | 569 | break; |
568 | 570 | ||
569 | } | 571 | } |
570 | 572 | ||
571 | 573 | ||
572 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 574 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
573 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 575 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
574 | ++syncedProfiles; | 576 | ++syncedProfiles; |
575 | mSyncWithDesktop = false; | 577 | mSyncWithDesktop = false; |
576 | // mAskForPreferences = temp->getAskForPreferences(); | 578 | // mAskForPreferences = temp->getAskForPreferences(); |
577 | mWriteBackFile = temp->getWriteBackFile(); | 579 | mWriteBackFile = temp->getWriteBackFile(); |
578 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 580 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
579 | mIsKapiFile = temp->getIsKapiFile(); | 581 | mIsKapiFile = temp->getIsKapiFile(); |
580 | mWriteBackInFuture = 0; | 582 | mWriteBackInFuture = 0; |
581 | if ( temp->getWriteBackFuture() ) | 583 | if ( temp->getWriteBackFuture() ) { |
582 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 584 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
585 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | ||
586 | } | ||
583 | mShowSyncSummary = false; | 587 | mShowSyncSummary = false; |
584 | mCurrentSyncDevice = syncProfileNames[i] ; | 588 | mCurrentSyncDevice = syncProfileNames[i] ; |
585 | mCurrentSyncName = mLocalMachineName; | 589 | mCurrentSyncName = mLocalMachineName; |
586 | if ( i == 0 ) { | 590 | if ( i == 0 ) { |
587 | mIsKapiFile = false; | 591 | mIsKapiFile = false; |
588 | #ifdef DESKTOP_VERSION | 592 | #ifdef DESKTOP_VERSION |
589 | syncKDE(); | 593 | syncKDE(); |
590 | #else | 594 | #else |
591 | syncSharp(); | 595 | syncSharp(); |
592 | #endif | 596 | #endif |
593 | } else { | 597 | } else { |
594 | if ( temp->getIsLocalFileSync() ) { | 598 | if ( temp->getIsLocalFileSync() ) { |
595 | switch(mTargetApp) | 599 | switch(mTargetApp) |
596 | { | 600 | { |
597 | case (KAPI): | 601 | case (KAPI): |
598 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 602 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
599 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 603 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
600 | break; | 604 | break; |
601 | case (KOPI): | 605 | case (KOPI): |
602 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 606 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
603 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 607 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
604 | break; | 608 | break; |
605 | case (PWMPI): | 609 | case (PWMPI): |
606 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 610 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
607 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 611 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
608 | break; | 612 | break; |
609 | default: | 613 | default: |
610 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 614 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
611 | break; | 615 | break; |
612 | } | 616 | } |
613 | } else { | 617 | } else { |
614 | if ( temp->getIsPhoneSync() ) { | 618 | if ( temp->getIsPhoneSync() ) { |