-rw-r--r-- | libkcal/incidencebase.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index d7c4595..f1db8b7 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -357,114 +357,118 @@ 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 ) { 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) - return -1; + ret = -1; } } - return ret; + qDebug("getID*%s*%d*%s* ", prof.latin1(), ret,mExternalId.latin1() ); + 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) +":"; } + 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) - return -1; + ret = -1; } } + qDebug("getCsum*%s*%d*%s* ", prof.latin1(), ret,mExternalId.latin1() ); 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 ) { 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() ) { Observer *o = it.current(); ++it; o->incidenceUpdated( this ); } } |