summaryrefslogtreecommitdiffstats
path: root/kresources/egroupware/kabc_resourcexmlrpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kresources/egroupware/kabc_resourcexmlrpc.cpp')
-rw-r--r--kresources/egroupware/kabc_resourcexmlrpc.cpp202
1 files changed, 101 insertions, 101 deletions
diff --git a/kresources/egroupware/kabc_resourcexmlrpc.cpp b/kresources/egroupware/kabc_resourcexmlrpc.cpp
index eba630cc3..ee1e74bea 100644
--- a/kresources/egroupware/kabc_resourcexmlrpc.cpp
+++ b/kresources/egroupware/kabc_resourcexmlrpc.cpp
@@ -18,7 +18,7 @@
Boston, MA 02110-1301, USA.
*/
-#include <qapplication.h>
+#include <tqapplication.h>
#include <kabc/addressee.h>
#include <kabprefs.h>
@@ -41,15 +41,15 @@
using namespace KABC;
-static const QString SearchContactsCommand = "addressbook.boaddressbook.search";
-static const QString AddContactCommand = "addressbook.boaddressbook.write";
-static const QString DeleteContactCommand = "addressbook.boaddressbook.delete";
-static const QString LoadCategoriesCommand = "addressbook.boaddressbook.categories";
-static const QString LoadCustomFieldsCommand = "addressbook.boaddressbook.customfields";
+static const TQString SearchContactsCommand = "addressbook.boaddressbook.search";
+static const TQString AddContactCommand = "addressbook.boaddressbook.write";
+static const TQString DeleteContactCommand = "addressbook.boaddressbook.delete";
+static const TQString LoadCategoriesCommand = "addressbook.boaddressbook.categories";
+static const TQString LoadCustomFieldsCommand = "addressbook.boaddressbook.customfields";
static void setRights( KABC::Addressee &addr, int rights )
{
- addr.insertCustom( "EGWRESOURCE", "RIGHTS", QString::number( rights ) );
+ addr.insertCustom( "EGWRESOURCE", "RIGHTS", TQString::number( rights ) );
}
static int rights( const KABC::Addressee &addr )
@@ -70,8 +70,8 @@ ResourceXMLRPC::ResourceXMLRPC( const KConfig *config )
initEGroupware();
}
-ResourceXMLRPC::ResourceXMLRPC( const QString &url, const QString &domain,
- const QString &user, const QString &password )
+ResourceXMLRPC::ResourceXMLRPC( const TQString &url, const TQString &domain,
+ const TQString &user, const TQString &password )
: ResourceCached( 0 ), mServer( 0 )
{
init();
@@ -150,14 +150,14 @@ bool ResourceXMLRPC::doOpen()
mServer->setUrl( KURL( mPrefs->url() ) );
mServer->setUserAgent( "KDE-AddressBook" );
- QMap<QString, QVariant> args;
+ TQMap<TQString, TQVariant> args;
args.insert( "domain", mPrefs->domain() );
args.insert( "username", mPrefs->user() );
args.insert( "password", mPrefs->password() );
- mServer->call( "system.login", QVariant( args ),
- this, SLOT( loginFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( fault( int, const QString&, const QVariant& ) ) );
+ mServer->call( "system.login", TQVariant( args ),
+ this, TQT_SLOT( loginFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
mSynchronizer->start();
@@ -166,13 +166,13 @@ bool ResourceXMLRPC::doOpen()
void ResourceXMLRPC::doClose()
{
- QMap<QString, QVariant> args;
+ TQMap<TQString, TQVariant> args;
args.insert( "sessionid", mSessionID );
args.insert( "kp3", mKp3 );
- mServer->call( "system.logout", QVariant( args ),
- this, SLOT( logoutFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( fault( int, const QString&, const QVariant& ) ) );
+ mServer->call( "system.logout", TQVariant( args ),
+ this, TQT_SLOT( logoutFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
mSynchronizer->start();
}
@@ -193,7 +193,7 @@ bool ResourceXMLRPC::asyncLoad()
loadCache();
- QMap<QString, QVariant> args;
+ TQMap<TQString, TQVariant> args;
args.insert( "start", "0" );
args.insert( "query", "" );
args.insert( "filter", "" );
@@ -202,16 +202,16 @@ bool ResourceXMLRPC::asyncLoad()
args.insert( "include_users", "calendar" );
mServer->call( SearchContactsCommand, args,
- this, SLOT( listContactsFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( fault( int, const QString&, const QVariant& ) ) );
+ this, TQT_SLOT( listContactsFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
- mServer->call( LoadCategoriesCommand, QVariant( false, 0 ),
- this, SLOT( loadCategoriesFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( fault( int, const QString&, const QVariant& ) ) );
+ mServer->call( LoadCategoriesCommand, TQVariant( false, 0 ),
+ this, TQT_SLOT( loadCategoriesFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
- mServer->call( LoadCustomFieldsCommand, QVariant( QValueList<QVariant>() ),
- this, SLOT( loadCustomFieldsFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( fault( int, const QString&, const QVariant& ) ) );
+ mServer->call( LoadCustomFieldsCommand, TQVariant( TQValueList<TQVariant>() ),
+ this, TQT_SLOT( loadCustomFieldsFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
return true;
}
@@ -246,13 +246,13 @@ bool ResourceXMLRPC::asyncSave( Ticket* )
void ResourceXMLRPC::addContact( const Addressee& addr )
{
- QMap<QString, QVariant> args;
+ TQMap<TQString, TQVariant> args;
writeContact( addr, args );
mServer->call( AddContactCommand, args,
- this, SLOT( addContactFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( addContactFault( int, const QString&, const QVariant& ) ),
- QVariant( addr.uid() ) );
+ this, TQT_SLOT( addContactFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( addContactFault( int, const TQString&, const TQVariant& ) ),
+ TQVariant( addr.uid() ) );
}
void ResourceXMLRPC::updateContact( const Addressee& addr )
@@ -262,14 +262,14 @@ void ResourceXMLRPC::updateContact( const Addressee& addr )
return;
}
- QMap<QString, QVariant> args;
+ TQMap<TQString, TQVariant> args;
writeContact( addr, args );
args.insert( "id", idMapper().remoteId( addr.uid() ) );
mServer->call( AddContactCommand, args,
- this, SLOT( updateContactFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( updateContactFault( int, const QString&, const QVariant& ) ),
- QVariant( addr.uid() ) );
+ this, TQT_SLOT( updateContactFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( updateContactFault( int, const TQString&, const TQVariant& ) ),
+ TQVariant( addr.uid() ) );
}
void ResourceXMLRPC::deleteContact( const Addressee& addr )
@@ -281,15 +281,15 @@ void ResourceXMLRPC::deleteContact( const Addressee& addr )
}
mServer->call( DeleteContactCommand, idMapper().remoteId( addr.uid() ),
- this, SLOT( deleteContactFinished( const QValueList<QVariant>&, const QVariant& ) ),
- this, SLOT( deleteContactFault( int, const QString&, const QVariant& ) ),
- QVariant( addr.uid() ) );
+ this, TQT_SLOT( deleteContactFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
+ this, TQT_SLOT( deleteContactFault( int, const TQString&, const TQVariant& ) ),
+ TQVariant( addr.uid() ) );
}
-void ResourceXMLRPC::loginFinished( const QValueList<QVariant> &variant,
- const QVariant& )
+void ResourceXMLRPC::loginFinished( const TQValueList<TQVariant> &variant,
+ const TQVariant& )
{
- QMap<QString, QVariant> map = variant[0].toMap();
+ TQMap<TQString, TQVariant> map = variant[0].toMap();
KURL url( mPrefs->url() );
if ( map[ "GOAWAY" ].toString() == "XOXO" ) { // failed
@@ -307,10 +307,10 @@ void ResourceXMLRPC::loginFinished( const QValueList<QVariant> &variant,
mSynchronizer->stop();
}
-void ResourceXMLRPC::logoutFinished( const QValueList<QVariant> &variant,
- const QVariant& )
+void ResourceXMLRPC::logoutFinished( const TQValueList<TQVariant> &variant,
+ const TQVariant& )
{
- QMap<QString, QVariant> map = variant[0].toMap();
+ TQMap<TQString, TQVariant> map = variant[0].toMap();
if ( map[ "GOODBYE" ].toString() != "XOXO" )
addressBook()->error( i18n( "Logout failed, please check your username and password." ) );
@@ -324,18 +324,18 @@ void ResourceXMLRPC::logoutFinished( const QValueList<QVariant> &variant,
mSynchronizer->stop();
}
-void ResourceXMLRPC::listContactsFinished( const QValueList<QVariant> &mapList,
- const QVariant& )
+void ResourceXMLRPC::listContactsFinished( const TQValueList<TQVariant> &mapList,
+ const TQVariant& )
{
- const QValueList<QVariant> contactList = mapList[ 0 ].toList();
- QValueList<QVariant>::ConstIterator contactIt;
+ const TQValueList<TQVariant> contactList = mapList[ 0 ].toList();
+ TQValueList<TQVariant>::ConstIterator contactIt;
KABC::Addressee::List serverContacts;
for ( contactIt = contactList.begin(); contactIt != contactList.end(); ++contactIt ) {
- const QMap<QString, QVariant> map = (*contactIt).toMap();
+ const TQMap<TQString, TQVariant> map = (*contactIt).toMap();
Addressee addr;
- QString uid;
+ TQString uid;
readContact( map, addr, uid );
@@ -343,7 +343,7 @@ void ResourceXMLRPC::listContactsFinished( const QValueList<QVariant> &mapList,
addr.setResource( this );
addr.setChanged( false );
- QString local = idMapper().localId( uid );
+ TQString local = idMapper().localId( uid );
if ( local.isEmpty() ) { // new entry
idMapper().setRemoteId( addr.uid(), uid );
} else {
@@ -361,8 +361,8 @@ void ResourceXMLRPC::listContactsFinished( const QValueList<QVariant> &mapList,
emit loadingFinished( this );
}
-void ResourceXMLRPC::addContactFinished( const QValueList<QVariant> &list,
- const QVariant &id )
+void ResourceXMLRPC::addContactFinished( const TQValueList<TQVariant> &list,
+ const TQVariant &id )
{
clearChange( id.toString() );
idMapper().setRemoteId( id.toString(), list[ 0 ].toString() );
@@ -370,16 +370,16 @@ void ResourceXMLRPC::addContactFinished( const QValueList<QVariant> &list,
saveCache();
}
-void ResourceXMLRPC::updateContactFinished( const QValueList<QVariant>&,
- const QVariant &id )
+void ResourceXMLRPC::updateContactFinished( const TQValueList<TQVariant>&,
+ const TQVariant &id )
{
clearChange( id.toString() );
saveCache();
}
-void ResourceXMLRPC::deleteContactFinished( const QValueList<QVariant>&,
- const QVariant &id )
+void ResourceXMLRPC::deleteContactFinished( const TQValueList<TQVariant>&,
+ const TQVariant &id )
{
clearChange( id.toString() );
idMapper().removeRemoteId( idMapper().remoteId( id.toString() ) );
@@ -387,38 +387,38 @@ void ResourceXMLRPC::deleteContactFinished( const QValueList<QVariant>&,
saveCache();
}
-void ResourceXMLRPC::fault( int error, const QString &errorMsg,
- const QVariant& )
+void ResourceXMLRPC::fault( int error, const TQString &errorMsg,
+ const TQVariant& )
{
- QString msg = i18n( "<qt>Server sent error %1: <b>%2</b></qt>" ).arg( error ).arg( errorMsg );
+ TQString msg = i18n( "<qt>Server sent error %1: <b>%2</b></qt>" ).arg( error ).arg( errorMsg );
if ( addressBook() )
addressBook()->error( msg );
mSynchronizer->stop();
}
-void ResourceXMLRPC::addContactFault( int, const QString &errorMsg,
- const QVariant &id )
+void ResourceXMLRPC::addContactFault( int, const TQString &errorMsg,
+ const TQVariant &id )
{
KABC::Addressee addr = mAddrMap[ id.toString() ];
mAddrMap.remove( addr.uid() );
- QString msg = i18n( "Unable to add contact %1 to server. (%2)" );
+ TQString msg = i18n( "Unable to add contact %1 to server. (%2)" );
addressBook()->error( msg.arg( addr.formattedName(), errorMsg ) );
}
-void ResourceXMLRPC::updateContactFault( int, const QString &errorMsg,
- const QVariant &id )
+void ResourceXMLRPC::updateContactFault( int, const TQString &errorMsg,
+ const TQVariant &id )
{
KABC::Addressee addr = mAddrMap[ id.toString() ];
- QString msg = i18n( "Unable to update contact %1 on server. (%2)" );
+ TQString msg = i18n( "Unable to update contact %1 on server. (%2)" );
addressBook()->error( msg.arg( addr.formattedName(), errorMsg ) );
}
-void ResourceXMLRPC::deleteContactFault( int, const QString &errorMsg,
- const QVariant &id )
+void ResourceXMLRPC::deleteContactFault( int, const TQString &errorMsg,
+ const TQVariant &id )
{
KABC::Addressee addr;
@@ -433,14 +433,14 @@ void ResourceXMLRPC::deleteContactFault( int, const QString &errorMsg,
mAddrMap.insert( addr.uid(), addr );
- QString msg = i18n( "Unable to delete contact %1 from server. (%2)" );
+ TQString msg = i18n( "Unable to delete contact %1 from server. (%2)" );
addressBook()->error( msg.arg( addr.formattedName(), errorMsg ) );
}
-QString ResourceXMLRPC::addrTypesToTypeStr( int typeMask )
+TQString ResourceXMLRPC::addrTypesToTypeStr( int typeMask )
{
- QStringList types;
- QMap<QString, int>::ConstIterator it;
+ TQStringList types;
+ TQMap<TQString, int>::ConstIterator it;
for ( it = mAddrTypes.begin(); it != mAddrTypes.end(); ++it )
if ( it.data() & typeMask )
types.append( it.key() );
@@ -448,7 +448,7 @@ QString ResourceXMLRPC::addrTypesToTypeStr( int typeMask )
return types.join( ";" );
}
-void ResourceXMLRPC::writeContact( const Addressee &addr, QMap<QString, QVariant> &args )
+void ResourceXMLRPC::writeContact( const Addressee &addr, TQMap<TQString, TQVariant> &args )
{
args.insert( "access", ( addr.secrecy().type() == Secrecy::Private ? "private" : "public" ) );
args.insert( "fn", addr.formattedName() );
@@ -470,17 +470,17 @@ void ResourceXMLRPC::writeContact( const Addressee &addr, QMap<QString, QVariant
args.insert( "title", addr.title() );
// CATEGORIES
- QStringList::ConstIterator catIt;
- const QStringList categories = addr.categories();
+ TQStringList::ConstIterator catIt;
+ const TQStringList categories = addr.categories();
- QMap<QString, QVariant> catMap;
+ TQMap<TQString, TQVariant> catMap;
int counter = 0;
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
- QMap<QString, int>::ConstIterator it = mCategoryMap.find( *catIt );
+ TQMap<TQString, int>::ConstIterator it = mCategoryMap.find( *catIt );
if ( it == mCategoryMap.end() ) // new category
- catMap.insert( QString::number( counter-- ), *catIt );
+ catMap.insert( TQString::number( counter-- ), *catIt );
else
- catMap.insert( QString::number( it.data() ), *catIt );
+ catMap.insert( TQString::number( it.data() ), *catIt );
}
args.insert( "cat_id", catMap );
@@ -569,15 +569,15 @@ void ResourceXMLRPC::writeContact( const Addressee &addr, QMap<QString, QVariant
}
- const QStringList customFields = addr.customs();
- QStringList::ConstIterator it;
+ const TQStringList customFields = addr.customs();
+ TQStringList::ConstIterator it;
for ( it = customFields.begin(); it != customFields.end(); ++it ) {
int colon = (*it).find( ":" );
- QString identifier = (*it).left( colon );
+ TQString identifier = (*it).left( colon );
int dash = identifier.find( "-" );
- QString app = identifier.left( dash );
- QString name = identifier.mid( dash + 1 );
- QString value = (*it).mid( colon + 1 );
+ TQString app = identifier.left( dash );
+ TQString name = identifier.mid( dash + 1 );
+ TQString value = (*it).mid( colon + 1 );
if ( value.isEmpty() )
continue;
@@ -585,16 +585,16 @@ void ResourceXMLRPC::writeContact( const Addressee &addr, QMap<QString, QVariant
args.insert( name, value );
}
- QString url = KCal::FreeBusyUrlStore::self()->readUrl( addr.preferredEmail() );
+ TQString url = KCal::FreeBusyUrlStore::self()->readUrl( addr.preferredEmail() );
if ( !url.isEmpty() )
args.insert( "freebusy_url", url );
}
-void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee &addr, QString &uid )
+void ResourceXMLRPC::readContact( const TQMap<TQString, TQVariant> &args, Addressee &addr, TQString &uid )
{
Address addrOne, addrTwo;
- QMap<QString, QVariant>::ConstIterator it;
+ TQMap<TQString, TQVariant>::ConstIterator it;
for ( it = args.begin(); it != args.end(); ++it ) {
if ( it.key() == "id" ) {
uid = it.data().toString();
@@ -647,7 +647,7 @@ void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee
} else if ( it.key() == "adr_one_countryname" ) {
addrOne.setCountry( it.data().toString() );
} else if ( it.key() == "adr_one_type" ) {
- QStringList types = QStringList::split( ';', it.data().toString() );
+ TQStringList types = TQStringList::split( ';', it.data().toString() );
int type = Address::Work;
for ( uint i = 0; i < types.count(); ++i )
@@ -667,7 +667,7 @@ void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee
} else if ( it.key() == "adr_two_countryname" ) {
addrTwo.setCountry( it.data().toString() );
} else if ( it.key() == "adr_two_type" ) {
- QStringList types = QStringList::split( ';', it.data().toString() );
+ TQStringList types = TQStringList::split( ';', it.data().toString() );
int type = Address::Home;
for ( uint i = 0; i < types.count(); ++i )
@@ -707,8 +707,8 @@ void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee
addr.insertEmail( it.data().toString(), false );
} else if ( it.key() == "email_home_type" ) {
} else if ( it.key() == "cat_id" ) {
- const QMap<QString, QVariant> categories = it.data().toMap();
- QMap<QString, QVariant>::ConstIterator it;
+ const TQMap<TQString, TQVariant> categories = it.data().toMap();
+ TQMap<TQString, TQVariant>::ConstIterator it;
for ( it = categories.begin(); it != categories.end(); ++it )
addr.insertCategory( it.data().toString() );
@@ -717,7 +717,7 @@ void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee
}
}
- QMap<QString, QString>::ConstIterator cfIt;
+ TQMap<TQString, TQString>::ConstIterator cfIt;
for ( cfIt = mCustomFieldsMap.begin(); cfIt != mCustomFieldsMap.end(); ++cfIt ) {
if ( args[ cfIt.key() ].toString().isEmpty() )
continue;
@@ -736,19 +736,19 @@ void ResourceXMLRPC::readContact( const QMap<QString, QVariant> &args, Addressee
addr.insertAddress( addrTwo );
}
-void ResourceXMLRPC::loadCategoriesFinished( const QValueList<QVariant> &mapList,
- const QVariant& )
+void ResourceXMLRPC::loadCategoriesFinished( const TQValueList<TQVariant> &mapList,
+ const TQVariant& )
{
mCategoryMap.clear();
- const QMap<QString, QVariant> map = mapList[ 0 ].toMap();
- QMap<QString, QVariant>::ConstIterator it;
+ const TQMap<TQString, TQVariant> map = mapList[ 0 ].toMap();
+ TQMap<TQString, TQVariant>::ConstIterator it;
KABPrefs *prefs = KABPrefs::instance();
for ( it = map.begin(); it != map.end(); ++it ) {
mCategoryMap.insert( it.data().toString(), it.key().toInt() );
- QStringList categories = prefs->customCategories();
+ TQStringList categories = prefs->customCategories();
if ( categories.find( it.data().toString() ) == categories.end() )
categories.append( it.data().toString() );
@@ -756,13 +756,13 @@ void ResourceXMLRPC::loadCategoriesFinished( const QValueList<QVariant> &mapList
}
}
-void ResourceXMLRPC::loadCustomFieldsFinished( const QValueList<QVariant> &mapList,
- const QVariant& )
+void ResourceXMLRPC::loadCustomFieldsFinished( const TQValueList<TQVariant> &mapList,
+ const TQVariant& )
{
mCustomFieldsMap.clear();
- const QMap<QString, QVariant> map = mapList[ 0 ].toMap();
- QMap<QString, QVariant>::ConstIterator it;
+ const TQMap<TQString, TQVariant> map = mapList[ 0 ].toMap();
+ TQMap<TQString, TQVariant>::ConstIterator it;
for ( it = map.begin(); it != map.end(); ++it )
mCustomFieldsMap.insert( it.key(), it.data().toString() );