summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/icalformatimpl.cpp16
-rw-r--r--libkcal/incidencebase.cpp81
-rw-r--r--libkcal/incidencebase.h8
3 files changed, 92 insertions, 13 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index df05ab3..c23978d 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -269,9 +269,6 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
}
- if (incidence->zaurusId() >= 0) {
- incidence->setNonKDECustomProperty("X-ZAURUSID", QString::number(incidence->zaurusId()));
+ if ( !incidence->IDStr().isEmpty()) {
+ incidence->setNonKDECustomProperty("X-KOPIEXTID",incidence->IDStr() );
}
- if (incidence->zaurusUid() > 0) {
- incidence->setNonKDECustomProperty("X-ZAURUSUID", QString::number(incidence->zaurusUid()));
- }
@@ -1282,10 +1279,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
}
- kp = incidence->nonKDECustomProperty("X-ZAURUSID");
- if (!kp.isNull()) {
- incidence->setZaurusId(kp.toInt());
- }
- kp = incidence->nonKDECustomProperty("X-ZAURUSUID");
+
+ kp = incidence->nonKDECustomProperty("X-KOPIEXTID");
if (!kp.isNull()) {
- incidence->setZaurusUid(kp.toInt());
+ incidence->setIDStr(kp);
}
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 707d666..d7c4595 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -42,2 +42,3 @@ IncidenceBase::IncidenceBase() :
mZaurusUid = 0;
+ mExternalId = ":";
mTempSyncStat = 0;
@@ -67,3 +68,3 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) :
mSyncStatus = i.mSyncStatus;
-
+ mExternalId = i.mExternalId;
// The copied object is a new one, so it isn't observed by the observer
@@ -82,3 +83,3 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
{
-
+ // do not compare mSyncStatus and mExternalId
if( i1.attendees().count() != i2.attendees().count() ) {
@@ -374,2 +375,78 @@ void IncidenceBase::setTempSyncStat( int id )
+void IncidenceBase::setID( const QString & prof , int id )
+{
+ int num = mExternalId.find( ":"+prof+";" );
+ if ( num >= 0 ) {
+ int len = prof.length()+2;
+ int end = mExternalId.find( ";", num+len );
+ if ( end > 0 ) {
+ mExternalId = mExternalId.left( num+len ) +QString::number( id)+mExternalId.mid( end );
+ } else
+ qDebug("Error in IncidenceBase::setID ");
+ } else {
+ mExternalId += prof+";"+QString::number( id) +";0:";
+ }
+}
+int IncidenceBase::getID( const QString & prof)
+{
+ int ret = -1;
+ int num = mExternalId.find(":"+ prof+";" );
+ if ( num >= 0 ) {
+ int len = prof.length()+2;
+ int end = mExternalId.find( ";", num+len );
+ if ( end > 0 ) {
+ bool ok;
+ ret = mExternalId.mid ( num + len,end-len-num).toInt( &ok );
+ if (!ok)
+ return -1;
+ }
+ }
+ return ret;
+}
+
+// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
+// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
+void IncidenceBase::setCsum( const QString & prof , int id )
+{
+ int num = mExternalId.find( ":"+prof+";");
+ if ( num >= 0 ) {
+ int len = prof.length()+2;
+ num = mExternalId.find( ";", num+len );
+ int end = mExternalId.find( ":", num+1 );
+ if ( end > 0 ) {
+ mExternalId = mExternalId.left( num ) +QString::number(id)+mExternalId.mid( end );
+ } else
+ qDebug("Error in IncidenceBase::setCsum ");
+ } else {
+ mExternalId += prof+";-1;"+QString::number( id) +":";
+ }
+}
+int IncidenceBase::getCsum( const QString & prof)
+{
+ int ret = -1;
+ int num = mExternalId.find( ":"+prof+";" );
+ if ( num >= 0 ) {
+ int len = prof.length()+2;
+ num = mExternalId.find( ";", num+len );
+ int end = mExternalId.find( ":", num+1 );
+ if ( end > 0 ) {
+ bool ok;
+ ret = mExternalId.mid ( num ,end-num).toInt( &ok );
+ if (!ok)
+ return -1;
+ }
+ }
+ return ret;
+}
+
+void IncidenceBase::setIDStr( const QString & s )
+{
+ if (mReadOnly) return;
+ mExternalId = s;
+}
+
+QString IncidenceBase::IDStr() const
+{
+ return mExternalId ;
+}
void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index ce6e254..2f85df6 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -134,2 +134,9 @@ class IncidenceBase : public CustomProperties
int tempSyncStat() const;
+ void setIDStr( const QString & );
+ QString IDStr() const;
+ void setID( const QString &, int );
+ int getID( const QString & );
+ void setCsum( const QString &, int );
+ int getCsum( const QString & );
+
@@ -155,2 +162,3 @@ class IncidenceBase : public CustomProperties
bool mHasDuration;
+ QString mExternalId;
int mZaurusId;