-rw-r--r-- | libkdepim/ksyncmanager.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index f488a07..3adbf61 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -175,25 +175,25 @@ void KSyncManager::slotClearMenu( int action ) | |||
175 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); | 175 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); |
176 | else | 176 | else |
177 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); | 177 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); |
178 | 178 | ||
179 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, | 179 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, |
180 | 0, 1 ); | 180 | 0, 1 ); |
181 | if ( result ) | 181 | if ( result ) |
182 | return; | 182 | return; |
183 | mImplementation->removeSyncInfo( syncDevice ); | 183 | mImplementation->removeSyncInfo( syncDevice ); |
184 | } | 184 | } |
185 | void KSyncManager::slotSyncMenu( int action ) | 185 | void KSyncManager::slotSyncMenu( int action ) |
186 | { | 186 | { |
187 | qDebug("syncaction %d ", action); | 187 | qDebug("KSM::syncaction %d ", action); |
188 | if ( action == 5000 ) | 188 | if ( action == 5000 ) |
189 | return; | 189 | return; |
190 | mSyncWithDesktop = false; | 190 | mSyncWithDesktop = false; |
191 | if ( action == 0 ) { | 191 | if ( action == 0 ) { |
192 | 192 | ||
193 | // seems to be a Qt2 event handling bug | 193 | // seems to be a Qt2 event handling bug |
194 | // syncmenu.clear causes a segfault at first time | 194 | // syncmenu.clear causes a segfault at first time |
195 | // when we call it after the main event loop, it is ok | 195 | // when we call it after the main event loop, it is ok |
196 | // same behaviour when calling OM/Pi via QCOP for the first time | 196 | // same behaviour when calling OM/Pi via QCOP for the first time |
197 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 197 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
198 | //confSync(); | 198 | //confSync(); |
199 | 199 | ||
@@ -283,25 +283,25 @@ void KSyncManager::slotSyncMenu( int action ) | |||
283 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 283 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
284 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 284 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
285 | break; | 285 | break; |
286 | case (KOPI): | 286 | case (KOPI): |
287 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 287 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
288 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 288 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
289 | break; | 289 | break; |
290 | case (PWMPI): | 290 | case (PWMPI): |
291 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 291 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
292 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 292 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
293 | break; | 293 | break; |
294 | default: | 294 | default: |
295 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 295 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
296 | break; | 296 | break; |
297 | 297 | ||
298 | } | 298 | } |
299 | } else { | 299 | } else { |
300 | if ( temp->getIsPhoneSync() ) { | 300 | if ( temp->getIsPhoneSync() ) { |
301 | mPhoneDevice = temp->getPhoneDevice( ) ; | 301 | mPhoneDevice = temp->getPhoneDevice( ) ; |
302 | mPhoneConnection = temp->getPhoneConnection( ); | 302 | mPhoneConnection = temp->getPhoneConnection( ); |
303 | mPhoneModel = temp->getPhoneModel( ); | 303 | mPhoneModel = temp->getPhoneModel( ); |
304 | syncPhone(); | 304 | syncPhone(); |
305 | } else if ( temp->getIsPiSync() ) { | 305 | } else if ( temp->getIsPiSync() ) { |
306 | if ( mTargetApp == KAPI ) { | 306 | if ( mTargetApp == KAPI ) { |
307 | mPassWordPiSync = temp->getRemotePwAB(); | 307 | mPassWordPiSync = temp->getRemotePwAB(); |
@@ -431,34 +431,34 @@ void KSyncManager::syncLocalFile() | |||
431 | switch(mTargetApp) | 431 | switch(mTargetApp) |
432 | { | 432 | { |
433 | case (KAPI): | 433 | case (KAPI): |
434 | ext = "(*.vcf)"; | 434 | ext = "(*.vcf)"; |
435 | break; | 435 | break; |
436 | case (KOPI): | 436 | case (KOPI): |
437 | ext = "(*.ics/*.vcs)"; | 437 | ext = "(*.ics/*.vcs)"; |
438 | break; | 438 | break; |
439 | case (PWMPI): | 439 | case (PWMPI): |
440 | ext = "(*.pwm)"; | 440 | ext = "(*.pwm)"; |
441 | break; | 441 | break; |
442 | default: | 442 | default: |
443 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); | 443 | qDebug("KSM::syncLocalFile: invalid apptype selected"); |
444 | break; | 444 | break; |
445 | 445 | ||
446 | } | 446 | } |
447 | 447 | ||
448 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 448 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
449 | if ( fn == "" ) | 449 | if ( fn == "" ) |
450 | return; | 450 | return; |
451 | if ( syncWithFile( fn, false ) ) { | 451 | if ( syncWithFile( fn, false ) ) { |
452 | qDebug("syncLocalFile() successful "); | 452 | qDebug("KSM::syncLocalFile() successful "); |
453 | } | 453 | } |
454 | 454 | ||
455 | } | 455 | } |
456 | 456 | ||
457 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 457 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
458 | { | 458 | { |
459 | bool ret = false; | 459 | bool ret = false; |
460 | QFileInfo info; | 460 | QFileInfo info; |
461 | info.setFile( fn ); | 461 | info.setFile( fn ); |
462 | QString mess; | 462 | QString mess; |
463 | bool loadbup = true; | 463 | bool loadbup = true; |
464 | if ( !info. exists() ) { | 464 | if ( !info. exists() ) { |
@@ -489,25 +489,25 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
489 | else | 489 | else |
490 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 490 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
491 | if ( ! quick ) | 491 | if ( ! quick ) |
492 | mPrefs->mLastSyncedLocalFile = fn; | 492 | mPrefs->mLastSyncedLocalFile = fn; |
493 | } | 493 | } |
494 | return ret; | 494 | return ret; |
495 | } | 495 | } |
496 | 496 | ||
497 | void KSyncManager::quickSyncLocalFile() | 497 | void KSyncManager::quickSyncLocalFile() |
498 | { | 498 | { |
499 | 499 | ||
500 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 500 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
501 | qDebug("quick syncLocalFile() successful "); | 501 | qDebug("KSM::quick syncLocalFile() successful "); |
502 | 502 | ||
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void KSyncManager::multiSync( bool askforPrefs ) | 506 | void KSyncManager::multiSync( bool askforPrefs ) |
507 | { | 507 | { |
508 | if (blockSave()) | 508 | if (blockSave()) |
509 | return; | 509 | return; |
510 | setBlockSave(true); | 510 | setBlockSave(true); |
511 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 511 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
512 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 512 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
513 | question, | 513 | question, |
@@ -560,25 +560,25 @@ int KSyncManager::ringSync() | |||
560 | switch(mTargetApp) | 560 | switch(mTargetApp) |
561 | { | 561 | { |
562 | case (KAPI): | 562 | case (KAPI): |
563 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 563 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
564 | break; | 564 | break; |
565 | case (KOPI): | 565 | case (KOPI): |
566 | includeInRingSync = temp->getIncludeInRingSync(); | 566 | includeInRingSync = temp->getIncludeInRingSync(); |
567 | break; | 567 | break; |
568 | case (PWMPI): | 568 | case (PWMPI): |
569 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 569 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
570 | break; | 570 | break; |
571 | default: | 571 | default: |
572 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 572 | qDebug("KSM::ringSync: invalid apptype selected"); |
573 | break; | 573 | break; |
574 | 574 | ||
575 | } | 575 | } |
576 | 576 | ||
577 | 577 | ||
578 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 578 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
579 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 579 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
580 | ++syncedProfiles; | 580 | ++syncedProfiles; |
581 | mSyncWithDesktop = false; | 581 | mSyncWithDesktop = false; |
582 | // mAskForPreferences = temp->getAskForPreferences(); | 582 | // mAskForPreferences = temp->getAskForPreferences(); |
583 | mWriteBackFile = temp->getWriteBackFile(); | 583 | mWriteBackFile = temp->getWriteBackFile(); |
584 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 584 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
@@ -610,25 +610,25 @@ int KSyncManager::ringSync() | |||
610 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 610 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
611 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 611 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
612 | break; | 612 | break; |
613 | case (KOPI): | 613 | case (KOPI): |
614 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 614 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
615 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 615 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
616 | break; | 616 | break; |
617 | case (PWMPI): | 617 | case (PWMPI): |
618 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 618 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
619 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 619 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
620 | break; | 620 | break; |
621 | default: | 621 | default: |
622 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 622 | qDebug("KSM: invalid apptype selected"); |
623 | break; | 623 | break; |
624 | } | 624 | } |
625 | } else { | 625 | } else { |
626 | if ( temp->getIsPhoneSync() ) { | 626 | if ( temp->getIsPhoneSync() ) { |
627 | mPhoneDevice = temp->getPhoneDevice( ) ; | 627 | mPhoneDevice = temp->getPhoneDevice( ) ; |
628 | mPhoneConnection = temp->getPhoneConnection( ); | 628 | mPhoneConnection = temp->getPhoneConnection( ); |
629 | mPhoneModel = temp->getPhoneModel( ); | 629 | mPhoneModel = temp->getPhoneModel( ); |
630 | syncPhone(); | 630 | syncPhone(); |
631 | } else if ( temp->getIsPiSync() ) { | 631 | } else if ( temp->getIsPiSync() ) { |
632 | if ( mTargetApp == KAPI ) { | 632 | if ( mTargetApp == KAPI ) { |
633 | mPassWordPiSync = temp->getRemotePwAB(); | 633 | mPassWordPiSync = temp->getRemotePwAB(); |
634 | mActiveSyncPort = temp->getRemotePortAB(); | 634 | mActiveSyncPort = temp->getRemotePortAB(); |
@@ -697,45 +697,45 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
697 | break; | 697 | break; |
698 | case (KOPI): | 698 | case (KOPI): |
699 | preCommand = prof->getPreSyncCommand(); | 699 | preCommand = prof->getPreSyncCommand(); |
700 | postCommand = prof->getPostSyncCommand(); | 700 | postCommand = prof->getPostSyncCommand(); |
701 | localTempFile = prof->getLocalTempFile(); | 701 | localTempFile = prof->getLocalTempFile(); |
702 | break; | 702 | break; |
703 | case (PWMPI): | 703 | case (PWMPI): |
704 | preCommand = prof->getPreSyncCommandPWM(); | 704 | preCommand = prof->getPreSyncCommandPWM(); |
705 | postCommand = prof->getPostSyncCommandPWM(); | 705 | postCommand = prof->getPostSyncCommandPWM(); |
706 | localTempFile = prof->getLocalTempFilePWM(); | 706 | localTempFile = prof->getLocalTempFilePWM(); |
707 | break; | 707 | break; |
708 | default: | 708 | default: |
709 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); | 709 | qDebug("KSM::syncRemote: invalid apptype selected"); |
710 | break; | 710 | break; |
711 | } | 711 | } |
712 | 712 | ||
713 | 713 | ||
714 | int fi; | 714 | int fi; |
715 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 715 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
716 | QString pwd = getPassword(); | 716 | QString pwd = getPassword(); |
717 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 717 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
718 | 718 | ||
719 | } | 719 | } |
720 | int maxlen = 30; | 720 | int maxlen = 30; |
721 | if ( QApplication::desktop()->width() > 320 ) | 721 | if ( QApplication::desktop()->width() > 320 ) |
722 | maxlen += 25; | 722 | maxlen += 25; |
723 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 723 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
724 | int fileSize = 0; | 724 | int fileSize = 0; |
725 | int result = system ( preCommand ); | 725 | int result = system ( preCommand ); |
726 | // 0 : okay | 726 | // 0 : okay |
727 | // 256: no such file or dir | 727 | // 256: no such file or dir |
728 | // | 728 | // |
729 | qDebug("Sync: Remote copy result(0 = okay): %d ",result ); | 729 | qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); |
730 | if ( result != 0 ) { | 730 | if ( result != 0 ) { |
731 | unsigned int len = maxlen; | 731 | unsigned int len = maxlen; |
732 | while ( len < preCommand.length() ) { | 732 | while ( len < preCommand.length() ) { |
733 | preCommand.insert( len , "\n" ); | 733 | preCommand.insert( len , "\n" ); |
734 | len += maxlen +2; | 734 | len += maxlen +2; |
735 | } | 735 | } |
736 | 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) ; | 736 | 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) ; |
737 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 737 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
738 | question, | 738 | question, |
739 | i18n("Okay!")) ; | 739 | i18n("Okay!")) ; |
740 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); | 740 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
741 | return; | 741 | return; |
@@ -745,25 +745,25 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
745 | 745 | ||
746 | if ( syncWithFile( localTempFile, true ) ) { | 746 | if ( syncWithFile( localTempFile, true ) ) { |
747 | 747 | ||
748 | if ( mWriteBackFile ) { | 748 | if ( mWriteBackFile ) { |
749 | int fi; | 749 | int fi; |
750 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 750 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
751 | QString pwd = getPassword(); | 751 | QString pwd = getPassword(); |
752 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 752 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
753 | 753 | ||
754 | } | 754 | } |
755 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); | 755 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); |
756 | result = system ( postCommand ); | 756 | result = system ( postCommand ); |
757 | qDebug("Sync:Writing back file result: %d ", result); | 757 | qDebug("KSM::Sync:Writing back file result: %d ", result); |
758 | if ( result != 0 ) { | 758 | if ( result != 0 ) { |
759 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 759 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
760 | return; | 760 | return; |
761 | } else { | 761 | } else { |
762 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 762 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | } | 765 | } |
766 | return; | 766 | return; |
767 | } | 767 | } |
768 | bool KSyncManager::edit_pisync_options() | 768 | bool KSyncManager::edit_pisync_options() |
769 | { | 769 | { |
@@ -940,49 +940,49 @@ void KSyncManager::syncKDE() | |||
940 | if ( mWriteBackFile ) { | 940 | if ( mWriteBackFile ) { |
941 | command += " --read"; | 941 | command += " --read"; |
942 | system ( command.latin1()); | 942 | system ( command.latin1()); |
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
946 | } | 946 | } |
947 | break; | 947 | break; |
948 | case (PWMPI): | 948 | case (PWMPI): |
949 | 949 | ||
950 | break; | 950 | break; |
951 | default: | 951 | default: |
952 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 952 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
953 | break; | 953 | break; |
954 | 954 | ||
955 | } | 955 | } |
956 | } | 956 | } |
957 | 957 | ||
958 | void KSyncManager::syncSharp() | 958 | void KSyncManager::syncSharp() |
959 | { | 959 | { |
960 | 960 | ||
961 | if ( ! syncExternalApplication("sharp") ) | 961 | if ( ! syncExternalApplication("sharp") ) |
962 | qDebug("ERROR sync sharp "); | 962 | qDebug("KSM::ERROR sync sharp "); |
963 | } | 963 | } |
964 | 964 | ||
965 | bool KSyncManager::syncExternalApplication(QString resource) | 965 | bool KSyncManager::syncExternalApplication(QString resource) |
966 | { | 966 | { |
967 | 967 | ||
968 | emit save(); | 968 | emit save(); |
969 | 969 | ||
970 | if ( mAskForPreferences ) | 970 | if ( mAskForPreferences ) |
971 | if ( !edit_sync_options()) { | 971 | if ( !edit_sync_options()) { |
972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
973 | return false; | 973 | return false; |
974 | } | 974 | } |
975 | 975 | ||
976 | qDebug("Sync extern %s", resource.latin1()); | 976 | qDebug("KSM::Sync extern %s", resource.latin1()); |
977 | 977 | ||
978 | bool syncOK = mImplementation->syncExternal(this, resource); | 978 | bool syncOK = mImplementation->syncExternal(this, resource); |
979 | 979 | ||
980 | return syncOK; | 980 | return syncOK; |
981 | 981 | ||
982 | } | 982 | } |
983 | 983 | ||
984 | void KSyncManager::syncPhone() | 984 | void KSyncManager::syncPhone() |
985 | { | 985 | { |
986 | 986 | ||
987 | syncExternalApplication("phone"); | 987 | syncExternalApplication("phone"); |
988 | 988 | ||
@@ -1111,49 +1111,49 @@ void KSyncManager::readFileFromSocket() | |||
1111 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1111 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
1112 | { | 1112 | { |
1113 | mPassWord = pw; | 1113 | mPassWord = pw; |
1114 | mSocket = 0; | 1114 | mSocket = 0; |
1115 | mSyncActionDialog = 0; | 1115 | mSyncActionDialog = 0; |
1116 | blockRC = false; | 1116 | blockRC = false; |
1117 | }; | 1117 | }; |
1118 | 1118 | ||
1119 | void KServerSocket::newConnection ( int socket ) | 1119 | void KServerSocket::newConnection ( int socket ) |
1120 | { | 1120 | { |
1121 | // qDebug("KServerSocket:New connection %d ", socket); | 1121 | // qDebug("KServerSocket:New connection %d ", socket); |
1122 | if ( mSocket ) { | 1122 | if ( mSocket ) { |
1123 | qDebug("KServerSocket::newConnection Socket deleted! "); | 1123 | qDebug("KSS::newConnection Socket deleted! "); |
1124 | delete mSocket; | 1124 | delete mSocket; |
1125 | mSocket = 0; | 1125 | mSocket = 0; |
1126 | } | 1126 | } |
1127 | mSocket = new QSocket( this ); | 1127 | mSocket = new QSocket( this ); |
1128 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1128 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1129 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1129 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1130 | mSocket->setSocket( socket ); | 1130 | mSocket->setSocket( socket ); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | void KServerSocket::discardClient() | 1133 | void KServerSocket::discardClient() |
1134 | { | 1134 | { |
1135 | //qDebug(" KServerSocket::discardClient()"); | 1135 | //qDebug(" KServerSocket::discardClient()"); |
1136 | if ( mSocket ) { | 1136 | if ( mSocket ) { |
1137 | delete mSocket; | 1137 | delete mSocket; |
1138 | mSocket = 0; | 1138 | mSocket = 0; |
1139 | } | 1139 | } |
1140 | //emit endConnect(); | 1140 | //emit endConnect(); |
1141 | } | 1141 | } |
1142 | void KServerSocket::readClient() | 1142 | void KServerSocket::readClient() |
1143 | { | 1143 | { |
1144 | if ( blockRC ) | 1144 | if ( blockRC ) |
1145 | return; | 1145 | return; |
1146 | if ( mSocket == 0 ) { | 1146 | if ( mSocket == 0 ) { |
1147 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 1147 | qDebug("ERROR::KSS::readClient(): mSocket == 0 "); |
1148 | return; | 1148 | return; |
1149 | } | 1149 | } |
1150 | //qDebug("KServerSocket::readClient()"); | 1150 | //qDebug("KServerSocket::readClient()"); |
1151 | if ( mSocket->canReadLine() ) { | 1151 | if ( mSocket->canReadLine() ) { |
1152 | QString line = mSocket->readLine(); | 1152 | QString line = mSocket->readLine(); |
1153 | //qDebug("KServerSocket readline: %s ", line.latin1()); | 1153 | //qDebug("KServerSocket readline: %s ", line.latin1()); |
1154 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 1154 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
1155 | if ( tokens[0] == "GET" ) { | 1155 | if ( tokens[0] == "GET" ) { |
1156 | if ( tokens[1] == mPassWord ) { | 1156 | if ( tokens[1] == mPassWord ) { |
1157 | //emit sendFile( mSocket ); | 1157 | //emit sendFile( mSocket ); |
1158 | bool ok = false; | 1158 | bool ok = false; |
1159 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); | 1159 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); |
@@ -1210,25 +1210,25 @@ void KServerSocket::send_file() | |||
1210 | secs = secs * (-1); | 1210 | secs = secs * (-1); |
1211 | if ( secs > 30 ) | 1211 | if ( secs > 30 ) |
1212 | //if ( true ) | 1212 | //if ( true ) |
1213 | { | 1213 | { |
1214 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); | 1214 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); |
1215 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1215 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1216 | label->setAlignment ( Qt::AlignHCenter ); | 1216 | label->setAlignment ( Qt::AlignHCenter ); |
1217 | lay->addWidget( label); | 1217 | lay->addWidget( label); |
1218 | if ( secs > 180 ) | 1218 | if ( secs > 180 ) |
1219 | { | 1219 | { |
1220 | if ( secs > 300 ) { | 1220 | if ( secs > 300 ) { |
1221 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { | 1221 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { |
1222 | qDebug("cancelled "); | 1222 | qDebug("KSS::Sync cancelled ,cs"); |
1223 | return ; | 1223 | return ; |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | QFont f = label->font(); | 1226 | QFont f = label->font(); |
1227 | f.setPointSize ( f.pointSize() *2 ); | 1227 | f.setPointSize ( f.pointSize() *2 ); |
1228 | f. setBold (true ); | 1228 | f. setBold (true ); |
1229 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1229 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1230 | label->setFont( f ); | 1230 | label->setFont( f ); |
1231 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); | 1231 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); |
1232 | label->setText( warning ); | 1232 | label->setText( warning ); |
1233 | label->setAlignment ( Qt::AlignHCenter ); | 1233 | label->setAlignment ( Qt::AlignHCenter ); |
1234 | lay->addWidget( label); | 1234 | lay->addWidget( label); |
@@ -1456,25 +1456,25 @@ void KCommandSocket::readFileFromSocket() | |||
1456 | // if state is not idle, deleteSocket(); is called via | 1456 | // if state is not idle, deleteSocket(); is called via |
1457 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1457 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1458 | if ( mSocket->state() == QSocket::Idle ) | 1458 | if ( mSocket->state() == QSocket::Idle ) |
1459 | deleteSocket(); | 1459 | deleteSocket(); |
1460 | } | 1460 | } |
1461 | 1461 | ||
1462 | void KCommandSocket::deleteSocket() | 1462 | void KCommandSocket::deleteSocket() |
1463 | { | 1463 | { |
1464 | //qDebug("KCommandSocket::deleteSocket() "); | 1464 | //qDebug("KCommandSocket::deleteSocket() "); |
1465 | if ( mTimerSocket->isActive () ) { | 1465 | if ( mTimerSocket->isActive () ) { |
1466 | mTimerSocket->stop(); | 1466 | mTimerSocket->stop(); |
1467 | mRetVal = errorTO; | 1467 | mRetVal = errorTO; |
1468 | qDebug("Connection to remote host timed out"); | 1468 | qDebug("KCS::Connection to remote host timed out"); |
1469 | if ( mSocket ) { | 1469 | if ( mSocket ) { |
1470 | mSocket->close(); | 1470 | mSocket->close(); |
1471 | //if ( mSocket->state() == QSocket::Idle ) | 1471 | //if ( mSocket->state() == QSocket::Idle ) |
1472 | // deleteSocket(); | 1472 | // deleteSocket(); |
1473 | delete mSocket; | 1473 | delete mSocket; |
1474 | mSocket = 0; | 1474 | mSocket = 0; |
1475 | } | 1475 | } |
1476 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | 1476 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); |
1477 | emit commandFinished( this, mRetVal ); | 1477 | emit commandFinished( this, mRetVal ); |
1478 | return; | 1478 | return; |
1479 | } | 1479 | } |
1480 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1480 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |