summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp7
-rw-r--r--kaddressbook/kabcore.cpp23
-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.cpp22
-rw-r--r--libkdepim/ksyncmanager.h2
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
@@ -861,10 +861,13 @@ void AddressBook::removeSyncAddressees( bool removeDeleted )
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;
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 )
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
@@ -2043,8 +2045,11 @@ void KABCore::addActionsManually()
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
@@ -2506,9 +2511,18 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
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() ) {
@@ -2604,8 +2618,10 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
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 );
@@ -2896,9 +2912,12 @@ void KABCore::getFile( bool success )
2896 message( i18n("Pi-Sync successful!") ); 2912 message( i18n("Pi-Sync successful!") );
2897 mViewManager->refreshView(); 2913 mViewManager->refreshView();
2898} 2914}
2899void KABCore::syncFileRequest() 2915void KABCore::syncFileRequest()
2900{ 2916{
2917 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
2918 syncManager->slotSyncMenu( 999 );
2919 }
2901 mAddressBook->export2File( sentSyncFile() ); 2920 mAddressBook->export2File( sentSyncFile() );
2902} 2921}
2903QString KABCore::sentSyncFile() 2922QString KABCore::sentSyncFile()
2904{ 2923{
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 )
299 if ( mActiveView ) 299 if ( mActiveView )
300 mActiveView->refresh( uid ); 300 mActiveView->refresh( uid );
301} 301}
302 302
303void ViewManager::setFocusAV()
304{
305 if ( mActiveView )
306 mActiveView->setFocus();
307}
303void ViewManager::editView() 308void ViewManager::editView()
304{ 309{
305 if ( !mActiveView ) 310 if ( !mActiveView )
306 return; 311 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
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();
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
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() );
@@ -943,9 +943,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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();
@@ -966,9 +966,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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);
@@ -1026,17 +1026,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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) );
@@ -1182,9 +1182,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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;
@@ -3744,20 +3744,17 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
3744 3744
3745bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3745bool 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}
3757bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3755bool 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" )
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
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;
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 )
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
@@ -250,8 +251,9 @@ void KSyncManager::slotSyncMenu( int action )
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();
@@ -881,13 +883,31 @@ void KSyncManager::confSync()
881 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 883 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
882} 884}
883void KSyncManager::syncKDE() 885void 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
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
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);
@@ -186,8 +187,9 @@ class KSyncManager : public QObject
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
191private slots: 193private slots:
192 void confSync(); 194 void confSync();
193 195