summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 5ebd3a4..bdc5bd8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1901,24 +1901,30 @@ void KABCore::initActions()
1901 mActionLicence = new KAction( i18n( "Licence" ), 0, 1901 mActionLicence = new KAction( i18n( "Licence" ), 0,
1902 this, SLOT( showLicence() ), actionCollection(), 1902 this, SLOT( showLicence() ), actionCollection(),
1903 "licence_about_data" ); 1903 "licence_about_data" );
1904 mActionFaq = new KAction( i18n( "Faq" ), 0, 1904 mActionFaq = new KAction( i18n( "Faq" ), 0,
1905 this, SLOT( faq() ), actionCollection(), 1905 this, SLOT( faq() ), actionCollection(),
1906 "faq_about_data" ); 1906 "faq_about_data" );
1907 mActionWN = new KAction( i18n( "What's New?" ), 0, 1907 mActionWN = new KAction( i18n( "What's New?" ), 0,
1908 this, SLOT( whatsnew() ), actionCollection(), 1908 this, SLOT( whatsnew() ), actionCollection(),
1909 "wn" ); 1909 "wn" );
1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1911 this, SLOT( synchowto() ), actionCollection(), 1911 this, SLOT( synchowto() ), actionCollection(),
1912 "sync" ); 1912 "sync" );
1913 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1914 this, SLOT( kdesynchowto() ), actionCollection(),
1915 "kdesync" );
1916 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1917 this, SLOT( multisynchowto() ), actionCollection(),
1918 "multisync" );
1913 1919
1914 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1920 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1915 this, SLOT( createAboutData() ), actionCollection(), 1921 this, SLOT( createAboutData() ), actionCollection(),
1916 "kaddressbook_about_data" ); 1922 "kaddressbook_about_data" );
1917#endif //KAB_EMBEDDED 1923#endif //KAB_EMBEDDED
1918 1924
1919 clipboardDataChanged(); 1925 clipboardDataChanged();
1920 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1926 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1921 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1927 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1922} 1928}
1923 1929
1924//US we need this function, to plug all actions into the correct menues. 1930//US we need this function, to plug all actions into the correct menues.
@@ -2042,26 +2048,28 @@ void KABCore::addActionsManually()
2042 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2048 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2043 mActionDetails->plug( tb ); 2049 mActionDetails->plug( tb );
2044 settingsMenu->insertSeparator(); 2050 settingsMenu->insertSeparator();
2045 mActionBR->plug(settingsMenu ); 2051 mActionBR->plug(settingsMenu );
2046 settingsMenu->insertSeparator(); 2052 settingsMenu->insertSeparator();
2047 2053
2048 mActionWhoAmI->plug( settingsMenu ); 2054 mActionWhoAmI->plug( settingsMenu );
2049 mActionCategories->plug( settingsMenu ); 2055 mActionCategories->plug( settingsMenu );
2050 2056
2051 2057
2052 mActionWN->plug( helpMenu ); 2058 mActionWN->plug( helpMenu );
2053 mActionSyncHowto->plug( helpMenu ); 2059 mActionSyncHowto->plug( helpMenu );
2054 mActionLicence->plug( helpMenu ); 2060 mActionKdeSyncHowto->plug( helpMenu );
2061 mActionMultiSyncHowto->plug( helpMenu );
2055 mActionFaq->plug( helpMenu ); 2062 mActionFaq->plug( helpMenu );
2063 mActionLicence->plug( helpMenu );
2056 mActionAboutKAddressbook->plug( helpMenu ); 2064 mActionAboutKAddressbook->plug( helpMenu );
2057 2065
2058 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2066 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2059 2067
2060 mActionSave->plug( tb ); 2068 mActionSave->plug( tb );
2061 mViewManager->getFilterAction()->plug ( tb); 2069 mViewManager->getFilterAction()->plug ( tb);
2062 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2070 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2063 mActionUndo->plug( tb ); 2071 mActionUndo->plug( tb );
2064 mActionDelete->plug( tb ); 2072 mActionDelete->plug( tb );
2065 mActionRedo->plug( tb ); 2073 mActionRedo->plug( tb );
2066 } 2074 }
2067 } else { 2075 } else {
@@ -2341,25 +2349,32 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses
2341 } 2349 }
2342 } 2350 }
2343} 2351}
2344 2352
2345void KABCore::whatsnew() 2353void KABCore::whatsnew()
2346{ 2354{
2347 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2355 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2348} 2356}
2349void KABCore::synchowto() 2357void KABCore::synchowto()
2350{ 2358{
2351 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2359 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2352} 2360}
2353 2361void KABCore::kdesynchowto()
2362{
2363 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2364}
2365void KABCore::multisynchowto()
2366{
2367 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2368}
2354void KABCore::faq() 2369void KABCore::faq()
2355{ 2370{
2356 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2371 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2357} 2372}
2358 2373
2359#include <libkcal/syncdefines.h> 2374#include <libkcal/syncdefines.h>
2360 2375
2361KABC::Addressee KABCore::getLastSyncAddressee() 2376KABC::Addressee KABCore::getLastSyncAddressee()
2362{ 2377{
2363 Addressee lse; 2378 Addressee lse;
2364 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2365 2380
@@ -2769,28 +2784,32 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2769 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2784 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2770 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2785 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2771 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2786 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2772 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2787 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2773 addresseeRSync.setNote( "" ) ; 2788 addresseeRSync.setNote( "" ) ;
2774 addresseeLSync.setNote( "" ); 2789 addresseeLSync.setNote( "" );
2775 2790
2776 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2791 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2777 remote->insertAddressee( addresseeRSync, false ); 2792 remote->insertAddressee( addresseeRSync, false );
2778 local->insertAddressee( addresseeLSync, false ); 2793 local->insertAddressee( addresseeLSync, false );
2779 QString mes; 2794 QString mes;
2780 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 ); 2795 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 );
2796 qDebug( mes );
2781 if ( syncManager->mShowSyncSummary ) { 2797 if ( syncManager->mShowSyncSummary ) {
2782 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2798 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2799 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2800 qDebug("cancelled ");
2801 return false;
2802 }
2783 } 2803 }
2784 qDebug( mes );
2785 return syncOK; 2804 return syncOK;
2786} 2805}
2787 2806
2788 2807
2789//this is a overwritten callbackmethods from the syncinterface 2808//this is a overwritten callbackmethods from the syncinterface
2790bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2809bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2791{ 2810{
2792 2811
2793 //pending prepare addresseeview for output 2812 //pending prepare addresseeview for output
2794 //pending detect, if remote file has REV field. if not switch to external sync 2813 //pending detect, if remote file has REV field. if not switch to external sync
2795 mGlobalSyncMode = SYNC_MODE_NORMAL; 2814 mGlobalSyncMode = SYNC_MODE_NORMAL;
2796 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2815 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
@@ -2865,25 +2884,26 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2865 bool syncOK = false; 2884 bool syncOK = false;
2866 if ( abLocal.load() ) { 2885 if ( abLocal.load() ) {
2867 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2886 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2868 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2887 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2869 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2888 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2870 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2889 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2871 if ( syncOK ) { 2890 if ( syncOK ) {
2872 if ( syncManager->mWriteBackFile ) { 2891 if ( syncManager->mWriteBackFile ) {
2873 abLocal.removeSyncAddressees( false ); 2892 abLocal.removeSyncAddressees( false );
2874 abLocal.saveAB(); 2893 abLocal.saveAB();
2875 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2894 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2876 } 2895 }
2877 } 2896 } else
2897 message( i18n("Sync cancelled or failed.") );
2878 setModified(); 2898 setModified();
2879 } 2899 }
2880 if ( syncOK ) 2900 if ( syncOK )
2881 mViewManager->refreshView(); 2901 mViewManager->refreshView();
2882 disableBR( false ); 2902 disableBR( false );
2883 return syncOK; 2903 return syncOK;
2884 2904
2885} 2905}
2886void KABCore::message( QString m ) 2906void KABCore::message( QString m )
2887{ 2907{
2888 topLevelWidget()->setCaption( m ); 2908 topLevelWidget()->setCaption( m );
2889 mMessageTimer->start( 15000, true ); 2909 mMessageTimer->start( 15000, true );