summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-26 20:55:30 (UTC)
committer zautrix <zautrix>2004-10-26 20:55:30 (UTC)
commit13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (patch) (unidiff)
tree77395039348f3af1b5d1e1673f5638a7f34c0e99
parent8b111ae30fc51a4a580b8d485bef8ad28b0dde84 (diff)
downloadkdepimpi-13e996beddabc5e88f4f2fe49b2ce6cb8408eb30.zip
kdepimpi-13e996beddabc5e88f4f2fe49b2ce6cb8408eb30.tar.gz
kdepimpi-13e996beddabc5e88f4f2fe49b2ce6cb8408eb30.tar.bz2
added removeSyncInfo to KSyncInterface class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp5
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--libkdepim/ksyncmanager.h1
-rw-r--r--pwmanager/pwmanager/pwm.cpp6
-rw-r--r--pwmanager/pwmanager/pwm.h3
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp5
-rw-r--r--pwmanager/pwmanager/pwmdoc.h1
9 files changed, 27 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2a3334e..efae874 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2717,192 +2717,197 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2717 } 2717 }
2718 } 2718 }
2719 } 2719 }
2720 } 2720 }
2721 } 2721 }
2722 ++incCounter; 2722 ++incCounter;
2723 } 2723 }
2724 el.clear(); 2724 el.clear();
2725 syncManager->hideProgressBar(); 2725 syncManager->hideProgressBar();
2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2727 // get rid of micro seconds 2727 // get rid of micro seconds
2728 QTime t = mLastAddressbookSync.time(); 2728 QTime t = mLastAddressbookSync.time();
2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2730 addresseeLSync.setRevision( mLastAddressbookSync ); 2730 addresseeLSync.setRevision( mLastAddressbookSync );
2731 addresseeRSync.setRevision( mLastAddressbookSync ); 2731 addresseeRSync.setRevision( mLastAddressbookSync );
2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2738 addresseeRSync.setNote( "" ) ; 2738 addresseeRSync.setNote( "" ) ;
2739 addresseeLSync.setNote( "" ); 2739 addresseeLSync.setNote( "" );
2740 2740
2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2742 remote->insertAddressee( addresseeRSync, false ); 2742 remote->insertAddressee( addresseeRSync, false );
2743 local->insertAddressee( addresseeLSync, false ); 2743 local->insertAddressee( addresseeLSync, false );
2744 QString mes; 2744 QString mes;
2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2746 if ( syncManager->mShowSyncSummary ) { 2746 if ( syncManager->mShowSyncSummary ) {
2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2748 } 2748 }
2749 qDebug( mes ); 2749 qDebug( mes );
2750 return syncOK; 2750 return syncOK;
2751} 2751}
2752 2752
2753 2753
2754//this is a overwritten callbackmethods from the syncinterface 2754//this is a overwritten callbackmethods from the syncinterface
2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2756{ 2756{
2757 2757
2758 //pending prepare addresseeview for output 2758 //pending prepare addresseeview for output
2759 //pending detect, if remote file has REV field. if not switch to external sync 2759 //pending detect, if remote file has REV field. if not switch to external sync
2760 mGlobalSyncMode = SYNC_MODE_NORMAL; 2760 mGlobalSyncMode = SYNC_MODE_NORMAL;
2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2762 2762
2763 AddressBook abLocal(filename,"syncContact"); 2763 AddressBook abLocal(filename,"syncContact");
2764 bool syncOK = false; 2764 bool syncOK = false;
2765 if ( abLocal.load() ) { 2765 if ( abLocal.load() ) {
2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2767 bool external = false; 2767 bool external = false;
2768 bool isXML = false; 2768 bool isXML = false;
2769 if ( filename.right(4) == ".xml") { 2769 if ( filename.right(4) == ".xml") {
2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2771 isXML = true; 2771 isXML = true;
2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2773 } else { 2773 } else {
2774 external = !manager->mIsKapiFile; 2774 external = !manager->mIsKapiFile;
2775 if ( external ) { 2775 if ( external ) {
2776 qDebug("Setting vcf mode to external "); 2776 qDebug("Setting vcf mode to external ");
2777 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2777 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2778 AddressBook::Iterator it; 2778 AddressBook::Iterator it;
2779 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2779 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2780 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2780 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2781 (*it).computeCsum( mCurrentSyncDevice ); 2781 (*it).computeCsum( mCurrentSyncDevice );
2782 } 2782 }
2783 } 2783 }
2784 } 2784 }
2785 //AddressBook::Iterator it; 2785 //AddressBook::Iterator it;
2786 //QStringList vcards; 2786 //QStringList vcards;
2787 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2787 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2788 // qDebug("Name %s ", (*it).familyName().latin1()); 2788 // qDebug("Name %s ", (*it).familyName().latin1());
2789 //} 2789 //}
2790 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2790 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2791 if ( syncOK ) { 2791 if ( syncOK ) {
2792 if ( syncManager->mWriteBackFile ) 2792 if ( syncManager->mWriteBackFile )
2793 { 2793 {
2794 if ( external ) 2794 if ( external )
2795 abLocal.removeSyncAddressees( !isXML); 2795 abLocal.removeSyncAddressees( !isXML);
2796 qDebug("Saving remote AB "); 2796 qDebug("Saving remote AB ");
2797 if ( ! abLocal.saveAB()) 2797 if ( ! abLocal.saveAB())
2798 qDebug("Error writing back AB to file "); 2798 qDebug("Error writing back AB to file ");
2799 if ( isXML ) { 2799 if ( isXML ) {
2800 // afterwrite processing 2800 // afterwrite processing
2801 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2801 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2802 } 2802 }
2803 } 2803 }
2804 } 2804 }
2805 setModified(); 2805 setModified();
2806 2806
2807 } 2807 }
2808 if ( syncOK ) 2808 if ( syncOK )
2809 mViewManager->refreshView(); 2809 mViewManager->refreshView();
2810 return syncOK; 2810 return syncOK;
2811 2811
2812} 2812}
2813void KABCore::removeSyncInfo( QString syncProfile)
2814{
2815 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1());
2816
2817}
2813 2818
2814 2819
2815//this is a overwritten callbackmethods from the syncinterface 2820//this is a overwritten callbackmethods from the syncinterface
2816bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2821bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2817{ 2822{
2818 if ( resource == "phone" ) 2823 if ( resource == "phone" )
2819 return syncPhone(); 2824 return syncPhone();
2820 disableBR( true ); 2825 disableBR( true );
2821 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2826 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2822 2827
2823 AddressBook abLocal( resource,"syncContact"); 2828 AddressBook abLocal( resource,"syncContact");
2824 bool syncOK = false; 2829 bool syncOK = false;
2825 if ( abLocal.load() ) { 2830 if ( abLocal.load() ) {
2826 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2831 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2827 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2832 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2828 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2833 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2829 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2834 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2830 if ( syncOK ) { 2835 if ( syncOK ) {
2831 if ( syncManager->mWriteBackFile ) { 2836 if ( syncManager->mWriteBackFile ) {
2832 abLocal.removeSyncAddressees( false ); 2837 abLocal.removeSyncAddressees( false );
2833 abLocal.saveAB(); 2838 abLocal.saveAB();
2834 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2839 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2835 } 2840 }
2836 } 2841 }
2837 setModified(); 2842 setModified();
2838 } 2843 }
2839 if ( syncOK ) 2844 if ( syncOK )
2840 mViewManager->refreshView(); 2845 mViewManager->refreshView();
2841 disableBR( false ); 2846 disableBR( false );
2842 return syncOK; 2847 return syncOK;
2843 2848
2844} 2849}
2845void KABCore::message( QString m ) 2850void KABCore::message( QString m )
2846{ 2851{
2847 topLevelWidget()->setCaption( m ); 2852 topLevelWidget()->setCaption( m );
2848 mMessageTimer->start( 15000, true ); 2853 mMessageTimer->start( 15000, true );
2849} 2854}
2850bool KABCore::syncPhone() 2855bool KABCore::syncPhone()
2851{ 2856{
2852 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2857 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2853 QString fileName = getPhoneFile(); 2858 QString fileName = getPhoneFile();
2854 if ( !PhoneAccess::readFromPhone( fileName) ) { 2859 if ( !PhoneAccess::readFromPhone( fileName) ) {
2855 message(i18n("Phone access failed!")); 2860 message(i18n("Phone access failed!"));
2856 return false; 2861 return false;
2857 } 2862 }
2858 AddressBook abLocal( fileName,"syncContact"); 2863 AddressBook abLocal( fileName,"syncContact");
2859 bool syncOK = false; 2864 bool syncOK = false;
2860 { 2865 {
2861 abLocal.importFromFile( fileName ); 2866 abLocal.importFromFile( fileName );
2862 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2867 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2863 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2868 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2864 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2869 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2865 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2870 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2866 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2871 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2867 if ( syncOK ) { 2872 if ( syncOK ) {
2868 if ( syncManager->mWriteBackFile ) { 2873 if ( syncManager->mWriteBackFile ) {
2869 abLocal.removeSyncAddressees( true ); 2874 abLocal.removeSyncAddressees( true );
2870 abLocal.saveABphone( fileName ); 2875 abLocal.saveABphone( fileName );
2871 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2876 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2872 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2877 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2873 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2878 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2874 } 2879 }
2875 } 2880 }
2876 setModified(); 2881 setModified();
2877 } 2882 }
2878 if ( syncOK ) 2883 if ( syncOK )
2879 mViewManager->refreshView(); 2884 mViewManager->refreshView();
2880 return syncOK; 2885 return syncOK;
2881} 2886}
2882void KABCore::getFile( bool success ) 2887void KABCore::getFile( bool success )
2883{ 2888{
2884 if ( ! success ) { 2889 if ( ! success ) {
2885 message( i18n("Error receiving file. Nothing changed!") ); 2890 message( i18n("Error receiving file. Nothing changed!") );
2886 return; 2891 return;
2887 } 2892 }
2888 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 2893 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
2889 if ( count ) 2894 if ( count )
2890 setModified( true ); 2895 setModified( true );
2891 message( i18n("Pi-Sync successful!") ); 2896 message( i18n("Pi-Sync successful!") );
2892 mViewManager->refreshView(); 2897 mViewManager->refreshView();
2893} 2898}
2894void KABCore::syncFileRequest() 2899void KABCore::syncFileRequest()
2895{ 2900{
2896 mAddressBook->export2File( sentSyncFile() ); 2901 mAddressBook->export2File( sentSyncFile() );
2897} 2902}
2898QString KABCore::sentSyncFile() 2903QString KABCore::sentSyncFile()
2899{ 2904{
2900#ifdef DESKTOP_VERSION 2905#ifdef DESKTOP_VERSION
2901 return locateLocal( "tmp", "copysyncab.vcf" ); 2906 return locateLocal( "tmp", "copysyncab.vcf" );
2902#else 2907#else
2903 return QString( "/tmp/copysyncab.vcf" ); 2908 return QString( "/tmp/copysyncab.vcf" );
2904#endif 2909#endif
2905} 2910}
2906 2911
2907void KABCore::setCaptionBack() 2912void KABCore::setCaptionBack()
2908{ 2913{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index fcbe1e8..a288505 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -389,114 +389,115 @@ class KABCore : public QWidget, public KSyncInterface
389 const char *name = 0 ); 389 const char *name = 0 );
390 390
391 KXMLGUIClient *mGUIClient; 391 KXMLGUIClient *mGUIClient;
392 392
393 KABC::AddressBook *mAddressBook; 393 KABC::AddressBook *mAddressBook;
394 394
395 ViewManager *mViewManager; 395 ViewManager *mViewManager;
396 // QSplitter *mDetailsSplitter; 396 // QSplitter *mDetailsSplitter;
397 KDGanttMinimizeSplitter *mExtensionBarSplitter; 397 KDGanttMinimizeSplitter *mExtensionBarSplitter;
398 ViewContainer *mDetails; 398 ViewContainer *mDetails;
399 KDGanttMinimizeSplitter* mMiniSplitter; 399 KDGanttMinimizeSplitter* mMiniSplitter;
400 XXPortManager *mXXPortManager; 400 XXPortManager *mXXPortManager;
401 JumpButtonBar *mJumpButtonBar; 401 JumpButtonBar *mJumpButtonBar;
402 IncSearchWidget *mIncSearchWidget; 402 IncSearchWidget *mIncSearchWidget;
403 ExtensionManager *mExtensionManager; 403 ExtensionManager *mExtensionManager;
404 404
405 KCMultiDialog *mConfigureDialog; 405 KCMultiDialog *mConfigureDialog;
406 406
407#ifndef KAB_EMBEDDED 407#ifndef KAB_EMBEDDED
408 LDAPSearchDialog *mLdapSearchDialog; 408 LDAPSearchDialog *mLdapSearchDialog;
409#endif //KAB_EMBEDDED 409#endif //KAB_EMBEDDED
410 // QDict<AddresseeEditorDialog> mEditorDict; 410 // QDict<AddresseeEditorDialog> mEditorDict;
411 AddresseeEditorDialog *mEditorDialog; 411 AddresseeEditorDialog *mEditorDialog;
412 bool mReadWrite; 412 bool mReadWrite;
413 bool mModified; 413 bool mModified;
414 bool mIsPart; 414 bool mIsPart;
415 bool mMultipleViewsAtOnce; 415 bool mMultipleViewsAtOnce;
416 416
417 417
418 //US file menu 418 //US file menu
419 KAction *mActionMail; 419 KAction *mActionMail;
420 KAction *mActionBeam; 420 KAction *mActionBeam;
421 KToggleAction *mActionBR; 421 KToggleAction *mActionBR;
422 KAction *mActionExport2phone; 422 KAction *mActionExport2phone;
423 KAction* mActionPrint; 423 KAction* mActionPrint;
424 KAction* mActionNewContact; 424 KAction* mActionNewContact;
425 KAction *mActionSave; 425 KAction *mActionSave;
426 KAction *mActionEditAddressee; 426 KAction *mActionEditAddressee;
427 KAction *mActionMailVCard; 427 KAction *mActionMailVCard;
428 KAction *mActionBeamVCard; 428 KAction *mActionBeamVCard;
429 429
430 KAction *mActionQuit; 430 KAction *mActionQuit;
431 431
432 //US edit menu 432 //US edit menu
433 KAction *mActionCopy; 433 KAction *mActionCopy;
434 KAction *mActionCut; 434 KAction *mActionCut;
435 KAction *mActionPaste; 435 KAction *mActionPaste;
436 KAction *mActionSelectAll; 436 KAction *mActionSelectAll;
437 KAction *mActionUndo; 437 KAction *mActionUndo;
438 KAction *mActionRedo; 438 KAction *mActionRedo;
439 KAction *mActionDelete; 439 KAction *mActionDelete;
440 440
441 //US settings menu 441 //US settings menu
442 KAction *mActionConfigResources; 442 KAction *mActionConfigResources;
443 KAction *mActionConfigKAddressbook; 443 KAction *mActionConfigKAddressbook;
444 KAction *mActionConfigShortcuts; 444 KAction *mActionConfigShortcuts;
445 KAction *mActionConfigureToolbars; 445 KAction *mActionConfigureToolbars;
446 KAction *mActionKeyBindings; 446 KAction *mActionKeyBindings;
447 KToggleAction *mActionJumpBar; 447 KToggleAction *mActionJumpBar;
448 KToggleAction *mActionDetails; 448 KToggleAction *mActionDetails;
449 KAction *mActionWhoAmI; 449 KAction *mActionWhoAmI;
450 KAction *mActionCategories; 450 KAction *mActionCategories;
451 KAction *mActionAboutKAddressbook; 451 KAction *mActionAboutKAddressbook;
452 KAction *mActionLicence; 452 KAction *mActionLicence;
453 KAction *mActionFaq; 453 KAction *mActionFaq;
454 KAction *mActionWN; 454 KAction *mActionWN;
455 KAction *mActionSyncHowto; 455 KAction *mActionSyncHowto;
456 456
457 KAction *mActionDeleteView; 457 KAction *mActionDeleteView;
458 458
459 QPopupMenu *viewMenu; 459 QPopupMenu *viewMenu;
460 QPopupMenu *filterMenu; 460 QPopupMenu *filterMenu;
461 QPopupMenu *settingsMenu; 461 QPopupMenu *settingsMenu;
462 QPopupMenu *changeMenu; 462 QPopupMenu *changeMenu;
463//US QAction *mActionSave; 463//US QAction *mActionSave;
464 QPopupMenu *ImportMenu; 464 QPopupMenu *ImportMenu;
465 QPopupMenu *ExportMenu; 465 QPopupMenu *ExportMenu;
466 //LR additional methods 466 //LR additional methods
467 KAction *mActionRemoveVoice; 467 KAction *mActionRemoveVoice;
468 KAction * mActionImportOL; 468 KAction * mActionImportOL;
469 469
470#ifndef KAB_EMBEDDED 470#ifndef KAB_EMBEDDED
471 KAddressBookService *mAddressBookService; 471 KAddressBookService *mAddressBookService;
472#endif //KAB_EMBEDDED 472#endif //KAB_EMBEDDED
473 473
474 class KABCorePrivate; 474 class KABCorePrivate;
475 KABCorePrivate *d; 475 KABCorePrivate *d;
476 //US bool mBlockSaveFlag; 476 //US bool mBlockSaveFlag;
477 477
478#ifdef KAB_EMBEDDED 478#ifdef KAB_EMBEDDED
479 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 479 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
480#endif //KAB_EMBEDDED 480#endif //KAB_EMBEDDED
481 481
482 //this are the overwritten callbackmethods from the syncinterface 482 //this are the overwritten callbackmethods from the syncinterface
483 virtual bool sync(KSyncManager* manager, QString filename, int mode); 483 virtual bool sync(KSyncManager* manager, QString filename, int mode);
484 virtual bool syncExternal(KSyncManager* manager, QString resource); 484 virtual bool syncExternal(KSyncManager* manager, QString resource);
485 virtual void removeSyncInfo( QString syncProfile);
485 bool syncPhone(); 486 bool syncPhone();
486 void message( QString m ); 487 void message( QString m );
487 488
488 // LR ******************************* 489 // LR *******************************
489 // sync stuff! 490 // sync stuff!
490 QString sentSyncFile(); 491 QString sentSyncFile();
491 QPopupMenu *syncMenu; 492 QPopupMenu *syncMenu;
492 KSyncManager* syncManager; 493 KSyncManager* syncManager;
493 int mGlobalSyncMode; 494 int mGlobalSyncMode;
494 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 495 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
495 KABC::Addressee getLastSyncAddressee(); 496 KABC::Addressee getLastSyncAddressee();
496 QDateTime mLastAddressbookSync; 497 QDateTime mLastAddressbookSync;
497 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 498 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
498 // ********************* 499 // *********************
499 500
500}; 501};
501 502
502#endif 503#endif
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 2ccccfa..af01625 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3671,96 +3671,102 @@ bool CalendarView::removeCompletedSubTodos( Todo* t )
3671{ 3671{
3672 bool deleteTodo = true; 3672 bool deleteTodo = true;
3673 QPtrList<Incidence> subTodos; 3673 QPtrList<Incidence> subTodos;
3674 Incidence *aTodo; 3674 Incidence *aTodo;
3675 subTodos = t->relations(); 3675 subTodos = t->relations();
3676 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3676 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3677 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3677 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3678 deleteTodo = false; 3678 deleteTodo = false;
3679 } 3679 }
3680 if ( deleteTodo ) { 3680 if ( deleteTodo ) {
3681 if ( t->isCompleted() ) { 3681 if ( t->isCompleted() ) {
3682 checkExternalId( t ); 3682 checkExternalId( t );
3683 mCalendar->deleteTodo( t ); 3683 mCalendar->deleteTodo( t );
3684 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3684 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3685 } 3685 }
3686 else 3686 else
3687 deleteTodo = false; 3687 deleteTodo = false;
3688 } 3688 }
3689 return deleteTodo; 3689 return deleteTodo;
3690 3690
3691} 3691}
3692void CalendarView::purgeCompleted() 3692void CalendarView::purgeCompleted()
3693{ 3693{
3694 int result = KMessageBox::warningContinueCancel(this, 3694 int result = KMessageBox::warningContinueCancel(this,
3695 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3695 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3696 3696
3697 if (result == KMessageBox::Continue) { 3697 if (result == KMessageBox::Continue) {
3698 3698
3699 QPtrList<Todo> todoCal; 3699 QPtrList<Todo> todoCal;
3700 QPtrList<Todo> rootTodos; 3700 QPtrList<Todo> rootTodos;
3701 //QPtrList<Incidence> rel; 3701 //QPtrList<Incidence> rel;
3702 Todo *aTodo;//, *rTodo; 3702 Todo *aTodo;//, *rTodo;
3703 Incidence *rIncidence; 3703 Incidence *rIncidence;
3704 bool childDelete = false; 3704 bool childDelete = false;
3705 bool deletedOne = true; 3705 bool deletedOne = true;
3706 todoCal = calendar()->todos(); 3706 todoCal = calendar()->todos();
3707 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3707 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3708 if ( !aTodo->relatedTo() ) 3708 if ( !aTodo->relatedTo() )
3709 rootTodos.append( aTodo ); 3709 rootTodos.append( aTodo );
3710 } 3710 }
3711 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3711 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3712 removeCompletedSubTodos( aTodo ); 3712 removeCompletedSubTodos( aTodo );
3713 } 3713 }
3714 3714
3715 updateView(); 3715 updateView();
3716 } 3716 }
3717} 3717}
3718 3718
3719void CalendarView::slotCalendarChanged() 3719void CalendarView::slotCalendarChanged()
3720{ 3720{
3721 ; 3721 ;
3722} 3722}
3723 3723
3724NavigatorBar *CalendarView::navigatorBar() 3724NavigatorBar *CalendarView::navigatorBar()
3725{ 3725{
3726 return mNavigatorBar; 3726 return mNavigatorBar;
3727} 3727}
3728 3728
3729 3729
3730 3730
3731void CalendarView::keyPressEvent ( QKeyEvent *e) 3731void CalendarView::keyPressEvent ( QKeyEvent *e)
3732{ 3732{
3733 //qDebug(" alendarView::keyPressEvent "); 3733 //qDebug(" alendarView::keyPressEvent ");
3734 e->ignore(); 3734 e->ignore();
3735} 3735}
3736 3736
3737 3737
3738bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3738bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3739{ 3739{
3740 // mSyncManager = manager; 3740 // mSyncManager = manager;
3741 mSyncKDE = false; 3741 mSyncKDE = false;
3742 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3742 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3743 qDebug("SyncKDE request detected!"); 3743 qDebug("SyncKDE request detected!");
3744 mSyncKDE = true; 3744 mSyncKDE = true;
3745 } 3745 }
3746 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3746 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3747 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3747 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3748 return syncCalendar( filename, mode ); 3748 return syncCalendar( filename, mode );
3749} 3749}
3750bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3750bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3751{ 3751{
3752 mSyncKDE = false; 3752 mSyncKDE = false;
3753 //mSyncManager = manager; 3753 //mSyncManager = manager;
3754 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3754 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3755 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3755 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3756 if ( resource == "sharp" ) 3756 if ( resource == "sharp" )
3757 syncExternal( 0 ); 3757 syncExternal( 0 );
3758 if ( resource == "phone" ) 3758 if ( resource == "phone" )
3759 syncExternal( 1 ); 3759 syncExternal( 1 );
3760 // pending setmodified 3760 // pending setmodified
3761 return true; 3761 return true;
3762} 3762}
3763void CalendarView::setSyncManager(KSyncManager* manager) 3763void CalendarView::setSyncManager(KSyncManager* manager)
3764{ 3764{
3765 mSyncManager = manager; 3765 mSyncManager = manager;
3766} 3766}
3767
3768void CalendarView::removeSyncInfo( QString syncProfile)
3769{
3770 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1());
3771
3772}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 2818ee9..acc20d6 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -372,192 +372,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
372 bool isReadOnly(); 372 bool isReadOnly();
373 /** set state of calendar to read-only */ 373 /** set state of calendar to read-only */
374 void setReadOnly(bool readOnly=true); 374 void setReadOnly(bool readOnly=true);
375 375
376 void eventUpdated(Incidence *); 376 void eventUpdated(Incidence *);
377 377
378 /* iTIP scheduling actions */ 378 /* iTIP scheduling actions */
379 void schedule_publish(Incidence *incidence = 0); 379 void schedule_publish(Incidence *incidence = 0);
380 void schedule_request(Incidence *incidence = 0); 380 void schedule_request(Incidence *incidence = 0);
381 void schedule_refresh(Incidence *incidence = 0); 381 void schedule_refresh(Incidence *incidence = 0);
382 void schedule_cancel(Incidence *incidence = 0); 382 void schedule_cancel(Incidence *incidence = 0);
383 void schedule_add(Incidence *incidence = 0); 383 void schedule_add(Incidence *incidence = 0);
384 void schedule_reply(Incidence *incidence = 0); 384 void schedule_reply(Incidence *incidence = 0);
385 void schedule_counter(Incidence *incidence = 0); 385 void schedule_counter(Incidence *incidence = 0);
386 void schedule_declinecounter(Incidence *incidence = 0); 386 void schedule_declinecounter(Incidence *incidence = 0);
387 void schedule_publish_freebusy(int daysToPublish = 30); 387 void schedule_publish_freebusy(int daysToPublish = 30);
388 388
389 void openAddressbook(); 389 void openAddressbook();
390 390
391 void editFilters(); 391 void editFilters();
392 void toggleFilerEnabled(); 392 void toggleFilerEnabled();
393 QPtrList<CalFilter> filters(); 393 QPtrList<CalFilter> filters();
394 void toggleFilter(); 394 void toggleFilter();
395 void showFilter(bool visible); 395 void showFilter(bool visible);
396 void updateFilter(); 396 void updateFilter();
397 void filterEdited(); 397 void filterEdited();
398 void selectFilter( int ); 398 void selectFilter( int );
399 KOFilterView *filterView(); 399 KOFilterView *filterView();
400 400
401 void showIntro(); 401 void showIntro();
402 402
403 /** Move the curdatepient view date to today */ 403 /** Move the curdatepient view date to today */
404 void goToday(); 404 void goToday();
405 405
406 /** Move to the next date(s) in the current view */ 406 /** Move to the next date(s) in the current view */
407 void goNext(); 407 void goNext();
408 408
409 /** Move to the previous date(s) in the current view */ 409 /** Move to the previous date(s) in the current view */
410 void goPrevious(); 410 void goPrevious();
411 /** Move to the next date(s) in the current view */ 411 /** Move to the next date(s) in the current view */
412 void goNextMonth(); 412 void goNextMonth();
413 413
414 /** Move to the previous date(s) in the current view */ 414 /** Move to the previous date(s) in the current view */
415 void goPreviousMonth(); 415 void goPreviousMonth();
416 416
417 void toggleExpand(); 417 void toggleExpand();
418 void toggleDateNavigatorWidget(); 418 void toggleDateNavigatorWidget();
419 void toggleAllDaySize(); 419 void toggleAllDaySize();
420 void dialogClosing(Incidence *); 420 void dialogClosing(Incidence *);
421 421
422 /** Look for new messages in the inbox */ 422 /** Look for new messages in the inbox */
423 void lookForIncomingMessages(); 423 void lookForIncomingMessages();
424 /** Look for new messages in the outbox */ 424 /** Look for new messages in the outbox */
425 void lookForOutgoingMessages(); 425 void lookForOutgoingMessages();
426 426
427 void processMainViewSelection( Incidence * ); 427 void processMainViewSelection( Incidence * );
428 void processTodoListSelection( Incidence * ); 428 void processTodoListSelection( Incidence * );
429 429
430 void processIncidenceSelection( Incidence * ); 430 void processIncidenceSelection( Incidence * );
431 431
432 void purgeCompleted(); 432 void purgeCompleted();
433 bool removeCompletedSubTodos( Todo* ); 433 bool removeCompletedSubTodos( Todo* );
434 void slotCalendarChanged(); 434 void slotCalendarChanged();
435 bool importBday(); 435 bool importBday();
436 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 436 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
437 bool importQtopia( const QString &categoriesFile, 437 bool importQtopia( const QString &categoriesFile,
438 const QString &datebookFile, 438 const QString &datebookFile,
439 const QString &tasklistFile ); 439 const QString &tasklistFile );
440 void syncExternal( int mode ); 440 void syncExternal( int mode );
441 void slotSelectPickerDate( QDate ) ; 441 void slotSelectPickerDate( QDate ) ;
442 void showDatePicker( ) ; 442 void showDatePicker( ) ;
443 void moveIncidence(Incidence *) ; 443 void moveIncidence(Incidence *) ;
444 void beamIncidence(Incidence *) ; 444 void beamIncidence(Incidence *) ;
445 void beamCalendar() ; 445 void beamCalendar() ;
446 void beamFilteredCalendar() ; 446 void beamFilteredCalendar() ;
447 void beamIncidenceList(QPtrList<Incidence>) ; 447 void beamIncidenceList(QPtrList<Incidence>) ;
448 void manageCategories(); 448 void manageCategories();
449 int addCategories(); 449 int addCategories();
450 void removeCategories(); 450 void removeCategories();
451 void setSyncDevice( QString ); 451 void setSyncDevice( QString );
452 void setSyncName( QString ); 452 void setSyncName( QString );
453 protected slots: 453 protected slots:
454 void timerAlarm(); 454 void timerAlarm();
455 void suspendAlarm(); 455 void suspendAlarm();
456 void beamDone( Ir *ir ); 456 void beamDone( Ir *ir );
457 /** Select a view or adapt the current view to display the specified dates. */ 457 /** Select a view or adapt the current view to display the specified dates. */
458 void showDates( const KCal::DateList & ); 458 void showDates( const KCal::DateList & );
459 void selectWeekNum ( int ); 459 void selectWeekNum ( int );
460 460
461 public: 461 public:
462 // show a standard warning 462 // show a standard warning
463 // returns KMsgBox::yesNoCancel() 463 // returns KMsgBox::yesNoCancel()
464 int msgCalModified(); 464 int msgCalModified();
465 virtual bool sync(KSyncManager* manager, QString filename, int mode); 465 virtual bool sync(KSyncManager* manager, QString filename, int mode);
466 466
467 virtual bool syncExternal(KSyncManager* manager, QString resource); 467 virtual bool syncExternal(KSyncManager* manager, QString resource);
468 virtual void removeSyncInfo( QString syncProfile);
468 void setSyncManager(KSyncManager* manager); 469 void setSyncManager(KSyncManager* manager);
469 void setLoadedFileVersion(QDateTime); 470 void setLoadedFileVersion(QDateTime);
470 bool checkFileVersion(QString fn); 471 bool checkFileVersion(QString fn);
471 bool checkFileChanged(QString fn); 472 bool checkFileChanged(QString fn);
472 Event* getLastSyncEvent(); 473 Event* getLastSyncEvent();
473 /** Adapt navigation units correpsonding to step size of navigation of the 474 /** Adapt navigation units correpsonding to step size of navigation of the
474 * current view. 475 * current view.
475 */ 476 */
476 void adaptNavigationUnits(); 477 void adaptNavigationUnits();
477 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 478 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
478 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 479 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
479 //Attendee* getYourAttendee(Event *event); 480 //Attendee* getYourAttendee(Event *event);
480 protected: 481 protected:
481 void schedule(Scheduler::Method, Incidence *incidence = 0); 482 void schedule(Scheduler::Method, Incidence *incidence = 0);
482 483
483 // returns KMsgBox::OKCandel() 484 // returns KMsgBox::OKCandel()
484 int msgItemDelete(); 485 int msgItemDelete();
485 void showEventEditor(); 486 void showEventEditor();
486 void showTodoEditor(); 487 void showTodoEditor();
487 void writeLocale(); 488 void writeLocale();
488 Todo *selectedTodo(); 489 Todo *selectedTodo();
489 490
490 private: 491 private:
491 bool mSyncKDE; 492 bool mSyncKDE;
492 KSyncManager* mSyncManager; 493 KSyncManager* mSyncManager;
493 AlarmDialog * mAlarmDialog; 494 AlarmDialog * mAlarmDialog;
494 QString mAlarmNotification; 495 QString mAlarmNotification;
495 QString mSuspendAlarmNotification; 496 QString mSuspendAlarmNotification;
496 QTimer* mSuspendTimer; 497 QTimer* mSuspendTimer;
497 QTimer* mAlarmTimer; 498 QTimer* mAlarmTimer;
498 QTimer* mRecheckAlarmTimer; 499 QTimer* mRecheckAlarmTimer;
499 void computeAlarm( QString ); 500 void computeAlarm( QString );
500 void startAlarm( QString, QString ); 501 void startAlarm( QString, QString );
501 void setSyncEventsReadOnly(); 502 void setSyncEventsReadOnly();
502 503
503 QDateTime loadedFileVersion; 504 QDateTime loadedFileVersion;
504 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 505 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
505 void checkExternalId( Incidence * inc ); 506 void checkExternalId( Incidence * inc );
506 int mGlobalSyncMode; 507 int mGlobalSyncMode;
507 QString mCurrentSyncDevice; 508 QString mCurrentSyncDevice;
508 QString mCurrentSyncName; 509 QString mCurrentSyncName;
509 KOBeamPrefs* beamDialog; 510 KOBeamPrefs* beamDialog;
510 void init(); 511 void init();
511 int mDatePickerMode; 512 int mDatePickerMode;
512 bool mFlagEditDescription; 513 bool mFlagEditDescription;
513 QDateTime mLastCalendarSync; 514 QDateTime mLastCalendarSync;
514 void createPrinter(); 515 void createPrinter();
515 516
516 void calendarModified( bool, Calendar * ); 517 void calendarModified( bool, Calendar * );
517 518
518 CalPrinter *mCalPrinter; 519 CalPrinter *mCalPrinter;
519 520
520 QSplitter *mPanner; 521 QSplitter *mPanner;
521 QSplitter *mLeftSplitter; 522 QSplitter *mLeftSplitter;
522 QWidget *mLeftFrame; 523 QWidget *mLeftFrame;
523 QWidgetStack *mRightFrame; 524 QWidgetStack *mRightFrame;
524 525
525 KDatePicker* mDatePicker; 526 KDatePicker* mDatePicker;
526 QVBox* mDateFrame; 527 QVBox* mDateFrame;
527 NavigatorBar *mNavigatorBar; 528 NavigatorBar *mNavigatorBar;
528 529
529 KDateNavigator *mDateNavigator; // widget showing small month view. 530 KDateNavigator *mDateNavigator; // widget showing small month view.
530 531
531 KOFilterView *mFilterView; 532 KOFilterView *mFilterView;
532 533
533 ResourceView *mResourceView; 534 ResourceView *mResourceView;
534 535
535 // calendar object for this viewing instance 536 // calendar object for this viewing instance
536 Calendar *mCalendar; 537 Calendar *mCalendar;
537 538
538 CalendarResourceManager *mResourceManager; 539 CalendarResourceManager *mResourceManager;
539 540
540 FileStorage *mStorage; 541 FileStorage *mStorage;
541 542
542 DateNavigator *mNavigator; 543 DateNavigator *mNavigator;
543 544
544 KOViewManager *mViewManager; 545 KOViewManager *mViewManager;
545 KODialogManager *mDialogManager; 546 KODialogManager *mDialogManager;
546 547
547 // Calendar filters 548 // Calendar filters
548 QPtrList<CalFilter> mFilters; 549 QPtrList<CalFilter> mFilters;
549 550
550 // various housekeeping variables. 551 // various housekeeping variables.
551 bool mModified; // flag indicating if calendar is modified 552 bool mModified; // flag indicating if calendar is modified
552 bool mReadOnly; // flag indicating if calendar is read-only 553 bool mReadOnly; // flag indicating if calendar is read-only
553 QDate mSaveSingleDate; 554 QDate mSaveSingleDate;
554 555
555 Incidence *mSelectedIncidence; 556 Incidence *mSelectedIncidence;
556 Incidence *mMoveIncidence; 557 Incidence *mMoveIncidence;
557 KOTodoView *mTodoList; 558 KOTodoView *mTodoList;
558 KOEventEditor * mEventEditor; 559 KOEventEditor * mEventEditor;
559 KOTodoEditor * mTodoEditor; 560 KOTodoEditor * mTodoEditor;
560 KOEventViewerDialog * mEventViewerDialog; 561 KOEventViewerDialog * mEventViewerDialog;
561 void keyPressEvent ( QKeyEvent *e) ; 562 void keyPressEvent ( QKeyEvent *e) ;
562 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 563 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
563}; 564};
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 4a610fa..af4f1ab 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -103,109 +103,110 @@ 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 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 125 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
126 QString getCurrentSyncName() { return mCurrentSyncName; } 126 QString getCurrentSyncName() { return mCurrentSyncName; }
127 127
128 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 128 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
129 void hideProgressBar(); 129 void hideProgressBar();
130 bool isProgressBarCanceled(); 130 bool isProgressBarCanceled();
131 131
132 // sync stuff 132 // sync stuff
133 QString mLocalMachineName; 133 QString mLocalMachineName;
134 QStringList mExternSyncProfiles; 134 QStringList mExternSyncProfiles;
135 QStringList mSyncProfileNames; 135 QStringList mSyncProfileNames;
136 bool mAskForPreferences; 136 bool mAskForPreferences;
137 bool mShowSyncSummary; 137 bool mShowSyncSummary;
138 bool mIsKapiFile; 138 bool mIsKapiFile;
139 bool mWriteBackExistingOnly; 139 bool mWriteBackExistingOnly;
140 int mSyncAlgoPrefs; 140 int mSyncAlgoPrefs;
141 bool mWriteBackFile; 141 bool mWriteBackFile;
142 int mWriteBackInFuture; 142 int mWriteBackInFuture;
143 QString mPhoneDevice; 143 QString mPhoneDevice;
144 QString mPhoneConnection; 144 QString mPhoneConnection;
145 QString mPhoneModel; 145 QString mPhoneModel;
146 QString mPassWordPiSync; 146 QString mPassWordPiSync;
147 QString mActiveSyncPort; 147 QString mActiveSyncPort;
148 QString mActiveSyncIP ; 148 QString mActiveSyncIP ;
149 149
150 signals: 150 signals:
151 void save(); 151 void save();
152 void request_file(); 152 void request_file();
153 void getFile( bool ); 153 void getFile( bool );
154 154
155 public slots: 155 public slots:
156 void slotSyncMenu( int ); 156 void slotSyncMenu( int );
157 void deleteCommandSocket(KCommandSocket*s, int state); 157 void deleteCommandSocket(KCommandSocket*s, int state);
158 void readFileFromSocket(); 158 void readFileFromSocket();
159 void fillSyncMenu(); 159 void fillSyncMenu();
160 160
161 private: 161 private:
162 void syncPi(); 162 void syncPi();
163 KServerSocket * mServerSocket; 163 KServerSocket * mServerSocket;
164 KPimPrefs* mPrefs; 164 KPimPrefs* mPrefs;
165 QString mDefFileName; 165 QString mDefFileName;
166 QString mCurrentSyncDevice; 166 QString mCurrentSyncDevice;
167 QString mCurrentSyncName; 167 QString mCurrentSyncName;
168 void quickSyncLocalFile(); 168 void quickSyncLocalFile();
169 bool syncWithFile( QString fn , bool quick ); 169 bool syncWithFile( QString fn , bool quick );
170 void syncLocalFile(); 170 void syncLocalFile();
171 void syncPhone(); 171 void syncPhone();
172 void syncSharp(); 172 void syncSharp();
173 void syncKDE(); 173 void syncKDE();
174 bool syncExternalApplication(QString); 174 bool syncExternalApplication(QString);
175 int mCurrentSyncProfile ; 175 int mCurrentSyncProfile ;
176 void syncRemote( KSyncProfile* prof, bool ask = true); 176 void syncRemote( KSyncProfile* prof, bool ask = true);
177 bool edit_sync_options(); 177 bool edit_sync_options();
178 bool edit_pisync_options(); 178 bool edit_pisync_options();
179 int ringSync(); 179 int ringSync();
180 QString getPassword( ); 180 QString getPassword( );
181 bool mPisyncFinished; 181 bool mPisyncFinished;
182 bool mBlockSaveFlag; 182 bool mBlockSaveFlag;
183 QWidget* mParent; 183 QWidget* mParent;
184 KSyncInterface* mImplementation; 184 KSyncInterface* mImplementation;
185 TargetApp mTargetApp; 185 TargetApp mTargetApp;
186 QPopupMenu* mSyncMenu; 186 QPopupMenu* mSyncMenu;
187 QProgressBar* bar; 187 QProgressBar* bar;
188 188
189private slots: 189private slots:
190 void confSync(); 190 void confSync();
191 191
192 192
193}; 193};
194 194
195 195
196class KSyncInterface 196class KSyncInterface
197{ 197{
198 public : 198 public :
199 virtual void removeSyncInfo( QString syncProfile) = 0;
199 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; 200 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
200 virtual bool syncExternal(KSyncManager* manager, QString resource) 201 virtual bool syncExternal(KSyncManager* manager, QString resource)
201 { 202 {
202 // empty implementation, because some syncable applications do not 203 // empty implementation, because some syncable applications do not
203 // have an external(sharpdtm) syncmode, like pwmanager. 204 // have an external(sharpdtm) syncmode, like pwmanager.
204 return false; 205 return false;
205 } 206 }
206 207
207 208
208}; 209};
209 210
210 211
211#endif 212#endif
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 2b8f2fa..6ae6e28 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1371,102 +1371,108 @@ void PwM::copyToClipboard(const QString &s)
1371 1371
1372void PwM::showStatMsg(const QString &msg) 1372void PwM::showStatMsg(const QString &msg)
1373{ 1373{
1374#ifdef DESKTOP_VERSION 1374#ifdef DESKTOP_VERSION
1375 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); 1375 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
1376#else 1376#else
1377 qDebug("Statusbar : %s",msg.latin1()); 1377 qDebug("Statusbar : %s",msg.latin1());
1378 Global::statusMessage(msg); 1378 Global::statusMessage(msg);
1379#endif 1379#endif
1380} 1380}
1381 1381
1382void PwM::focusInEvent(QFocusEvent *e) 1382void PwM::focusInEvent(QFocusEvent *e)
1383{ 1383{
1384 if (e->gotFocus()) { 1384 if (e->gotFocus()) {
1385 emit gotFocus(this); 1385 emit gotFocus(this);
1386 } else if (e->lostFocus()) { 1386 } else if (e->lostFocus()) {
1387 emit lostFocus(this); 1387 emit lostFocus(this);
1388 } 1388 }
1389} 1389}
1390 1390
1391 1391
1392#ifdef PWM_EMBEDDED 1392#ifdef PWM_EMBEDDED
1393 1393
1394void PwM::whatsnew_slot() 1394void PwM::whatsnew_slot()
1395{ 1395{
1396 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1396 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1397} 1397}
1398 1398
1399void PwM::showLicense_slot() 1399void PwM::showLicense_slot()
1400{ 1400{
1401 KApplication::showLicence(); 1401 KApplication::showLicence();
1402} 1402}
1403 1403
1404void PwM::faq_slot() 1404void PwM::faq_slot()
1405{ 1405{
1406 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1406 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1407} 1407}
1408 1408
1409void PwM::syncHowTo_slot() 1409void PwM::syncHowTo_slot()
1410{ 1410{
1411 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1411 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1412} 1412}
1413 1413
1414 1414
1415void PwM::createAboutData_slot() 1415void PwM::createAboutData_slot()
1416{ 1416{
1417 QString version; 1417 QString version;
1418#include <../version> 1418#include <../version>
1419; 1419;
1420 QMessageBox::about( this, "About PwManager/Pi", 1420 QMessageBox::about( this, "About PwManager/Pi",
1421 "PwManager/Platform-independent\n" 1421 "PwManager/Platform-independent\n"
1422 "(PWM/Pi) " +version + " - " + 1422 "(PWM/Pi) " +version + " - " +
1423#ifdef DESKTOP_VERSION 1423#ifdef DESKTOP_VERSION
1424 "Desktop Edition\n" 1424 "Desktop Edition\n"
1425#else 1425#else
1426 "PDA-Edition\n" 1426 "PDA-Edition\n"
1427 "for: Zaurus 5500 / 7x0 / 8x0\n" 1427 "for: Zaurus 5500 / 7x0 / 8x0\n"
1428#endif 1428#endif
1429 1429
1430 "(c) 2004 Ulf Schenk\n" 1430 "(c) 2004 Ulf Schenk\n"
1431 "(c) 2004 Lutz Rogowski\n" 1431 "(c) 2004 Lutz Rogowski\n"
1432 "(c) 1997-2004, The KDE PIM Team\n" 1432 "(c) 1997-2004, The KDE PIM Team\n"
1433 1433
1434 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1434 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1435 "Matt Scifo - mscifo@o1.com\n" 1435 "Matt Scifo - mscifo@o1.com\n"
1436 "Elias Probst - elias.probst@gmx.de\n" 1436 "Elias Probst - elias.probst@gmx.de\n"
1437 "George Staikos - staikos@kde.org\n" 1437 "George Staikos - staikos@kde.org\n"
1438 "Matthew Palmer - mjp16@uow.edu.au\n" 1438 "Matthew Palmer - mjp16@uow.edu.au\n"
1439 "Olivier Sessink - gpasman@nl.linux.org\n" 1439 "Olivier Sessink - gpasman@nl.linux.org\n"
1440 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1440 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1441 "Troy Engel - tengel@sonic.net\n" 1441 "Troy Engel - tengel@sonic.net\n"
1442 "Wickey - wickey@gmx.at\n" 1442 "Wickey - wickey@gmx.at\n"
1443 "Ian MacGregor - original documentation author.\n" 1443 "Ian MacGregor - original documentation author.\n"
1444 ); 1444 );
1445} 1445}
1446 1446
1447 1447
1448//this are the overwritten callbackmethods from the syncinterface 1448//this are the overwritten callbackmethods from the syncinterface
1449bool PwM::sync(KSyncManager* manager, QString filename, int mode) 1449bool PwM::sync(KSyncManager* manager, QString filename, int mode)
1450{ 1450{
1451 PWM_ASSERT(curDoc()); 1451 PWM_ASSERT(curDoc());
1452 1452
1453 bool ret = curDoc()->sync(manager, filename, mode); 1453 bool ret = curDoc()->sync(manager, filename, mode);
1454 1454
1455 qDebug("PwM::sync save now: ret=%i", ret); 1455 qDebug("PwM::sync save now: ret=%i", ret);
1456 1456
1457 if (ret == true) { 1457 if (ret == true) {
1458 //US BUG: what can we call here to update the view of the current doc? 1458 //US BUG: what can we call here to update the view of the current doc?
1459 //mViewManager->refreshView(); 1459 //mViewManager->refreshView();
1460 1460
1461 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. 1461 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
1462 save(); 1462 save();
1463 } 1463 }
1464 1464
1465 return ret; 1465 return ret;
1466} 1466}
1467
1468void PwM::removeSyncInfo( QString syncProfile)
1469{
1470 qDebug("PWM::not implemented: removeSyncInfo for profile %s ", syncProfile.latin1());
1471}
1472
1467#endif 1473#endif
1468 1474
1469 1475
1470#ifndef PWM_EMBEDDED 1476#ifndef PWM_EMBEDDED
1471#include "pwm.moc" 1477#include "pwm.moc"
1472#endif 1478#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index 5822d59..fb34bca 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -184,114 +184,115 @@ public slots:
184 void faq_slot(); 184 void faq_slot();
185 void createAboutData_slot(); 185 void createAboutData_slot();
186 void syncHowTo_slot(); 186 void syncHowTo_slot();
187#endif 187#endif
188 188
189protected: 189protected:
190 /** is this window virgin? */ 190 /** is this window virgin? */
191 bool isVirgin() 191 bool isVirgin()
192 { return virgin; } 192 { return virgin; }
193 /** add/remove virginity */ 193 /** add/remove virginity */
194 void setVirgin(bool v); 194 void setVirgin(bool v);
195 /** initialize the menubar */ 195 /** initialize the menubar */
196 void initMenubar(); 196 void initMenubar();
197 /** initialize the toolbar */ 197 /** initialize the toolbar */
198 void initToolbar(); 198 void initToolbar();
199 /** initialize the window-metrics */ 199 /** initialize the window-metrics */
200 void initMetrics(); 200 void initMetrics();
201 /** close-event */ 201 /** close-event */
202 void closeEvent(QCloseEvent *e); 202 void closeEvent(QCloseEvent *e);
203 /** creates a new PwM-ListView and returns it */ 203 /** creates a new PwM-ListView and returns it */
204 PwMView * makeNewListView(PwMDoc *doc); 204 PwMView * makeNewListView(PwMDoc *doc);
205 /** Window hide-event */ 205 /** Window hide-event */
206 void hideEvent(QHideEvent *); 206 void hideEvent(QHideEvent *);
207 /** is this window minimized? */ 207 /** is this window minimized? */
208 bool isMinimized() 208 bool isMinimized()
209 { 209 {
210#ifndef PWM_EMBEDDED 210#ifndef PWM_EMBEDDED
211 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) 211 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0)
212 return KWin::windowInfo(winId()).isMinimized(); 212 return KWin::windowInfo(winId()).isMinimized();
213 #else // KDE_VERSION 213 #else // KDE_VERSION
214 return KWin::info(winId()).isIconified(); 214 return KWin::info(winId()).isIconified();
215 #endif // KDE_VERSION 215 #endif // KDE_VERSION
216#else 216#else
217 return false; 217 return false;
218#endif 218#endif
219 } 219 }
220 /** window got the focus */ 220 /** window got the focus */
221 void focusInEvent(QFocusEvent *e); 221 void focusInEvent(QFocusEvent *e);
222 /** update the caption string */ 222 /** update the caption string */
223 void updateCaption(); 223 void updateCaption();
224#ifdef CONFIG_KWALLETIF 224#ifdef CONFIG_KWALLETIF
225 /** check if kwalletemu is enabled and ask the user what to do */ 225 /** check if kwalletemu is enabled and ask the user what to do */
226 bool checkAndAskForKWalletEmu(); 226 bool checkAndAskForKWalletEmu();
227#endif // CONFIG_KWALLETIF 227#endif // CONFIG_KWALLETIF
228 228
229protected slots: 229protected slots:
230 /** doc got closed */ 230 /** doc got closed */
231 void docClosed(PwMDoc *doc); 231 void docClosed(PwMDoc *doc);
232 232
233signals: 233signals:
234 /** window got closed (by user or someone else) */ 234 /** window got closed (by user or someone else) */
235 void closed(PwM *wnd); 235 void closed(PwM *wnd);
236 /** window got the focus (was brought to foreground) */ 236 /** window got the focus (was brought to foreground) */
237 void gotFocus(PwM *wnd); 237 void gotFocus(PwM *wnd);
238 /** window lost the focus */ 238 /** window lost the focus */
239 void lostFocus(PwM *wnd); 239 void lostFocus(PwM *wnd);
240 240
241protected: 241protected:
242 /** pointer to the view active in this KMainWindow */ 242 /** pointer to the view active in this KMainWindow */
243 PwMView *view; 243 PwMView *view;
244 /** pointer to the init class */ 244 /** pointer to the init class */
245 PwMInit *init; 245 PwMInit *init;
246 /** has this window already lost its virginity? 246 /** has this window already lost its virginity?
247 * Means is there an open working document 247 * Means is there an open working document
248 */ 248 */
249 bool virgin; 249 bool virgin;
250 /** "file" popup-menu */ 250 /** "file" popup-menu */
251 KPopupMenu *filePopup; 251 KPopupMenu *filePopup;
252 252
253 /** "manage" popup-menu */ 253 /** "manage" popup-menu */
254 KPopupMenu *managePopup; 254 KPopupMenu *managePopup;
255#ifdef CONFIG_KEYCARD 255#ifdef CONFIG_KEYCARD
256 /** "chipcard" popup-menu */ 256 /** "chipcard" popup-menu */
257 KPopupMenu *chipcardPopup; 257 KPopupMenu *chipcardPopup;
258#endif // CONFIG_KEYCARD 258#endif // CONFIG_KEYCARD
259 /** "view" popup-menu */ 259 /** "view" popup-menu */
260 KPopupMenu *viewPopup; 260 KPopupMenu *viewPopup;
261 /** "options" popup-menu */ 261 /** "options" popup-menu */
262 KPopupMenu *optionsPopup; 262 KPopupMenu *optionsPopup;
263 /** "help" popup-menu */ 263 /** "help" popup-menu */
264 KPopupMenu *helpPopup; 264 KPopupMenu *helpPopup;
265 /** "export" popup-menu */ 265 /** "export" popup-menu */
266 KPopupMenu *exportPopup; 266 KPopupMenu *exportPopup;
267 /** "import" popup-menu */ 267 /** "import" popup-menu */
268 KPopupMenu *importPopup; 268 KPopupMenu *importPopup;
269 /** force quit this window? */ 269 /** force quit this window? */
270 bool forceQuit; 270 bool forceQuit;
271 /** force minimize this window to the tray */ 271 /** force minimize this window to the tray */
272 bool forceMinimizeToTray; 272 bool forceMinimizeToTray;
273 273
274 274
275 275
276 276
277 private: 277 private:
278#ifdef PWM_EMBEDDED 278#ifdef PWM_EMBEDDED
279 //this are the overwritten callbackmethods from the syncinterface 279 //this are the overwritten callbackmethods from the syncinterface
280 virtual bool sync(KSyncManager* manager, QString filename, int mode); 280 virtual bool sync(KSyncManager* manager, QString filename, int mode);
281 virtual void removeSyncInfo( QString syncProfile);
281 282
282 // LR ******************************* 283 // LR *******************************
283 // sync stuff! 284 // sync stuff!
284 QPopupMenu *syncPopup; 285 QPopupMenu *syncPopup;
285 KSyncManager* syncManager; 286 KSyncManager* syncManager;
286#endif 287#endif
287 288
288 289
289 290
290 291
291 292
292 293
293 294
294 295
295}; 296};
296 297
297#endif 298#endif
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index cf8690f..fd17ce5 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -3211,193 +3211,196 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
3211 syncItemRemote->lastSyncDate = mLastSync; 3211 syncItemRemote->lastSyncDate = mLastSync;
3212 3212
3213 QString mes; 3213 QString mes;
3214 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedPasswordsLocal, addedPasswordsRemote, changedLocal, changedRemote, deletedPasswordsLocal, deletedPasswordsRemote ); 3214 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedPasswordsLocal, addedPasswordsRemote, changedLocal, changedRemote, deletedPasswordsLocal, deletedPasswordsRemote );
3215 if ( manager->mShowSyncSummary ) { 3215 if ( manager->mShowSyncSummary ) {
3216 KMessageBox::information(0, mes, i18n("PWM/Pi Synchronization") ); 3216 KMessageBox::information(0, mes, i18n("PWM/Pi Synchronization") );
3217 } 3217 }
3218 qDebug( mes ); 3218 qDebug( mes );
3219 return e_success; 3219 return e_success;
3220} 3220}
3221 3221
3222 3222
3223int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full ) 3223int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full )
3224{ 3224{
3225 // 0 equal 3225 // 0 equal
3226 // 1 take local 3226 // 1 take local
3227 // 2 take remote 3227 // 2 take remote
3228 // 3 cancel 3228 // 3 cancel
3229 QDateTime localMod = local->meta.update; 3229 QDateTime localMod = local->meta.update;
3230 QDateTime remoteMod = remote->meta.update; 3230 QDateTime remoteMod = remote->meta.update;
3231 3231
3232 if ( localMod == remoteMod ) 3232 if ( localMod == remoteMod )
3233 return 0; 3233 return 0;
3234 3234
3235 qDebug(" %d %d conflict on %s %s ", mode, full, local->desc.c_str(), remote->desc.c_str() ); 3235 qDebug(" %d %d conflict on %s %s ", mode, full, local->desc.c_str(), remote->desc.c_str() );
3236 3236
3237 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 3237 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
3238 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 3238 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
3239 //full = true; //debug only 3239 //full = true; //debug only
3240 if ( full ) { 3240 if ( full ) {
3241 bool equ = ( (*local) == (*remote) ); 3241 bool equ = ( (*local) == (*remote) );
3242 if ( equ ) { 3242 if ( equ ) {
3243 //qDebug("equal "); 3243 //qDebug("equal ");
3244 if ( mode < SYNC_PREF_FORCE_LOCAL ) 3244 if ( mode < SYNC_PREF_FORCE_LOCAL )
3245 return 0; 3245 return 0;
3246 3246
3247 }//else //debug only 3247 }//else //debug only
3248 //qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str()); 3248 //qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str());
3249 } 3249 }
3250 3250
3251 int result; 3251 int result;
3252 bool localIsNew; 3252 bool localIsNew;
3253 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 3253 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
3254 3254
3255 if ( full && mode < SYNC_PREF_NEWEST ) 3255 if ( full && mode < SYNC_PREF_NEWEST )
3256 mode = SYNC_PREF_ASK; 3256 mode = SYNC_PREF_ASK;
3257 3257
3258 switch( mode ) { 3258 switch( mode ) {
3259 case SYNC_PREF_LOCAL: 3259 case SYNC_PREF_LOCAL:
3260 if ( lastSync > remoteMod ) 3260 if ( lastSync > remoteMod )
3261 return 1; 3261 return 1;
3262 if ( lastSync > localMod ) 3262 if ( lastSync > localMod )
3263 return 2; 3263 return 2;
3264 return 1; 3264 return 1;
3265 break; 3265 break;
3266 case SYNC_PREF_REMOTE: 3266 case SYNC_PREF_REMOTE:
3267 if ( lastSync > remoteMod ) 3267 if ( lastSync > remoteMod )
3268 return 1; 3268 return 1;
3269 if ( lastSync > localMod ) 3269 if ( lastSync > localMod )
3270 return 2; 3270 return 2;
3271 return 2; 3271 return 2;
3272 break; 3272 break;
3273 case SYNC_PREF_NEWEST: 3273 case SYNC_PREF_NEWEST:
3274 if ( localMod > remoteMod ) 3274 if ( localMod > remoteMod )
3275 return 1; 3275 return 1;
3276 else 3276 else
3277 return 2; 3277 return 2;
3278 break; 3278 break;
3279 case SYNC_PREF_ASK: 3279 case SYNC_PREF_ASK:
3280 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 3280 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
3281 if ( lastSync > remoteMod ) 3281 if ( lastSync > remoteMod )
3282 return 1; 3282 return 1;
3283 if ( lastSync > localMod ) 3283 if ( lastSync > localMod )
3284 return 2; 3284 return 2;
3285 localIsNew = localMod >= remoteMod; 3285 localIsNew = localMod >= remoteMod;
3286 //qDebug("conflict! ************************************** "); 3286 //qDebug("conflict! ************************************** ");
3287 { 3287 {
3288 PwMDataItemChooser acd ( *local,*remote, localIsNew , 0/*this*/ ); 3288 PwMDataItemChooser acd ( *local,*remote, localIsNew , 0/*this*/ );
3289 result = acd.executeD(localIsNew); 3289 result = acd.executeD(localIsNew);
3290 return result; 3290 return result;
3291 } 3291 }
3292 break; 3292 break;
3293 case SYNC_PREF_FORCE_LOCAL: 3293 case SYNC_PREF_FORCE_LOCAL:
3294 return 1; 3294 return 1;
3295 break; 3295 break;
3296 case SYNC_PREF_FORCE_REMOTE: 3296 case SYNC_PREF_FORCE_REMOTE:
3297 return 2; 3297 return 2;
3298 break; 3298 break;
3299 3299
3300 default: 3300 default:
3301 // SYNC_PREF_TAKE_BOTH not implemented 3301 // SYNC_PREF_TAKE_BOTH not implemented
3302 break; 3302 break;
3303 } 3303 }
3304 return 0; 3304 return 0;
3305} 3305}
3306 3306
3307 3307void PwMDoc::removeSyncInfo( QString syncProfile)
3308{
3309 qDebug("PwMDoc::not implemented: removeSyncInfo for profile %s ", syncProfile.latin1());
3310}
3308 3311
3309 3312
3310//this are the overwritten callbackmethods from the syncinterface 3313//this are the overwritten callbackmethods from the syncinterface
3311bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode) 3314bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode)
3312{ 3315{
3313 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3316 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3314 3317
3315 //1) unlock local file first if necessary (ask for password) 3318 //1) unlock local file first if necessary (ask for password)
3316 if (this->isDeepLocked()) { 3319 if (this->isDeepLocked()) {
3317 PwMerror ret = this->deepLock(false); 3320 PwMerror ret = this->deepLock(false);
3318 if (ret != e_success) 3321 if (ret != e_success)
3319 return false; 3322 return false;
3320 } 3323 }
3321 3324
3322 //2) construct and open a new doc on the stack(automatic cleanup of remote file). 3325 //2) construct and open a new doc on the stack(automatic cleanup of remote file).
3323 PwMDoc syncTarget(this, "synctarget"); 3326 PwMDoc syncTarget(this, "synctarget");
3324 PwMDoc* pSyncTarget = &syncTarget; 3327 PwMDoc* pSyncTarget = &syncTarget;
3325 3328
3326 3329
3327 PwMerror err = pSyncTarget->openDoc(&filename, 1 /*== open with all entries locked*/); 3330 PwMerror err = pSyncTarget->openDoc(&filename, 1 /*== open with all entries locked*/);
3328 3331
3329 if (err == e_alreadyOpen) { 3332 if (err == e_alreadyOpen) {
3330 PwMDocList::listItem li; 3333 PwMDocList::listItem li;
3331 if (getOpenDocList()->find(filename.latin1(), &li)) 3334 if (getOpenDocList()->find(filename.latin1(), &li))
3332 pSyncTarget = li.doc; 3335 pSyncTarget = li.doc;
3333 else { 3336 else {
3334 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1()); 3337 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1());
3335 return false; 3338 return false;
3336 } 3339 }
3337 } 3340 }
3338 else if (err != e_success) { 3341 else if (err != e_success) {
3339 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1()); 3342 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1());
3340 return false; 3343 return false;
3341 } 3344 }
3342 3345
3343 qDebug("PWM file loaded %s,sync mode %d",filename.latin1(), mode ); 3346 qDebug("PWM file loaded %s,sync mode %d",filename.latin1(), mode );
3344 3347
3345 3348
3346 //3) unlock remote file first if necessary (ask for password) 3349 //3) unlock remote file first if necessary (ask for password)
3347 if (pSyncTarget->isDeepLocked()) { 3350 if (pSyncTarget->isDeepLocked()) {
3348 PwMerror ret = pSyncTarget->deepLock(false); 3351 PwMerror ret = pSyncTarget->deepLock(false);
3349 if (ret != e_success) 3352 if (ret != e_success)
3350 return false; 3353 return false;
3351 } 3354 }
3352 3355
3353 3356
3354 err = syncronize(manager, this, pSyncTarget, mode ); 3357 err = syncronize(manager, this, pSyncTarget, mode );
3355 3358
3356 if (err == e_success) { 3359 if (err == e_success) {
3357 if ( manager->mWriteBackFile ){ 3360 if ( manager->mWriteBackFile ){
3358 qDebug("Saving remote PWManager file"); 3361 qDebug("Saving remote PWManager file");
3359 err = pSyncTarget->saveDoc(conf()->confGlobCompression()); 3362 err = pSyncTarget->saveDoc(conf()->confGlobCompression());
3360 if (err != e_success) { 3363 if (err != e_success) {
3361 qDebug("PwmDoc::sync: Sync failed. Error %i while storing file %s",err, filename.latin1()); 3364 qDebug("PwmDoc::sync: Sync failed. Error %i while storing file %s",err, filename.latin1());
3362 return false; 3365 return false;
3363 } 3366 }
3364 } 3367 }
3365 3368
3366 flagDirty(); 3369 flagDirty();
3367 return true; 3370 return true;
3368 } 3371 }
3369 else { 3372 else {
3370 return false; 3373 return false;
3371 } 3374 }
3372} 3375}
3373 3376
3374#endif 3377#endif
3375 3378
3376 3379
3377bool PwMDoc::findSyncData(const QString &syncname, unsigned int *index) 3380bool PwMDoc::findSyncData(const QString &syncname, unsigned int *index)
3378{ 3381{
3379 vector<PwMSyncItem>::iterator i = dti.syncDta.begin(), 3382 vector<PwMSyncItem>::iterator i = dti.syncDta.begin(),
3380 end = dti.syncDta.end(); 3383 end = dti.syncDta.end();
3381 3384
3382 while (i != end) { 3385 while (i != end) {
3383 if ((*i).syncName == syncname.latin1()) { 3386 if ((*i).syncName == syncname.latin1()) {
3384 if (index) { 3387 if (index) {
3385 *index = i - dti.syncDta.begin(); 3388 *index = i - dti.syncDta.begin();
3386 } 3389 }
3387 return true; 3390 return true;
3388 } 3391 }
3389 ++i; 3392 ++i;
3390 } 3393 }
3391 return false; 3394 return false;
3392}; 3395};
3393 3396
3394/** add new syncdataentry */ 3397/** add new syncdataentry */
3395PwMerror PwMDoc::addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty) 3398PwMerror PwMDoc::addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty)
3396{ 3399{
3397 PWM_ASSERT(d); 3400 PWM_ASSERT(d);
3398 3401
3399 if (isDeepLocked()) { 3402 if (isDeepLocked()) {
3400 PwMerror ret; 3403 PwMerror ret;
3401 ret = deepLock(false); 3404 ret = deepLock(false);
3402 if (ret != e_success) 3405 if (ret != e_success)
3403 return e_lock; 3406 return e_lock;
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 55e3231..e419c24 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -669,120 +669,121 @@ protected:
669 unsigned int curDocStat; 669 unsigned int curDocStat;
670 /** browser process for goToURL() */ 670 /** browser process for goToURL() */
671 KProcess browserProc; 671 KProcess browserProc;
672 /** pointer to the list-view, using this document. 672 /** pointer to the list-view, using this document.
673 * As there can only be one list-view per doc, we 673 * As there can only be one list-view per doc, we
674 * don't need a list here. 674 * don't need a list here.
675 */ 675 */
676 PwMView *listView; 676 PwMView *listView;
677 /** unnamedNum is used to store the "unnamed counter" 677 /** unnamedNum is used to store the "unnamed counter"
678 * for this document, while it's unnamed. If it's 0, 678 * for this document, while it's unnamed. If it's 0,
679 * we have to get a new unique one. 679 * we have to get a new unique one.
680 */ 680 */
681 unsigned int unnamedNum; 681 unsigned int unnamedNum;
682 /** is this doc going to be deleted (executing in destructor context) */ 682 /** is this doc going to be deleted (executing in destructor context) */
683 bool deleted; 683 bool deleted;
684 /** document timer */ 684 /** document timer */
685 DocTimer *_timer; 685 DocTimer *_timer;
686 /** lock counter for the "dataChanged" signal */ 686 /** lock counter for the "dataChanged" signal */
687 unsigned int dataChangedLock; 687 unsigned int dataChangedLock;
688 688
689 /** list of all open documents */ 689 /** list of all open documents */
690 static PwMDocList openDocList; 690 static PwMDocList openDocList;
691 691
692protected: 692protected:
693 /** serialize "dta" and return it in "d". */ 693 /** serialize "dta" and return it in "d". */
694 bool serializeDta(string *d); 694 bool serializeDta(string *d);
695 /** de-serialize "d" and overwrite "dta" */ 695 /** de-serialize "d" and overwrite "dta" */
696 bool deSerializeDta(const string *d, bool entriesLocked); 696 bool deSerializeDta(const string *d, bool entriesLocked);
697 /** write header to file */ 697 /** write header to file */
698 PwMerror writeFileHeader(char keyHash, char dataHash, char crypt, char compress, 698 PwMerror writeFileHeader(char keyHash, char dataHash, char crypt, char compress,
699 QString *pw, QFile *f); 699 QString *pw, QFile *f);
700 /** write data-hash to file */ 700 /** write data-hash to file */
701 PwMerror writeDataHash(char dataHash, string *d, QFile *f); 701 PwMerror writeDataHash(char dataHash, string *d, QFile *f);
702 /** check header. Read header info and verify key-hash and filever. 702 /** check header. Read header info and verify key-hash and filever.
703 * returns length of header in "headerLength" */ 703 * returns length of header in "headerLength" */
704 PwMerror checkHeader(char *cryptAlgo, QString *pw, char *compress, 704 PwMerror checkHeader(char *cryptAlgo, QString *pw, char *compress,
705 unsigned int *headerLength, char *dataHashType, 705 unsigned int *headerLength, char *dataHashType,
706 string *dataHash, QFile *f); 706 string *dataHash, QFile *f);
707 /** check the data-hash */ 707 /** check the data-hash */
708 PwMerror checkDataHash(char dataHashType, const string *dataHash, const string *dataStream); 708 PwMerror checkDataHash(char dataHashType, const string *dataHash, const string *dataStream);
709 /** encrypt data "d" and write to "filename" */ 709 /** encrypt data "d" and write to "filename" */
710 PwMerror encrypt(string *d, const QString *pw, QFile *f, char algo); 710 PwMerror encrypt(string *d, const QString *pw, QFile *f, char algo);
711 /** read data from file beginning at "pos", decrypt and return it */ 711 /** read data from file beginning at "pos", decrypt and return it */
712 PwMerror decrypt(string *d, unsigned int pos, const QString *pw, char algo, QFile *f); 712 PwMerror decrypt(string *d, unsigned int pos, const QString *pw, char algo, QFile *f);
713 /** compress the data */ 713 /** compress the data */
714 bool compressDta(string *d, char algo); 714 bool compressDta(string *d, char algo);
715 /** uncompress the data */ 715 /** uncompress the data */
716 bool decompressDta(string *d, char algo); 716 bool decompressDta(string *d, char algo);
717 /** internal import function for a text-file generated by PwM. 717 /** internal import function for a text-file generated by PwM.
718 * If this is not a valid PwM-exported file, it returns e_fileFormat */ 718 * If this is not a valid PwM-exported file, it returns e_fileFormat */
719 PwMerror importText_PwM(const QString *file); 719 PwMerror importText_PwM(const QString *file);
720 /** PwM-text-import helper function to extract the name/pw/comment out 720 /** PwM-text-import helper function to extract the name/pw/comment out
721 * of one entry-line */ 721 * of one entry-line */
722 bool textExtractEntry_PwM(const char *in, ssize_t in_size, string *out); 722 bool textExtractEntry_PwM(const char *in, ssize_t in_size, string *out);
723 /** compare two strings */ 723 /** compare two strings */
724 bool compareString(const string &s1, const string &s2, bool caseSensitive, 724 bool compareString(const string &s1, const string &s2, bool caseSensitive,
725 bool exactWordMatch); 725 bool exactWordMatch);
726 /** clears all document-data */ 726 /** clears all document-data */
727 void clearDoc(); 727 void clearDoc();
728 /** delete all empty categories */ 728 /** delete all empty categories */
729 void delAllEmptyCat(bool dontFlagDirty); 729 void delAllEmptyCat(bool dontFlagDirty);
730 /** set a document status flag */ 730 /** set a document status flag */
731 void setDocStatFlag(unsigned int statFlag) 731 void setDocStatFlag(unsigned int statFlag)
732 { curDocStat |= statFlag; } 732 { curDocStat |= statFlag; }
733 /** unset a document status flag */ 733 /** unset a document status flag */
734 void unsetDocStatFlag(unsigned int statFlag) 734 void unsetDocStatFlag(unsigned int statFlag)
735 { curDocStat &= ~statFlag; } 735 { curDocStat &= ~statFlag; }
736 /** get a document status flag */ 736 /** get a document status flag */
737 bool getDocStatFlag(unsigned int statFlag) const 737 bool getDocStatFlag(unsigned int statFlag) const
738 { return (curDocStat & statFlag); } 738 { return (curDocStat & statFlag); }
739 /** set the "currentPassword" */ 739 /** set the "currentPassword" */
740 void setCurrentPw(const QString &pw) 740 void setCurrentPw(const QString &pw)
741 { 741 {
742 currentPw = pw; 742 currentPw = pw;
743 setDocStatFlag(DOC_STAT_DISK_DIRTY); 743 setDocStatFlag(DOC_STAT_DISK_DIRTY);
744 } 744 }
745 /** make a backup-copy of the given file */ 745 /** make a backup-copy of the given file */
746 bool backupFile(const QString &filePath); 746 bool backupFile(const QString &filePath);
747 /** copy a file from src to dst */ 747 /** copy a file from src to dst */
748 bool copyFile(const QString &src, const QString &dst); 748 bool copyFile(const QString &src, const QString &dst);
749 749
750 750
751 public: 751 public:
752#ifdef PWM_EMBEDDED 752#ifdef PWM_EMBEDDED
753 //US ENH: this is the magic function that syncronizes the local doc with the remote doc. 753 //US ENH: this is the magic function that syncronizes the local doc with the remote doc.
754 PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode ); 754 PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode );
755 755
756 //takePwMDataItem returns the following values 756 //takePwMDataItem returns the following values
757 // 0 equal 757 // 0 equal
758 // 1 take local 758 // 1 take local
759 // 2 take remote 759 // 2 take remote
760 // 3 cancel 760 // 3 cancel
761 int takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full ); 761 int takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full );
762 762
763 //the following methods are the overwritten callbackmethods from the syncinterface 763 //the following methods are the overwritten callbackmethods from the syncinterface
764 virtual bool sync(KSyncManager* manager, QString filename, int mode); 764 virtual bool sync(KSyncManager* manager, QString filename, int mode);
765 virtual void removeSyncInfo( QString syncProfile);
765 766
766#endif 767#endif
767 private: 768 private:
768 //US ENH: helpermethods to access the sync data for a certain syncname. 769 //US ENH: helpermethods to access the sync data for a certain syncname.
769 // It returns the syncdatas index 770 // It returns the syncdatas index
770 bool findSyncData(const QString &syncname, unsigned int *index); 771 bool findSyncData(const QString &syncname, unsigned int *index);
771 772
772 /** add new syncdataentry */ 773 /** add new syncdataentry */
773 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false); 774 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false);
774 775
775 /** returns a pointer to the syncdata */ 776 /** returns a pointer to the syncdata */
776 PwMSyncItem* getSyncDataEntry(unsigned int index) 777 PwMSyncItem* getSyncDataEntry(unsigned int index)
777 { return &(dti.syncDta[index]); } 778 { return &(dti.syncDta[index]); }
778 779
779 /** delete entry */ 780 /** delete entry */
780 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false); 781 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false);
781 782
782 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index); 783 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index);
783 784
784 QStringList getIDEntryList(); 785 QStringList getIDEntryList();
785 786
786}; 787};
787 788
788#endif 789#endif