diff options
Diffstat (limited to 'kresources/scalix/shared/scalixbase.cpp')
-rw-r--r-- | kresources/scalix/shared/scalixbase.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/kresources/scalix/shared/scalixbase.cpp b/kresources/scalix/shared/scalixbase.cpp index ab38500e2..8fb5177b7 100644 --- a/kresources/scalix/shared/scalixbase.cpp +++ b/kresources/scalix/shared/scalixbase.cpp @@ -36,14 +36,14 @@ #include <libkcal/journal.h> #include <libkdepim/kpimprefs.h> #include <kdebug.h> -#include <qfile.h> +#include <tqfile.h> using namespace Scalix; -ScalixBase::ScalixBase( const QString& tz ) - : mCreationDate( QDateTime::currentDateTime() ), - mLastModified( QDateTime::currentDateTime() ), +ScalixBase::ScalixBase( const TQString& tz ) + : mCreationDate( TQDateTime::currentDateTime() ), + mLastModified( TQDateTime::currentDateTime() ), mSensitivity( Public ), mTimeZoneId( tz ), mHasPilotSyncId( false ), mHasPilotSyncStatus( false ) { @@ -88,20 +88,20 @@ void ScalixBase::setFields( const KABC::Addressee* addressee ) setCategories( addressee->categories().join( "," ) ); // Set creation-time and last-modification-time - const QString creationString = addressee->custom( "KOLAB", "CreationDate" ); + const TQString creationString = addressee->custom( "KOLAB", "CreationDate" ); kdDebug(5006) << "Creation time string: " << creationString << endl; - QDateTime creationDate; + TQDateTime creationDate; if ( creationString.isEmpty() ) { - creationDate = QDateTime::currentDateTime(); + creationDate = TQDateTime::currentDateTime(); kdDebug(5006) << "Creation date set to current time\n"; } else { creationDate = stringToDateTime( creationString ); kdDebug(5006) << "Creation date loaded\n"; } - QDateTime modified = addressee->revision(); + TQDateTime modified = addressee->revision(); if ( !modified.isValid() ) - modified = QDateTime::currentDateTime(); + modified = TQDateTime::currentDateTime(); setLastModified( modified ); if ( modified < creationDate ) { // It's not possible that the modification date is earlier than creation @@ -109,7 +109,7 @@ void ScalixBase::setFields( const KABC::Addressee* addressee ) kdDebug(5006) << "Creation date set to modification date\n"; } setCreationDate( creationDate ); - const QString newCreationDate = dateTimeToString( creationDate ); + const TQString newCreationDate = dateTimeToString( creationDate ); if ( creationString != newCreationDate ) { // We modified the creation date, so store it for future reference const_cast<KABC::Addressee*>( addressee ) @@ -135,7 +135,7 @@ void ScalixBase::saveTo( KABC::Addressee* addressee ) const { addressee->setUid( uid() ); addressee->setNote( body() ); - addressee->setCategories( QStringList::split( ',', categories() ) ); + addressee->setCategories( TQStringList::split( ',', categories() ) ); addressee->setRevision( lastModified() ); addressee->insertCustom( "KOLAB", "CreationDate", dateTimeToString( creationDate() ) ); @@ -155,52 +155,52 @@ void ScalixBase::saveTo( KABC::Addressee* addressee ) const // TODO: Attachments } -void ScalixBase::setUid( const QString& uid ) +void ScalixBase::setUid( const TQString& uid ) { mUid = uid; } -QString ScalixBase::uid() const +TQString ScalixBase::uid() const { return mUid; } -void ScalixBase::setBody( const QString& body ) +void ScalixBase::setBody( const TQString& body ) { mBody = body; } -QString ScalixBase::body() const +TQString ScalixBase::body() const { return mBody; } -void ScalixBase::setCategories( const QString& categories ) +void ScalixBase::setCategories( const TQString& categories ) { mCategories = categories; } -QString ScalixBase::categories() const +TQString ScalixBase::categories() const { return mCategories; } -void ScalixBase::setCreationDate( const QDateTime& date ) +void ScalixBase::setCreationDate( const TQDateTime& date ) { mCreationDate = date; } -QDateTime ScalixBase::creationDate() const +TQDateTime ScalixBase::creationDate() const { return mCreationDate; } -void ScalixBase::setLastModified( const QDateTime& date ) +void ScalixBase::setLastModified( const TQDateTime& date ) { mLastModified = date; } -QDateTime ScalixBase::lastModified() const +TQDateTime ScalixBase::lastModified() const { return mLastModified; } @@ -247,14 +247,14 @@ int ScalixBase::pilotSyncStatus() const return mPilotSyncStatus; } -bool ScalixBase::loadEmailAttribute( QDomElement& element, Email& email ) +bool ScalixBase::loadEmailAttribute( TQDomElement& element, Email& email ) { - for ( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { + for ( TQDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { if ( n.isComment() ) continue; if ( n.isElement() ) { - QDomElement e = n.toElement(); - QString tagName = e.tagName(); + TQDomElement e = n.toElement(); + TQString tagName = e.tagName(); if ( tagName == "display-name" ) email.displayName = e.text(); @@ -270,18 +270,18 @@ bool ScalixBase::loadEmailAttribute( QDomElement& element, Email& email ) return true; } -void ScalixBase::saveEmailAttribute( QDomElement& element, const Email& email, - const QString& tagName ) const +void ScalixBase::saveEmailAttribute( TQDomElement& element, const Email& email, + const TQString& tagName ) const { - QDomElement e = element.ownerDocument().createElement( tagName ); + TQDomElement e = element.ownerDocument().createElement( tagName ); element.appendChild( e ); writeString( e, "display-name", email.displayName ); writeString( e, "smtp-address", email.smtpAddress ); } -bool ScalixBase::loadAttribute( QDomElement& element ) +bool ScalixBase::loadAttribute( TQDomElement& element ) { - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if ( tagName == "uid" ) setUid( element.text() ); @@ -308,7 +308,7 @@ bool ScalixBase::loadAttribute( QDomElement& element ) return true; } -bool ScalixBase::saveAttributes( QDomElement& element ) const +bool ScalixBase::saveAttributes( TQDomElement& element ) const { writeString( element, "product-id", productID() ); writeString( element, "uid", uid() ); @@ -319,17 +319,17 @@ bool ScalixBase::saveAttributes( QDomElement& element ) const dateTimeToString( lastModified() ) ); writeString( element, "sensitivity", sensitivityToString( sensitivity() ) ); if ( hasPilotSyncId() ) - writeString( element, "pilot-sync-id", QString::number( pilotSyncId() ) ); + writeString( element, "pilot-sync-id", TQString::number( pilotSyncId() ) ); if ( hasPilotSyncStatus() ) - writeString( element, "pilot-sync-status", QString::number( pilotSyncStatus() ) ); + writeString( element, "pilot-sync-status", TQString::number( pilotSyncStatus() ) ); return true; } -bool ScalixBase::load( const QString& xml ) +bool ScalixBase::load( const TQString& xml ) { - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; - QDomDocument document; + TQDomDocument document; bool ok = document.setContent( xml, &errorMsg, &errorLine, &errorColumn ); if ( !ok ) { @@ -342,11 +342,11 @@ bool ScalixBase::load( const QString& xml ) return loadXML( document ); } -bool ScalixBase::load( QFile& xml ) +bool ScalixBase::load( TQFile& xml ) { - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; - QDomDocument document; + TQDomDocument document; bool ok = document.setContent( &xml, &errorMsg, &errorLine, &errorColumn ); if ( !ok ) { @@ -359,41 +359,41 @@ bool ScalixBase::load( QFile& xml ) return loadXML( document ); } -QDomDocument ScalixBase::domTree() +TQDomDocument ScalixBase::domTree() { - QDomDocument document; + TQDomDocument document; - QString p = "version=\"1.0\" encoding=\"UTF-8\""; + TQString p = "version=\"1.0\" encoding=\"UTF-8\""; document.appendChild(document.createProcessingInstruction( "xml", p ) ); return document; } -QString ScalixBase::dateTimeToString( const QDateTime& time ) +TQString ScalixBase::dateTimeToString( const TQDateTime& time ) { return time.toString( Qt::ISODate ) + 'Z'; } -QString ScalixBase::dateToString( const QDate& date ) +TQString ScalixBase::dateToString( const TQDate& date ) { return date.toString( Qt::ISODate ); } -QDateTime ScalixBase::stringToDateTime( const QString& _date ) +TQDateTime ScalixBase::stringToDateTime( const TQString& _date ) { - QString date( _date ); + TQString date( _date ); if ( date.endsWith( "Z" ) ) date.truncate( date.length() - 1 ); - return QDateTime::fromString( date, Qt::ISODate ); + return TQDateTime::fromString( date, Qt::ISODate ); } -QDate ScalixBase::stringToDate( const QString& date ) +TQDate ScalixBase::stringToDate( const TQString& date ) { - return QDate::fromString( date, Qt::ISODate ); + return TQDate::fromString( date, Qt::ISODate ); } -QString ScalixBase::sensitivityToString( Sensitivity s ) +TQString ScalixBase::sensitivityToString( Sensitivity s ) { switch( s ) { case Private: return "private"; @@ -404,7 +404,7 @@ QString ScalixBase::sensitivityToString( Sensitivity s ) return "What what what???"; } -ScalixBase::Sensitivity ScalixBase::stringToSensitivity( const QString& s ) +ScalixBase::Sensitivity ScalixBase::stringToSensitivity( const TQString& s ) { if ( s == "private" ) return Private; @@ -413,34 +413,34 @@ ScalixBase::Sensitivity ScalixBase::stringToSensitivity( const QString& s ) return Public; } -QString ScalixBase::colorToString( const QColor& color ) +TQString ScalixBase::colorToString( const TQColor& color ) { // Color is in the format "#RRGGBB" return color.name(); } -QColor ScalixBase::stringToColor( const QString& s ) +TQColor ScalixBase::stringToColor( const TQString& s ) { - return QColor( s ); + return TQColor( s ); } -void ScalixBase::writeString( QDomElement& element, const QString& tag, - const QString& tagString ) +void ScalixBase::writeString( TQDomElement& element, const TQString& tag, + const TQString& tagString ) { if ( !tagString.isEmpty() ) { - QDomElement e = element.ownerDocument().createElement( tag ); - QDomText t = element.ownerDocument().createTextNode( tagString ); + TQDomElement e = element.ownerDocument().createElement( tag ); + TQDomText t = element.ownerDocument().createTextNode( tagString ); e.appendChild( t ); element.appendChild( e ); } } -QDateTime ScalixBase::localToUTC( const QDateTime& time ) const +TQDateTime ScalixBase::localToUTC( const TQDateTime& time ) const { return KPimPrefs::localTimeToUtc( time, mTimeZoneId ); } -QDateTime ScalixBase::utcToLocal( const QDateTime& time ) const +TQDateTime ScalixBase::utcToLocal( const TQDateTime& time ) const { return KPimPrefs::utcToLocalTime( time, mTimeZoneId ); } |