author | zautrix <zautrix> | 2004-10-27 12:27:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-27 12:27:39 (UTC) |
commit | 2f3396d84d2f3c92e1e0e420d677892c1f9c0778 (patch) (unidiff) | |
tree | 1ebab5dc6d00cb09720789897ce2c86df05cc9ab | |
parent | f73d249579d52d7aeaacde2dcb23abeb42f9ee95 (diff) | |
download | kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.zip kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.gz kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.bz2 |
completed KDE AB sync. but will it work ...?
-rw-r--r-- | kabc/addressbook.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 23 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 15 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 22 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
8 files changed, 61 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index d101589..9b196b5 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -849,34 +849,37 @@ void AddressBook::removeAddressee( const Addressee &a ) | |||
849 | 849 | ||
850 | } | 850 | } |
851 | } | 851 | } |
852 | 852 | ||
853 | if ( found ) | 853 | if ( found ) |
854 | removeAddressee( it2 ); | 854 | removeAddressee( it2 ); |
855 | 855 | ||
856 | } | 856 | } |
857 | 857 | ||
858 | void AddressBook::removeSyncAddressees( bool removeDeleted ) | 858 | void AddressBook::removeSyncAddressees( bool removeDeleted ) |
859 | { | 859 | { |
860 | Iterator it = begin(); | 860 | Iterator it = begin(); |
861 | Iterator it2 ; | 861 | Iterator it2 ; |
862 | QDateTime dt ( QDate( 2004,1,1) ); | 862 | QDateTime dt ( QDate( 2004,1,1) ); |
863 | while ( it != end() ) { | 863 | while ( it != end() ) { |
864 | (*it).setRevision( dt ); | 864 | (*it).setRevision( dt ); |
865 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 865 | if (( *it).IDStr() != "changed" ) { |
866 | (*it).setIDStr(""); | 866 | // "changed" is used for tagging changed addressees when syncing with KDE or OL |
867 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | ||
868 | (*it).setIDStr(""); | ||
869 | } | ||
867 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | 870 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { |
868 | it2 = it; | 871 | it2 = it; |
869 | //qDebug("removing %s ",(*it).uid().latin1() ); | 872 | //qDebug("removing %s ",(*it).uid().latin1() ); |
870 | ++it; | 873 | ++it; |
871 | removeAddressee( it2 ); | 874 | removeAddressee( it2 ); |
872 | } else { | 875 | } else { |
873 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 876 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
874 | ++it; | 877 | ++it; |
875 | } | 878 | } |
876 | } | 879 | } |
877 | deleteRemovedAddressees(); | 880 | deleteRemovedAddressees(); |
878 | } | 881 | } |
879 | 882 | ||
880 | void AddressBook::removeAddressee( const Iterator &it ) | 883 | void AddressBook::removeAddressee( const Iterator &it ) |
881 | { | 884 | { |
882 | d->mRemovedAddressees.append( (*it) ); | 885 | d->mRemovedAddressees.append( (*it) ); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f00a09..ea87929 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1299,36 +1299,38 @@ void KABCore::setDetailsVisible( bool visible ) | |||
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1302 | // the listview and the detailview. We do that by changing the splitbar size. | 1302 | // the listview and the detailview. We do that by changing the splitbar size. |
1303 | if (mMultipleViewsAtOnce) | 1303 | if (mMultipleViewsAtOnce) |
1304 | { | 1304 | { |
1305 | if ( visible ) | 1305 | if ( visible ) |
1306 | mDetails->show(); | 1306 | mDetails->show(); |
1307 | else | 1307 | else |
1308 | mDetails->hide(); | 1308 | mDetails->hide(); |
1309 | } | 1309 | } |
1310 | else | 1310 | else |
1311 | { | 1311 | { |
1312 | if ( visible ) { | 1312 | if ( visible ) { |
1313 | mViewManager->hide(); | 1313 | mViewManager->hide(); |
1314 | mDetails->show(); | 1314 | mDetails->show(); |
1315 | mIncSearchWidget->setFocus(); | ||
1315 | } | 1316 | } |
1316 | else { | 1317 | else { |
1317 | mViewManager->show(); | 1318 | mViewManager->show(); |
1318 | mDetails->hide(); | 1319 | mDetails->hide(); |
1320 | mViewManager->setFocusAV(); | ||
1319 | } | 1321 | } |
1320 | setJumpButtonBarVisible( !visible ); | 1322 | setJumpButtonBarVisible( !visible ); |
1321 | } | 1323 | } |
1322 | 1324 | ||
1323 | } | 1325 | } |
1324 | 1326 | ||
1325 | void KABCore::extensionChanged( int id ) | 1327 | void KABCore::extensionChanged( int id ) |
1326 | { | 1328 | { |
1327 | //change the details view only for non desktop systems | 1329 | //change the details view only for non desktop systems |
1328 | #ifndef DESKTOP_VERSION | 1330 | #ifndef DESKTOP_VERSION |
1329 | 1331 | ||
1330 | if (id == 0) | 1332 | if (id == 0) |
1331 | { | 1333 | { |
1332 | //the user disabled the extension. | 1334 | //the user disabled the extension. |
1333 | 1335 | ||
1334 | if (mMultipleViewsAtOnce) | 1336 | if (mMultipleViewsAtOnce) |
@@ -2031,32 +2033,35 @@ void KABCore::addActionsManually() | |||
2031 | 2033 | ||
2032 | mActionWN->plug( helpMenu ); | 2034 | mActionWN->plug( helpMenu ); |
2033 | mActionSyncHowto->plug( helpMenu ); | 2035 | mActionSyncHowto->plug( helpMenu ); |
2034 | mActionLicence->plug( helpMenu ); | 2036 | mActionLicence->plug( helpMenu ); |
2035 | mActionFaq->plug( helpMenu ); | 2037 | mActionFaq->plug( helpMenu ); |
2036 | mActionAboutKAddressbook->plug( helpMenu ); | 2038 | mActionAboutKAddressbook->plug( helpMenu ); |
2037 | 2039 | ||
2038 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2040 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2039 | 2041 | ||
2040 | mActionSave->plug( tb ); | 2042 | mActionSave->plug( tb ); |
2041 | mViewManager->getFilterAction()->plug ( tb); | 2043 | mViewManager->getFilterAction()->plug ( tb); |
2042 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2044 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2043 | mActionUndo->plug( tb ); | 2045 | mActionUndo->plug( tb ); |
2044 | mActionDelete->plug( tb ); | 2046 | mActionDelete->plug( tb ); |
2045 | mActionRedo->plug( tb ); | 2047 | mActionRedo->plug( tb ); |
2046 | } | 2048 | } |
2049 | } else { | ||
2050 | if (KABPrefs::instance()->mMultipleViewsAtOnce ) | ||
2051 | mActionSave->plug( tb ); | ||
2047 | } | 2052 | } |
2048 | //mActionQuit->plug ( tb ); | 2053 | //mActionQuit->plug ( tb ); |
2049 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2054 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2050 | 2055 | ||
2051 | //US link the searchwidget first to this. | 2056 | //US link the searchwidget first to this. |
2052 | // The real linkage to the toolbar happens later. | 2057 | // The real linkage to the toolbar happens later. |
2053 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2058 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2054 | //US tb->insertItem( mIncSearchWidget ); | 2059 | //US tb->insertItem( mIncSearchWidget ); |
2055 | /*US | 2060 | /*US |
2056 | mIncSearchWidget = new IncSearchWidget( tb ); | 2061 | mIncSearchWidget = new IncSearchWidget( tb ); |
2057 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2062 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2058 | SLOT( incrementalSearch( const QString& ) ) ); | 2063 | SLOT( incrementalSearch( const QString& ) ) ); |
2059 | 2064 | ||
2060 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2065 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2061 | 2066 | ||
2062 | //US topLayout->addWidget( mJumpButtonBar ); | 2067 | //US topLayout->addWidget( mJumpButtonBar ); |
@@ -2494,33 +2499,42 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2494 | 2499 | ||
2495 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2500 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2496 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2501 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2497 | 2502 | ||
2498 | //QPtrList<Addressee> el = local->rawAddressees(); | 2503 | //QPtrList<Addressee> el = local->rawAddressees(); |
2499 | Addressee addresseeR; | 2504 | Addressee addresseeR; |
2500 | QString uid; | 2505 | QString uid; |
2501 | int take; | 2506 | int take; |
2502 | Addressee addresseeL; | 2507 | Addressee addresseeL; |
2503 | Addressee addresseeRSync; | 2508 | Addressee addresseeRSync; |
2504 | Addressee addresseeLSync; | 2509 | Addressee addresseeLSync; |
2505 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2510 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2506 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2511 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2507 | bool fullDateRange = false; | 2512 | bool fullDateRange = false; |
2508 | local->resetTempSyncStat(); | 2513 | local->resetTempSyncStat(); |
2509 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2514 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2510 | QDateTime modifiedCalendar = mLastAddressbookSync;; | 2515 | if ( syncManager->syncWithDesktop() ) { |
2516 | remote->removeSyncInfo( QString());//remove all info | ||
2517 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | ||
2518 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | ||
2519 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | ||
2520 | } else { | ||
2521 | qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); | ||
2522 | } | ||
2523 | } | ||
2524 | QDateTime modifiedCalendar = mLastAddressbookSync; | ||
2511 | addresseeLSync = getLastSyncAddressee(); | 2525 | addresseeLSync = getLastSyncAddressee(); |
2512 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2526 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2513 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2527 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2514 | if ( !addresseeR.isEmpty() ) { | 2528 | if ( !addresseeR.isEmpty() ) { |
2515 | addresseeRSync = addresseeR; | 2529 | addresseeRSync = addresseeR; |
2516 | remote->removeAddressee(addresseeR ); | 2530 | remote->removeAddressee(addresseeR ); |
2517 | 2531 | ||
2518 | } else { | 2532 | } else { |
2519 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2533 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2520 | addresseeRSync = addresseeLSync ; | 2534 | addresseeRSync = addresseeLSync ; |
2521 | } else { | 2535 | } else { |
2522 | qDebug("FULLDATE 1"); | 2536 | qDebug("FULLDATE 1"); |
2523 | fullDateRange = true; | 2537 | fullDateRange = true; |
2524 | Addressee newAdd; | 2538 | Addressee newAdd; |
2525 | addresseeRSync = newAdd; | 2539 | addresseeRSync = newAdd; |
2526 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2540 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
@@ -2592,32 +2606,34 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2592 | if ( take == 1 ) {// take local | 2606 | if ( take == 1 ) {// take local |
2593 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2607 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2594 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2608 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2595 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2609 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2596 | local->insertAddressee( inL, false ); | 2610 | local->insertAddressee( inL, false ); |
2597 | idS = inR.externalUID(); | 2611 | idS = inR.externalUID(); |
2598 | OidS = inR.originalExternalUID(); | 2612 | OidS = inR.originalExternalUID(); |
2599 | } | 2613 | } |
2600 | else | 2614 | else |
2601 | idS = inR.IDStr(); | 2615 | idS = inR.IDStr(); |
2602 | remote->removeAddressee( inR ); | 2616 | remote->removeAddressee( inR ); |
2603 | inR = inL; | 2617 | inR = inL; |
2604 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2618 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2605 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2619 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2606 | inR.setOriginalExternalUID( OidS ); | 2620 | inR.setOriginalExternalUID( OidS ); |
2607 | inR.setExternalUID( idS ); | 2621 | inR.setExternalUID( idS ); |
2622 | if ( syncManager->syncWithDesktop() ) | ||
2623 | inR.setIDStr( "changed" ); | ||
2608 | } else { | 2624 | } else { |
2609 | inR.setIDStr( idS ); | 2625 | inR.setIDStr( idS ); |
2610 | } | 2626 | } |
2611 | inR.setResource( 0 ); | 2627 | inR.setResource( 0 ); |
2612 | remote->insertAddressee( inR , false); | 2628 | remote->insertAddressee( inR , false); |
2613 | ++changedRemote; | 2629 | ++changedRemote; |
2614 | } else { // take == 2 take remote | 2630 | } else { // take == 2 take remote |
2615 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2631 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2616 | if ( inR.revision().date().year() < 2004 ) | 2632 | if ( inR.revision().date().year() < 2004 ) |
2617 | inR.setRevision( modifiedCalendar ); | 2633 | inR.setRevision( modifiedCalendar ); |
2618 | } | 2634 | } |
2619 | idS = inL.IDStr(); | 2635 | idS = inL.IDStr(); |
2620 | local->removeAddressee( inL ); | 2636 | local->removeAddressee( inL ); |
2621 | inL = inR; | 2637 | inL = inR; |
2622 | inL.setIDStr( idS ); | 2638 | inL.setIDStr( idS ); |
2623 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2639 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
@@ -2884,33 +2900,36 @@ bool KABCore::syncPhone() | |||
2884 | mViewManager->refreshView(); | 2900 | mViewManager->refreshView(); |
2885 | return syncOK; | 2901 | return syncOK; |
2886 | } | 2902 | } |
2887 | void KABCore::getFile( bool success ) | 2903 | void KABCore::getFile( bool success ) |
2888 | { | 2904 | { |
2889 | if ( ! success ) { | 2905 | if ( ! success ) { |
2890 | message( i18n("Error receiving file. Nothing changed!") ); | 2906 | message( i18n("Error receiving file. Nothing changed!") ); |
2891 | return; | 2907 | return; |
2892 | } | 2908 | } |
2893 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2909 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2894 | if ( count ) | 2910 | if ( count ) |
2895 | setModified( true ); | 2911 | setModified( true ); |
2896 | message( i18n("Pi-Sync successful!") ); | 2912 | message( i18n("Pi-Sync successful!") ); |
2897 | mViewManager->refreshView(); | 2913 | mViewManager->refreshView(); |
2898 | } | 2914 | } |
2899 | void KABCore::syncFileRequest() | 2915 | void KABCore::syncFileRequest() |
2900 | { | 2916 | { |
2917 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | ||
2918 | syncManager->slotSyncMenu( 999 ); | ||
2919 | } | ||
2901 | mAddressBook->export2File( sentSyncFile() ); | 2920 | mAddressBook->export2File( sentSyncFile() ); |
2902 | } | 2921 | } |
2903 | QString KABCore::sentSyncFile() | 2922 | QString KABCore::sentSyncFile() |
2904 | { | 2923 | { |
2905 | #ifdef DESKTOP_VERSION | 2924 | #ifdef DESKTOP_VERSION |
2906 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2925 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2907 | #else | 2926 | #else |
2908 | return QString( "/tmp/copysyncab.vcf" ); | 2927 | return QString( "/tmp/copysyncab.vcf" ); |
2909 | #endif | 2928 | #endif |
2910 | } | 2929 | } |
2911 | 2930 | ||
2912 | void KABCore::setCaptionBack() | 2931 | void KABCore::setCaptionBack() |
2913 | { | 2932 | { |
2914 | mMessageTimer->stop(); | 2933 | mMessageTimer->stop(); |
2915 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2934 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2916 | } | 2935 | } |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -287,32 +287,37 @@ void ViewManager::setActiveView( const QString &name ) | |||
287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; | 287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 291 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
292 | void ViewManager::refreshView() | 292 | void ViewManager::refreshView() |
293 | { | 293 | { |
294 | refreshView( QString::null ); | 294 | refreshView( QString::null ); |
295 | } | 295 | } |
296 | 296 | ||
297 | void ViewManager::refreshView( const QString &uid ) | 297 | void ViewManager::refreshView( const QString &uid ) |
298 | { | 298 | { |
299 | if ( mActiveView ) | 299 | if ( mActiveView ) |
300 | mActiveView->refresh( uid ); | 300 | mActiveView->refresh( uid ); |
301 | } | 301 | } |
302 | 302 | ||
303 | void ViewManager::setFocusAV() | ||
304 | { | ||
305 | if ( mActiveView ) | ||
306 | mActiveView->setFocus(); | ||
307 | } | ||
303 | void ViewManager::editView() | 308 | void ViewManager::editView() |
304 | { | 309 | { |
305 | if ( !mActiveView ) | 310 | if ( !mActiveView ) |
306 | return; | 311 | return; |
307 | 312 | ||
308 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); | 313 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); |
309 | ViewConfigureWidget *wdg = 0; | 314 | ViewConfigureWidget *wdg = 0; |
310 | ViewConfigureDialog* dlg = 0; | 315 | ViewConfigureDialog* dlg = 0; |
311 | if ( factory ) { | 316 | if ( factory ) { |
312 | // Save the filters so the dialog has the latest set | 317 | // Save the filters so the dialog has the latest set |
313 | Filter::save( mCore->config(), "Filter", mFilterList ); | 318 | Filter::save( mCore->config(), "Filter", mFilterList ); |
314 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); | 319 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); |
315 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); | 320 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); |
316 | } else { | 321 | } else { |
317 | qDebug("ViewManager::editView()::cannot find viewfactory "); | 322 | qDebug("ViewManager::editView()::cannot find viewfactory "); |
318 | return; | 323 | return; |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 585f4e9..a03a83f 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -51,32 +51,33 @@ class ViewManager : public QWidget | |||
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
54 | ~ViewManager(); | 54 | ~ViewManager(); |
55 | 55 | ||
56 | void restoreSettings(); | 56 | void restoreSettings(); |
57 | void saveSettings(); | 57 | void saveSettings(); |
58 | void doSearch( const QString& s ,KABC::Field *field ); | 58 | void doSearch( const QString& s ,KABC::Field *field ); |
59 | 59 | ||
60 | void unloadViews(); | 60 | void unloadViews(); |
61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
62 | 62 | ||
63 | QStringList selectedUids() const; | 63 | QStringList selectedUids() const; |
64 | QStringList selectedEmails() const; | 64 | QStringList selectedEmails() const; |
65 | KABC::Addressee::List selectedAddressees() const; | 65 | KABC::Addressee::List selectedAddressees() const; |
66 | void setListSelected(QStringList); | 66 | void setListSelected(QStringList); |
67 | void setFocusAV(); | ||
67 | 68 | ||
68 | public slots: | 69 | public slots: |
69 | void scrollUP(); | 70 | void scrollUP(); |
70 | void scrollDOWN(); | 71 | void scrollDOWN(); |
71 | 72 | ||
72 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 73 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
73 | void setSelected( const QString &uid, bool); | 74 | void setSelected( const QString &uid, bool); |
74 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 75 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
75 | void setSelected(); | 76 | void setSelected(); |
76 | 77 | ||
77 | 78 | ||
78 | 79 | ||
79 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 80 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
80 | void refreshView(); | 81 | void refreshView(); |
81 | void refreshView( const QString &uid); | 82 | void refreshView( const QString &uid); |
82 | 83 | ||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 326db88..6e61351 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -914,73 +914,73 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
914 | int deletedEventR = 0; | 914 | int deletedEventR = 0; |
915 | int deletedEventL = 0; | 915 | int deletedEventL = 0; |
916 | int changedLocal = 0; | 916 | int changedLocal = 0; |
917 | int changedRemote = 0; | 917 | int changedRemote = 0; |
918 | //QPtrList<Event> el = local->rawEvents(); | 918 | //QPtrList<Event> el = local->rawEvents(); |
919 | Event* eventR; | 919 | Event* eventR; |
920 | QString uid; | 920 | QString uid; |
921 | int take; | 921 | int take; |
922 | Event* eventL; | 922 | Event* eventL; |
923 | Event* eventRSync; | 923 | Event* eventRSync; |
924 | Event* eventLSync; | 924 | Event* eventLSync; |
925 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 925 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
926 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 926 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
927 | bool fullDateRange = false; | 927 | bool fullDateRange = false; |
928 | local->resetTempSyncStat(); | 928 | local->resetTempSyncStat(); |
929 | mLastCalendarSync = QDateTime::currentDateTime(); | 929 | mLastCalendarSync = QDateTime::currentDateTime(); |
930 | if ( mSyncKDE ) { | 930 | if ( mSyncManager->syncWithDesktop() ) { |
931 | remote->resetPilotStat(1); | 931 | remote->resetPilotStat(1); |
932 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 932 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
933 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 933 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
934 | qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 934 | qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
935 | } else { | 935 | } else { |
936 | qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 936 | qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); |
937 | } | 937 | } |
938 | } | 938 | } |
939 | QDateTime modifiedCalendar = mLastCalendarSync;; | 939 | QDateTime modifiedCalendar = mLastCalendarSync;; |
940 | eventLSync = getLastSyncEvent(); | 940 | eventLSync = getLastSyncEvent(); |
941 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 941 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
942 | if ( eventR ) { | 942 | if ( eventR ) { |
943 | eventRSync = (Event*) eventR->clone(); | 943 | eventRSync = (Event*) eventR->clone(); |
944 | remote->deleteEvent(eventR ); | 944 | remote->deleteEvent(eventR ); |
945 | 945 | ||
946 | } else { | 946 | } else { |
947 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) { | 947 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
948 | eventRSync = (Event*)eventLSync->clone(); | 948 | eventRSync = (Event*)eventLSync->clone(); |
949 | } else { | 949 | } else { |
950 | fullDateRange = true; | 950 | fullDateRange = true; |
951 | eventRSync = new Event(); | 951 | eventRSync = new Event(); |
952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
954 | eventRSync->setDtStart( mLastCalendarSync ); | 954 | eventRSync->setDtStart( mLastCalendarSync ); |
955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
956 | eventRSync->setCategories( i18n("SyncEvent") ); | 956 | eventRSync->setCategories( i18n("SyncEvent") ); |
957 | } | 957 | } |
958 | } | 958 | } |
959 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 959 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
960 | fullDateRange = true; | 960 | fullDateRange = true; |
961 | 961 | ||
962 | if ( ! fullDateRange ) { | 962 | if ( ! fullDateRange ) { |
963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
964 | 964 | ||
965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
967 | fullDateRange = true; | 967 | fullDateRange = true; |
968 | } | 968 | } |
969 | } | 969 | } |
970 | if ( mSyncKDE ) { | 970 | if ( mSyncManager->syncWithDesktop() ) { |
971 | fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync ); | 971 | fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync ); |
972 | } | 972 | } |
973 | if ( fullDateRange ) | 973 | if ( fullDateRange ) |
974 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 974 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
975 | else | 975 | else |
976 | mLastCalendarSync = eventLSync->dtStart(); | 976 | mLastCalendarSync = eventLSync->dtStart(); |
977 | // for resyncing if own file has changed | 977 | // for resyncing if own file has changed |
978 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 978 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
979 | mLastCalendarSync = loadedFileVersion; | 979 | mLastCalendarSync = loadedFileVersion; |
980 | //qDebug("setting mLastCalendarSync "); | 980 | //qDebug("setting mLastCalendarSync "); |
981 | } | 981 | } |
982 | //qDebug("*************************** "); | 982 | //qDebug("*************************** "); |
983 | qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 983 | qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
984 | QPtrList<Incidence> er = remote->rawIncidences(); | 984 | QPtrList<Incidence> er = remote->rawIncidences(); |
985 | Incidence* inR = er.first(); | 985 | Incidence* inR = er.first(); |
986 | Incidence* inL; | 986 | Incidence* inL; |
@@ -1014,41 +1014,41 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1014 | if ( inL ) { // maybe conflict - same uid in both calendars | 1014 | if ( inL ) { // maybe conflict - same uid in both calendars |
1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1017 | if ( take == 3 ) | 1017 | if ( take == 3 ) |
1018 | return false; | 1018 | return false; |
1019 | if ( take == 1 ) {// take local | 1019 | if ( take == 1 ) {// take local |
1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1022 | else | 1022 | else |
1023 | idS = inR->IDStr(); | 1023 | idS = inR->IDStr(); |
1024 | remote->deleteIncidence( inR ); | 1024 | remote->deleteIncidence( inR ); |
1025 | inR = inL->clone(); | 1025 | inR = inL->clone(); |
1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1028 | inR->setIDStr( idS ); | 1028 | inR->setIDStr( idS ); |
1029 | remote->addIncidence( inR ); | 1029 | remote->addIncidence( inR ); |
1030 | if ( mSyncKDE ) | 1030 | if ( mSyncManager->syncWithDesktop() ) |
1031 | inR->setPilotId( 2 ); | 1031 | inR->setPilotId( 2 ); |
1032 | ++changedRemote; | 1032 | ++changedRemote; |
1033 | } else { | 1033 | } else { |
1034 | idS = inL->IDStr(); | 1034 | idS = inL->IDStr(); |
1035 | int pid = inL->pilotId(); | 1035 | int pid = inL->pilotId(); |
1036 | local->deleteIncidence( inL ); | 1036 | local->deleteIncidence( inL ); |
1037 | inL = inR->clone(); | 1037 | inL = inR->clone(); |
1038 | if ( mSyncKDE ) | 1038 | if ( mSyncManager->syncWithDesktop() ) |
1039 | inL->setPilotId( pid ); | 1039 | inL->setPilotId( pid ); |
1040 | inL->setIDStr( idS ); | 1040 | inL->setIDStr( idS ); |
1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1044 | } | 1044 | } |
1045 | local->addIncidence( inL ); | 1045 | local->addIncidence( inL ); |
1046 | ++changedLocal; | 1046 | ++changedLocal; |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | } else { // no conflict | 1049 | } else { // no conflict |
1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1051 | QString des = eventLSync->description(); | 1051 | QString des = eventLSync->description(); |
1052 | QString pref = "e"; | 1052 | QString pref = "e"; |
1053 | if ( inR->type() == "Todo" ) | 1053 | if ( inR->type() == "Todo" ) |
1054 | pref = "t"; | 1054 | pref = "t"; |
@@ -1170,33 +1170,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1170 | remote->deleteIncidence( inR ); | 1170 | remote->deleteIncidence( inR ); |
1171 | ++delFut; | 1171 | ++delFut; |
1172 | } | 1172 | } |
1173 | inR = er.next(); | 1173 | inR = er.next(); |
1174 | } | 1174 | } |
1175 | } | 1175 | } |
1176 | bar.hide(); | 1176 | bar.hide(); |
1177 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1177 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1178 | eventLSync->setReadOnly( false ); | 1178 | eventLSync->setReadOnly( false ); |
1179 | eventLSync->setDtStart( mLastCalendarSync ); | 1179 | eventLSync->setDtStart( mLastCalendarSync ); |
1180 | eventRSync->setDtStart( mLastCalendarSync ); | 1180 | eventRSync->setDtStart( mLastCalendarSync ); |
1181 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1181 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1182 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1182 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1183 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1183 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1184 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1184 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1185 | eventLSync->setReadOnly( true ); | 1185 | eventLSync->setReadOnly( true ); |
1186 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... | 1186 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1187 | remote->addEvent( eventRSync ); | 1187 | remote->addEvent( eventRSync ); |
1188 | else | 1188 | else |
1189 | delete eventRSync; | 1189 | delete eventRSync; |
1190 | QString mes; | 1190 | QString mes; |
1191 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1191 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1192 | QString delmess; | 1192 | QString delmess; |
1193 | if ( delFut ) { | 1193 | if ( delFut ) { |
1194 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1194 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1195 | mes += delmess; | 1195 | mes += delmess; |
1196 | } | 1196 | } |
1197 | if ( mSyncManager->mShowSyncSummary ) { | 1197 | if ( mSyncManager->mShowSyncSummary ) { |
1198 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1198 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1199 | } | 1199 | } |
1200 | qDebug( mes ); | 1200 | qDebug( mes ); |
1201 | mCalendar->checkAlarmForIncidence( 0, true ); | 1201 | mCalendar->checkAlarmForIncidence( 0, true ); |
1202 | return syncOK; | 1202 | return syncOK; |
@@ -3732,44 +3732,41 @@ NavigatorBar *CalendarView::navigatorBar() | |||
3732 | { | 3732 | { |
3733 | return mNavigatorBar; | 3733 | return mNavigatorBar; |
3734 | } | 3734 | } |
3735 | 3735 | ||
3736 | 3736 | ||
3737 | 3737 | ||
3738 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3738 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3739 | { | 3739 | { |
3740 | //qDebug(" alendarView::keyPressEvent "); | 3740 | //qDebug(" alendarView::keyPressEvent "); |
3741 | e->ignore(); | 3741 | e->ignore(); |
3742 | } | 3742 | } |
3743 | 3743 | ||
3744 | 3744 | ||
3745 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3745 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3746 | { | 3746 | { |
3747 | // mSyncManager = manager; | 3747 | // mSyncManager = manager; |
3748 | mSyncKDE = false; | ||
3749 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3748 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3750 | qDebug("SyncKDE request detected!"); | 3749 | qDebug("SyncKDE request detected!"); |
3751 | mSyncKDE = true; | ||
3752 | } | 3750 | } |
3753 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3751 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3754 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3752 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3755 | return syncCalendar( filename, mode ); | 3753 | return syncCalendar( filename, mode ); |
3756 | } | 3754 | } |
3757 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3755 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3758 | { | 3756 | { |
3759 | mSyncKDE = false; | ||
3760 | //mSyncManager = manager; | 3757 | //mSyncManager = manager; |
3761 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3758 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3762 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3759 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3763 | if ( resource == "sharp" ) | 3760 | if ( resource == "sharp" ) |
3764 | syncExternal( 0 ); | 3761 | syncExternal( 0 ); |
3765 | if ( resource == "phone" ) | 3762 | if ( resource == "phone" ) |
3766 | syncExternal( 1 ); | 3763 | syncExternal( 1 ); |
3767 | // pending setmodified | 3764 | // pending setmodified |
3768 | return true; | 3765 | return true; |
3769 | } | 3766 | } |
3770 | void CalendarView::setSyncManager(KSyncManager* manager) | 3767 | void CalendarView::setSyncManager(KSyncManager* manager) |
3771 | { | 3768 | { |
3772 | mSyncManager = manager; | 3769 | mSyncManager = manager; |
3773 | } | 3770 | } |
3774 | 3771 | ||
3775 | void CalendarView::removeSyncInfo( QString syncProfile) | 3772 | void CalendarView::removeSyncInfo( QString syncProfile) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index acc20d6..437a51c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -476,33 +476,32 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
476 | */ | 476 | */ |
477 | void adaptNavigationUnits(); | 477 | void adaptNavigationUnits(); |
478 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 478 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
479 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 479 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
480 | //Attendee* getYourAttendee(Event *event); | 480 | //Attendee* getYourAttendee(Event *event); |
481 | protected: | 481 | protected: |
482 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 482 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
483 | 483 | ||
484 | // returns KMsgBox::OKCandel() | 484 | // returns KMsgBox::OKCandel() |
485 | int msgItemDelete(); | 485 | int msgItemDelete(); |
486 | void showEventEditor(); | 486 | void showEventEditor(); |
487 | void showTodoEditor(); | 487 | void showTodoEditor(); |
488 | void writeLocale(); | 488 | void writeLocale(); |
489 | Todo *selectedTodo(); | 489 | Todo *selectedTodo(); |
490 | 490 | ||
491 | private: | 491 | private: |
492 | bool mSyncKDE; | ||
493 | KSyncManager* mSyncManager; | 492 | KSyncManager* mSyncManager; |
494 | AlarmDialog * mAlarmDialog; | 493 | AlarmDialog * mAlarmDialog; |
495 | QString mAlarmNotification; | 494 | QString mAlarmNotification; |
496 | QString mSuspendAlarmNotification; | 495 | QString mSuspendAlarmNotification; |
497 | QTimer* mSuspendTimer; | 496 | QTimer* mSuspendTimer; |
498 | QTimer* mAlarmTimer; | 497 | QTimer* mAlarmTimer; |
499 | QTimer* mRecheckAlarmTimer; | 498 | QTimer* mRecheckAlarmTimer; |
500 | void computeAlarm( QString ); | 499 | void computeAlarm( QString ); |
501 | void startAlarm( QString, QString ); | 500 | void startAlarm( QString, QString ); |
502 | void setSyncEventsReadOnly(); | 501 | void setSyncEventsReadOnly(); |
503 | 502 | ||
504 | QDateTime loadedFileVersion; | 503 | QDateTime loadedFileVersion; |
505 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 504 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
506 | void checkExternalId( Incidence * inc ); | 505 | void checkExternalId( Incidence * inc ); |
507 | int mGlobalSyncMode; | 506 | int mGlobalSyncMode; |
508 | QString mCurrentSyncDevice; | 507 | QString mCurrentSyncDevice; |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e09050e..17e6c75 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -174,32 +174,33 @@ void KSyncManager::slotClearMenu( int action ) | |||
174 | if ( syncDevice.isEmpty() ) | 174 | if ( syncDevice.isEmpty() ) |
175 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); | 175 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); |
176 | else | 176 | else |
177 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); | 177 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); |
178 | 178 | ||
179 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, | 179 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, |
180 | 0, 1 ); | 180 | 0, 1 ); |
181 | if ( result ) | 181 | if ( result ) |
182 | return; | 182 | return; |
183 | mImplementation->removeSyncInfo( syncDevice ); | 183 | mImplementation->removeSyncInfo( syncDevice ); |
184 | } | 184 | } |
185 | void KSyncManager::slotSyncMenu( int action ) | 185 | void KSyncManager::slotSyncMenu( int action ) |
186 | { | 186 | { |
187 | qDebug("syncaction %d ", action); | 187 | qDebug("syncaction %d ", action); |
188 | if ( action == 5000 ) | 188 | if ( action == 5000 ) |
189 | return; | 189 | return; |
190 | mSyncWithDesktop = false; | ||
190 | if ( action == 0 ) { | 191 | if ( action == 0 ) { |
191 | 192 | ||
192 | // seems to be a Qt2 event handling bug | 193 | // seems to be a Qt2 event handling bug |
193 | // syncmenu.clear causes a segfault at first time | 194 | // syncmenu.clear causes a segfault at first time |
194 | // when we call it after the main event loop, it is ok | 195 | // when we call it after the main event loop, it is ok |
195 | // same behaviour when calling OM/Pi via QCOP for the first time | 196 | // same behaviour when calling OM/Pi via QCOP for the first time |
196 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 197 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
197 | //confSync(); | 198 | //confSync(); |
198 | 199 | ||
199 | return; | 200 | return; |
200 | } | 201 | } |
201 | if ( action == 1 ) { | 202 | if ( action == 1 ) { |
202 | multiSync( true ); | 203 | multiSync( true ); |
203 | return; | 204 | return; |
204 | } | 205 | } |
205 | if ( action == 2 ) { | 206 | if ( action == 2 ) { |
@@ -238,32 +239,33 @@ void KSyncManager::slotSyncMenu( int action ) | |||
238 | mWriteBackFile = true; | 239 | mWriteBackFile = true; |
239 | mSyncAlgoPrefs = 2;// take newest | 240 | mSyncAlgoPrefs = 2;// take newest |
240 | } | 241 | } |
241 | else { | 242 | else { |
242 | mAskForPreferences = temp->getAskForPreferences(); | 243 | mAskForPreferences = temp->getAskForPreferences(); |
243 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 244 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
244 | mWriteBackFile = temp->getWriteBackFile(); | 245 | mWriteBackFile = temp->getWriteBackFile(); |
245 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 246 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
246 | } | 247 | } |
247 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 248 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
248 | mIsKapiFile = temp->getIsKapiFile(); | 249 | mIsKapiFile = temp->getIsKapiFile(); |
249 | mWriteBackInFuture = 0; | 250 | mWriteBackInFuture = 0; |
250 | if ( temp->getWriteBackFuture() ) | 251 | if ( temp->getWriteBackFuture() ) |
251 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 252 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
252 | 253 | ||
253 | if ( action == 1000 ) { | 254 | if ( action == 1000 ) { |
255 | mIsKapiFile = false; | ||
254 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
255 | syncKDE(); | 257 | syncKDE(); |
256 | #else | 258 | #else |
257 | syncSharp(); | 259 | syncSharp(); |
258 | #endif | 260 | #endif |
259 | 261 | ||
260 | } else if ( action == 1001 ) { | 262 | } else if ( action == 1001 ) { |
261 | syncLocalFile(); | 263 | syncLocalFile(); |
262 | 264 | ||
263 | } else if ( action == 1002 ) { | 265 | } else if ( action == 1002 ) { |
264 | mWriteBackFile = false; | 266 | mWriteBackFile = false; |
265 | mAskForPreferences = false; | 267 | mAskForPreferences = false; |
266 | mShowSyncSummary = false; | 268 | mShowSyncSummary = false; |
267 | mSyncAlgoPrefs = 3; | 269 | mSyncAlgoPrefs = 3; |
268 | quickSyncLocalFile(); | 270 | quickSyncLocalFile(); |
269 | 271 | ||
@@ -869,37 +871,55 @@ void KSyncManager::confSync() | |||
869 | #else | 871 | #else |
870 | sp->show(); | 872 | sp->show(); |
871 | #endif | 873 | #endif |
872 | sp->exec(); | 874 | sp->exec(); |
873 | QStringList oldSyncProfileNames = mSyncProfileNames; | 875 | QStringList oldSyncProfileNames = mSyncProfileNames; |
874 | mSyncProfileNames = sp->getSyncProfileNames(); | 876 | mSyncProfileNames = sp->getSyncProfileNames(); |
875 | mLocalMachineName = sp->getLocalMachineName (); | 877 | mLocalMachineName = sp->getLocalMachineName (); |
876 | int ii; | 878 | int ii; |
877 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | 879 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { |
878 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | 880 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) |
879 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | 881 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); |
880 | } | 882 | } |
881 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 883 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
882 | } | 884 | } |
883 | void KSyncManager::syncKDE() | 885 | void KSyncManager::syncKDE() |
884 | { | 886 | { |
887 | mSyncWithDesktop = true; | ||
885 | emit save(); | 888 | emit save(); |
886 | switch(mTargetApp) | 889 | switch(mTargetApp) |
887 | { | 890 | { |
888 | case (KAPI): | 891 | case (KAPI): |
889 | 892 | { | |
893 | #ifdef DESKTOP_VERSION | ||
894 | QString command = qApp->applicationDirPath () + "/kdeabdump"; | ||
895 | #else | ||
896 | QString command = "kdeabdump"; | ||
897 | #endif | ||
898 | if ( ! QFile::exists ( command ) ) | ||
899 | command = "kdeabdump"; | ||
900 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; | ||
901 | system ( command.latin1()); | ||
902 | if ( syncWithFile( fileName,true ) ) { | ||
903 | if ( mWriteBackFile ) { | ||
904 | command += " --read"; | ||
905 | system ( command.latin1()); | ||
906 | } | ||
907 | } | ||
908 | |||
909 | } | ||
890 | break; | 910 | break; |
891 | case (KOPI): | 911 | case (KOPI): |
892 | { | 912 | { |
893 | #ifdef DESKTOP_VERSION | 913 | #ifdef DESKTOP_VERSION |
894 | QString command = qApp->applicationDirPath () + "/kdecaldump"; | 914 | QString command = qApp->applicationDirPath () + "/kdecaldump"; |
895 | #else | 915 | #else |
896 | QString command = "kdecaldump"; | 916 | QString command = "kdecaldump"; |
897 | #endif | 917 | #endif |
898 | if ( ! QFile::exists ( command ) ) | 918 | if ( ! QFile::exists ( command ) ) |
899 | command = "kdecaldump"; | 919 | command = "kdecaldump"; |
900 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 920 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
901 | system ( command.latin1()); | 921 | system ( command.latin1()); |
902 | if ( syncWithFile( fileName,true ) ) { | 922 | if ( syncWithFile( fileName,true ) ) { |
903 | if ( mWriteBackFile ) { | 923 | if ( mWriteBackFile ) { |
904 | command += " --read"; | 924 | command += " --read"; |
905 | system ( command.latin1()); | 925 | system ( command.latin1()); |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 2af891b..6da0ee4 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -109,32 +109,33 @@ class KSyncManager : public QObject | |||
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 | bool syncWithDesktop () { return mSyncWithDesktop;} | ||
125 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 126 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
126 | QString getCurrentSyncName() { return mCurrentSyncName; } | 127 | QString getCurrentSyncName() { return mCurrentSyncName; } |
127 | 128 | ||
128 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 129 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
129 | void hideProgressBar(); | 130 | void hideProgressBar(); |
130 | bool isProgressBarCanceled(); | 131 | bool isProgressBarCanceled(); |
131 | 132 | ||
132 | // sync stuff | 133 | // sync stuff |
133 | QString mLocalMachineName; | 134 | QString mLocalMachineName; |
134 | QStringList mExternSyncProfiles; | 135 | QStringList mExternSyncProfiles; |
135 | QStringList mSyncProfileNames; | 136 | QStringList mSyncProfileNames; |
136 | bool mAskForPreferences; | 137 | bool mAskForPreferences; |
137 | bool mShowSyncSummary; | 138 | bool mShowSyncSummary; |
138 | bool mIsKapiFile; | 139 | bool mIsKapiFile; |
139 | bool mWriteBackExistingOnly; | 140 | bool mWriteBackExistingOnly; |
140 | int mSyncAlgoPrefs; | 141 | int mSyncAlgoPrefs; |
@@ -174,32 +175,33 @@ class KSyncManager : public QObject | |||
174 | void syncSharp(); | 175 | void syncSharp(); |
175 | void syncKDE(); | 176 | void syncKDE(); |
176 | bool syncExternalApplication(QString); | 177 | bool syncExternalApplication(QString); |
177 | int mCurrentSyncProfile ; | 178 | int mCurrentSyncProfile ; |
178 | void syncRemote( KSyncProfile* prof, bool ask = true); | 179 | void syncRemote( KSyncProfile* prof, bool ask = true); |
179 | bool edit_sync_options(); | 180 | bool edit_sync_options(); |
180 | bool edit_pisync_options(); | 181 | bool edit_pisync_options(); |
181 | int ringSync(); | 182 | int ringSync(); |
182 | QString getPassword( ); | 183 | QString getPassword( ); |
183 | bool mPisyncFinished; | 184 | bool mPisyncFinished; |
184 | bool mBlockSaveFlag; | 185 | bool mBlockSaveFlag; |
185 | QWidget* mParent; | 186 | QWidget* mParent; |
186 | KSyncInterface* mImplementation; | 187 | KSyncInterface* mImplementation; |
187 | TargetApp mTargetApp; | 188 | TargetApp mTargetApp; |
188 | QPopupMenu* mSyncMenu; | 189 | QPopupMenu* mSyncMenu; |
189 | QProgressBar* bar; | 190 | QProgressBar* bar; |
191 | bool mSyncWithDesktop; | ||
190 | 192 | ||
191 | private slots: | 193 | private slots: |
192 | void confSync(); | 194 | void confSync(); |
193 | 195 | ||
194 | 196 | ||
195 | }; | 197 | }; |
196 | 198 | ||
197 | 199 | ||
198 | class KSyncInterface | 200 | class KSyncInterface |
199 | { | 201 | { |
200 | public : | 202 | public : |
201 | virtual void removeSyncInfo( QString syncProfile) = 0; | 203 | virtual void removeSyncInfo( QString syncProfile) = 0; |
202 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 204 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
203 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 205 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
204 | { | 206 | { |
205 | // empty implementation, because some syncable applications do not | 207 | // empty implementation, because some syncable applications do not |