-rw-r--r-- | korganizer/calendarview.cpp | 43 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | libkcal/calendar.h | 4 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 8 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 12 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 3 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 18 |
8 files changed, 35 insertions, 59 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9160e1d..cbe2a10 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -911,2 +911,8 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t } +void CalendarView::checkExternalId( Incidence * inc ) +{ + QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; + checkExternSyncEvent( lastSync, inc ); + +} bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) @@ -1028,3 +1034,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int pref = "t"; - if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it + if ( des.find(pref+QString::number( inR->getID(mCurrentSyncDevice) ) +"," ) >= 0 && mode != 5) { // delete it inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); @@ -1078,3 +1084,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { - if ( inL->zaurusId() >= 0 && mode != 4 ) { + if ( inL->getID(mCurrentSyncDevice) >= 0 && mode != 4 ) { local->deleteIncidence( inL ); @@ -1083,3 +1089,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { - inL->setZaurusId( -1 ); + inL->setID(mCurrentSyncDevice, -1 ); ++addedEventR; @@ -1202,3 +1208,3 @@ void CalendarView::syncSharp() if ( loc ) { - loc->setZaurusId( inc->zaurusId() ); + loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); loc->setZaurusUid( inc->zaurusUid() ); @@ -1831,18 +1837,3 @@ void CalendarView::changeTodoDisplay(Todo *which, int action) } -void CalendarView::checkZaurusId( int id, bool todo ) -{ - if ( id >= 0 ) { - Incidence* lse = mCalendar->event( "last-syncEvent-Sharp-DTM"); - if ( lse ) { - QString des = lse->description(); - QString pref = "e"; - if ( todo ) - pref = "t"; - des += pref+ QString::number ( id ) + ","; - lse->setReadOnly( false ); - lse->setDescription( des ); - lse->setReadOnly( true ); - } - } -} + void CalendarView::changeIncidenceDisplay(Incidence *which, int action) @@ -2578,3 +2569,3 @@ void CalendarView::deleteTodo(Todo *todo) } else { - checkZaurusId( todo->zaurusId(), true ); + checkExternalId( todo ); calendar()->deleteTodo(todo); @@ -2590,3 +2581,3 @@ void CalendarView::deleteTodo(Todo *todo) } else { - checkZaurusId( todo->zaurusId(), true ); + checkExternalId( todo ); mCalendar->deleteTodo(todo); @@ -2652,3 +2643,3 @@ void CalendarView::deleteEvent(Event *anEvent) - checkZaurusId( anEvent->zaurusId()); + checkExternalId( anEvent); mCalendar->deleteEvent(anEvent); @@ -2686,3 +2677,3 @@ void CalendarView::deleteEvent(Event *anEvent) schedule(Scheduler::Cancel,anEvent); - checkZaurusId( anEvent->zaurusId()); + checkExternalId( anEvent); mCalendar->deleteEvent(anEvent); @@ -2694,3 +2685,3 @@ void CalendarView::deleteEvent(Event *anEvent) schedule(Scheduler::Cancel,anEvent); - checkZaurusId( anEvent->zaurusId()); + checkExternalId( anEvent); mCalendar->deleteEvent(anEvent); @@ -3448,3 +3439,3 @@ bool CalendarView::removeCompletedSubTodos( Todo* t ) if ( t->isCompleted() ) { - checkZaurusId( t->zaurusId(), true ); + checkExternalId( t ); mCalendar->deleteTodo( t ); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 557554f..f7a1213 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -485,3 +485,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); - void checkZaurusId( int id, bool todo = false ); + void checkExternalId( Incidence * inc ); int mGlobalSyncMode; diff --git a/libkcal/calendar.h b/libkcal/calendar.h index df5bbcf..d59bca6 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -164,3 +164,3 @@ public: virtual Event *event( const QString &UniqueStr ) = 0; - virtual Event *event( int ) = 0; + virtual Event *event( QString, int ) = 0; /** @@ -213,3 +213,3 @@ public: virtual Todo *todo( const QString &uid ) = 0; - virtual Todo *todo( int ) = 0; + virtual Todo *todo( QString, int ) = 0; /** diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 09ce9f0..e464a77 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -214,3 +214,3 @@ QPtrList<Todo> CalendarLocal::rawTodos() } -Todo *CalendarLocal::todo( int id ) +Todo *CalendarLocal::todo( QString syncProf, int id ) { @@ -218,3 +218,3 @@ Todo *CalendarLocal::todo( int id ) for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { - if ( todo->zaurusId() == id ) return todo; + if ( todo->getID( syncProf ) == id ) return todo; } @@ -237,3 +237,3 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents() } -Event *CalendarLocal::event( int id ) +Event *CalendarLocal::event( QString syncProf, int id ) { @@ -241,3 +241,3 @@ Event *CalendarLocal::event( int id ) for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { - if ( todo->zaurusId() == id ) return todo; + if ( todo->getID( syncProf ) == id ) return todo; } diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 3257198..4728063 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -177,4 +177,4 @@ class CalendarLocal : public Calendar bool inclusive = false ); - Todo *CalendarLocal::todo( int uid ); - Event *CalendarLocal::event( int uid ); + Todo *todo( QString, int uid ); + Event *event( QString,int uid ); diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index f1db8b7..5d8785b 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -40,3 +40,2 @@ IncidenceBase::IncidenceBase() : mPilotId = 0; - mZaurusId = -1; mZaurusUid = 0; @@ -64,3 +63,2 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) : mPilotId = i.mPilotId; - mZaurusId = i.mZaurusId; mZaurusUid = i.mZaurusUid; @@ -344,12 +342,2 @@ int IncidenceBase::pilotId() const } -void IncidenceBase::setZaurusId( int id ) -{ - if (mReadOnly) return; - mZaurusId = id; -} - -int IncidenceBase::zaurusId() const -{ - return mZaurusId; -} diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 2f85df6..e2950d3 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -128,4 +128,2 @@ class IncidenceBase : public CustomProperties - void setZaurusId(int id); - int zaurusId() const; void setZaurusUid(int id); @@ -163,3 +161,2 @@ class IncidenceBase : public CustomProperties QString mExternalId; - int mZaurusId; int mZaurusUid; diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index d39d2dd..605a54d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp @@ -87,3 +87,3 @@ class SharpParser : public QObject Event *event; - event = existingCalendar->event( attList[0].toInt() ); + event = existingCalendar->event( "Sharp_DTM",attList[0].toInt() ); if ( event ) @@ -92,3 +92,3 @@ class SharpParser : public QObject event = new Event; - event->setZaurusId( attList[0].toInt() ); + event->setID("Sharp_DTM", attList[0].toInt() ); event->setZaurusUid( cSum ); @@ -191,3 +191,3 @@ class SharpParser : public QObject - todo = existingCalendar->todo( attList[0].toInt() ); + todo = existingCalendar->todo( "Sharp_DTM", attList[0].toInt() ); if (todo ) @@ -203,3 +203,3 @@ class SharpParser : public QObject - todo->setZaurusId( attList[0].toInt() ); + todo->setID( "Sharp_DTM", attList[0].toInt() ); todo->setZaurusUid( cSum ); @@ -468,3 +468,3 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) retval = newnum; - inc->setZaurusId( newnum ); + inc->setID( "Sharp_DTM",newnum ); inc->setZaurusUid( getCsum( templist ) ); @@ -522,3 +522,3 @@ bool SharpFormat::save( Calendar *calendar) } - else if ( ev->zaurusId() == -1 ) { // add new + else if ( ev->getID("Sharp_DTM") == -1 ) { // add new command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; @@ -608,3 +608,3 @@ bool SharpFormat::save( Calendar *calendar) } - else if ( to->zaurusId() == -1 ) { // add new + else if ( to->getID("Sharp_DTM") == -1 ) { // add new command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; @@ -698,3 +698,3 @@ QString SharpFormat::getEventString( Event* event ) QStringList list; - list.append( QString::number(event->zaurusId() ) ); + list.append( QString::number(event->getID("Sharp_DTM") ) ); list.append( event->categories().join(",") ); @@ -862,3 +862,3 @@ QString SharpFormat::getTodoString( Todo* todo ) QStringList list; - list.append( QString::number( todo->zaurusId() ) ); + list.append( QString::number( todo->getID("Sharp_DTM") ) ); list.append( todo->categories().join(",") ); |