author | zautrix <zautrix> | 2005-11-25 17:41:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 17:41:25 (UTC) |
commit | 279e183c0325cd9565605f60af0215bb9bfdc825 (patch) (unidiff) | |
tree | 43ab776cd108874819e7c6e73070a7d989a9078f | |
parent | 794a5204686ad9bfc16172b01db35f1f3b7683e5 (diff) | |
download | kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.zip kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.gz kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.bz2 |
sync
-rw-r--r-- | korganizer/calendarview.cpp | 73 | ||||
-rw-r--r-- | korganizer/calendarview.h | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 14 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 4 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 16 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 24 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 6 |
9 files changed, 118 insertions, 25 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8965d3b..307027a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -368,2 +368,3 @@ void CalendarView::init() | |||
368 | { | 368 | { |
369 | mMultiResourceSync = false; | ||
369 | flag_blockConflict = false; | 370 | flag_blockConflict = false; |
@@ -1554,2 +1555,3 @@ Event* CalendarView::getLastSyncEvent() | |||
1554 | lse->setReadOnly( true ); | 1555 | lse->setReadOnly( true ); |
1556 | lse->setCalID( 1 ); | ||
1555 | mCalendar->addEvent( lse ); | 1557 | mCalendar->addEvent( lse ); |
@@ -1904,12 +1906,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1904 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1906 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1905 | eventLSync->setReadOnly( false ); | 1907 | if ( mMultiResourceSync ) { |
1906 | eventLSync->setDtStart( mLastCalendarSync ); | 1908 | remote->removeSyncInfo( "" ); //all |
1907 | eventRSync->setDtStart( mLastCalendarSync ); | 1909 | |
1908 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1910 | } else { |
1909 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1911 | eventLSync->setReadOnly( false ); |
1910 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1912 | eventLSync->setDtStart( mLastCalendarSync ); |
1911 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1913 | eventRSync->setDtStart( mLastCalendarSync ); |
1912 | eventLSync->setReadOnly( true ); | 1914 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1915 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | ||
1916 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | ||
1917 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | ||
1918 | eventLSync->setReadOnly( true ); | ||
1919 | } | ||
1913 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1920 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1914 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1921 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop() && !mMultiResourceSync ) // kde is abnormal... |
1915 | remote->addEvent( eventRSync ); | 1922 | remote->addEvent( eventRSync ); |
@@ -2437,2 +2444,28 @@ void CalendarView::mergeFile( QString fn ) | |||
2437 | } | 2444 | } |
2445 | void CalendarView::mergeFileResource( QString fn ,QString resource ) | ||
2446 | { | ||
2447 | |||
2448 | if ( resource == "ALL" ) { | ||
2449 | mergeFile( fn ); | ||
2450 | return; | ||
2451 | } | ||
2452 | |||
2453 | int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); | ||
2454 | if ( !exclusiveResource ) { | ||
2455 | qDebug("KO: CalendarView::mergeFileResource: resource not found %s", resource.latin1() ); | ||
2456 | return; | ||
2457 | } | ||
2458 | clearAllViews(); | ||
2459 | mCalendar->setCalendarRemove( exclusiveResource ); | ||
2460 | int def = mCalendar->defaultCalendar(); | ||
2461 | mCalendar->setDefaultCalendar(exclusiveResource); | ||
2462 | if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) { | ||
2463 | qDebug("KO: CalendarView::mergeFileResource: error adding file %s", fn.latin1() ); | ||
2464 | } | ||
2465 | mCalendar->setDefaultCalendar( def ); | ||
2466 | mCalendar->reInitAlarmSettings(); | ||
2467 | setSyncEventsReadOnly(); | ||
2468 | updateUnmanagedViews(); | ||
2469 | updateView(); | ||
2470 | } | ||
2438 | void CalendarView::showOpenError() | 2471 | void CalendarView::showOpenError() |
@@ -2524,2 +2557,3 @@ bool CalendarView::checkFileVersion(QString fn) | |||
2524 | mSyncManager->mShowSyncSummary = false; | 2557 | mSyncManager->mShowSyncSummary = false; |
2558 | mMultiResourceSync = false; | ||
2525 | syncCalendar( fn, 3 ); | 2559 | syncCalendar( fn, 3 ); |
@@ -2560,2 +2594,19 @@ bool CalendarView::saveCalendars() | |||
2560 | } | 2594 | } |
2595 | bool CalendarView::saveCalendarResource(QString filename, QString resource) | ||
2596 | { | ||
2597 | if ( resource == "ALL" ) | ||
2598 | return saveCalendar( filename ); | ||
2599 | int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); | ||
2600 | if ( !exclusiveResource ) { | ||
2601 | qDebug("KO: CalendarView::saveCalendarResource: resource not found %s", resource.latin1() ); | ||
2602 | return false; | ||
2603 | } | ||
2604 | mCalendar->setDefaultCalendar( exclusiveResource ); | ||
2605 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
2606 | mCalendar->setSyncEventsEnabled(); | ||
2607 | bool res = saveCalendar( filename ); | ||
2608 | restoreCalendarSettings(); | ||
2609 | return res; | ||
2610 | |||
2611 | } | ||
2561 | bool CalendarView::saveCalendar( QString filename ) | 2612 | bool CalendarView::saveCalendar( QString filename ) |
@@ -5034,3 +5085,7 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) | |||
5034 | 5085 | ||
5086 | void CalendarView::multiResourceSyncStart( bool start ) | ||
5087 | { | ||
5088 | mMultiResourceSync = start; | ||
5035 | 5089 | ||
5090 | } | ||
5036 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) | 5091 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index f85b6a3..60b1276 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -141,2 +141,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
141 | void mergeFile( QString fn ); | 141 | void mergeFile( QString fn ); |
142 | void mergeFileResource( QString fn ,QString res); | ||
142 | 143 | ||
@@ -203,2 +204,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
203 | public slots: | 204 | public slots: |
205 | void multiResourceSyncStart( bool ); | ||
204 | void displayCalendarInfo( int id ); | 206 | void displayCalendarInfo( int id ); |
@@ -248,2 +250,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
248 | bool saveCalendar(QString filename); | 250 | bool saveCalendar(QString filename); |
251 | bool saveCalendarResource(QString filename, QString resource); | ||
249 | 252 | ||
@@ -541,2 +544,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
541 | protected: | 544 | protected: |
545 | bool mMultiResourceSync; | ||
542 | Event *mConflictingEvent; | 546 | Event *mConflictingEvent; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 66bb19b..69ccde1 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -376,4 +376,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
376 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 376 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
377 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 377 | connect(mSyncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); |
378 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 378 | connect(mSyncManager , SIGNAL( getFile( bool, const QString &)), this, SLOT(getFile( bool,const QString & ) ) ); |
379 | connect(mSyncManager , SIGNAL( multiResourceSyncStart( bool )), mView, SLOT( multiResourceSyncStart( bool ) ) ); | ||
380 | |||
379 | mSyncManager->setDefaultFileName( sentSyncFile()); | 381 | mSyncManager->setDefaultFileName( sentSyncFile()); |
@@ -2706,3 +2708,3 @@ QString MainWindow::sentSyncFile() | |||
2706 | 2708 | ||
2707 | void MainWindow::syncFileRequest() | 2709 | void MainWindow::syncFileRequest(const QString& resource) |
2708 | { | 2710 | { |
@@ -2718,3 +2720,3 @@ void MainWindow::syncFileRequest() | |||
2718 | setCaption(i18n("Saving Data to temp file ..." )); | 2720 | setCaption(i18n("Saving Data to temp file ..." )); |
2719 | mView->saveCalendar( sentSyncFile() ); | 2721 | mView->saveCalendarResource( sentSyncFile(), resource ); |
2720 | setCaption(i18n("Data saved to temp file!" )); | 2722 | setCaption(i18n("Data saved to temp file!" )); |
@@ -2723,3 +2725,3 @@ void MainWindow::syncFileRequest() | |||
2723 | } | 2725 | } |
2724 | void MainWindow::getFile( bool success ) | 2726 | void MainWindow::getFile( bool success ,const QString& resource) |
2725 | { | 2727 | { |
@@ -2729,3 +2731,3 @@ void MainWindow::getFile( bool success ) | |||
2729 | } | 2731 | } |
2730 | mView->mergeFile( sentSyncFile() ); | 2732 | mView->mergeFileResource( sentSyncFile(), resource); |
2731 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2733 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index d8018b6..a533d8b 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -112,4 +112,4 @@ class MainWindow : public QMainWindow | |||
112 | void showConfigureAgenda(); | 112 | void showConfigureAgenda(); |
113 | void getFile( bool ); | 113 | void getFile( bool ,const QString &); |
114 | void syncFileRequest(); | 114 | void syncFileRequest(const QString &); |
115 | 115 | ||
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 4b8b3ff..0a94914 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -81,2 +81,3 @@ public: | |||
81 | virtual void setSyncEventsReadOnly() = 0; | 81 | virtual void setSyncEventsReadOnly() = 0; |
82 | virtual void setSyncEventsEnabled() = 0; | ||
82 | virtual void stopAllTodos() = 0; | 83 | virtual void stopAllTodos() = 0; |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 0ddfeca..45e3128 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -175,3 +175,3 @@ bool CalendarLocal::addCalendarFile( QString name, int id ) | |||
175 | } | 175 | } |
176 | void CalendarLocal::setSyncEventsReadOnly() | 176 | void CalendarLocal::setSyncEventsEnabled() |
177 | { | 177 | { |
@@ -181,3 +181,15 @@ void CalendarLocal::setSyncEventsReadOnly() | |||
181 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 181 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
182 | ev->setReadOnly( true ); | 182 | ev->setCalEnabled( true ); |
183 | ev = mEventList.next(); | ||
184 | } | ||
185 | } | ||
186 | void CalendarLocal::setSyncEventsReadOnly() | ||
187 | { | ||
188 | Event * ev; | ||
189 | ev = mEventList.first(); | ||
190 | while ( ev ) { | ||
191 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) { | ||
192 | ev->setReadOnly( true ); | ||
193 | ev->setCalID( 1 ); | ||
194 | } | ||
183 | ev = mEventList.next(); | 195 | ev = mEventList.next(); |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index ca0bd98..eb7bf34 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -51,2 +51,3 @@ class CalendarLocal : public Calendar | |||
51 | void setSyncEventsReadOnly(); | 51 | void setSyncEventsReadOnly(); |
52 | void setSyncEventsEnabled(); | ||
52 | void stopAllTodos(); | 53 | void stopAllTodos(); |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index a64eb34..719d80b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -198,3 +198,4 @@ void KSyncManager::slotSyncMenu( int action ) | |||
198 | qDebug("KSM::syncaction %d ", action); | 198 | qDebug("KSM::syncaction %d ", action); |
199 | mCurrentResourceLocal = ""; | 199 | mCurrentResourceLocal = ""; |
200 | emit multiResourceSyncStart( false ); | ||
200 | if ( action == 5000 ) | 201 | if ( action == 5000 ) |
@@ -443,2 +444,4 @@ void KSyncManager::enableQuick( bool ask ) | |||
443 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 444 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
445 | connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); | ||
446 | connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); | ||
444 | } | 447 | } |
@@ -571,3 +574,3 @@ int KSyncManager::ringSync() | |||
571 | { | 574 | { |
572 | 575 | emit multiResourceSyncStart( false ); | |
573 | int syncedProfiles = 0; | 576 | int syncedProfiles = 0; |
@@ -1142,3 +1145,6 @@ void KSyncManager::syncPi() | |||
1142 | int startRemote = mSpecificResources.count()/2; | 1145 | int startRemote = mSpecificResources.count()/2; |
1146 | emit multiResourceSyncStart( true ); | ||
1143 | while ( startLocal < mSpecificResources.count()/2 ) { | 1147 | while ( startLocal < mSpecificResources.count()/2 ) { |
1148 | if ( startLocal+1 >= mSpecificResources.count()/2 ) | ||
1149 | emit multiResourceSyncStart( false ); | ||
1144 | mPisyncFinished = false; | 1150 | mPisyncFinished = false; |
@@ -1221,3 +1227,3 @@ void KSyncManager::readFileFromSocket() | |||
1221 | } | 1227 | } |
1222 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1228 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1223 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1229 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
@@ -1285,2 +1291,3 @@ void KServerSocket::readClient() | |||
1285 | } | 1291 | } |
1292 | mResource = ""; | ||
1286 | mErrorMessage = 0; | 1293 | mErrorMessage = 0; |
@@ -1301,2 +1308,3 @@ void KServerSocket::readClient() | |||
1301 | KSyncManager::mRequestedSyncEvent = QDateTime(); | 1308 | KSyncManager::mRequestedSyncEvent = QDateTime(); |
1309 | mResource =tokens[3]; | ||
1302 | send_file(); | 1310 | send_file(); |
@@ -1312,2 +1320,3 @@ void KServerSocket::readClient() | |||
1312 | blockRC = true; | 1320 | blockRC = true; |
1321 | mResource =tokens[2]; | ||
1313 | get_file(); | 1322 | get_file(); |
@@ -1408,2 +1417,3 @@ void KServerSocket::send_file() | |||
1408 | mSyncActionDialog->raise(); | 1417 | mSyncActionDialog->raise(); |
1418 | emit request_file(mResource); | ||
1409 | emit request_file(); | 1419 | emit request_file(); |
@@ -1469,3 +1479,4 @@ void KServerSocket::readBackFileFromSocket() | |||
1469 | piFileString = ""; | 1479 | piFileString = ""; |
1470 | emit file_received( false ); | 1480 | emit file_received( false, mResource); |
1481 | emit file_received( false); | ||
1471 | blockRC = false; | 1482 | blockRC = false; |
@@ -1485,3 +1496,4 @@ void KServerSocket::readBackFileFromSocket() | |||
1485 | piFileString = ""; | 1496 | piFileString = ""; |
1486 | emit file_received( true ); | 1497 | emit file_received( true, mResource ); |
1498 | emit file_received( true); | ||
1487 | delete mSyncActionDialog; | 1499 | delete mSyncActionDialog; |
@@ -1598,3 +1610,3 @@ void KCommandSocket::writeFileToSocket() | |||
1598 | os2.setEncoding( QTextStream::Latin1 ); | 1610 | os2.setEncoding( QTextStream::Latin1 ); |
1599 | os2 << "PUT " << mPassWord << "\r\n\r\n";; | 1611 | os2 << "PUT " << mPassWord << mRemoteResource << "\r\n\r\n";; |
1600 | int byteCount = 0; | 1612 | int byteCount = 0; |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index f4654ce..53c611d 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -55,2 +55,4 @@ class KServerSocket : public QServerSocket | |||
55 | void request_file(); | 55 | void request_file(); |
56 | void file_received( bool, const QString &); | ||
57 | void request_file(const QString &); | ||
56 | void saveFile(); | 58 | void saveFile(); |
@@ -64,2 +66,3 @@ class KServerSocket : public QServerSocket | |||
64 | private : | 66 | private : |
67 | QString mResource; | ||
65 | int mErrorMessage; | 68 | int mErrorMessage; |
@@ -176,2 +179,5 @@ class KSyncManager : public QObject | |||
176 | void getFile( bool ); | 179 | void getFile( bool ); |
180 | void getFile( bool, const QString &); | ||
181 | void request_file(const QString &); | ||
182 | void multiResourceSyncStart( bool ); | ||
177 | 183 | ||