-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 @@ -988,33 +988,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++changedRemote; } else { if ( inR->revision() < maxrev ) inR->setRevision( maxrev ); 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; } else { checkSharpEvent(eventRSyncSharp, inR); remote->deleteIncidence( inR ); ++deletedEventR; @@ -1158,33 +1158,33 @@ void CalendarView::syncSharp() if ( KOPrefs::instance()->mWriteBackFile ) { QPtrList<Incidence> iL = mCalendar->rawIncidences(); Incidence* inc = iL.first(); /* 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( "" ); lse->setReadOnly( true ); } } } diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 3437f45..df05ab3 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -261,35 +261,32 @@ icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) { // pilot sync stuff // 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( incidence->uid().utf8())); // revision icalcomponent_add_property(parent,icalproperty_new_sequence( @@ -1280,37 +1277,32 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) incidence->setPilotId(kp.toInt()); } kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); if (!kp.isNull()) { 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); } } void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) { diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 9479048..707d666 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -27,56 +27,56 @@ #include "incidencebase.h" 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() { } bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) { @@ -349,40 +349,40 @@ void IncidenceBase::setZaurusId( int id ) int IncidenceBase::zaurusId() const { return mZaurusId; } 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 ); } void IncidenceBase::updated() { QPtrListIterator<Observer> it(mObservers); while( it.current() ) { diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 0ab7eef..ce6e254 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -117,54 +117,54 @@ class IncidenceBase : public CustomProperties /** pilot syncronization states */ enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; /** Set synchronisation satus. */ void setSyncStatus(int stat); /** 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 @@ -79,33 +79,33 @@ class SharpParser : public QObject } ++i ; } if ( skip ) 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] )); } QString rtype = attList[11]; if ( rtype != "255" ) { @@ -190,33 +190,33 @@ class SharpParser : public QObject Todo *todo; todo = existingCalendar->todo( 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->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 ) ); QString hasDateStr = attList[3]; // due if ( !hasDateStr.isEmpty() ) { if ( hasDateStr.right(6) == "000000" ) { @@ -455,33 +455,33 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) ok = false; } if ( tempString.right(1) =="\n" ) tempString = tempString.left( tempString.length()-1); 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; int h = status.sizeHint().height()+20 ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); status.setCaption(i18n("Writing DTM Data") ); @@ -494,37 +494,37 @@ bool SharpFormat::save( Calendar *calendar) QString answer; QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; QString command; 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 ); if (!file.open( IO_ReadOnly ) ) { return false; } @@ -580,37 +580,37 @@ bool SharpFormat::save( Calendar *calendar) command = "db2file datebook -d -c " + codec+ " < "+ fileName; system ( command.latin1() ); // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); } 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 ); if (!file.open( IO_ReadOnly ) ) { return false; } |