-rw-r--r-- | libkdepim/ksyncmanager.cpp | 166 |
1 files changed, 92 insertions, 74 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index fad9a76..568c2a9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -73,13 +73,13 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ | |||
73 | 73 | ||
74 | KSyncManager::~KSyncManager() | 74 | KSyncManager::~KSyncManager() |
75 | { | 75 | { |
76 | delete bar; | 76 | delete bar; |
77 | } | 77 | } |
78 | 78 | ||
79 | //LR ok | 79 | |
80 | void KSyncManager::fillSyncMenu() | 80 | void KSyncManager::fillSyncMenu() |
81 | { | 81 | { |
82 | if ( mSyncMenu->count() ) | 82 | if ( mSyncMenu->count() ) |
83 | mSyncMenu->clear(); | 83 | mSyncMenu->clear(); |
84 | 84 | ||
85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
@@ -98,17 +98,20 @@ void KSyncManager::fillSyncMenu() | |||
98 | QStringList prof = config.readListEntry("SyncProfileNames"); | 98 | QStringList prof = config.readListEntry("SyncProfileNames"); |
99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
100 | if ( prof.count() < 2 ) { | 100 | if ( prof.count() < 2 ) { |
101 | prof.clear(); | 101 | prof.clear(); |
102 | prof << i18n("Sharp_DTM"); | 102 | prof << i18n("Sharp_DTM"); |
103 | prof << i18n("Local_file"); | 103 | prof << i18n("Local_file"); |
104 | prof << i18n("Last_file"); | ||
104 | KSyncProfile* temp = new KSyncProfile (); | 105 | KSyncProfile* temp = new KSyncProfile (); |
105 | temp->setName( prof[0] ); | 106 | temp->setName( prof[0] ); |
106 | temp->writeConfig(&config); | 107 | temp->writeConfig(&config); |
107 | temp->setName( prof[1] ); | 108 | temp->setName( prof[1] ); |
108 | temp->writeConfig(&config); | 109 | temp->writeConfig(&config); |
110 | temp->setName( prof[2] ); | ||
111 | temp->writeConfig(&config); | ||
109 | config.setGroup("General"); | 112 | config.setGroup("General"); |
110 | config.writeEntry("SyncProfileNames",prof); | 113 | config.writeEntry("SyncProfileNames",prof); |
111 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 114 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
112 | config.sync(); | 115 | config.sync(); |
113 | delete temp; | 116 | delete temp; |
114 | } | 117 | } |
@@ -123,14 +126,15 @@ void KSyncManager::fillSyncMenu() | |||
123 | QDir app_dir; | 126 | QDir app_dir; |
124 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 127 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
125 | if ( mTargetApp == PWMPI) { | 128 | if ( mTargetApp == PWMPI) { |
126 | mSyncMenu->removeItem( 1000 ); | 129 | mSyncMenu->removeItem( 1000 ); |
127 | } | 130 | } |
128 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 131 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
129 | mSyncMenu->setItemEnabled( 1000, false ); | 132 | mSyncMenu->removeItem( 1000 ); |
130 | } | 133 | } |
134 | mSyncMenu->removeItem( 1002 ); | ||
131 | } | 135 | } |
132 | 136 | ||
133 | void KSyncManager::slotSyncMenu( int action ) | 137 | void KSyncManager::slotSyncMenu( int action ) |
134 | { | 138 | { |
135 | //qDebug("syncaction %d ", action); | 139 | //qDebug("syncaction %d ", action); |
136 | if ( action == 0 ) { | 140 | if ( action == 0 ) { |
@@ -188,31 +192,31 @@ void KSyncManager::slotSyncMenu( int action ) | |||
188 | 192 | ||
189 | } else if ( action == 1002 ) { | 193 | } else if ( action == 1002 ) { |
190 | quickSyncLocalFile(); | 194 | quickSyncLocalFile(); |
191 | 195 | ||
192 | } else if ( action >= 1003 ) { | 196 | } else if ( action >= 1003 ) { |
193 | if ( temp->getIsLocalFileSync() ) { | 197 | if ( temp->getIsLocalFileSync() ) { |
194 | switch(mTargetApp) | 198 | switch(mTargetApp) |
195 | { | 199 | { |
196 | case (KAPI): | 200 | case (KAPI): |
197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 201 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 202 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
199 | break; | 203 | break; |
200 | case (KOPI): | 204 | case (KOPI): |
201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 205 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
202 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 206 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
203 | break; | 207 | break; |
204 | case (PWMPI): | 208 | case (PWMPI): |
205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 209 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 210 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
207 | break; | 211 | break; |
208 | default: | 212 | default: |
209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 213 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
210 | break; | 214 | break; |
211 | 215 | ||
212 | } | 216 | } |
213 | } else { | 217 | } else { |
214 | if ( temp->getIsPhoneSync() ) { | 218 | if ( temp->getIsPhoneSync() ) { |
215 | mPhoneDevice = temp->getPhoneDevice( ) ; | 219 | mPhoneDevice = temp->getPhoneDevice( ) ; |
216 | mPhoneConnection = temp->getPhoneConnection( ); | 220 | mPhoneConnection = temp->getPhoneConnection( ); |
217 | mPhoneModel = temp->getPhoneModel( ); | 221 | mPhoneModel = temp->getPhoneModel( ); |
218 | syncPhone(); | 222 | syncPhone(); |
@@ -236,12 +240,13 @@ void KSyncManager::slotSyncMenu( int action ) | |||
236 | 240 | ||
237 | } | 241 | } |
238 | } | 242 | } |
239 | delete temp; | 243 | delete temp; |
240 | setBlockSave(false); | 244 | setBlockSave(false); |
241 | } | 245 | } |
246 | |||
242 | void KSyncManager::enableQuick() | 247 | void KSyncManager::enableQuick() |
243 | { | 248 | { |
244 | QDialog dia ( 0, "input-dialog", true ); | 249 | QDialog dia ( 0, "input-dialog", true ); |
245 | QLineEdit lab ( &dia ); | 250 | QLineEdit lab ( &dia ); |
246 | QVBoxLayout lay( &dia ); | 251 | QVBoxLayout lay( &dia ); |
247 | lab.setText( mPrefs->mPassiveSyncPort ); | 252 | lab.setText( mPrefs->mPassiveSyncPort ); |
@@ -282,21 +287,20 @@ void KSyncManager::enableQuick() | |||
282 | if ( !mServerSocket->ok() ) { | 287 | if ( !mServerSocket->ok() ) { |
283 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 288 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
284 | delete mServerSocket; | 289 | delete mServerSocket; |
285 | mServerSocket = 0; | 290 | mServerSocket = 0; |
286 | return; | 291 | return; |
287 | } | 292 | } |
288 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); | ||
289 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 293 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
290 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 294 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
291 | } | 295 | } |
292 | 296 | ||
293 | void KSyncManager::syncLocalFile() | 297 | void KSyncManager::syncLocalFile() |
294 | { | 298 | { |
295 | 299 | ||
296 | QString fn =mLastSyncedLocalFile; | 300 | QString fn =mPrefs->mLastSyncedLocalFile; |
297 | QString ext; | 301 | QString ext; |
298 | 302 | ||
299 | switch(mTargetApp) | 303 | switch(mTargetApp) |
300 | { | 304 | { |
301 | case (KAPI): | 305 | case (KAPI): |
302 | ext = "(*.vcf)"; | 306 | ext = "(*.vcf)"; |
@@ -318,12 +322,13 @@ void KSyncManager::syncLocalFile() | |||
318 | return; | 322 | return; |
319 | if ( syncWithFile( fn, false ) ) { | 323 | if ( syncWithFile( fn, false ) ) { |
320 | qDebug("syncLocalFile() successful "); | 324 | qDebug("syncLocalFile() successful "); |
321 | } | 325 | } |
322 | 326 | ||
323 | } | 327 | } |
328 | |||
324 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 329 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
325 | { | 330 | { |
326 | bool ret = false; | 331 | bool ret = false; |
327 | QFileInfo info; | 332 | QFileInfo info; |
328 | info.setFile( fn ); | 333 | info.setFile( fn ); |
329 | QString mess; | 334 | QString mess; |
@@ -350,40 +355,42 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
350 | //qDebug("Now sycing ... "); | 355 | //qDebug("Now sycing ... "); |
351 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 356 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
352 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 357 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
353 | else | 358 | else |
354 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 359 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
355 | if ( ! quick ) | 360 | if ( ! quick ) |
356 | mLastSyncedLocalFile = fn; | 361 | mPrefs->mLastSyncedLocalFile = fn; |
357 | } | 362 | } |
358 | return ret; | 363 | return ret; |
359 | } | 364 | } |
365 | |||
360 | void KSyncManager::quickSyncLocalFile() | 366 | void KSyncManager::quickSyncLocalFile() |
361 | { | 367 | { |
362 | 368 | ||
363 | if ( syncWithFile( mLastSyncedLocalFile, false ) ) { | 369 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { |
364 | qDebug("quick syncLocalFile() successful "); | 370 | qDebug("quick syncLocalFile() successful "); |
365 | 371 | ||
366 | } | 372 | } |
367 | } | 373 | } |
374 | |||
368 | void KSyncManager::multiSync( bool askforPrefs ) | 375 | void KSyncManager::multiSync( bool askforPrefs ) |
369 | { | 376 | { |
370 | if (blockSave()) | 377 | if (blockSave()) |
371 | return; | 378 | return; |
372 | setBlockSave(true); | 379 | setBlockSave(true); |
373 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 380 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
374 | if ( QMessageBox::information( mParent, i18n("Sync"), | 381 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
375 | question, | 382 | question, |
376 | i18n("Yes"), i18n("No"), | 383 | i18n("Yes"), i18n("No"), |
377 | 0, 0 ) != 0 ) { | 384 | 0, 0 ) != 0 ) { |
378 | setBlockSave(false); | 385 | setBlockSave(false); |
379 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 386 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
380 | return; | 387 | return; |
381 | } | 388 | } |
382 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 389 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
383 | mSyncAlgoPrefs = mRingSyncAlgoPrefs; | 390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
384 | if ( askforPrefs ) { | 391 | if ( askforPrefs ) { |
385 | edit_sync_options(); | 392 | edit_sync_options(); |
386 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 393 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
387 | } | 394 | } |
388 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 395 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
389 | qApp->processEvents(); | 396 | qApp->processEvents(); |
@@ -391,17 +398,18 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
391 | if ( num > 1 ) | 398 | if ( num > 1 ) |
392 | ringSync(); | 399 | ringSync(); |
393 | setBlockSave(false); | 400 | setBlockSave(false); |
394 | if ( num ) | 401 | if ( num ) |
395 | emit save(); | 402 | emit save(); |
396 | if ( num ) | 403 | if ( num ) |
397 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 404 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
398 | else | 405 | else |
399 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 406 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
400 | return; | 407 | return; |
401 | } | 408 | } |
409 | |||
402 | int KSyncManager::ringSync() | 410 | int KSyncManager::ringSync() |
403 | { | 411 | { |
404 | int syncedProfiles = 0; | 412 | int syncedProfiles = 0; |
405 | unsigned int i; | 413 | unsigned int i; |
406 | QTime timer; | 414 | QTime timer; |
407 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 415 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
@@ -410,32 +418,32 @@ int KSyncManager::ringSync() | |||
410 | mAskForPreferences = false; | 418 | mAskForPreferences = false; |
411 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 419 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
412 | mCurrentSyncProfile = i; | 420 | mCurrentSyncProfile = i; |
413 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 421 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
414 | temp->readConfig(&config); | 422 | temp->readConfig(&config); |
415 | 423 | ||
416 | QString includeInRingSync; | 424 | QString includeInRingSync; |
417 | switch(mTargetApp) | 425 | switch(mTargetApp) |
418 | { | 426 | { |
419 | case (KAPI): | 427 | case (KAPI): |
420 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 428 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
421 | break; | 429 | break; |
422 | case (KOPI): | 430 | case (KOPI): |
423 | includeInRingSync = temp->getIncludeInRingSync(); | 431 | includeInRingSync = temp->getIncludeInRingSync(); |
424 | break; | 432 | break; |
425 | case (PWMPI): | 433 | case (PWMPI): |
426 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 434 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
427 | break; | 435 | break; |
428 | default: | 436 | default: |
429 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 437 | qDebug("KSyncManager::ringSync: invalid apptype selected"); |
430 | break; | 438 | break; |
431 | 439 | ||
432 | } | 440 | } |
433 | 441 | ||
434 | 442 | ||
435 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 443 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
436 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 444 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
437 | ++syncedProfiles; | 445 | ++syncedProfiles; |
438 | // mAskForPreferences = temp->getAskForPreferences(); | 446 | // mAskForPreferences = temp->getAskForPreferences(); |
439 | mWriteBackFile = temp->getWriteBackFile(); | 447 | mWriteBackFile = temp->getWriteBackFile(); |
440 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 448 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
441 | mWriteBackInFuture = 0; | 449 | mWriteBackInFuture = 0; |
@@ -445,36 +453,51 @@ int KSyncManager::ringSync() | |||
445 | mCurrentSyncDevice = syncProfileNames[i] ; | 453 | mCurrentSyncDevice = syncProfileNames[i] ; |
446 | mCurrentSyncName = mLocalMachineName; | 454 | mCurrentSyncName = mLocalMachineName; |
447 | if ( i == 0 ) { | 455 | if ( i == 0 ) { |
448 | syncSharp(); | 456 | syncSharp(); |
449 | } else { | 457 | } else { |
450 | if ( temp->getIsLocalFileSync() ) { | 458 | if ( temp->getIsLocalFileSync() ) { |
451 | switch(mTargetApp) | 459 | switch(mTargetApp) |
452 | { | 460 | { |
453 | case (KAPI): | 461 | case (KAPI): |
454 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 462 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
455 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 463 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
456 | break; | 464 | break; |
457 | case (KOPI): | 465 | case (KOPI): |
458 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 466 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
459 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 467 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
460 | break; | 468 | break; |
461 | case (PWMPI): | 469 | case (PWMPI): |
462 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 470 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
463 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 471 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
464 | break; | 472 | break; |
465 | default: | 473 | default: |
466 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 474 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
467 | break; | 475 | break; |
468 | } | 476 | } |
469 | } else { | 477 | } else { |
470 | if ( temp->getIsPhoneSync() ) { | 478 | if ( temp->getIsPhoneSync() ) { |
471 | mPhoneDevice = temp->getPhoneDevice( ) ; | 479 | mPhoneDevice = temp->getPhoneDevice( ) ; |
472 | mPhoneConnection = temp->getPhoneConnection( ); | 480 | mPhoneConnection = temp->getPhoneConnection( ); |
473 | mPhoneModel = temp->getPhoneModel( ); | 481 | mPhoneModel = temp->getPhoneModel( ); |
474 | syncPhone(); | 482 | syncPhone(); |
483 | } else if ( temp->getIsPiSync() ) { | ||
484 | if ( mTargetApp == KAPI ) { | ||
485 | mPassWordPiSync = temp->getRemotePwAB(); | ||
486 | mActiveSyncPort = temp->getRemotePortAB(); | ||
487 | mActiveSyncIP = temp->getRemoteIPAB(); | ||
488 | } else if ( mTargetApp == KOPI ) { | ||
489 | mPassWordPiSync = temp->getRemotePw(); | ||
490 | mActiveSyncPort = temp->getRemotePort(); | ||
491 | mActiveSyncIP = temp->getRemoteIP(); | ||
492 | } else { | ||
493 | mPassWordPiSync = temp->getRemotePwPWM(); | ||
494 | mActiveSyncPort = temp->getRemotePortPWM(); | ||
495 | mActiveSyncIP = temp->getRemoteIPPWM(); | ||
496 | } | ||
497 | syncPi(); | ||
475 | } else | 498 | } else |
476 | syncRemote( temp, false ); | 499 | syncRemote( temp, false ); |
477 | 500 | ||
478 | } | 501 | } |
479 | } | 502 | } |
480 | timer.start(); | 503 | timer.start(); |
@@ -555,25 +578,20 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
555 | len += maxlen +2; | 578 | len += maxlen +2; |
556 | } | 579 | } |
557 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; | 580 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; |
558 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 581 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
559 | question, | 582 | question, |
560 | i18n("Okay!")) ; | 583 | i18n("Okay!")) ; |
561 | mParent->topLevelWidget()->setCaption (""); | 584 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
562 | return; | 585 | return; |
563 | } | 586 | } |
564 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 587 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
565 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 588 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
566 | 589 | ||
567 | |||
568 | |||
569 | if ( syncWithFile( localTempFile, true ) ) { | 590 | if ( syncWithFile( localTempFile, true ) ) { |
570 | // Event* e = mView->getLastSyncEvent(); | 591 | |
571 | // e->setReadOnly( false ); | ||
572 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
573 | // e->setReadOnly( true ); | ||
574 | if ( mWriteBackFile ) { | 592 | if ( mWriteBackFile ) { |
575 | int fi; | 593 | int fi; |
576 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 594 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
577 | QString pwd = getPassword(); | 595 | QString pwd = getPassword(); |
578 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 596 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
579 | 597 | ||
@@ -641,12 +659,13 @@ void KSyncManager::edit_sync_options() | |||
641 | if ( dia.exec() ) { | 659 | if ( dia.exec() ) { |
642 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 660 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
643 | } | 661 | } |
644 | 662 | ||
645 | 663 | ||
646 | } | 664 | } |
665 | |||
647 | QString KSyncManager::getPassword( ) | 666 | QString KSyncManager::getPassword( ) |
648 | { | 667 | { |
649 | QString retfile = ""; | 668 | QString retfile = ""; |
650 | QDialog dia ( mParent, "input-dialog", true ); | 669 | QDialog dia ( mParent, "input-dialog", true ); |
651 | QLineEdit lab ( &dia ); | 670 | QLineEdit lab ( &dia ); |
652 | lab.setEchoMode( QLineEdit::Password ); | 671 | lab.setEchoMode( QLineEdit::Password ); |
@@ -682,17 +701,18 @@ void KSyncManager::confSync() | |||
682 | #else | 701 | #else |
683 | sp->show(); | 702 | sp->show(); |
684 | #endif | 703 | #endif |
685 | sp->exec(); | 704 | sp->exec(); |
686 | mSyncProfileNames = sp->getSyncProfileNames(); | 705 | mSyncProfileNames = sp->getSyncProfileNames(); |
687 | mLocalMachineName = sp->getLocalMachineName (); | 706 | mLocalMachineName = sp->getLocalMachineName (); |
688 | fillSyncMenu(); | 707 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
689 | } | 708 | } |
690 | 709 | ||
691 | void KSyncManager::syncSharp() | 710 | void KSyncManager::syncSharp() |
692 | { | 711 | { |
712 | |||
693 | if ( ! syncExternalApplication("sharp") ) | 713 | if ( ! syncExternalApplication("sharp") ) |
694 | qDebug("ERROR sync sharp ");; | 714 | qDebug("ERROR sync sharp ");; |
695 | } | 715 | } |
696 | 716 | ||
697 | bool KSyncManager::syncExternalApplication(QString resource) | 717 | bool KSyncManager::syncExternalApplication(QString resource) |
698 | { | 718 | { |
@@ -709,16 +729,14 @@ bool KSyncManager::syncExternalApplication(QString resource) | |||
709 | return syncOK; | 729 | return syncOK; |
710 | 730 | ||
711 | } | 731 | } |
712 | 732 | ||
713 | void KSyncManager::syncPhone() | 733 | void KSyncManager::syncPhone() |
714 | { | 734 | { |
715 | emit save(); | ||
716 | 735 | ||
717 | qDebug("pending syncPhone(); "); | 736 | syncExternalApplication("phone"); |
718 | //mView->syncPhone(); | ||
719 | 737 | ||
720 | } | 738 | } |
721 | 739 | ||
722 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 740 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
723 | { | 741 | { |
724 | if (!bar->isVisible()) | 742 | if (!bar->isVisible()) |
@@ -764,12 +782,13 @@ QString KSyncManager::syncFileName() | |||
764 | return locateLocal( "tmp", fn ); | 782 | return locateLocal( "tmp", fn ); |
765 | #else | 783 | #else |
766 | return (QString( "/tmp/" )+ fn ); | 784 | return (QString( "/tmp/" )+ fn ); |
767 | #endif | 785 | #endif |
768 | } | 786 | } |
769 | 787 | ||
788 | |||
770 | void KSyncManager::syncPi() | 789 | void KSyncManager::syncPi() |
771 | { | 790 | { |
772 | qApp->processEvents(); | 791 | qApp->processEvents(); |
773 | bool ok; | 792 | bool ok; |
774 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 793 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
775 | if ( ! ok ) { | 794 | if ( ! ok ) { |
@@ -1150,7 +1169,6 @@ void KCommandSocket::deleteSocket() | |||
1150 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1169 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1151 | if ( mSocket) | 1170 | if ( mSocket) |
1152 | delete mSocket; | 1171 | delete mSocket; |
1153 | mSocket = 0; | 1172 | mSocket = 0; |
1154 | emit commandFinished( this, mRetVal ); | 1173 | emit commandFinished( this, mRetVal ); |
1155 | } | 1174 | } |
1156 | |||