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 | 3 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 21 | ||||
-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 | 20 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
8 files changed, 57 insertions, 11 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index d101589..9b196b5 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -859,14 +859,17 @@ 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 | if (( *it).IDStr() != "changed" ) { | ||
866 | // "changed" is used for tagging changed addressees when syncing with KDE or OL | ||
865 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 867 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
866 | (*it).setIDStr(""); | 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 { |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f00a09..ea87929 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1309,16 +1309,18 @@ void KABCore::setDetailsVisible( bool visible ) | |||
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 | ||
@@ -2041,12 +2043,15 @@ void KABCore::addActionsManually() | |||
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. |
@@ -2504,13 +2509,22 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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 ); |
@@ -2602,12 +2616,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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; |
@@ -2895,12 +2911,15 @@ void KABCore::getFile( bool success ) | |||
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" ); |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -297,12 +297,17 @@ void ViewManager::refreshView() | |||
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() ); |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 585f4e9..a03a83f 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -61,12 +61,13 @@ class ViewManager : public QWidget | |||
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 ); |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 326db88..6e61351 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -924,13 +924,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 "); |
@@ -941,13 +941,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 ); |
@@ -964,13 +964,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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(); |
@@ -1024,21 +1024,21 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 | } |
@@ -1180,13 +1180,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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; |
@@ -3742,24 +3742,21 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) | |||
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" ) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index acc20d6..437a51c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -486,13 +486,12 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
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; |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e09050e..17e6c75 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -184,12 +184,13 @@ void KSyncManager::slotClearMenu( int action ) | |||
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 |
@@ -248,12 +249,13 @@ void KSyncManager::slotSyncMenu( int action ) | |||
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 | ||
@@ -879,17 +881,35 @@ void KSyncManager::confSync() | |||
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): |
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 | } | ||
889 | 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 |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 2af891b..6da0ee4 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -119,12 +119,13 @@ class KSyncManager : public QObject | |||
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(); |
@@ -184,12 +185,13 @@ class KSyncManager : public QObject | |||
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 | }; |