author | zautrix <zautrix> | 2004-10-07 07:28:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 07:28:54 (UTC) |
commit | 77280f6a176a15b60004f312e6cacdfbbd3909c1 (patch) (unidiff) | |
tree | e074d4abedc2f4cc575e5655575e038b9d460106 /kaddressbook | |
parent | f1eb5b74c962909851607c4b4cb05ee18a347d37 (diff) | |
download | kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.zip kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.gz kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.bz2 |
sync changes
-rw-r--r-- | kaddressbook/kabcore.cpp | 31 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 7 |
2 files changed, 14 insertions, 24 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d9eb391..83fede4 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1674,24 +1674,28 @@ void KABCore::initGUI() | |||
1674 | 1674 | ||
1675 | mDetails = new ViewContainer( this ); | 1675 | mDetails = new ViewContainer( this ); |
1676 | 1676 | ||
1677 | topLayout->addWidget( viewSpace ); | 1677 | topLayout->addWidget( viewSpace ); |
1678 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1678 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1679 | topLayout->addWidget( mDetails ); | 1679 | topLayout->addWidget( mDetails ); |
1680 | #endif //KAB_NOSPLITTER | 1680 | #endif //KAB_NOSPLITTER |
1681 | */ | 1681 | */ |
1682 | 1682 | ||
1683 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1683 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1684 | syncManager->setBlockSave(false); | 1684 | syncManager->setBlockSave(false); |
1685 | 1685 | ||
1686 | connect(syncManager , SIGNAL( save() ), this, SLOT( save() ) ); | ||
1687 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | ||
1688 | syncManager->setDefaultFileName(locateLocal( "apps","kabc/std.vcf") ); | ||
1689 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | ||
1686 | 1690 | ||
1687 | #endif //KAB_EMBEDDED | 1691 | #endif //KAB_EMBEDDED |
1688 | initActions(); | 1692 | initActions(); |
1689 | 1693 | ||
1690 | #ifdef KAB_EMBEDDED | 1694 | #ifdef KAB_EMBEDDED |
1691 | addActionsManually(); | 1695 | addActionsManually(); |
1692 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1696 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1693 | mXXPortManager = new XXPortManager( this, this ); | 1697 | mXXPortManager = new XXPortManager( this, this ); |
1694 | 1698 | ||
1695 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1699 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1696 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1700 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1697 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1701 | // mActionQuit->plug ( mMainWindow->toolBar()); |
@@ -2828,49 +2832,40 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2828 | 2832 | ||
2829 | //this is a overwritten callbackmethods from the syncinterface | 2833 | //this is a overwritten callbackmethods from the syncinterface |
2830 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2834 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2831 | { | 2835 | { |
2832 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2836 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2833 | 2837 | ||
2834 | AddressBook abLocal( resource,"syncContact"); | 2838 | AddressBook abLocal( resource,"syncContact"); |
2835 | bool syncOK = false; | 2839 | bool syncOK = false; |
2836 | if ( abLocal.load() ) { | 2840 | if ( abLocal.load() ) { |
2837 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2841 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2838 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2842 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2839 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); | 2843 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); |
2840 | qDebug("KABCore::syncExternal: why do we acces here KABPrefs and not somehow KSyncProfile? "); | ||
2841 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2844 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2842 | if ( syncOK ) { | 2845 | if ( syncOK ) { |
2843 | if ( syncManager->mWriteBackFile ) { | 2846 | if ( syncManager->mWriteBackFile ) { |
2844 | abLocal.saveAB(); | 2847 | abLocal.saveAB(); |
2845 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2848 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2846 | } | 2849 | } |
2847 | } | 2850 | } |
2848 | setModified(); | 2851 | setModified(); |
2849 | } | 2852 | } |
2850 | if ( syncOK ) | 2853 | if ( syncOK ) |
2851 | mViewManager->refreshView(); | 2854 | mViewManager->refreshView(); |
2852 | return syncOK; | 2855 | return syncOK; |
2853 | 2856 | ||
2854 | } | 2857 | } |
2855 | 2858 | ||
2856 | //called by the syncmanager to indicate that the work has to marked as dirty. | 2859 | void KABCore::getFile( bool success ) |
2857 | void KABCore::sync_setModified() | ||
2858 | { | 2860 | { |
2859 | setModified(); | 2861 | if ( ! success ) { |
2860 | } | 2862 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2861 | 2863 | return; | |
2862 | //called by the syncmanager to ask if the dirty flag is set. | 2864 | } |
2863 | bool KABCore::sync_isModified() | 2865 | //mView->watchSavedFile(); |
2864 | { | 2866 | //mView->openCalendar( defaultFileName() ); |
2865 | return mModified; | 2867 | // pending: reload received file! |
2866 | } | 2868 | setCaption( i18n("Pi-Sync successful!") ); |
2867 | |||
2868 | |||
2869 | //called by the syncmanager to indicate that the work has to be saved. | ||
2870 | void KABCore::sync_save() | ||
2871 | { | ||
2872 | save(); | ||
2873 | } | 2869 | } |
2874 | 2870 | ||
2875 | 2871 | ||
2876 | |||
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c9c0d38..355e828 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -333,24 +333,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
333 | */ | 333 | */ |
334 | void addGUIClient( KXMLGUIClient *client ); | 334 | void addGUIClient( KXMLGUIClient *client ); |
335 | 335 | ||
336 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 336 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
337 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 337 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
338 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 338 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
339 | 339 | ||
340 | 340 | ||
341 | signals: | 341 | signals: |
342 | void contactSelected( const QString &name ); | 342 | void contactSelected( const QString &name ); |
343 | void contactSelected( const QPixmap &pixmap ); | 343 | void contactSelected( const QPixmap &pixmap ); |
344 | public slots: | 344 | public slots: |
345 | void getFile( bool success ); | ||
345 | void setDetailsVisible( bool visible ); | 346 | void setDetailsVisible( bool visible ); |
346 | void setDetailsToState(); | 347 | void setDetailsToState(); |
347 | // void slotSyncMenu( int ); | 348 | // void slotSyncMenu( int ); |
348 | private slots: | 349 | private slots: |
349 | void setJumpButtonBarVisible( bool visible ); | 350 | void setJumpButtonBarVisible( bool visible ); |
350 | void importFromOL(); | 351 | void importFromOL(); |
351 | void extensionModified( const KABC::Addressee::List &list ); | 352 | void extensionModified( const KABC::Addressee::List &list ); |
352 | void extensionChanged( int id ); | 353 | void extensionChanged( int id ); |
353 | void clipboardDataChanged(); | 354 | void clipboardDataChanged(); |
354 | void updateActionMenu(); | 355 | void updateActionMenu(); |
355 | void configureKeyBindings(); | 356 | void configureKeyBindings(); |
356 | void removeVoice(); | 357 | void removeVoice(); |
@@ -452,30 +453,24 @@ class KABCore : public QWidget, public KSyncInterface | |||
452 | class KABCorePrivate; | 453 | class KABCorePrivate; |
453 | KABCorePrivate *d; | 454 | KABCorePrivate *d; |
454 | //US bool mBlockSaveFlag; | 455 | //US bool mBlockSaveFlag; |
455 | 456 | ||
456 | #ifdef KAB_EMBEDDED | 457 | #ifdef KAB_EMBEDDED |
457 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 458 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
458 | #endif //KAB_EMBEDDED | 459 | #endif //KAB_EMBEDDED |
459 | 460 | ||
460 | //this are the overwritten callbackmethods from the syncinterface | 461 | //this are the overwritten callbackmethods from the syncinterface |
461 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 462 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
462 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 463 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
463 | 464 | ||
464 | //called by the syncmanager to indicate that the work has to marked as dirty. | ||
465 | virtual void sync_setModified(); | ||
466 | //called by the syncmanager to ask if the dirty flag is set. | ||
467 | virtual bool sync_isModified(); | ||
468 | //called by the syncmanager to indicate that the work has to be saved. | ||
469 | virtual void sync_save(); | ||
470 | 465 | ||
471 | // LR ******************************* | 466 | // LR ******************************* |
472 | // sync stuff! | 467 | // sync stuff! |
473 | QPopupMenu *syncMenu; | 468 | QPopupMenu *syncMenu; |
474 | KSyncManager* syncManager; | 469 | KSyncManager* syncManager; |
475 | int mGlobalSyncMode; | 470 | int mGlobalSyncMode; |
476 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 471 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
477 | KABC::Addressee getLastSyncAddressee(); | 472 | KABC::Addressee getLastSyncAddressee(); |
478 | QDateTime mLastAddressbookSync; | 473 | QDateTime mLastAddressbookSync; |
479 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 474 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
480 | // ********************* | 475 | // ********************* |
481 | 476 | ||