diff options
Diffstat (limited to 'kresources/slox/kabcresourceslox.cpp')
-rw-r--r-- | kresources/slox/kabcresourceslox.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/kresources/slox/kabcresourceslox.cpp b/kresources/slox/kabcresourceslox.cpp index e6bf326c3..757bfae08 100644 --- a/kresources/slox/kabcresourceslox.cpp +++ b/kresources/slox/kabcresourceslox.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <qapplication.h> +#include <tqapplication.h> #include <kabc/picture.h> #include <kconfig.h> @@ -53,7 +53,7 @@ ResourceSlox::ResourceSlox( const KConfig *config ) } ResourceSlox::ResourceSlox( const KURL &url, - const QString &user, const QString &password ) + const TQString &user, const TQString &password ) : ResourceCached( 0 ), SloxBase( this ) { init(); @@ -184,16 +184,16 @@ bool ResourceSlox::asyncLoad() url.setUser( mPrefs->user() ); url.setPass( mPrefs->password() ); - QString lastsync = "0"; + TQString lastsync = "0"; if ( mPrefs->useLastSync() ) { - QDateTime dt = mPrefs->lastSync(); + TQDateTime dt = mPrefs->lastSync(); if ( dt.isValid() ) lastsync = WebdavHandler::qDateTimeToSlox( dt.addDays( -1 ) ); } - QDomDocument doc; - QDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" ); - QDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" ); + TQDomDocument doc; + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" ); + TQDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" ); WebdavHandler::addSloxElement( this, doc, prop, fieldName( LastSync ), lastsync ); WebdavHandler::addSloxElement( this, doc, prop, fieldName( FolderId ), mPrefs->folderId() ); if ( type() == "ox" ) { @@ -205,18 +205,18 @@ bool ResourceSlox::asyncLoad() kdDebug() << "REQUEST CONTACTS: \n" << doc.toString( 2 ) << endl; mDownloadJob = KIO::davPropFind( url, doc, "0", false ); - connect( mDownloadJob, SIGNAL( result( KIO::Job * ) ), - SLOT( slotResult( KIO::Job * ) ) ); - connect( mDownloadJob, SIGNAL( percent( KIO::Job *, unsigned long ) ), - SLOT( slotProgress( KIO::Job *, unsigned long ) ) ); + connect( mDownloadJob, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotResult( KIO::Job * ) ) ); + connect( mDownloadJob, TQT_SIGNAL( percent( KIO::Job *, unsigned long ) ), + TQT_SLOT( slotProgress( KIO::Job *, unsigned long ) ) ); mDownloadProgress = KPIM::ProgressManager::instance()->createProgressItem( KPIM::ProgressManager::getUniqueID(), i18n("Downloading contacts") ); connect( mDownloadProgress, - SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), - SLOT( cancelDownload() ) ); + TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), + TQT_SLOT( cancelDownload() ) ); - mPrefs->setLastSync( QDateTime::currentDateTime() ); + mPrefs->setLastSync( TQDateTime::currentDateTime() ); return true; } @@ -230,20 +230,20 @@ void ResourceSlox::slotResult( KIO::Job *job ) } else { kdDebug() << "ResourceSlox::slotResult() success" << endl; - QDomDocument doc = mDownloadJob->response(); + TQDomDocument doc = mDownloadJob->response(); mWebdavHandler.log( doc.toString( 2 ) ); - QValueList<SloxItem> items = WebdavHandler::getSloxItems( this, doc ); + TQValueList<SloxItem> items = WebdavHandler::getSloxItems( this, doc ); bool changed = false; - QValueList<SloxItem>::ConstIterator it; + TQValueList<SloxItem>::ConstIterator it; for( it = items.begin(); it != items.end(); ++it ) { SloxItem item = *it; - QString uid = "kresources_slox_kabc_" + item.sloxId; + TQString uid = "kresources_slox_kabc_" + item.sloxId; if ( item.status == SloxItem::Delete ) { - QMap<QString,Addressee>::Iterator it; + TQMap<TQString,Addressee>::Iterator it; it = mAddrMap.find( uid ); if ( it != mAddrMap.end() ) { mAddrMap.remove( it ); @@ -255,9 +255,9 @@ void ResourceSlox::slotResult( KIO::Job *job ) mWebdavHandler.clearSloxAttributeStatus(); - QDomNode n; + TQDomNode n; for( n = item.domNode.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); mWebdavHandler.parseSloxAttribute( e ); parseContactAttribute( e, a ); } @@ -295,13 +295,13 @@ void ResourceSlox::slotUploadResult( KIO::Job *job ) } else { kdDebug() << "ResourceSlox::slotUploadResult() success" << endl; - QDomDocument doc = mUploadJob->response(); + TQDomDocument doc = mUploadJob->response(); kdDebug() << k_funcinfo << "Upload result: " << endl; kdDebug() << doc.toString() << endl; - QValueList<SloxItem> items = WebdavHandler::getSloxItems( this, doc ); + TQValueList<SloxItem> items = WebdavHandler::getSloxItems( this, doc ); - QValueList<SloxItem>::ConstIterator it; + TQValueList<SloxItem>::ConstIterator it; for( it = items.begin(); it != items.end(); ++it ) { SloxItem item = *it; if ( !item.response.contains( "200" ) ) { @@ -309,7 +309,7 @@ void ResourceSlox::slotUploadResult( KIO::Job *job ) continue; } if ( item.status == SloxItem::New ) { - QMap<QString,Addressee>::Iterator search_res; + TQMap<TQString,Addressee>::Iterator search_res; search_res = mAddrMap.find( item.clientId ); if ( search_res != mAddrMap.end() ) { // use the id provided by the server @@ -334,15 +334,15 @@ void ResourceSlox::slotUploadResult( KIO::Job *job ) uploadContacts(); } -void ResourceSlox::parseContactAttribute( const QDomElement &e, Addressee &a ) +void ResourceSlox::parseContactAttribute( const TQDomElement &e, Addressee &a ) { - QString text = decodeText( e.text() ); + TQString text = decodeText( e.text() ); if ( text.isEmpty() ) return; - QString tag = e.tagName(); + TQString tag = e.tagName(); int pnType = 0; if ( tag == fieldName( Birthday ) ) { - QDateTime dt = WebdavHandler::sloxToQDateTime( text ); + TQDateTime dt = WebdavHandler::sloxToQDateTime( text ); a.setBirthday( dt.date() ); } else if ( tag == fieldName( Role ) ) { a.setRole( text ); @@ -376,9 +376,9 @@ void ResourceSlox::parseContactAttribute( const QDomElement &e, Addressee &a ) } else if ( tag == fieldName( Url ) ) { a.setUrl( text ); } else if ( tag == fieldName( Image ) ) { - QByteArray decodedPicture; + TQByteArray decodedPicture; KCodecs::base64Decode( text.utf8(), decodedPicture ); - a.setPhoto( Picture( QImage( decodedPicture ) ) ); + a.setPhoto( Picture( TQImage( decodedPicture ) ) ); } else if ( tag == fieldName( NickName ) ) { a.setNickName( text ); } else if ( tag == fieldName( InstantMsg ) ) { @@ -394,10 +394,10 @@ void ResourceSlox::parseContactAttribute( const QDomElement &e, Addressee &a ) } else if ( tag == fieldName( SpousesName ) ) { a.insertCustom( "KADDRESSBOOK", "X-SpousesName", text ); } else if ( tag == fieldName( Anniversary ) ) { - QDateTime dt = WebdavHandler::sloxToQDateTime( text ); + TQDateTime dt = WebdavHandler::sloxToQDateTime( text ); a.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt.toString( Qt::ISODate ) ); } else if ( tag == fieldName( Categories ) ) { - a.setCategories( QStringList::split( QRegExp(",\\s*"), text ) ); + a.setCategories( TQStringList::split( TQRegExp(",\\s*"), text ) ); } else if ( type() == "ox" ) { // FIXME: Address reading is missing for SLOX // read addresses Address addr; @@ -423,17 +423,17 @@ void ResourceSlox::parseContactAttribute( const QDomElement &e, Addressee &a ) } } -int ResourceSlox::phoneNumberType( const QString &fieldName ) const +int ResourceSlox::phoneNumberType( const TQString &fieldName ) const { - QMap<int, QStringList> pnmap; + TQMap<int, TQStringList> pnmap; if ( type() == "ox" ) pnmap = mPhoneNumberOxMap; else pnmap = mPhoneNumberSloxMap; - QMap<int, QStringList>::ConstIterator it; + TQMap<int, TQStringList>::ConstIterator it; for ( it = pnmap.begin(); it != pnmap.end(); ++it ) { - QStringList l = it.data(); - QStringList::ConstIterator it2; + TQStringList l = it.data(); + TQStringList::ConstIterator it2; for ( it2 = l.begin(); it2 != l.end(); ++it2 ) if ( (*it2) == fieldName ) return it.key(); @@ -471,10 +471,10 @@ bool ResourceSlox::asyncSave( Ticket* ) void ResourceSlox::uploadContacts() { - QDomDocument doc; - QDomElement root = WebdavHandler::addDavElement( doc, doc, "propertyupdate" ); - QDomElement set = WebdavHandler::addDavElement( doc, root, "set" ); - QDomElement prop = WebdavHandler::addDavElement( doc, set, "prop" ); + TQDomDocument doc; + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propertyupdate" ); + TQDomElement set = WebdavHandler::addDavElement( doc, root, "set" ); + TQDomElement prop = WebdavHandler::addDavElement( doc, set, "prop" ); bool isDelete = false; @@ -501,7 +501,7 @@ void ResourceSlox::uploadContacts() if ( !isDelete ) { createAddresseeFields( doc, prop, mUploadAddressee ); } else { - QString tmp_uid = mUploadAddressee.uid().remove( 0, sizeof("kresources_slox_kabc_") - 1); // remove prefix from uid + TQString tmp_uid = mUploadAddressee.uid().remove( 0, sizeof("kresources_slox_kabc_") - 1); // remove prefix from uid WebdavHandler::addSloxElement( this, doc, prop, fieldName( ObjectId ), tmp_uid ); WebdavHandler::addSloxElement( this, doc, prop, "method", "DELETE" ); } @@ -514,19 +514,19 @@ void ResourceSlox::uploadContacts() url.setPass( mPrefs->password() ); mUploadJob = KIO::davPropPatch( url, doc, false ); - connect( mUploadJob, SIGNAL( result( KIO::Job * ) ), - SLOT( slotUploadResult( KIO::Job * ) ) ); - connect( mUploadJob, SIGNAL( percent( KIO::Job *, unsigned long ) ), - SLOT( slotProgress( KIO::Job *, unsigned long ) ) ); + connect( mUploadJob, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotUploadResult( KIO::Job * ) ) ); + connect( mUploadJob, TQT_SIGNAL( percent( KIO::Job *, unsigned long ) ), + TQT_SLOT( slotProgress( KIO::Job *, unsigned long ) ) ); mUploadProgress = KPIM::ProgressManager::instance()->createProgressItem( KPIM::ProgressManager::getUniqueID(), i18n("Uploading contacts") ); connect( mUploadProgress, - SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), - SLOT( cancelUpload() ) ); + TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), + TQT_SLOT( cancelUpload() ) ); } -void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, +void ResourceSlox::createAddresseeFields( TQDomDocument &doc, TQDomElement &prop, const Addressee &a ) { // choose addressbook @@ -562,10 +562,10 @@ void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, a.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); WebdavHandler::addSloxElement( this, doc, prop, fieldName( SpousesName ), a.custom( "KADDRESSBOOK", "X-SpousesName" ) ); - QString anniversary = a.custom( "KADDRESSBOOK", "X-Anniversary" ); + TQString anniversary = a.custom( "KADDRESSBOOK", "X-Anniversary" ); if ( !anniversary.isEmpty() ) WebdavHandler::addSloxElement( this, doc, prop, fieldName( Anniversary ), - WebdavHandler::qDateTimeToSlox( QDateTime::fromString( anniversary, Qt::ISODate ).date() ) ); + WebdavHandler::qDateTimeToSlox( TQDateTime::fromString( anniversary, Qt::ISODate ).date() ) ); else WebdavHandler::addSloxElement( this, doc, prop, fieldName( Anniversary ) ); } @@ -575,8 +575,8 @@ void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, WebdavHandler::addSloxElement( this, doc, prop, fieldName( Categories ), a.categories().join( ", " ) ); // emails - QStringList email_list = a.emails(); - QStringList::const_iterator emails_it = email_list.begin(); + TQStringList email_list = a.emails(); + TQStringList::const_iterator emails_it = email_list.begin(); if ( emails_it != email_list.end() ) WebdavHandler::addSloxElement( this, doc, prop, fieldName( PrimaryEmail ), *(emails_it++) ); if ( emails_it != email_list.end() ) @@ -586,15 +586,15 @@ void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, // phone numbers PhoneNumber::List pnlist = a.phoneNumbers(); - QMap<int, QStringList> pnSaveMap; + TQMap<int, TQStringList> pnSaveMap; if ( type() == "ox" ) pnSaveMap = mPhoneNumberOxMap; else pnSaveMap = mPhoneNumberSloxMap; for ( PhoneNumber::List::ConstIterator it = pnlist.begin() ; it != pnlist.end(); ++it ) { if ( pnSaveMap.contains( (*it).type() ) ) { - QStringList l = pnSaveMap[(*it).type()]; - QString fn = l.first(); + TQStringList l = pnSaveMap[(*it).type()]; + TQString fn = l.first(); l.remove( l.begin() ); if ( !l.isEmpty() ) pnSaveMap[(*it).type()] = l; @@ -606,9 +606,9 @@ void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, } // send empty fields for the remaining ohone number fields // it's not possible to delete phone numbers otherwise - for ( QMap<int, QStringList>::ConstIterator it = pnSaveMap.begin(); it != pnSaveMap.end(); ++it ) { - QStringList l = it.data(); - for ( QStringList::ConstIterator it2 = l.begin(); it2 != l.end(); ++it2 ) + for ( TQMap<int, TQStringList>::ConstIterator it = pnSaveMap.begin(); it != pnSaveMap.end(); ++it ) { + TQStringList l = it.data(); + for ( TQStringList::ConstIterator it2 = l.begin(); it2 != l.end(); ++it2 ) WebdavHandler::addSloxElement( this, doc, prop, (*it2) ); } @@ -620,8 +620,8 @@ void ResourceSlox::createAddresseeFields( QDomDocument &doc, QDomElement &prop, } } -void KABC::ResourceSlox::createAddressFields( QDomDocument &doc, QDomElement &parent, - const QString &prefix, const KABC::Address &addr ) +void KABC::ResourceSlox::createAddressFields( TQDomDocument &doc, TQDomElement &parent, + const TQString &prefix, const KABC::Address &addr ) { WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( Street ), addr.street() ); WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( PostalCode ), addr.postalCode() ); |