summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp10
-rw-r--r--libkdepim/ksyncmanager.h4
2 files changed, 13 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 33b4a65..6c1f444 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -207,97 +207,101 @@ void KSyncManager::slotSyncMenu( int action )
207 enableQuick(); 207 enableQuick();
208 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 208 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
209 return; 209 return;
210 } 210 }
211 if ( action == 3 ) { 211 if ( action == 3 ) {
212 delete mServerSocket; 212 delete mServerSocket;
213 mServerSocket = 0; 213 mServerSocket = 0;
214 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 214 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
215 return; 215 return;
216 } 216 }
217 217
218 if (blockSave()) 218 if (blockSave())
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( ); 253 mWriteBackInPast = temp->getWriteBackPastWeeks( );
254 } 254 }
255 255 mFilterInCal = temp->getFilterInCal();
256 mFilterOutCal = temp->getFilterOutCal();
257 mFilterInAB = temp->getFilterInAB();
258 mFilterOutAB = temp->getFilterOutAB();
259
256 if ( action == 1000 ) { 260 if ( action == 1000 ) {
257 mIsKapiFile = false; 261 mIsKapiFile = false;
258#ifdef DESKTOP_VERSION 262#ifdef DESKTOP_VERSION
259 syncKDE(); 263 syncKDE();
260#else 264#else
261 syncSharp(); 265 syncSharp();
262#endif 266#endif
263 267
264 } else if ( action == 1001 ) { 268 } else if ( action == 1001 ) {
265 syncLocalFile(); 269 syncLocalFile();
266 270
267 } else if ( action == 1002 ) { 271 } else if ( action == 1002 ) {
268 mWriteBackFile = false; 272 mWriteBackFile = false;
269 mAskForPreferences = false; 273 mAskForPreferences = false;
270 mShowSyncSummary = false; 274 mShowSyncSummary = false;
271 mSyncAlgoPrefs = 3; 275 mSyncAlgoPrefs = 3;
272 quickSyncLocalFile(); 276 quickSyncLocalFile();
273 277
274 } else if ( action >= 1003 ) { 278 } else if ( action >= 1003 ) {
275 if ( temp->getIsLocalFileSync() ) { 279 if ( temp->getIsLocalFileSync() ) {
276 switch(mTargetApp) 280 switch(mTargetApp)
277 { 281 {
278 case (KAPI): 282 case (KAPI):
279 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 283 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
280 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 284 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
281 break; 285 break;
282 case (KOPI): 286 case (KOPI):
283 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 287 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
284 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 288 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
285 break; 289 break;
286 case (PWMPI): 290 case (PWMPI):
287 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 291 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
288 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 292 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
289 break; 293 break;
290 default: 294 default:
291 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 295 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
292 break; 296 break;
293 297
294 } 298 }
295 } else { 299 } else {
296 if ( temp->getIsPhoneSync() ) { 300 if ( temp->getIsPhoneSync() ) {
297 mPhoneDevice = temp->getPhoneDevice( ) ; 301 mPhoneDevice = temp->getPhoneDevice( ) ;
298 mPhoneConnection = temp->getPhoneConnection( ); 302 mPhoneConnection = temp->getPhoneConnection( );
299 mPhoneModel = temp->getPhoneModel( ); 303 mPhoneModel = temp->getPhoneModel( );
300 syncPhone(); 304 syncPhone();
301 } else if ( temp->getIsPiSync() ) { 305 } else if ( temp->getIsPiSync() ) {
302 if ( mTargetApp == KAPI ) { 306 if ( mTargetApp == KAPI ) {
303 mPassWordPiSync = temp->getRemotePwAB(); 307 mPassWordPiSync = temp->getRemotePwAB();
@@ -539,96 +543,100 @@ void KSyncManager::multiSync( bool askforPrefs )
539 543
540int KSyncManager::ringSync() 544int KSyncManager::ringSync()
541{ 545{
542 546
543 int syncedProfiles = 0; 547 int syncedProfiles = 0;
544 unsigned int i; 548 unsigned int i;
545 QTime timer; 549 QTime timer;
546 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 550 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
547 QStringList syncProfileNames = mSyncProfileNames; 551 QStringList syncProfileNames = mSyncProfileNames;
548 KSyncProfile* temp = new KSyncProfile (); 552 KSyncProfile* temp = new KSyncProfile ();
549 mAskForPreferences = false; 553 mAskForPreferences = false;
550 for ( i = 0; i < syncProfileNames.count(); ++i ) { 554 for ( i = 0; i < syncProfileNames.count(); ++i ) {
551 mCurrentSyncProfile = i; 555 mCurrentSyncProfile = i;
552 temp->setName(syncProfileNames[mCurrentSyncProfile]); 556 temp->setName(syncProfileNames[mCurrentSyncProfile]);
553 temp->readConfig(&config); 557 temp->readConfig(&config);
554 558
555 bool includeInRingSync; 559 bool includeInRingSync;
556 switch(mTargetApp) 560 switch(mTargetApp)
557 { 561 {
558 case (KAPI): 562 case (KAPI):
559 includeInRingSync = temp->getIncludeInRingSyncAB(); 563 includeInRingSync = temp->getIncludeInRingSyncAB();
560 break; 564 break;
561 case (KOPI): 565 case (KOPI):
562 includeInRingSync = temp->getIncludeInRingSync(); 566 includeInRingSync = temp->getIncludeInRingSync();
563 break; 567 break;
564 case (PWMPI): 568 case (PWMPI):
565 includeInRingSync = temp->getIncludeInRingSyncPWM(); 569 includeInRingSync = temp->getIncludeInRingSyncPWM();
566 break; 570 break;
567 default: 571 default:
568 qDebug("KSyncManager::ringSync: invalid apptype selected"); 572 qDebug("KSyncManager::ringSync: invalid apptype selected");
569 break; 573 break;
570 574
571 } 575 }
572 576
573 577
574 if ( includeInRingSync && ( i < 1 || i > 2 )) { 578 if ( includeInRingSync && ( i < 1 || i > 2 )) {
575 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 579 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
576 ++syncedProfiles; 580 ++syncedProfiles;
577 mSyncWithDesktop = false; 581 mSyncWithDesktop = false;
578 // mAskForPreferences = temp->getAskForPreferences(); 582 // mAskForPreferences = temp->getAskForPreferences();
579 mWriteBackFile = temp->getWriteBackFile(); 583 mWriteBackFile = temp->getWriteBackFile();
580 mWriteBackExistingOnly = temp->getWriteBackExisting(); 584 mWriteBackExistingOnly = temp->getWriteBackExisting();
581 mIsKapiFile = temp->getIsKapiFile(); 585 mIsKapiFile = temp->getIsKapiFile();
582 mWriteBackInFuture = 0; 586 mWriteBackInFuture = 0;
583 if ( temp->getWriteBackFuture() ) { 587 if ( temp->getWriteBackFuture() ) {
584 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 588 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
585 mWriteBackInPast = temp->getWriteBackPastWeeks( ); 589 mWriteBackInPast = temp->getWriteBackPastWeeks( );
586 } 590 }
591 mFilterInCal = temp->getFilterInCal();
592 mFilterOutCal = temp->getFilterOutCal();
593 mFilterInAB = temp->getFilterInAB();
594 mFilterOutAB = temp->getFilterOutAB();
587 mShowSyncSummary = false; 595 mShowSyncSummary = false;
588 mCurrentSyncDevice = syncProfileNames[i] ; 596 mCurrentSyncDevice = syncProfileNames[i] ;
589 mCurrentSyncName = mLocalMachineName; 597 mCurrentSyncName = mLocalMachineName;
590 if ( i == 0 ) { 598 if ( i == 0 ) {
591 mIsKapiFile = false; 599 mIsKapiFile = false;
592#ifdef DESKTOP_VERSION 600#ifdef DESKTOP_VERSION
593 syncKDE(); 601 syncKDE();
594#else 602#else
595 syncSharp(); 603 syncSharp();
596#endif 604#endif
597 } else { 605 } else {
598 if ( temp->getIsLocalFileSync() ) { 606 if ( temp->getIsLocalFileSync() ) {
599 switch(mTargetApp) 607 switch(mTargetApp)
600 { 608 {
601 case (KAPI): 609 case (KAPI):
602 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 610 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
603 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 611 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
604 break; 612 break;
605 case (KOPI): 613 case (KOPI):
606 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 614 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
607 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 615 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
608 break; 616 break;
609 case (PWMPI): 617 case (PWMPI):
610 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 618 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
611 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 619 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
612 break; 620 break;
613 default: 621 default:
614 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 622 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
615 break; 623 break;
616 } 624 }
617 } else { 625 } else {
618 if ( temp->getIsPhoneSync() ) { 626 if ( temp->getIsPhoneSync() ) {
619 mPhoneDevice = temp->getPhoneDevice( ) ; 627 mPhoneDevice = temp->getPhoneDevice( ) ;
620 mPhoneConnection = temp->getPhoneConnection( ); 628 mPhoneConnection = temp->getPhoneConnection( );
621 mPhoneModel = temp->getPhoneModel( ); 629 mPhoneModel = temp->getPhoneModel( );
622 syncPhone(); 630 syncPhone();
623 } else if ( temp->getIsPiSync() ) { 631 } else if ( temp->getIsPiSync() ) {
624 if ( mTargetApp == KAPI ) { 632 if ( mTargetApp == KAPI ) {
625 mPassWordPiSync = temp->getRemotePwAB(); 633 mPassWordPiSync = temp->getRemotePwAB();
626 mActiveSyncPort = temp->getRemotePortAB(); 634 mActiveSyncPort = temp->getRemotePortAB();
627 mActiveSyncIP = temp->getRemoteIPAB(); 635 mActiveSyncIP = temp->getRemoteIPAB();
628 } else if ( mTargetApp == KOPI ) { 636 } else if ( mTargetApp == KOPI ) {
629 mPassWordPiSync = temp->getRemotePw(); 637 mPassWordPiSync = temp->getRemotePw();
630 mActiveSyncPort = temp->getRemotePort(); 638 mActiveSyncPort = temp->getRemotePort();
631 mActiveSyncIP = temp->getRemoteIP(); 639 mActiveSyncIP = temp->getRemoteIP();
632 } else { 640 } else {
633 mPassWordPiSync = temp->getRemotePwPWM(); 641 mPassWordPiSync = temp->getRemotePwPWM();
634 mActiveSyncPort = temp->getRemotePortPWM(); 642 mActiveSyncPort = temp->getRemotePortPWM();
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 2d0a4ab..6d89950 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -103,96 +103,100 @@ class KCommandSocket : public QObject
103 103
104class KSyncManager : public QObject 104class KSyncManager : public QObject
105{ 105{
106 Q_OBJECT 106 Q_OBJECT
107 107
108 public: 108 public:
109 enum TargetApp { 109 enum TargetApp {
110 KOPI = 0, 110 KOPI = 0,
111 KAPI = 1, 111 KAPI = 1,
112 PWMPI = 2 }; 112 PWMPI = 2 };
113 113
114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
115 ~KSyncManager() ; 115 ~KSyncManager() ;
116 116
117 void multiSync( bool askforPrefs ); 117 void multiSync( bool askforPrefs );
118 bool blockSave() { return mBlockSaveFlag; } 118 bool blockSave() { return mBlockSaveFlag; }
119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
120 void setDefaultFileName( QString s) { mDefFileName = s ;} 120 void setDefaultFileName( QString s) { mDefFileName = s ;}
121 QString defaultFileName() { return mDefFileName ;} 121 QString defaultFileName() { return mDefFileName ;}
122 QString syncFileName(); 122 QString syncFileName();
123 void enableQuick( bool ask = true); 123 void enableQuick( bool ask = true);
124 124
125 bool syncWithDesktop () { return mSyncWithDesktop;} 125 bool syncWithDesktop () { return mSyncWithDesktop;}
126 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 126 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
127 QString getCurrentSyncName() { return mCurrentSyncName; } 127 QString getCurrentSyncName() { return mCurrentSyncName; }
128 128
129 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 129 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
130 void hideProgressBar(); 130 void hideProgressBar();
131 bool isProgressBarCanceled(); 131 bool isProgressBarCanceled();
132 132
133 // sync stuff 133 // sync stuff
134 QString mLocalMachineName; 134 QString mLocalMachineName;
135 QStringList mExternSyncProfiles; 135 QStringList mExternSyncProfiles;
136 QStringList mSyncProfileNames; 136 QStringList mSyncProfileNames;
137 bool mAskForPreferences; 137 bool mAskForPreferences;
138 bool mShowSyncSummary; 138 bool mShowSyncSummary;
139 bool mIsKapiFile; 139 bool mIsKapiFile;
140 bool mWriteBackExistingOnly; 140 bool mWriteBackExistingOnly;
141 int mSyncAlgoPrefs; 141 int mSyncAlgoPrefs;
142 bool mWriteBackFile; 142 bool mWriteBackFile;
143 int mWriteBackInFuture; 143 int mWriteBackInFuture;
144 int mWriteBackInPast; 144 int mWriteBackInPast;
145 QString mPhoneDevice; 145 QString mPhoneDevice;
146 QString mPhoneConnection; 146 QString mPhoneConnection;
147 QString mPhoneModel; 147 QString mPhoneModel;
148 QString mPassWordPiSync; 148 QString mPassWordPiSync;
149 QString mActiveSyncPort; 149 QString mActiveSyncPort;
150 QString mActiveSyncIP ; 150 QString mActiveSyncIP ;
151 QString mFilterInCal;
152 QString mFilterOutCal;
153 QString mFilterInAB;
154 QString mFilterOutAB;
151 static QDateTime mRequestedSyncEvent; 155 static QDateTime mRequestedSyncEvent;
152 156
153 signals: 157 signals:
154 void save(); 158 void save();
155 void request_file(); 159 void request_file();
156 void getFile( bool ); 160 void getFile( bool );
157 161
158 public slots: 162 public slots:
159 void slotSyncMenu( int ); 163 void slotSyncMenu( int );
160 void slotClearMenu( int action ); 164 void slotClearMenu( int action );
161 void deleteCommandSocket(KCommandSocket*s, int state); 165 void deleteCommandSocket(KCommandSocket*s, int state);
162 void readFileFromSocket(); 166 void readFileFromSocket();
163 void fillSyncMenu(); 167 void fillSyncMenu();
164 168
165 private: 169 private:
166 void syncPi(); 170 void syncPi();
167 KServerSocket * mServerSocket; 171 KServerSocket * mServerSocket;
168 KPimPrefs* mPrefs; 172 KPimPrefs* mPrefs;
169 QString mDefFileName; 173 QString mDefFileName;
170 QString mCurrentSyncDevice; 174 QString mCurrentSyncDevice;
171 QString mCurrentSyncName; 175 QString mCurrentSyncName;
172 void quickSyncLocalFile(); 176 void quickSyncLocalFile();
173 bool syncWithFile( QString fn , bool quick ); 177 bool syncWithFile( QString fn , bool quick );
174 void syncLocalFile(); 178 void syncLocalFile();
175 void syncPhone(); 179 void syncPhone();
176 void syncSharp(); 180 void syncSharp();
177 void syncKDE(); 181 void syncKDE();
178 bool syncExternalApplication(QString); 182 bool syncExternalApplication(QString);
179 int mCurrentSyncProfile ; 183 int mCurrentSyncProfile ;
180 void syncRemote( KSyncProfile* prof, bool ask = true); 184 void syncRemote( KSyncProfile* prof, bool ask = true);
181 bool edit_sync_options(); 185 bool edit_sync_options();
182 bool edit_pisync_options(); 186 bool edit_pisync_options();
183 int ringSync(); 187 int ringSync();
184 QString getPassword( ); 188 QString getPassword( );
185 bool mPisyncFinished; 189 bool mPisyncFinished;
186 bool mBlockSaveFlag; 190 bool mBlockSaveFlag;
187 QWidget* mParent; 191 QWidget* mParent;
188 KSyncInterface* mImplementation; 192 KSyncInterface* mImplementation;
189 TargetApp mTargetApp; 193 TargetApp mTargetApp;
190 QPopupMenu* mSyncMenu; 194 QPopupMenu* mSyncMenu;
191 QProgressBar* bar; 195 QProgressBar* bar;
192 bool mSyncWithDesktop; 196 bool mSyncWithDesktop;
193 197
194private slots: 198private slots:
195 void confSync(); 199 void confSync();
196 200
197 201
198}; 202};