-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 @@ -862,8 +862,11 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) QDateTime dt ( QDate( 2004,1,1) ); while ( it != end() ) { (*it).setRevision( dt ); + 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; //qDebug("removing %s ",(*it).uid().latin1() ); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f00a09..ea87929 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1312,10 +1312,12 @@ void KABCore::setDetailsVisible( bool visible ) if ( visible ) { mViewManager->hide(); mDetails->show(); + mIncSearchWidget->setFocus(); } else { mViewManager->show(); mDetails->hide(); + mViewManager->setFocusAV(); } setJumpButtonBarVisible( !visible ); } @@ -2044,6 +2046,9 @@ void KABCore::addActionsManually() mActionDelete->plug( tb ); mActionRedo->plug( tb ); } + } else { + if (KABPrefs::instance()->mMultipleViewsAtOnce ) + mActionSave->plug( tb ); } //mActionQuit->plug ( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget, 6); @@ -2507,7 +2512,16 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo bool fullDateRange = false; 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()); addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); @@ -2605,6 +2619,8 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inR.setOriginalExternalUID( OidS ); inR.setExternalUID( idS ); + if ( syncManager->syncWithDesktop() ) + inR.setIDStr( "changed" ); } else { inR.setIDStr( idS ); } @@ -2898,6 +2914,9 @@ void KABCore::getFile( bool success ) } void KABCore::syncFileRequest() { + if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { + syncManager->slotSyncMenu( 999 ); + } mAddressBook->export2File( sentSyncFile() ); } QString KABCore::sentSyncFile() diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -300,6 +300,11 @@ void ViewManager::refreshView( const QString &uid ) mActiveView->refresh( uid ); } +void ViewManager::setFocusAV() +{ + if ( mActiveView ) + mActiveView->setFocus(); +} void ViewManager::editView() { if ( !mActiveView ) diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 585f4e9..a03a83f 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h @@ -64,6 +64,7 @@ class ViewManager : public QWidget QStringList selectedEmails() const; KABC::Addressee::List selectedAddressees() const; void setListSelected(QStringList); + void setFocusAV(); public slots: void scrollUP(); diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 326db88..6e61351 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -927,7 +927,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int bool fullDateRange = false; local->resetTempSyncStat(); mLastCalendarSync = QDateTime::currentDateTime(); - if ( mSyncKDE ) { + if ( mSyncManager->syncWithDesktop() ) { remote->resetPilotStat(1); if ( KSyncManager::mRequestedSyncEvent.isValid() ) { mLastCalendarSync = KSyncManager::mRequestedSyncEvent; @@ -944,7 +944,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->deleteEvent(eventR ); } else { - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { eventRSync = (Event*)eventLSync->clone(); } else { fullDateRange = true; @@ -967,7 +967,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int fullDateRange = true; } } - if ( mSyncKDE ) { + if ( mSyncManager->syncWithDesktop() ) { fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync ); } if ( fullDateRange ) @@ -1027,7 +1027,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) inR->setIDStr( idS ); remote->addIncidence( inR ); - if ( mSyncKDE ) + if ( mSyncManager->syncWithDesktop() ) inR->setPilotId( 2 ); ++changedRemote; } else { @@ -1035,7 +1035,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int int pid = inL->pilotId(); local->deleteIncidence( inL ); inL = inR->clone(); - if ( mSyncKDE ) + if ( mSyncManager->syncWithDesktop() ) inL->setPilotId( pid ); inL->setIDStr( idS ); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { @@ -1183,7 +1183,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 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 delete eventRSync; @@ -3745,10 +3745,8 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) 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(); mCurrentSyncName = mSyncManager->getCurrentSyncName(); @@ -3756,7 +3754,6 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) } bool CalendarView::syncExternal(KSyncManager* manager, QString resource) { - mSyncKDE = false; //mSyncManager = manager; mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); mCurrentSyncName = mSyncManager->getCurrentSyncName(); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index acc20d6..437a51c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -489,7 +489,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Todo *selectedTodo(); private: - bool mSyncKDE; KSyncManager* mSyncManager; AlarmDialog * mAlarmDialog; QString mAlarmNotification; diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e09050e..17e6c75 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -187,6 +187,7 @@ void KSyncManager::slotSyncMenu( int action ) qDebug("syncaction %d ", action); if ( action == 5000 ) return; + mSyncWithDesktop = false; if ( action == 0 ) { // seems to be a Qt2 event handling bug @@ -251,6 +252,7 @@ void KSyncManager::slotSyncMenu( int action ) mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); if ( action == 1000 ) { + mIsKapiFile = false; #ifdef DESKTOP_VERSION syncKDE(); #else @@ -882,11 +884,29 @@ 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 @@ -122,6 +122,7 @@ class KSyncManager : public QObject QString syncFileName(); void enableQuick( bool ask = true); + bool syncWithDesktop () { return mSyncWithDesktop;} QString getCurrentSyncDevice() { return mCurrentSyncDevice; } QString getCurrentSyncName() { return mCurrentSyncName; } @@ -187,6 +188,7 @@ class KSyncManager : public QObject TargetApp mTargetApp; QPopupMenu* mSyncMenu; QProgressBar* bar; + bool mSyncWithDesktop; private slots: void confSync(); |