summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-27 12:27:39 (UTC)
committer zautrix <zautrix>2004-10-27 12:27:39 (UTC)
commit2f3396d84d2f3c92e1e0e420d677892c1f9c0778 (patch) (side-by-side diff)
tree1ebab5dc6d00cb09720789897ce2c86df05cc9ab
parentf73d249579d52d7aeaacde2dcb23abeb42f9ee95 (diff)
downloadkdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.zip
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.gz
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.bz2
completed KDE AB sync. but will it work ...?
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp3
-rw-r--r--kaddressbook/kabcore.cpp21
-rw-r--r--kaddressbook/viewmanager.cpp5
-rw-r--r--kaddressbook/viewmanager.h1
-rw-r--r--korganizer/calendarview.cpp15
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--libkdepim/ksyncmanager.cpp20
-rw-r--r--libkdepim/ksyncmanager.h2
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
@@ -861,10 +861,13 @@ void AddressBook::removeSyncAddressees( bool removeDeleted )
Iterator it2 ;
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() );
++it;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f00a09..ea87929 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1311,12 +1311,14 @@ void KABCore::setDetailsVisible( bool visible )
{
if ( visible ) {
mViewManager->hide();
mDetails->show();
+ mIncSearchWidget->setFocus();
}
else {
mViewManager->show();
mDetails->hide();
+ mViewManager->setFocusAV();
}
setJumpButtonBarVisible( !visible );
}
@@ -2043,8 +2045,11 @@ void KABCore::addActionsManually()
mActionUndo->plug( tb );
mActionDelete->plug( tb );
mActionRedo->plug( tb );
}
+ } else {
+ if (KABPrefs::instance()->mMultipleViewsAtOnce )
+ mActionSave->plug( tb );
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
@@ -2506,9 +2511,18 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
//KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
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 );
if ( !addresseeR.isEmpty() ) {
@@ -2604,8 +2618,10 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inR.setOriginalExternalUID( OidS );
inR.setExternalUID( idS );
+ if ( syncManager->syncWithDesktop() )
+ inR.setIDStr( "changed" );
} else {
inR.setIDStr( idS );
}
inR.setResource( 0 );
@@ -2897,8 +2913,11 @@ void KABCore::getFile( bool success )
mViewManager->refreshView();
}
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
@@ -299,8 +299,13 @@ void ViewManager::refreshView( const QString &uid )
if ( mActiveView )
mActiveView->refresh( uid );
}
+void ViewManager::setFocusAV()
+{
+ if ( mActiveView )
+ mActiveView->setFocus();
+}
void ViewManager::editView()
{
if ( !mActiveView )
return;
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index 585f4e9..a03a83f 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -63,8 +63,9 @@ class ViewManager : public QWidget
QStringList selectedUids() const;
QStringList selectedEmails() const;
KABC::Addressee::List selectedAddressees() const;
void setListSelected(QStringList);
+ void setFocusAV();
public slots:
void scrollUP();
void scrollDOWN();
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 326db88..6e61351 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -926,9 +926,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastCalendarSync = QDateTime::currentDateTime();
- if ( mSyncKDE ) {
+ if ( mSyncManager->syncWithDesktop() ) {
remote->resetPilotStat(1);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
@@ -943,9 +943,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
eventRSync = (Event*) eventR->clone();
remote->deleteEvent(eventR );
} else {
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) {
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
eventRSync = (Event*)eventLSync->clone();
} else {
fullDateRange = true;
eventRSync = new Event();
@@ -966,9 +966,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
//qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
fullDateRange = true;
}
}
- if ( mSyncKDE ) {
+ if ( mSyncManager->syncWithDesktop() ) {
fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync );
}
if ( fullDateRange )
mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
@@ -1026,17 +1026,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
inR->setIDStr( idS );
remote->addIncidence( inR );
- if ( mSyncKDE )
+ if ( mSyncManager->syncWithDesktop() )
inR->setPilotId( 2 );
++changedRemote;
} else {
idS = inL->IDStr();
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 ) {
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
@@ -1182,9 +1182,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
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;
QString mes;
@@ -3744,20 +3744,17 @@ 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();
return syncCalendar( filename, mode );
}
bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
{
- mSyncKDE = false;
//mSyncManager = manager;
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
if ( resource == "sharp" )
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index acc20d6..437a51c 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -488,9 +488,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void writeLocale();
Todo *selectedTodo();
private:
- bool mSyncKDE;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index e09050e..17e6c75 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -186,8 +186,9 @@ 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
// syncmenu.clear causes a segfault at first time
@@ -250,8 +251,9 @@ void KSyncManager::slotSyncMenu( int action )
if ( temp->getWriteBackFuture() )
mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
if ( action == 1000 ) {
+ mIsKapiFile = false;
#ifdef DESKTOP_VERSION
syncKDE();
#else
syncSharp();
@@ -881,13 +883,31 @@ void KSyncManager::confSync()
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
}
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):
{
#ifdef DESKTOP_VERSION
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 2af891b..6da0ee4 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -121,8 +121,9 @@ class KSyncManager : public QObject
QString defaultFileName() { return mDefFileName ;}
QString syncFileName();
void enableQuick( bool ask = true);
+ bool syncWithDesktop () { return mSyncWithDesktop;}
QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
QString getCurrentSyncName() { return mCurrentSyncName; }
void showProgressBar(int percentage, QString caption = QString::null, int total=100);
@@ -186,8 +187,9 @@ class KSyncManager : public QObject
KSyncInterface* mImplementation;
TargetApp mTargetApp;
QPopupMenu* mSyncMenu;
QProgressBar* bar;
+ bool mSyncWithDesktop;
private slots:
void confSync();