summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp43
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--libkcal/calendar.h4
-rw-r--r--libkcal/calendarlocal.cpp8
-rw-r--r--libkcal/calendarlocal.h4
-rw-r--r--libkcal/incidencebase.cpp12
-rw-r--r--libkcal/incidencebase.h3
-rw-r--r--libkcal/sharpformat.cpp18
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
@@ -909,6 +909,12 @@ 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 )
{
bool syncOK = true;
@@ -1026,7 +1032,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QString pref = "e";
if ( inR->type() == "Todo" )
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 );
//remote->deleteIncidence( inR );
++deletedEventR;
@@ -1076,12 +1082,12 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR = remote->incidence( uid );
if ( ! inR ) {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- if ( inL->zaurusId() >= 0 && mode != 4 ) {
+ if ( inL->getID(mCurrentSyncDevice) >= 0 && mode != 4 ) {
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
- inL->setZaurusId( -1 );
+ inL->setID(mCurrentSyncDevice, -1 );
++addedEventR;
inL->setLastModified( modifiedCalendar );
remote->addIncidence( inL->clone() );
@@ -1200,7 +1206,7 @@ void CalendarView::syncSharp()
if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
if ( loc ) {
- loc->setZaurusId( inc->zaurusId() );
+ loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
loc->setZaurusUid( inc->zaurusUid() );
}
}
@@ -1829,22 +1835,7 @@ void CalendarView::changeTodoDisplay(Todo *which, int action)
{
changeIncidenceDisplay((Incidence *)which, 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)
{
updateUnmanagedViews();
@@ -2576,7 +2567,7 @@ void CalendarView::deleteTodo(Todo *todo)
KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
i18n("Delete To-Do"));
} else {
- checkZaurusId( todo->zaurusId(), true );
+ checkExternalId( todo );
calendar()->deleteTodo(todo);
changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
updateView();
@@ -2588,7 +2579,7 @@ void CalendarView::deleteTodo(Todo *todo)
KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
i18n("Delete To-Do"));
} else {
- checkZaurusId( todo->zaurusId(), true );
+ checkExternalId( todo );
mCalendar->deleteTodo(todo);
changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
updateView();
@@ -2650,7 +2641,7 @@ void CalendarView::deleteEvent(Event *anEvent)
if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
schedule(Scheduler::Cancel,anEvent);
- checkZaurusId( anEvent->zaurusId());
+ checkExternalId( anEvent);
mCalendar->deleteEvent(anEvent);
changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
break;
@@ -2684,7 +2675,7 @@ void CalendarView::deleteEvent(Event *anEvent)
case KMessageBox::Continue: // OK
if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
schedule(Scheduler::Cancel,anEvent);
- checkZaurusId( anEvent->zaurusId());
+ checkExternalId( anEvent);
mCalendar->deleteEvent(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
break;
@@ -2692,7 +2683,7 @@ void CalendarView::deleteEvent(Event *anEvent)
} else {
if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
schedule(Scheduler::Cancel,anEvent);
- checkZaurusId( anEvent->zaurusId());
+ checkExternalId( anEvent);
mCalendar->deleteEvent(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
}
@@ -3446,7 +3437,7 @@ bool CalendarView::removeCompletedSubTodos( Todo* t )
}
if ( deleteTodo ) {
if ( t->isCompleted() ) {
- checkZaurusId( t->zaurusId(), true );
+ checkExternalId( t );
mCalendar->deleteTodo( t );
changeTodoDisplay( t,KOGlobals::EVENTDELETED );
}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 557554f..f7a1213 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -483,7 +483,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QDateTime loadedFileVersion;
void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
- void checkZaurusId( int id, bool todo = false );
+ void checkExternalId( Incidence * inc );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index df5bbcf..d59bca6 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -162,7 +162,7 @@ public:
Retrieves an event on the basis of the unique string ID.
*/
virtual Event *event( const QString &UniqueStr ) = 0;
- virtual Event *event( int ) = 0;
+ virtual Event *event( QString, int ) = 0;
/**
Builds and then returns a list of all events that match for the
date specified. useful for dayView, etc. etc.
@@ -211,7 +211,7 @@ public:
returns a pointer or null.
*/
virtual Todo *todo( const QString &uid ) = 0;
- virtual Todo *todo( int ) = 0;
+ virtual Todo *todo( QString, int ) = 0;
/**
Returns list of todos due on the specified date.
*/
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 09ce9f0..e464a77 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -212,11 +212,11 @@ QPtrList<Todo> CalendarLocal::rawTodos()
{
return mTodoList;
}
-Todo *CalendarLocal::todo( int id )
+Todo *CalendarLocal::todo( QString syncProf, int id )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
- if ( todo->zaurusId() == id ) return todo;
+ if ( todo->getID( syncProf ) == id ) return todo;
}
return 0;
@@ -235,11 +235,11 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
return el;
}
-Event *CalendarLocal::event( int id )
+Event *CalendarLocal::event( QString syncProf, int id )
{
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
- if ( todo->zaurusId() == id ) return todo;
+ if ( todo->getID( syncProf ) == id ) return todo;
}
return 0;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 3257198..4728063 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -175,8 +175,8 @@ class CalendarLocal : public Calendar
*/
QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
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
@@ -38,7 +38,6 @@ IncidenceBase::IncidenceBase() :
mDuration = 0;
mHasDuration = false;
mPilotId = 0;
- mZaurusId = -1;
mZaurusUid = 0;
mExternalId = ":";
mTempSyncStat = 0;
@@ -62,7 +61,6 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) :
mFloats = i.mFloats;
mLastModified = i.mLastModified;
mPilotId = i.mPilotId;
- mZaurusId = i.mZaurusId;
mZaurusUid = i.mZaurusUid;
mTempSyncStat = i.mTempSyncStat;
mSyncStatus = i.mSyncStatus;
@@ -342,16 +340,6 @@ int IncidenceBase::pilotId() const
{
return mPilotId;
}
-void IncidenceBase::setZaurusId( int id )
-{
- if (mReadOnly) return;
- mZaurusId = id;
-}
-
-int IncidenceBase::zaurusId() const
-{
- return mZaurusId;
-}
int IncidenceBase::zaurusUid() const
{
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 2f85df6..e2950d3 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -126,8 +126,6 @@ class IncidenceBase : public CustomProperties
/** Return Pilot Id. */
int pilotId() const;
- void setZaurusId(int id);
- int zaurusId() const;
void setZaurusUid(int id);
int zaurusUid() const;
void setTempSyncStat(int id);
@@ -161,7 +159,6 @@ class IncidenceBase : public CustomProperties
int mDuration;
bool mHasDuration;
QString mExternalId;
- int mZaurusId;
int mZaurusUid;
int mTempSyncStat;
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index d39d2dd..605a54d 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -85,12 +85,12 @@ class SharpParser : public QObject
if ( qName == "Event" ) {
Event *event;
- event = existingCalendar->event( attList[0].toInt() );
+ event = existingCalendar->event( "Sharp_DTM",attList[0].toInt() );
if ( event )
event = (Event*)event->clone();
else
event = new Event;
- event->setZaurusId( attList[0].toInt() );
+ event->setID("Sharp_DTM", attList[0].toInt() );
event->setZaurusUid( cSum );
event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
@@ -189,7 +189,7 @@ class SharpParser : public QObject
} else if ( qName == "Todo" ) {
Todo *todo;
- todo = existingCalendar->todo( attList[0].toInt() );
+ todo = existingCalendar->todo( "Sharp_DTM", attList[0].toInt() );
if (todo )
todo = (Todo*)todo->clone();
else
@@ -201,7 +201,7 @@ class SharpParser : public QObject
//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
- todo->setZaurusId( attList[0].toInt() );
+ todo->setID( "Sharp_DTM", attList[0].toInt() );
todo->setZaurusUid( cSum );
todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
@@ -466,7 +466,7 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
int newnum = templist[0].toInt( &ok );
if ( ok && newnum > 0) {
retval = newnum;
- inc->setZaurusId( newnum );
+ inc->setID( "Sharp_DTM",newnum );
inc->setZaurusUid( getCsum( templist ) );
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
@@ -520,7 +520,7 @@ bool SharpFormat::save( Calendar *calendar)
deleteEnt = true;
changeEnt = true;
}
- 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;
system ( command.utf8() );
QFile file( fileName );
@@ -606,7 +606,7 @@ bool SharpFormat::save( Calendar *calendar)
deleteEnt = true;
changeEnt = true;
}
- 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;
system ( command.utf8() );
QFile file( fileName );
@@ -696,7 +696,7 @@ QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ )
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(",") );
if ( !event->summary().isEmpty() )
list.append( event->summary() );
@@ -860,7 +860,7 @@ QString SharpFormat::getEventString( Event* event )
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(",") );
if ( todo->hasStartDate() ) {