-rw-r--r-- | kaddressbook/kabcore.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 1 |
3 files changed, 18 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 83fede4..6404410 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1674,27 +1674,27 @@ 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() ) ); | 1686 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1687 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1687 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1688 | syncManager->setDefaultFileName(locateLocal( "apps","kabc/std.vcf") ); | 1688 | syncManager->setDefaultFileName( sentSyncFile()); |
1689 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1689 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1690 | 1690 | ||
1691 | #endif //KAB_EMBEDDED | 1691 | #endif //KAB_EMBEDDED |
1692 | initActions(); | 1692 | initActions(); |
1693 | 1693 | ||
1694 | #ifdef KAB_EMBEDDED | 1694 | #ifdef KAB_EMBEDDED |
1695 | addActionsManually(); | 1695 | addActionsManually(); |
1696 | //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. |
1697 | mXXPortManager = new XXPortManager( this, this ); | 1697 | mXXPortManager = new XXPortManager( this, this ); |
1698 | 1698 | ||
1699 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1699 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1700 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1700 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
@@ -2853,19 +2853,29 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) | |||
2853 | if ( syncOK ) | 2853 | if ( syncOK ) |
2854 | mViewManager->refreshView(); | 2854 | mViewManager->refreshView(); |
2855 | return syncOK; | 2855 | return syncOK; |
2856 | 2856 | ||
2857 | } | 2857 | } |
2858 | 2858 | ||
2859 | void KABCore::getFile( bool success ) | 2859 | void KABCore::getFile( bool success ) |
2860 | { | 2860 | { |
2861 | if ( ! success ) { | 2861 | if ( ! success ) { |
2862 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2862 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2863 | return; | 2863 | return; |
2864 | } | 2864 | } |
2865 | //mView->watchSavedFile(); | 2865 | mAddressBook->importFromFile( sentSyncFile() ); |
2866 | //mView->openCalendar( defaultFileName() ); | ||
2867 | // pending: reload received file! | ||
2868 | setCaption( i18n("Pi-Sync successful!") ); | 2866 | setCaption( i18n("Pi-Sync successful!") ); |
2869 | } | 2867 | } |
2868 | void KABCore::syncFileRequest() | ||
2869 | { | ||
2870 | mAddressBook->export2File( sentSyncFile() ); | ||
2871 | } | ||
2872 | QString KABCore::sentSyncFile() | ||
2873 | { | ||
2874 | #ifdef _WIN32_ | ||
2875 | return locateLocal( "tmp", "syncab.ics" ); | ||
2876 | #else | ||
2877 | return QString( "/tmp/kapitempfile.vcf" ); | ||
2878 | #endif | ||
2879 | } | ||
2870 | 2880 | ||
2871 | 2881 | ||
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 355e828..987369d 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -334,24 +334,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 getFile( bool success ); |
346 | void syncFileRequest(); | ||
346 | void setDetailsVisible( bool visible ); | 347 | void setDetailsVisible( bool visible ); |
347 | void setDetailsToState(); | 348 | void setDetailsToState(); |
348 | // void slotSyncMenu( int ); | 349 | // void slotSyncMenu( int ); |
349 | private slots: | 350 | private slots: |
350 | void setJumpButtonBarVisible( bool visible ); | 351 | void setJumpButtonBarVisible( bool visible ); |
351 | void importFromOL(); | 352 | void importFromOL(); |
352 | void extensionModified( const KABC::Addressee::List &list ); | 353 | void extensionModified( const KABC::Addressee::List &list ); |
353 | void extensionChanged( int id ); | 354 | void extensionChanged( int id ); |
354 | void clipboardDataChanged(); | 355 | void clipboardDataChanged(); |
355 | void updateActionMenu(); | 356 | void updateActionMenu(); |
356 | void configureKeyBindings(); | 357 | void configureKeyBindings(); |
357 | void removeVoice(); | 358 | void removeVoice(); |
@@ -456,24 +457,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
456 | 457 | ||
457 | #ifdef KAB_EMBEDDED | 458 | #ifdef KAB_EMBEDDED |
458 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 459 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
459 | #endif //KAB_EMBEDDED | 460 | #endif //KAB_EMBEDDED |
460 | 461 | ||
461 | //this are the overwritten callbackmethods from the syncinterface | 462 | //this are the overwritten callbackmethods from the syncinterface |
462 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 463 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
463 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 464 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
464 | 465 | ||
465 | 466 | ||
466 | // LR ******************************* | 467 | // LR ******************************* |
467 | // sync stuff! | 468 | // sync stuff! |
469 | QString sentSyncFile(); | ||
468 | QPopupMenu *syncMenu; | 470 | QPopupMenu *syncMenu; |
469 | KSyncManager* syncManager; | 471 | KSyncManager* syncManager; |
470 | int mGlobalSyncMode; | 472 | int mGlobalSyncMode; |
471 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 473 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
472 | KABC::Addressee getLastSyncAddressee(); | 474 | KABC::Addressee getLastSyncAddressee(); |
473 | QDateTime mLastAddressbookSync; | 475 | QDateTime mLastAddressbookSync; |
474 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 476 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
475 | // ********************* | 477 | // ********************* |
476 | 478 | ||
477 | }; | 479 | }; |
478 | 480 | ||
479 | #endif | 481 | #endif |
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index acf6419..3079d42 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp | |||
@@ -112,24 +112,25 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString | |||
112 | 112 | ||
113 | KABC::Addressee::List::ConstIterator it; | 113 | KABC::Addressee::List::ConstIterator it; |
114 | for ( it = list.begin(); it != list.end(); ++it ) { | 114 | for ( it = list.begin(); it != list.end(); ++it ) { |
115 | KABC::VCardConverter converter; | 115 | KABC::VCardConverter converter; |
116 | QString vcard; | 116 | QString vcard; |
117 | 117 | ||
118 | KABC::VCardConverter::Version version; | 118 | KABC::VCardConverter::Version version; |
119 | if ( data == "v21" ) | 119 | if ( data == "v21" ) |
120 | version = KABC::VCardConverter::v2_1; | 120 | version = KABC::VCardConverter::v2_1; |
121 | else | 121 | else |
122 | version = KABC::VCardConverter::v3_0; | 122 | version = KABC::VCardConverter::v3_0; |
123 | 123 | ||
124 | version = KABC::VCardConverter::v2_1; | ||
124 | converter.addresseeToVCard( *it, vcard, version ); | 125 | converter.addresseeToVCard( *it, vcard, version ); |
125 | t << vcard << "\r\n\r\n"; | 126 | t << vcard << "\r\n\r\n"; |
126 | } | 127 | } |
127 | 128 | ||
128 | outFile.close(); | 129 | outFile.close(); |
129 | 130 | ||
130 | return true; | 131 | return true; |
131 | } | 132 | } |
132 | 133 | ||
133 | KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const | 134 | KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const |
134 | { | 135 | { |
135 | QString fileName; | 136 | QString fileName; |