-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 @@ -863,6 +863,9 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) while ( it != end() ) { (*it).setRevision( dt ); - (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); - (*it).setIDStr(""); + if (( *it).IDStr() != "changed" ) { + // "changed" is used for tagging changed addressees when syncing with KDE or OL + (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); + (*it).setIDStr(""); + } if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { it2 = it; diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f00a09..ea87929 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1313,8 +1313,10 @@ void KABCore::setDetailsVisible( bool visible ) mViewManager->hide(); mDetails->show(); + mIncSearchWidget->setFocus(); } else { mViewManager->show(); mDetails->hide(); + mViewManager->setFocusAV(); } setJumpButtonBarVisible( !visible ); @@ -2045,4 +2047,7 @@ void KABCore::addActionsManually() mActionRedo->plug( tb ); } + } else { + if (KABPrefs::instance()->mMultipleViewsAtOnce ) + mActionSave->plug( tb ); } //mActionQuit->plug ( tb ); @@ -2508,5 +2513,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo local->resetTempSyncStat(); mLastAddressbookSync = QDateTime::currentDateTime(); - QDateTime modifiedCalendar = mLastAddressbookSync;; + if ( syncManager->syncWithDesktop() ) { + remote->removeSyncInfo( QString());//remove all info + if ( KSyncManager::mRequestedSyncEvent.isValid() ) { + mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; + qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); + } else { + qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); + } + } + QDateTime modifiedCalendar = mLastAddressbookSync; addresseeLSync = getLastSyncAddressee(); qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); @@ -2606,4 +2620,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo inR.setOriginalExternalUID( OidS ); inR.setExternalUID( idS ); + if ( syncManager->syncWithDesktop() ) + inR.setIDStr( "changed" ); } else { inR.setIDStr( idS ); @@ -2898,5 +2914,8 @@ void KABCore::getFile( bool success ) } void KABCore::syncFileRequest() -{ +{ + if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { + syncManager->slotSyncMenu( 999 ); + } mAddressBook->export2File( sentSyncFile() ); } diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -301,4 +301,9 @@ void ViewManager::refreshView( const QString &uid ) } +void ViewManager::setFocusAV() +{ + if ( mActiveView ) + mActiveView->setFocus(); +} void ViewManager::editView() { diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 585f4e9..a03a83f 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h @@ -65,4 +65,5 @@ class ViewManager : public QWidget KABC::Addressee::List selectedAddressees() const; void setListSelected(QStringList); + void setFocusAV(); public slots: diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 326db88..6e61351 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -928,5 +928,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->resetTempSyncStat(); mLastCalendarSync = QDateTime::currentDateTime(); - if ( mSyncKDE ) { + if ( mSyncManager->syncWithDesktop() ) { remote->resetPilotStat(1); if ( KSyncManager::mRequestedSyncEvent.isValid() ) { @@ -945,5 +945,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } else { - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { eventRSync = (Event*)eventLSync->clone(); } else { @@ -968,5 +968,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } } - if ( mSyncKDE ) { + if ( mSyncManager->syncWithDesktop() ) { fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync ); } @@ -1028,5 +1028,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int inR->setIDStr( idS ); remote->addIncidence( inR ); - if ( mSyncKDE ) + if ( mSyncManager->syncWithDesktop() ) inR->setPilotId( 2 ); ++changedRemote; @@ -1036,5 +1036,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->deleteIncidence( inL ); inL = inR->clone(); - if ( mSyncKDE ) + if ( mSyncManager->syncWithDesktop() ) inL->setPilotId( pid ); inL->setIDStr( idS ); @@ -1184,5 +1184,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); eventLSync->setReadOnly( true ); - if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... + if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... remote->addEvent( eventRSync ); else @@ -3746,8 +3746,6 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) { // mSyncManager = manager; - mSyncKDE = false; if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { qDebug("SyncKDE request detected!"); - mSyncKDE = true; } mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); @@ -3757,5 +3755,4 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) bool CalendarView::syncExternal(KSyncManager* manager, QString resource) { - mSyncKDE = false; //mSyncManager = manager; mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index acc20d6..437a51c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -490,5 +490,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser private: - bool mSyncKDE; KSyncManager* mSyncManager; AlarmDialog * mAlarmDialog; diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e09050e..17e6c75 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -188,4 +188,5 @@ void KSyncManager::slotSyncMenu( int action ) if ( action == 5000 ) return; + mSyncWithDesktop = false; if ( action == 0 ) { @@ -252,4 +253,5 @@ void KSyncManager::slotSyncMenu( int action ) if ( action == 1000 ) { + mIsKapiFile = false; #ifdef DESKTOP_VERSION syncKDE(); @@ -883,9 +885,27 @@ void KSyncManager::confSync() void KSyncManager::syncKDE() { + mSyncWithDesktop = true; emit save(); switch(mTargetApp) { case (KAPI): - + { +#ifdef DESKTOP_VERSION + QString command = qApp->applicationDirPath () + "/kdeabdump"; +#else + QString command = "kdeabdump"; +#endif + if ( ! QFile::exists ( command ) ) + command = "kdeabdump"; + QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; + system ( command.latin1()); + if ( syncWithFile( fileName,true ) ) { + if ( mWriteBackFile ) { + command += " --read"; + system ( command.latin1()); + } + } + + } break; case (KOPI): diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 2af891b..6da0ee4 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -123,4 +123,5 @@ class KSyncManager : public QObject void enableQuick( bool ask = true); + bool syncWithDesktop () { return mSyncWithDesktop;} QString getCurrentSyncDevice() { return mCurrentSyncDevice; } QString getCurrentSyncName() { return mCurrentSyncName; } @@ -188,4 +189,5 @@ class KSyncManager : public QObject QPopupMenu* mSyncMenu; QProgressBar* bar; + bool mSyncWithDesktop; private slots: |