author | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
commit | 2468bddcb380d8621d5bb49b69b3492d90562d93 (patch) (side-by-side diff) | |
tree | c310f4fff5e476087e8406614e57a7f258f1b14f | |
parent | 7a439999b9fa2bd7ad76e195cdf95bf5211952cb (diff) | |
download | kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.zip kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.gz kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.bz2 |
sync
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 25 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 5 |
5 files changed, 29 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 307027a..e45240a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1653,13 +1653,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( eventLSync->dtStart() == mLastCalendarSync ) fullDateRange = true; if ( ! fullDateRange ) { if ( eventLSync->dtStart() != eventRSync->dtStart() ) { - qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); + qDebug("KO: Sync: Set fulldate to true! Local: %s --- Remote: %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); fullDateRange = true; } } if ( mSyncManager->syncWithDesktop() ) { fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 0a94914..66836a1 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -313,12 +313,13 @@ public: QString loadedProductId(); int defaultCalendar(); void setDontDeleteIncidencesOnClose (); public slots: void setDefaultCalendar( int ); virtual void setCalendarEnabled( int id, bool enable ) = 0; + virtual void setAllCalendarEnabled( bool enable ) = 0; virtual void setAlarmEnabled( int id, bool enable ) = 0; virtual void setReadOnly( int id, bool enable ) = 0; virtual void setDefaultCalendarEnabledOnly() = 0; virtual void setCalendarRemove( int id ) = 0; virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 45e3128..2a57724 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -187,29 +187,39 @@ void CalendarLocal::setSyncEventsReadOnly() { Event * ev; ev = mEventList.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) { ev->setReadOnly( true ); - ev->setCalID( 1 ); } ev = mEventList.next(); } } + void CalendarLocal::addCalendar( Calendar* cal ) { cal->setDontDeleteIncidencesOnClose(); + setSyncEventsEnabled(); { QPtrList<Event> EventList = cal->rawEvents(); + QPtrList<Event> el; Event * ev = EventList.first(); while ( ev ) { + if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { + Event * se = event( ev->uid() ); + if ( se ) + el.append( se ); + } ev->unRegisterObserver( cal ); ev->registerObserver( this ); mEventList.append( ev ); ev = EventList.next(); } + for ( ev = el.first(); ev; ev = el.next() ) { + deleteIncidence ( ev ); + } } { QPtrList<Todo> TodoList = cal->rawTodos(); Todo * ev = TodoList.first(); while ( ev ) { @@ -1000,12 +1010,25 @@ void CalendarLocal::setCalendarRemove( int id ) } clearUndo(0); } +void CalendarLocal::setAllCalendarEnabled( bool enable ) +{ + for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) + it->setCalEnabled( enable ); + + for ( Event *it = mEventList.first(); it; it = mEventList.next() ) + it->setCalEnabled( enable ); + + for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) + it->setCalEnabled( enable ); + + +} void CalendarLocal::setCalendarEnabled( int id, bool enable ) { for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) if ( it->calID() == id ) it->setCalEnabled( enable ); for ( Event *it = mEventList.first(); it; it = mEventList.next() ) diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index eb7bf34..b70f0c9 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -191,12 +191,13 @@ class CalendarLocal : public Calendar public slots: void setCalendarEnabled( int id, bool enable ); void setAlarmEnabled( int id, bool enable ); void setReadOnly( int id, bool enable ); void setDefaultCalendarEnabledOnly(); void setCalendarRemove( int id ); + void setAllCalendarEnabled( bool enable ); protected: // Event* mNextAlarmEvent; QString mNextSummary; QString mNextAlarmEventDateTimeString; diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 795cd30..d2cb71b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1137,31 +1137,30 @@ void KSyncManager::syncPi() mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); mPisyncFinished = true; return; } mCurrentResourceLocal = ""; mCurrentResourceRemote = ""; - qDebug ( "KSM: sync pi %d",mSpecificResources.count() ); if ( mSpecificResources.count() ) { int lastSyncRes = mSpecificResources.count()/2; int ccc = mSpecificResources.count()-1; while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { --ccc; --lastSyncRes; - qDebug ( "KSM: sync pi %d",ccc ); + //qDebug ( "KSM: sync pi %d",ccc ); } int startLocal = 0; int startRemote = mSpecificResources.count()/2; emit multiResourceSyncStart( true ); while ( startLocal < mSpecificResources.count()/2 ) { if ( startLocal+1 >= lastSyncRes ) emit multiResourceSyncStart( false ); mPisyncFinished = false; mCurrentResourceLocal = mSpecificResources[ startLocal ]; mCurrentResourceRemote = mSpecificResources[ startRemote ]; - qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); + //qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); if ( !mCurrentResourceRemote.isEmpty() ) { qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); commandSocket->readFile( syncFileName() ); while ( !mPisyncFinished ) { |