summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
authorzautrix <zautrix>2004-08-07 11:30:06 (UTC)
committer zautrix <zautrix>2004-08-07 11:30:06 (UTC)
commit835cc1b2c671bf2ab228362cf4ea2e4a04a1d5e5 (patch) (side-by-side diff)
tree816191299c688a7de051703af11d0ba4f8c8247f /libkcal/incidencebase.cpp
parent55ad0e5d505055016a0e5032bcc8f9355dfff210 (diff)
downloadkdepimpi-835cc1b2c671bf2ab228362cf4ea2e4a04a1d5e5.zip
kdepimpi-835cc1b2c671bf2ab228362cf4ea2e4a04a1d5e5.tar.gz
kdepimpi-835cc1b2c671bf2ab228362cf4ea2e4a04a1d5e5.tar.bz2
More sync stuff converted
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
@@ -18,12 +18,13 @@
Boston, MA 02111-1307, USA.
*/
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
+#include <kidmanager.h>
#include "calformat.h"
#include "incidencebase.h"
using namespace KCal;
@@ -34,14 +35,13 @@ IncidenceBase::IncidenceBase() :
{
setUid(CalFormat::createUniqueId());
mOrganizer = "";
mFloats = false;
mDuration = 0;
mHasDuration = false;
- mPilotId = 0;
- mZaurusUid = 0;
+ mPilotId = 0;
mExternalId = ":";
mTempSyncStat = 0;
mSyncStatus = 0;
mAttendees.setAutoDelete( true );
}
@@ -58,13 +58,12 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) :
for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
mAttendees.append( new Attendee( *a ) );
}
mFloats = i.mFloats;
mLastModified = i.mLastModified;
mPilotId = i.mPilotId;
- mZaurusUid = i.mZaurusUid;
mTempSyncStat = i.mTempSyncStat;
mSyncStatus = i.mSyncStatus;
mExternalId = i.mExternalId;
// The copied object is a new one, so it isn't observed by the observer
// of the original object.
mObservers.clear();
@@ -338,100 +337,45 @@ void IncidenceBase::setPilotId( int id )
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;
}
void IncidenceBase::setTempSyncStat( int id )
{
if (mReadOnly) return;
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 )
{
if (mReadOnly) return;
mExternalId = s;