-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 12 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 6 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 14 |
5 files changed, 18 insertions, 26 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index fd68dc4..b543eca 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -992,25 +992,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->deleteIncidence( inL ); local->addIncidence( inR->clone() ); ++changedLocal; } } } else { // no conflict if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; if ( inR->type() == "Todo" ) pref = "t"; if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it - inR->setZaurusStat( SYNC_TEMPSTATE_DELETE ); + inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); //remote->deleteIncidence( inR ); ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); local->addIncidence( inR->clone() ); ++addedEvent; } } else { if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { inR->setLastModified( modifiedCalendar ); local->addIncidence( inR->clone() ); ++addedEvent; @@ -1162,25 +1162,25 @@ void CalendarView::syncSharp() /* obsolete while ( inc ) { inc->setZaurusStat( inc->revision () ); inc = iL.next(); } */ // pending: clean last sync event description sharpFormat.save(calendar); iL = calendar->rawIncidences(); inc = iL.first(); Incidence* loc; while ( inc ) { - if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) { + if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { loc = mCalendar->incidence(inc->uid() ); if ( loc ) { loc->setZaurusId( inc->zaurusId() ); loc->setZaurusUid( inc->zaurusUid() ); } } inc = iL.next(); } Incidence* lse = getLastSyncEvent(); if ( lse ) { lse->setReadOnly( false ); lse->setDescription( "" ); diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 3437f45..df05ab3 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -265,27 +265,24 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) // TODO: move this application-specific code to kpilot if (incidence->pilotId()) { incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId())); incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus())); } if (incidence->zaurusId() >= 0) { incidence->setNonKDECustomProperty("X-ZAURUSID", QString::number(incidence->zaurusId())); } if (incidence->zaurusUid() > 0) { incidence->setNonKDECustomProperty("X-ZAURUSUID", QString::number(incidence->zaurusUid())); } - if (incidence->zaurusStat() > 0) { - incidence->setNonKDECustomProperty("X-ZAURUSSTAT", QString::number(incidence->zaurusStat())); - } writeIncidenceBase(parent,incidence); if (incidence->cancelled()) { icalcomponent_add_property(parent,icalproperty_new_status(ICAL_STATUS_CANCELLED)); } // creation date icalcomponent_add_property(parent,icalproperty_new_created( writeICalDateTime(incidence->created()))); // unique id icalcomponent_add_property(parent,icalproperty_new_uid( @@ -1284,29 +1281,24 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) incidence->setSyncStatus(kp.toInt()); } kp = incidence->nonKDECustomProperty("X-ZAURUSID"); if (!kp.isNull()) { incidence->setZaurusId(kp.toInt()); } kp = incidence->nonKDECustomProperty("X-ZAURUSUID"); if (!kp.isNull()) { incidence->setZaurusUid(kp.toInt()); } - kp = incidence->nonKDECustomProperty("X-ZAURUSSTAT"); - if (!kp.isNull()) { - incidence->setZaurusStat(kp.toInt()); - } - // Cancel backwards compatibility mode for subsequent changes by the application incidence->recurrence()->setCompatVersion(); // add categories incidence->setCategories(categories); // iterate through all alarms for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); alarm; alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { readAlarm(alarm,incidence); } diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 9479048..707d666 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -31,48 +31,48 @@ using namespace KCal; IncidenceBase::IncidenceBase() : mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), mPilotId(0), mSyncStatus(SYNCMOD) { setUid(CalFormat::createUniqueId()); mOrganizer = ""; mFloats = false; mDuration = 0; mHasDuration = false; mPilotId = 0; mZaurusId = -1; mZaurusUid = 0; - mZaurusStat = 0; + mTempSyncStat = 0; mSyncStatus = 0; mAttendees.setAutoDelete( true ); } IncidenceBase::IncidenceBase(const IncidenceBase &i) : CustomProperties( i ) { mReadOnly = i.mReadOnly; mDtStart = i.mDtStart; mDuration = i.mDuration; mHasDuration = i.mHasDuration; mOrganizer = i.mOrganizer; mUid = i.mUid; QPtrList<Attendee> attendees = i.attendees(); 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; - mZaurusStat = i.mZaurusStat; + mTempSyncStat = i.mTempSyncStat; mSyncStatus = i.mSyncStatus; // The copied object is a new one, so it isn't observed by the observer // of the original object. mObservers.clear(); mAttendees.setAutoDelete( true ); } IncidenceBase::~IncidenceBase() { } @@ -353,32 +353,32 @@ int IncidenceBase::zaurusId() const } int IncidenceBase::zaurusUid() const { return mZaurusUid; } void IncidenceBase::setZaurusUid( int id ) { if (mReadOnly) return; mZaurusUid = id; } -int IncidenceBase::zaurusStat() const +int IncidenceBase::tempSyncStat() const { - return mZaurusStat; + return mTempSyncStat; } -void IncidenceBase::setZaurusStat( int id ) +void IncidenceBase::setTempSyncStat( int id ) { if (mReadOnly) return; - mZaurusStat = id; + mTempSyncStat = id; } void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) { if( !mObservers.contains(observer) ) mObservers.append( observer ); } void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) { mObservers.remove( observer ); } diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 0ab7eef..ce6e254 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -121,50 +121,50 @@ class IncidenceBase : public CustomProperties /** Return synchronisation status. */ int syncStatus() const; /** 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 setZaurusStat(int id); - int zaurusStat() const; + void setTempSyncStat(int id); + int tempSyncStat() const; void registerObserver( Observer * ); void unRegisterObserver( Observer * ); void updated(); protected: bool mReadOnly; QDateTime getEvenTime( QDateTime ); private: // base components QDateTime mDtStart; QString mOrganizer; QString mUid; QDateTime mLastModified; QPtrList<Attendee> mAttendees; bool mFloats; int mDuration; bool mHasDuration; int mZaurusId; int mZaurusUid; - int mZaurusStat; + int mTempSyncStat; // PILOT SYNCHRONIZATION STUFF int mPilotId; // unique id for pilot sync int mSyncStatus; // status (for sync) QPtrList<Observer> mObservers; }; bool operator==( const IncidenceBase&, const IncidenceBase& ); } #endif diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 973f19d..d39d2dd 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp @@ -83,25 +83,25 @@ class SharpParser : public QObject return false; ulong cSum = SharpFormat::getCsum(attList ); if ( qName == "Event" ) { Event *event; event = existingCalendar->event( attList[0].toInt() ); if ( event ) event = (Event*)event->clone(); else event = new Event; event->setZaurusId( attList[0].toInt() ); event->setZaurusUid( cSum ); - event->setZaurusStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); + event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); event->setSummary( attList[2] ); event->setLocation( attList[3] ); event->setDescription( attList[4] ); if ( attList[7] == "1" ) { event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 ))); event->setFloats( true ); } else { event->setFloats( false ); event->setDtStart( fromString( attList[5] ) ); event->setDtEnd( fromString( attList[6] )); @@ -194,25 +194,25 @@ class SharpParser : public QObject 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->setZaurusUid( cSum ); - todo->setZaurusStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); + todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); todo->setSummary( attList[7] ); todo->setDescription( attList[8]); int priority = attList[6].toInt(); if ( priority == 0 ) priority = 3; todo->setPriority( priority ); QString categoryList = attList[1]; todo->setCategories( lookupCategories( categoryList ) ); @@ -459,25 +459,25 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) templist.append( tempString ); } ++ccc; 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->setZaurusUid( getCsum( templist ) ); - inc->setZaurusStat( SYNC_TEMPSTATE_NEW_ID ); + inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); } } } //qDebug("getNumFromRecord returning : %d ", retval); return retval; } bool SharpFormat::save( Calendar *calendar) { QLabel status ( i18n("Processing/adding events ..."), 0 ); int w = status.sizeHint().width()+20 ; if ( w < 200 ) w = 200; @@ -498,29 +498,29 @@ bool SharpFormat::save( Calendar *calendar) QPtrList<Event> er = calendar->rawEvents(); Event* ev = er.first(); QString fileName = "/tmp/kopitempout"; int i = 0; QString changeString = ePrefix; QString deleteString = ePrefix; bool deleteEnt = false; bool changeEnt = false; QString message = i18n("Processing event # "); int procCount = 0; while ( ev ) { //qDebug("i %d ", ++i); - if ( ev->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { + if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { status.setText ( message + QString::number ( ++procCount ) ); qApp->processEvents(); QString eString = getEventString( ev ); - if ( ev->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete + if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete // deleting empty strings does not work. // we write first and x and then delete the record with the x eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); changeString += eString + "\n"; deleteString += eString + "\n"; deleteEnt = true; changeEnt = true; } else if ( ev->zaurusId() == -1 ) { // add new command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; system ( command.utf8() ); QFile file( fileName ); @@ -584,29 +584,29 @@ bool SharpFormat::save( Calendar *calendar) changeString = tPrefix; deleteString = tPrefix; status.setText ( i18n("Processing todos ...") ); qApp->processEvents(); QPtrList<Todo> tl = calendar->rawTodos(); Todo* to = tl.first(); i = 0; message = i18n("Processing todo # "); procCount = 0; while ( to ) { - if ( to->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { + if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { status.setText ( message + QString::number ( ++procCount ) ); qApp->processEvents(); QString eString = getTodoString( to ); - if ( to->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete + if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete // deleting empty strings does not work. // we write first and x and then delete the record with the x eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); changeString += eString + "\n"; deleteString += eString + "\n"; deleteEnt = true; changeEnt = true; } else if ( to->zaurusId() == -1 ) { // add new command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; system ( command.utf8() ); QFile file( fileName ); |