From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/kopeteprotocol.cpp | 98 ++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'kopete/libkopete/kopeteprotocol.cpp') 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 #include -#include +#include #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 accounts = AccountManager::self()->accounts( this ); + TQDict 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 it( accounts ); it.current() ; ++it ) + for( TQDictIterator 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 dict = AccountManager::self()->accounts( this ); + TQDict 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 accounts = AccountManager::self()->accounts( this ); + TQDict accounts = AccountManager::self()->accounts( this ); if ( accounts.isEmpty() ) emit readyForUnload(); - else for ( QDictIterator it( accounts ); it.current() ; ++it ) + else for ( TQDictIterator 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 serializedData, sd; - QMap addressBookData, ad; - QMap::Iterator it; + TQMap serializedData, sd; + TQMap addressBookData, ad; + TQMap::Iterator it; //kdDebug( 14010 ) << "Protocol::metaContactAboutToSave: protocol " << pluginId() << ": serializing " << metaContact->displayName() << endl; - QPtrList contacts=metaContact->contacts(); + TQPtrList 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 &data ) +void Protocol::deserialize( MetaContact *metaContact, const TQMap &data ) { /*kdDebug( 14010 ) << "Protocol::deserialize: protocol " << pluginId() << ": deserializing " << metaContact->displayName() << endl;*/ - QMap serializedData; - QMap serializedDataIterators; - QMap::ConstIterator it; + TQMap serializedData; + TQMap serializedDataIterators; + TQMap::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 sd; - QMap::Iterator serializedDataIt; + TQMap sd; + TQMap::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 ad; - QStringList kabcFields = addressBookFields(); - for( QStringList::Iterator fieldIt = kabcFields.begin(); fieldIt != kabcFields.end(); ++fieldIt ) + TQMap 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 accounts = AccountManager::self()->accounts( this ); + TQDict accounts = AccountManager::self()->accounts( this ); if ( accounts.count() > 0 ) { - sd[ QString::fromLatin1( "accountId" ) ] = QDictIterator( accounts ).currentKey(); + sd[ TQString::fromLatin1( "accountId" ) ] = TQDictIterator( accounts ).currentKey(); } else { @@ -326,8 +326,8 @@ void Protocol::deserialize( MetaContact *metaContact, const QMap & /* serializedData */, - const QMap & /* addressBookData */ ) + const TQMap & /* serializedData */, + const TQMap & /* addressBookData */ ) { /* Default implementation does nothing */ return 0; -- cgit v1.2.1