summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp96
1 files changed, 20 insertions, 76 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 5d8785b..15c4fa8 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -21,6 +21,7 @@
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
+#include <kidmanager.h>
#include "calformat.h"
@@ -37,8 +38,7 @@ IncidenceBase::IncidenceBase() :
mFloats = false;
mDuration = 0;
mHasDuration = false;
- mPilotId = 0;
- mZaurusUid = 0;
+ mPilotId = 0;
mExternalId = ":";
mTempSyncStat = 0;
mSyncStatus = 0;
@@ -61,7 +61,6 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) :
mFloats = i.mFloats;
mLastModified = i.mLastModified;
mPilotId = i.mPilotId;
- mZaurusUid = i.mZaurusUid;
mTempSyncStat = i.mTempSyncStat;
mSyncStatus = i.mSyncStatus;
mExternalId = i.mExternalId;
@@ -341,16 +340,6 @@ int IncidenceBase::pilotId() const
return mPilotId;
}
-int IncidenceBase::zaurusUid() const
-{
- return mZaurusUid;
-}
-void IncidenceBase::setZaurusUid( int id )
-{
- if (mReadOnly) return;
- mZaurusUid = id;
-}
-
int IncidenceBase::tempSyncStat() const
{
return mTempSyncStat;
@@ -361,74 +350,29 @@ void IncidenceBase::setTempSyncStat( int id )
mTempSyncStat = id;
}
-void IncidenceBase::setID( const QString & prof , int id )
+void IncidenceBase::removeID(const QString &prof)
{
- 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:";
- }
- qDebug("setID*%s*%d*%s* ", prof.latin1(), id,mExternalId.latin1() );
-}
-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)
- ret = -1;
- }
- }
- qDebug("getID*%s*%d*%s* ", prof.latin1(), ret,mExternalId.latin1() );
- return ret;
+ mExternalId = KIdManager::removeId ( mExternalId, prof);
+
+}
+void IncidenceBase::setID( const QString & prof , const QString & id )
+{
+ mExternalId = KIdManager::setId ( mExternalId, prof, id );
+}
+QString IncidenceBase::getID( const QString & prof)
+{
+ return KIdManager::getId ( mExternalId, prof );
}
// 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) +":";
- }
- qDebug("setCsum*%s*%d*%s* ", prof.latin1(), id,mExternalId.latin1() );
-}
-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)
- ret = -1;
- }
- }
- qDebug("getCsum*%s*%d*%s* ", prof.latin1(), ret,mExternalId.latin1() );
- return ret;
+void IncidenceBase::setCsum( const QString & prof , const QString & id )
+{
+ mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
+}
+QString IncidenceBase::getCsum( const QString & prof)
+{
+ return KIdManager::getCsum ( mExternalId, prof );
}
void IncidenceBase::setIDStr( const QString & s )