diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/libkopete/kopeteprotocol.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/kopeteprotocol.cpp')
-rw-r--r-- | kopete/libkopete/kopeteprotocol.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/kopete/libkopete/kopeteprotocol.cpp b/kopete/libkopete/kopeteprotocol.cpp index 7854a1a3..e361abf6 100644 --- a/kopete/libkopete/kopeteprotocol.cpp +++ b/kopete/libkopete/kopeteprotocol.cpp @@ -23,7 +23,7 @@ #include <kaction.h> #include <klocale.h> -#include <qdict.h> +#include <tqdict.h> #include "kopeteaccountmanager.h" #include "kopeteaccount.h" @@ -50,7 +50,7 @@ public: Kopete::OnlineStatus accountNotConnectedStatus; }; -Protocol::Protocol( KInstance *instance, QObject *parent, const char *name ) +Protocol::Protocol( KInstance *instance, TQObject *parent, const char *name ) : Plugin( instance, parent, name ) { d = new Private; @@ -58,18 +58,18 @@ Protocol::Protocol( KInstance *instance, QObject *parent, const char *name ) d->mStickFullName = Global::Properties::self()->fullName(); d->unloading = false; d->capabilities = 0; - d->accountNotConnectedStatus = Kopete::OnlineStatus( Kopete::OnlineStatus::Unknown, 0, this, Kopete::OnlineStatus::AccountOffline, QString::fromLatin1( "account_offline_overlay" ), i18n( "Account Offline" ) ); + d->accountNotConnectedStatus = Kopete::OnlineStatus( Kopete::OnlineStatus::Unknown, 0, this, Kopete::OnlineStatus::AccountOffline, TQString::fromLatin1( "account_offline_overlay" ), i18n( "Account Offline" ) ); } Protocol::~Protocol() { // Remove all active accounts - QDict<Account> accounts = AccountManager::self()->accounts( this ); + TQDict<Account> accounts = AccountManager::self()->accounts( this ); if ( !accounts.isEmpty() ) { kdWarning( 14010 ) << k_funcinfo << "Deleting protocol with existing accounts! Did the account unloading go wrong?" << endl; - for( QDictIterator<Account> it( accounts ); it.current() ; ++it ) + for( TQDictIterator<Account> it( accounts ); it.current() ; ++it ) delete *it; } @@ -99,15 +99,15 @@ void Protocol::slotAccountOnlineStatusChanged( Contact *self ) // some protocols change status several times during shutdown. We should only call deleteLater() once disconnect( self, 0, this, 0 ); - connect( self->account(), SIGNAL(accountDestroyed(const Kopete::Account* )), - this, SLOT( slotAccountDestroyed( ) ) ); + connect( self->account(), TQT_SIGNAL(accountDestroyed(const Kopete::Account* )), + this, TQT_SLOT( slotAccountDestroyed( ) ) ); self->account()->deleteLater(); } void Protocol::slotAccountDestroyed( ) { - QDict<Account> dict = AccountManager::self()->accounts( this ); + TQDict<Account> dict = AccountManager::self()->accounts( this ); if ( dict.isEmpty() ) { // While at this point we are still in a stack trace from the destroyed @@ -124,20 +124,20 @@ void Protocol::aboutToUnload() d->unloading = true; // Disconnect all accounts - QDict<Account> accounts = AccountManager::self()->accounts( this ); + TQDict<Account> accounts = AccountManager::self()->accounts( this ); if ( accounts.isEmpty() ) emit readyForUnload(); - else for ( QDictIterator<Account> it( accounts ); it.current() ; ++it ) + else for ( TQDictIterator<Account> it( accounts ); it.current() ; ++it ) { if ( it.current()->myself() && it.current()->myself()->isOnline() ) { kdDebug( 14010 ) << k_funcinfo << it.current()->accountId() << " is still connected, disconnecting..." << endl; - QObject::connect( it.current()->myself(), - SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), - this, SLOT( slotAccountOnlineStatusChanged( Kopete::Contact * ) ) ); + TQObject::connect( it.current()->myself(), + TQT_SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), + this, TQT_SLOT( slotAccountOnlineStatusChanged( Kopete::Contact * ) ) ); it.current()->disconnect(); } else @@ -146,8 +146,8 @@ void Protocol::aboutToUnload() kdDebug( 14010 ) << k_funcinfo << it.current()->accountId() << " is already disconnected, deleting..." << endl; - QObject::connect( it.current(), SIGNAL( accountDestroyed( const Kopete::Account* ) ), - this, SLOT( slotAccountDestroyed( ) ) ); + TQObject::connect( it.current(), TQT_SIGNAL( accountDestroyed( const Kopete::Account* ) ), + this, TQT_SLOT( slotAccountDestroyed( ) ) ); it.current()->deleteLater(); } } @@ -157,13 +157,13 @@ void Protocol::aboutToUnload() void Protocol::slotMetaContactAboutToSave( MetaContact *metaContact ) { - QMap<QString, QString> serializedData, sd; - QMap<QString, QString> addressBookData, ad; - QMap<QString, QString>::Iterator it; + TQMap<TQString, TQString> serializedData, sd; + TQMap<TQString, TQString> addressBookData, ad; + TQMap<TQString, TQString>::Iterator it; //kdDebug( 14010 ) << "Protocol::metaContactAboutToSave: protocol " << pluginId() << ": serializing " << metaContact->displayName() << endl; - QPtrList<Contact> contacts=metaContact->contacts(); + TQPtrList<Contact> contacts=metaContact->contacts(); for (Contact *c=contacts.first() ; c ; c=contacts.next() ) { if( c->protocol()->pluginId() != pluginId() ) @@ -174,14 +174,14 @@ void Protocol::slotMetaContactAboutToSave( MetaContact *metaContact ) // Preset the contactId and displayName, if the plugin doesn't want to save // them, or use its own format, it can call clear() on the provided list - sd[ QString::fromLatin1( "contactId" ) ] = c->contactId(); + sd[ TQString::fromLatin1( "contactId" ) ] = c->contactId(); //TODO(nick) remove - sd[ QString::fromLatin1( "displayName" ) ] = c->property(Global::Properties::self()->nickName()).value().toString(); + sd[ TQString::fromLatin1( "displayName" ) ] = c->property(Global::Properties::self()->nickName()).value().toString(); if(c->account()) - sd[ QString::fromLatin1( "accountId" ) ] = c->account()->accountId(); + sd[ TQString::fromLatin1( "accountId" ) ] = c->account()->accountId(); // If there's an index field preset it too - QString index = c->protocol()->addressBookIndexField(); + TQString index = c->protocol()->addressBookIndexField(); if( !index.isEmpty() ) ad[ index ] = c->contactId(); @@ -194,11 +194,11 @@ void Protocol::slotMetaContactAboutToSave( MetaContact *metaContact ) // The Unicode chars E000-F800 are non-printable and reserved for // private use in applications. For more details, see also // http://www.unicode.org/charts/PDF/UE000.pdf. - // Inside libkabc the use of QChar( 0xE000 ) has been standardized + // Inside libkabc the use of TQChar( 0xE000 ) has been standardized // as separator for the string lists, use this also for the 'normal' // serialized data. if( serializedData.contains( it.key() ) ) - serializedData[ it.key() ] = serializedData[ it.key() ] + QChar( 0xE000 ) + it.data(); + serializedData[ it.key() ] = serializedData[ it.key() ] + TQChar( 0xE000 ) + it.data(); else serializedData[ it.key() ] = it.data(); } @@ -206,7 +206,7 @@ void Protocol::slotMetaContactAboutToSave( MetaContact *metaContact ) for( it = ad.begin(); it != ad.end(); ++it ) { if( addressBookData.contains( it.key() ) ) - addressBookData[ it.key() ] = addressBookData[ it.key() ] + QChar( 0xE000 ) + it.data(); + addressBookData[ it.key() ] = addressBookData[ it.key() ] + TQChar( 0xE000 ) + it.data(); else addressBookData[ it.key() ] = it.data(); } @@ -226,48 +226,48 @@ void Protocol::slotMetaContactAboutToSave( MetaContact *metaContact ) // we can devise a better API, but with the constantly changing // requirements every time I learn more about kabc I'd better no touch // the API yet - Martijn - if( it.key().startsWith( QString::fromLatin1( "messaging/" ) ) ) + if( it.key().startsWith( TQString::fromLatin1( "messaging/" ) ) ) { - metaContact->setAddressBookField( this, it.key(), QString::fromLatin1( "All" ), it.data() ); + metaContact->setAddressBookField( this, it.key(), TQString::fromLatin1( "All" ), it.data() ); // kdDebug(14010) << k_funcinfo << "metaContact->setAddressBookField( " << this << ", " << it.key() << ", \"All\", " << it.data() << " );" << endl; } else - metaContact->setAddressBookField( this, QString::fromLatin1( "kopete" ), it.key(), it.data() ); + metaContact->setAddressBookField( this, TQString::fromLatin1( "kopete" ), it.key(), it.data() ); } } -void Protocol::deserialize( MetaContact *metaContact, const QMap<QString, QString> &data ) +void Protocol::deserialize( MetaContact *metaContact, const TQMap<TQString, TQString> &data ) { /*kdDebug( 14010 ) << "Protocol::deserialize: protocol " << pluginId() << ": deserializing " << metaContact->displayName() << endl;*/ - QMap<QString, QStringList> serializedData; - QMap<QString, QStringList::Iterator> serializedDataIterators; - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQStringList> serializedData; + TQMap<TQString, TQStringList::Iterator> serializedDataIterators; + TQMap<TQString, TQString>::ConstIterator it; for( it = data.begin(); it != data.end(); ++it ) { - serializedData[ it.key() ] = QStringList::split( QChar( 0xE000 ), it.data(), true ); + serializedData[ it.key() ] = TQStringList::split( TQChar( 0xE000 ), it.data(), true ); serializedDataIterators[ it.key() ] = serializedData[ it.key() ].begin(); } - uint count = serializedData[QString::fromLatin1("contactId")].count(); + uint count = serializedData[TQString::fromLatin1("contactId")].count(); // Prepare the independent entries to pass to the plugin's implementation for( uint i = 0; i < count ; i++ ) { - QMap<QString, QString> sd; - QMap<QString, QStringList::Iterator>::Iterator serializedDataIt; + TQMap<TQString, TQString> sd; + TQMap<TQString, TQStringList::Iterator>::Iterator serializedDataIt; for( serializedDataIt = serializedDataIterators.begin(); serializedDataIt != serializedDataIterators.end(); ++serializedDataIt ) { sd[ serializedDataIt.key() ] = *( serializedDataIt.data() ); ++( serializedDataIt.data() ); } - const QString& accountId=sd[ QString::fromLatin1( "accountId" ) ]; + const TQString& accountId=sd[ TQString::fromLatin1( "accountId" ) ]; // myself was allowed in the contactlist in old version of kopete. // But if one keep it on the contactlist now, it may conflict witht he myself metacontact. // So ignore it - if(accountId == sd[ QString::fromLatin1( "contactId" ) ] ) + if(accountId == sd[ TQString::fromLatin1( "contactId" ) ] ) { kdDebug( 14010 ) << k_funcinfo << "Myself contact was on the contactlist.xml for account " << accountId << ". Ignore it" << endl; continue; @@ -282,18 +282,18 @@ void Protocol::deserialize( MetaContact *metaContact, const QMap<QString, QStrin // never notice, since none of the plugins use the address // book data in the deserializer yet, only when serializing. // - Martijn - QMap<QString, QString> ad; - QStringList kabcFields = addressBookFields(); - for( QStringList::Iterator fieldIt = kabcFields.begin(); fieldIt != kabcFields.end(); ++fieldIt ) + TQMap<TQString, TQString> ad; + TQStringList kabcFields = addressBookFields(); + for( TQStringList::Iterator fieldIt = kabcFields.begin(); fieldIt != kabcFields.end(); ++fieldIt ) { // FIXME: This hack is even more ugly, and has the same reasons as the similar // hack in the serialize code. // Once this code is actually capable of talking to kabc this hack // should be removed ASAP! - Martijn - if( ( *fieldIt ).startsWith( QString::fromLatin1( "messaging/" ) ) ) - ad[ *fieldIt ] = metaContact->addressBookField( this, *fieldIt, QString::fromLatin1( "All" ) ); + if( ( *fieldIt ).startsWith( TQString::fromLatin1( "messaging/" ) ) ) + ad[ *fieldIt ] = metaContact->addressBookField( this, *fieldIt, TQString::fromLatin1( "All" ) ); else - ad[ *fieldIt ] = metaContact->addressBookField( this, QString::fromLatin1( "kopete" ), *fieldIt ); + ad[ *fieldIt ] = metaContact->addressBookField( this, TQString::fromLatin1( "kopete" ), *fieldIt ); } // Check if we have an account id. If not we're deserializing a Kopete 0.6 contact @@ -302,10 +302,10 @@ void Protocol::deserialize( MetaContact *metaContact, const QMap<QString, QStrin // who migrate from 0.6, as there's only one account in that case if( accountId.isNull() ) { - QDict<Account> accounts = AccountManager::self()->accounts( this ); + TQDict<Account> accounts = AccountManager::self()->accounts( this ); if ( accounts.count() > 0 ) { - sd[ QString::fromLatin1( "accountId" ) ] = QDictIterator<Account>( accounts ).currentKey(); + sd[ TQString::fromLatin1( "accountId" ) ] = TQDictIterator<Account>( accounts ).currentKey(); } else { @@ -326,8 +326,8 @@ void Protocol::deserialize( MetaContact *metaContact, const QMap<QString, QStrin Contact *Protocol::deserializeContact( MetaContact */*metaContact */, - const QMap<QString, QString> & /* serializedData */, - const QMap<QString, QString> & /* addressBookData */ ) + const TQMap<TQString, TQString> & /* serializedData */, + const TQMap<TQString, TQString> & /* addressBookData */ ) { /* Default implementation does nothing */ return 0; |