-rw-r--r-- | libkcal/incidencebase.cpp | 96 |
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 @@ -23,2 +23,3 @@ #include <kdebug.h> +#include <kidmanager.h> @@ -39,4 +40,3 @@ IncidenceBase::IncidenceBase() : mHasDuration = false; - mPilotId = 0; - mZaurusUid = 0; + mPilotId = 0; mExternalId = ":"; @@ -63,3 +63,2 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) : mPilotId = i.mPilotId; - mZaurusUid = i.mZaurusUid; mTempSyncStat = i.mTempSyncStat; @@ -343,12 +342,2 @@ int IncidenceBase::pilotId() const -int IncidenceBase::zaurusUid() const -{ - return mZaurusUid; -} -void IncidenceBase::setZaurusUid( int id ) -{ - if (mReadOnly) return; - mZaurusUid = id; -} - int IncidenceBase::tempSyncStat() const @@ -363,33 +352,14 @@ void IncidenceBase::setTempSyncStat( int 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 ); } @@ -398,35 +368,9 @@ int IncidenceBase::getID( const QString & prof) // 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 ); } |