author | zautrix <zautrix> | 2004-10-07 11:44:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 11:44:35 (UTC) |
commit | 43c82cc5393522d2c34f34a4339cb6a1d1c6c555 (patch) (unidiff) | |
tree | 49916cfb6f12c846fa52f9697f9b0285c2902772 /kaddressbook | |
parent | f0e8b8f36bccda952fa662e4faf2d58fcee67262 (diff) | |
download | kdepimpi-43c82cc5393522d2c34f34a4339cb6a1d1c6c555.zip kdepimpi-43c82cc5393522d2c34f34a4339cb6a1d1c6c555.tar.gz kdepimpi-43c82cc5393522d2c34f34a4339cb6a1d1c6c555.tar.bz2 |
sync fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6404410..fa80f5c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2797,85 +2797,91 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2797 | if ( external ) | 2797 | if ( external ) |
2798 | abLocal.removeSyncAddressees( !isXML); | 2798 | abLocal.removeSyncAddressees( !isXML); |
2799 | qDebug("Saving remote AB "); | 2799 | qDebug("Saving remote AB "); |
2800 | abLocal.saveAB(); | 2800 | abLocal.saveAB(); |
2801 | if ( isXML ) { | 2801 | if ( isXML ) { |
2802 | // afterwrite processing | 2802 | // afterwrite processing |
2803 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2803 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2804 | } | 2804 | } |
2805 | } | 2805 | } |
2806 | } | 2806 | } |
2807 | setModified(); | 2807 | setModified(); |
2808 | 2808 | ||
2809 | } | 2809 | } |
2810 | if ( syncOK ) | 2810 | if ( syncOK ) |
2811 | mViewManager->refreshView(); | 2811 | mViewManager->refreshView(); |
2812 | return syncOK; | 2812 | return syncOK; |
2813 | #if 0 | 2813 | #if 0 |
2814 | 2814 | ||
2815 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 2815 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
2816 | getEventViewerDialog()->setSyncMode( true ); | 2816 | getEventViewerDialog()->setSyncMode( true ); |
2817 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 2817 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
2818 | getEventViewerDialog()->setSyncMode( false ); | 2818 | getEventViewerDialog()->setSyncMode( false ); |
2819 | if ( syncOK ) { | 2819 | if ( syncOK ) { |
2820 | if ( KOPrefs::instance()->mWriteBackFile ) | 2820 | if ( KOPrefs::instance()->mWriteBackFile ) |
2821 | { | 2821 | { |
2822 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2822 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
2823 | storage->save(); | 2823 | storage->save(); |
2824 | } | 2824 | } |
2825 | } | 2825 | } |
2826 | setModified(); | 2826 | setModified(); |
2827 | } | 2827 | } |
2828 | 2828 | ||
2829 | #endif | 2829 | #endif |
2830 | } | 2830 | } |
2831 | 2831 | ||
2832 | 2832 | ||
2833 | //this is a overwritten callbackmethods from the syncinterface | 2833 | //this is a overwritten callbackmethods from the syncinterface |
2834 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2834 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2835 | { | 2835 | { |
2836 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2836 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2837 | 2837 | ||
2838 | AddressBook abLocal( resource,"syncContact"); | 2838 | AddressBook abLocal( resource,"syncContact"); |
2839 | bool syncOK = false; | 2839 | bool syncOK = false; |
2840 | if ( abLocal.load() ) { | 2840 | if ( abLocal.load() ) { |
2841 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2841 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2842 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2842 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2843 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); | 2843 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); |
2844 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2844 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2845 | if ( syncOK ) { | 2845 | if ( syncOK ) { |
2846 | if ( syncManager->mWriteBackFile ) { | 2846 | if ( syncManager->mWriteBackFile ) { |
2847 | abLocal.saveAB(); | 2847 | abLocal.saveAB(); |
2848 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2848 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2849 | } | 2849 | } |
2850 | } | 2850 | } |
2851 | setModified(); | 2851 | setModified(); |
2852 | } | 2852 | } |
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 | qDebug("KABCore::getFile "); | ||
2862 | QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); | ||
2861 | if ( ! success ) { | 2863 | if ( ! success ) { |
2862 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2864 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2863 | return; | 2865 | return; |
2864 | } | 2866 | } |
2865 | mAddressBook->importFromFile( sentSyncFile() ); | 2867 | mAddressBook->importFromFile( sentSyncFile() ); |
2866 | setCaption( i18n("Pi-Sync successful!") ); | 2868 | topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); |
2867 | } | 2869 | } |
2868 | void KABCore::syncFileRequest() | 2870 | void KABCore::syncFileRequest() |
2869 | { | 2871 | { |
2870 | mAddressBook->export2File( sentSyncFile() ); | 2872 | mAddressBook->export2File( sentSyncFile() ); |
2871 | } | 2873 | } |
2872 | QString KABCore::sentSyncFile() | 2874 | QString KABCore::sentSyncFile() |
2873 | { | 2875 | { |
2874 | #ifdef _WIN32_ | 2876 | #ifdef _WIN32_ |
2875 | return locateLocal( "tmp", "syncab.ics" ); | 2877 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2876 | #else | 2878 | #else |
2877 | return QString( "/tmp/kapitempfile.vcf" ); | 2879 | return QString( "/tmp/copysyncab.vcf" ); |
2878 | #endif | 2880 | #endif |
2879 | } | 2881 | } |
2880 | 2882 | ||
2883 | void KABCore::setCaptionBack() | ||
2884 | { | ||
2885 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | ||
2886 | } | ||
2881 | 2887 | ||
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 987369d..c628399 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -288,128 +288,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
288 | */ | 288 | */ |
289 | void save(); | 289 | void save(); |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Undos the last command using the undo stack. | 292 | Undos the last command using the undo stack. |
293 | */ | 293 | */ |
294 | void undo(); | 294 | void undo(); |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Redos the last command that was undone, using the redo stack. | 297 | Redos the last command that was undone, using the redo stack. |
298 | */ | 298 | */ |
299 | void redo(); | 299 | void redo(); |
300 | 300 | ||
301 | /** | 301 | /** |
302 | Shows the edit dialog for the given uid. If the uid is QString::null, | 302 | Shows the edit dialog for the given uid. If the uid is QString::null, |
303 | the method will try to find a selected addressee in the view. | 303 | the method will try to find a selected addressee in the view. |
304 | */ | 304 | */ |
305 | void editContact( const QString &uid /*US = QString::null*/ ); | 305 | void editContact( const QString &uid /*US = QString::null*/ ); |
306 | //US added a second method without defaultparameter | 306 | //US added a second method without defaultparameter |
307 | void editContact2(); | 307 | void editContact2(); |
308 | 308 | ||
309 | /** | 309 | /** |
310 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 310 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
311 | the method will try to find a selected addressee in the view. | 311 | the method will try to find a selected addressee in the view. |
312 | */ | 312 | */ |
313 | void executeContact( const QString &uid /*US = QString::null*/ ); | 313 | void executeContact( const QString &uid /*US = QString::null*/ ); |
314 | 314 | ||
315 | /** | 315 | /** |
316 | Launches the configuration dialog. | 316 | Launches the configuration dialog. |
317 | */ | 317 | */ |
318 | void openConfigDialog(); | 318 | void openConfigDialog(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Launches the ldap search dialog. | 321 | Launches the ldap search dialog. |
322 | */ | 322 | */ |
323 | void openLDAPDialog(); | 323 | void openLDAPDialog(); |
324 | 324 | ||
325 | /** | 325 | /** |
326 | Creates a KAddressBookPrinter, which will display the print | 326 | Creates a KAddressBookPrinter, which will display the print |
327 | dialog and do the printing. | 327 | dialog and do the printing. |
328 | */ | 328 | */ |
329 | void print(); | 329 | void print(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Registers a new GUI client, so plugins can register its actions. | 332 | Registers a new GUI client, so plugins can register its actions. |
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 getFile( bool success ); |
346 | void syncFileRequest(); | 346 | void syncFileRequest(); |
347 | void setDetailsVisible( bool visible ); | 347 | void setDetailsVisible( bool visible ); |
348 | void setDetailsToState(); | 348 | void setDetailsToState(); |
349 | // void slotSyncMenu( int ); | 349 | // void slotSyncMenu( int ); |
350 | private slots: | 350 | private slots: |
351 | void setJumpButtonBarVisible( bool visible ); | 351 | void setJumpButtonBarVisible( bool visible ); |
352 | void setCaptionBack(); | ||
352 | void importFromOL(); | 353 | void importFromOL(); |
353 | void extensionModified( const KABC::Addressee::List &list ); | 354 | void extensionModified( const KABC::Addressee::List &list ); |
354 | void extensionChanged( int id ); | 355 | void extensionChanged( int id ); |
355 | void clipboardDataChanged(); | 356 | void clipboardDataChanged(); |
356 | void updateActionMenu(); | 357 | void updateActionMenu(); |
357 | void configureKeyBindings(); | 358 | void configureKeyBindings(); |
358 | void removeVoice(); | 359 | void removeVoice(); |
359 | #ifdef KAB_EMBEDDED | 360 | #ifdef KAB_EMBEDDED |
360 | void configureResources(); | 361 | void configureResources(); |
361 | #endif //KAB_EMBEDDED | 362 | #endif //KAB_EMBEDDED |
362 | 363 | ||
363 | void slotEditorDestroyed( const QString &uid ); | 364 | void slotEditorDestroyed( const QString &uid ); |
364 | void configurationChanged(); | 365 | void configurationChanged(); |
365 | void addressBookChanged(); | 366 | void addressBookChanged(); |
366 | 367 | ||
367 | private: | 368 | private: |
368 | void initGUI(); | 369 | void initGUI(); |
369 | void initActions(); | 370 | void initActions(); |
370 | 371 | ||
371 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 372 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
372 | const char *name = 0 ); | 373 | const char *name = 0 ); |
373 | 374 | ||
374 | KXMLGUIClient *mGUIClient; | 375 | KXMLGUIClient *mGUIClient; |
375 | 376 | ||
376 | KABC::AddressBook *mAddressBook; | 377 | KABC::AddressBook *mAddressBook; |
377 | 378 | ||
378 | ViewManager *mViewManager; | 379 | ViewManager *mViewManager; |
379 | // QSplitter *mDetailsSplitter; | 380 | // QSplitter *mDetailsSplitter; |
380 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 381 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
381 | ViewContainer *mDetails; | 382 | ViewContainer *mDetails; |
382 | KDGanttMinimizeSplitter* mMiniSplitter; | 383 | KDGanttMinimizeSplitter* mMiniSplitter; |
383 | XXPortManager *mXXPortManager; | 384 | XXPortManager *mXXPortManager; |
384 | JumpButtonBar *mJumpButtonBar; | 385 | JumpButtonBar *mJumpButtonBar; |
385 | IncSearchWidget *mIncSearchWidget; | 386 | IncSearchWidget *mIncSearchWidget; |
386 | ExtensionManager *mExtensionManager; | 387 | ExtensionManager *mExtensionManager; |
387 | 388 | ||
388 | KCMultiDialog *mConfigureDialog; | 389 | KCMultiDialog *mConfigureDialog; |
389 | 390 | ||
390 | #ifndef KAB_EMBEDDED | 391 | #ifndef KAB_EMBEDDED |
391 | LDAPSearchDialog *mLdapSearchDialog; | 392 | LDAPSearchDialog *mLdapSearchDialog; |
392 | #endif //KAB_EMBEDDED | 393 | #endif //KAB_EMBEDDED |
393 | // QDict<AddresseeEditorDialog> mEditorDict; | 394 | // QDict<AddresseeEditorDialog> mEditorDict; |
394 | AddresseeEditorDialog *mEditorDialog; | 395 | AddresseeEditorDialog *mEditorDialog; |
395 | bool mReadWrite; | 396 | bool mReadWrite; |
396 | bool mModified; | 397 | bool mModified; |
397 | bool mIsPart; | 398 | bool mIsPart; |
398 | bool mMultipleViewsAtOnce; | 399 | bool mMultipleViewsAtOnce; |
399 | 400 | ||
400 | 401 | ||
401 | //US file menu | 402 | //US file menu |
402 | KAction *mActionMail; | 403 | KAction *mActionMail; |
403 | KAction *mActionBeam; | 404 | KAction *mActionBeam; |
404 | KAction *mActionExport2phone; | 405 | KAction *mActionExport2phone; |
405 | KAction* mActionPrint; | 406 | KAction* mActionPrint; |
406 | KAction* mActionNewContact; | 407 | KAction* mActionNewContact; |
407 | KAction *mActionSave; | 408 | KAction *mActionSave; |
408 | KAction *mActionEditAddressee; | 409 | KAction *mActionEditAddressee; |
409 | KAction *mActionMailVCard; | 410 | KAction *mActionMailVCard; |
410 | KAction *mActionBeamVCard; | 411 | KAction *mActionBeamVCard; |
411 | 412 | ||
412 | KAction *mActionQuit; | 413 | KAction *mActionQuit; |
413 | 414 | ||
414 | //US edit menu | 415 | //US edit menu |
415 | KAction *mActionCopy; | 416 | KAction *mActionCopy; |