-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 |
6 files changed, 17 insertions, 32 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index df5bbcf..d59bca6 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -159,13 +159,13 @@ public: */ virtual void deleteEvent( Event * ) = 0; /** 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. The calendar filter is applied. */ QPtrList<Event> events( const QDate &date, bool sorted = false); @@ -208,13 +208,13 @@ public: virtual QPtrList<Todo> todos(); /** Searches todolist for an event with this unique string identifier, 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. */ virtual QPtrList<Todo> todos( const QDate &date ) = 0; /** Return unfiltered list of todos. diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 09ce9f0..e464a77 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -209,17 +209,17 @@ void CalendarLocal::deleteTodo( Todo *todo ) } 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; } QPtrList<Event> CalendarLocal::getExternLastSyncEvents() @@ -232,17 +232,17 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents() el.append( todo ); } 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; } Todo *CalendarLocal::todo( const QString &uid ) { diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 3257198..4728063 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -172,14 +172,14 @@ class CalendarLocal : public Calendar /** Get unfiltered events in a range of dates. If inclusive is set to true, only events are returned, which are completely included in the range. */ 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 ); protected: // Event* mNextAlarmEvent; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index f1db8b7..5d8785b 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -35,13 +35,12 @@ IncidenceBase::IncidenceBase() : setUid(CalFormat::createUniqueId()); mOrganizer = ""; mFloats = false; mDuration = 0; mHasDuration = false; mPilotId = 0; - mZaurusId = -1; mZaurusUid = 0; mExternalId = ":"; mTempSyncStat = 0; mSyncStatus = 0; mAttendees.setAutoDelete( true ); } @@ -59,13 +58,12 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) : for( Attendee *a = attendees.first(); a; a = attendees.next() ) { mAttendees.append( new Attendee( *a ) ); } mFloats = i.mFloats; mLastModified = i.mLastModified; mPilotId = i.mPilotId; - mZaurusId = i.mZaurusId; mZaurusUid = i.mZaurusUid; mTempSyncStat = i.mTempSyncStat; mSyncStatus = i.mSyncStatus; mExternalId = i.mExternalId; // The copied object is a new one, so it isn't observed by the observer // of the original object. @@ -339,22 +337,12 @@ void IncidenceBase::setPilotId( int id ) } 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 { return mZaurusUid; } void IncidenceBase::setZaurusUid( int id ) diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 2f85df6..e2950d3 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -123,14 +123,12 @@ class IncidenceBase : public CustomProperties /** Set Pilot Id. */ void setPilotId(int id); /** Return Pilot Id. */ int pilotId() const; - void setZaurusId(int id); - int zaurusId() const; void setZaurusUid(int id); int zaurusUid() const; void setTempSyncStat(int id); int tempSyncStat() const; void setIDStr( const QString & ); QString IDStr() const; @@ -158,13 +156,12 @@ class IncidenceBase : public CustomProperties bool mFloats; int mDuration; bool mHasDuration; QString mExternalId; - int mZaurusId; int mZaurusUid; int mTempSyncStat; // PILOT SYNCHRONIZATION STUFF int mPilotId; // unique id for pilot sync int mSyncStatus; // status (for sync) diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index d39d2dd..605a54d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp @@ -82,18 +82,18 @@ class SharpParser : public QObject if ( skip ) return false; ulong cSum = SharpFormat::getCsum(attList ); 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 ); event->setSummary( attList[2] ); event->setLocation( attList[3] ); event->setDescription( attList[4] ); @@ -186,25 +186,25 @@ class SharpParser : public QObject } mCalendar->addEvent( event); } 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 todo = new Todo; //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 // 0 1 2 3 4 5 6 7 8 //1,,,,,1,4,Loch zumachen,"" //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 ); todo->setSummary( attList[7] ); todo->setDescription( attList[8]); @@ -463,13 +463,13 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) if ( ccc == 2 && loopCount < 25 ) { start = 0; bool ok; 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 ); } } } //qDebug("getNumFromRecord returning : %d ", retval); @@ -517,13 +517,13 @@ bool SharpFormat::save( Calendar *calendar) eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); changeString += eString + "\n"; deleteString += eString + "\n"; 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 ); if (!file.open( IO_ReadOnly ) ) { return false; @@ -603,13 +603,13 @@ bool SharpFormat::save( Calendar *calendar) eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); changeString += eString + "\n"; deleteString += eString + "\n"; 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 ); if (!file.open( IO_ReadOnly ) ) { return false; @@ -693,13 +693,13 @@ QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) } return datestr + timestr; } 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() ); else list.append("" ); if ( !event->location().isEmpty() ) @@ -857,13 +857,13 @@ 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() ) { list.append( dtToString( todo->dtStart()) ); } else list.append( QString() ); |