diff options
Diffstat (limited to 'kopete/libkopete/kabcpersistence.cpp')
-rw-r--r-- | kopete/libkopete/kabcpersistence.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/kopete/libkopete/kabcpersistence.cpp b/kopete/libkopete/kabcpersistence.cpp index 527a99a4..93d55b35 100644 --- a/kopete/libkopete/kabcpersistence.cpp +++ b/kopete/libkopete/kabcpersistence.cpp @@ -15,8 +15,8 @@ ************************************************************************* */ -#include <qstring.h> -#include <qtimer.h> +#include <tqstring.h> +#include <tqtimer.h> #include <kabc/addressbook.h> #include <kabc/addressee.h> @@ -47,19 +47,19 @@ namespace Kopete /** * utility function to merge two QStrings containing individual elements separated by 0xE000 */ -static QString unionContents( QString arg1, QString arg2 ) +static TQString unionContents( TQString arg1, TQString arg2 ) { - QChar separator( 0xE000 ); - QStringList outList = QStringList::split( separator, arg1 ); - QStringList arg2List = QStringList::split( separator, arg2 ); - for ( QStringList::iterator it = arg2List.begin(); it != arg2List.end(); ++it ) + TQChar separator( 0xE000 ); + TQStringList outList = TQStringList::split( separator, arg1 ); + TQStringList arg2List = TQStringList::split( separator, arg2 ); + for ( TQStringList::iterator it = arg2List.begin(); it != arg2List.end(); ++it ) if ( !outList.contains( *it ) ) outList.append( *it ); - QString out = outList.join( separator ); + TQString out = outList.join( separator ); return out; } -KABCPersistence::KABCPersistence( QObject * parent, const char * name ) : QObject( parent, name ) +KABCPersistence::KABCPersistence( TQObject * parent, const char * name ) : TQObject( parent, name ) { s_pendingResources.setAutoDelete( false ); } @@ -72,7 +72,7 @@ KABCPersistence *KABCPersistence::s_self = 0L; bool KABCPersistence::s_addrBookWritePending = false; -QPtrList<KABC::Resource> KABCPersistence::s_pendingResources; +TQPtrList<KABC::Resource> KABCPersistence::s_pendingResources; KABC::AddressBook* KABCPersistence::s_addressBook = 0; @@ -112,29 +112,29 @@ void KABCPersistence::write( MetaContact * mc ) else { // collate the instant messaging data to be inserted into the address book - QMap<QString, QStringList> addressMap; - QPtrList<Contact> contacts = mc->contacts(); - QPtrListIterator<Contact> cIt( contacts ); + TQMap<TQString, TQStringList> addressMap; + TQPtrList<Contact> contacts = mc->contacts(); + TQPtrListIterator<Contact> cIt( contacts ); while ( Contact * c = cIt.current() ) { - QStringList addresses = addressMap[ c->protocol()->addressBookIndexField() ]; + TQStringList addresses = addressMap[ c->protocol()->addressBookIndexField() ]; addresses.append( c->contactId() ); addressMap.insert( c->protocol()->addressBookIndexField(), addresses ); ++cIt; } // insert a custom field for each protocol - QMap<QString, QStringList>::ConstIterator it = addressMap.begin(); + TQMap<TQString, TQStringList>::ConstIterator it = addressMap.begin(); for ( ; it != addressMap.end(); ++it ) { // read existing data for this key - QString currentCustomForProtocol = theAddressee.custom( it.key(), QString::fromLatin1( "All" ) ); + TQString currentCustomForProtocol = theAddressee.custom( it.key(), TQString::fromLatin1( "All" ) ); // merge without duplicating - QString toWrite = unionContents( currentCustomForProtocol, it.data().join( QChar( 0xE000 ) ) ); + TQString toWrite = unionContents( currentCustomForProtocol, it.data().join( TQChar( 0xE000 ) ) ); // Note if nothing ends up in the KABC data, this is because insertCustom does nothing if any param is empty. kdDebug( 14010 ) << k_funcinfo << "Writing: " << it.key() << ", " << "All" << ", " << toWrite << endl; - theAddressee.insertCustom( it.key(), QString::fromLatin1( "All" ), toWrite ); - QString check = theAddressee.custom( it.key(), QString::fromLatin1( "All" ) ); + theAddressee.insertCustom( it.key(), TQString::fromLatin1( "All" ), toWrite ); + TQString check = theAddressee.custom( it.key(), TQString::fromLatin1( "All" ) ); } ab->insertAddressee( theAddressee ); //kdDebug( 14010 ) << k_funcinfo << "dumping addressbook before write " << endl; @@ -150,16 +150,16 @@ void KABCPersistence::write( MetaContact * mc ) kdDebug( 14010 ) << k_funcinfo << "...FOUND ONE!" << endl; // Store address book fields - QMap<QString, QMap<QString, QString> >::ConstIterator appIt = d->addressBook.begin(); + TQMap<TQString, TQMap<TQString, TQString> >::ConstIterator appIt = d->addressBook.begin(); for( ; appIt != d->addressBook.end(); ++appIt ) { - QMap<QString, QString>::ConstIterator addrIt = appIt.data().begin(); + TQMap<TQString, TQString>::ConstIterator addrIt = appIt.data().begin(); for( ; addrIt != appIt.data().end(); ++addrIt ) { // read existing data for this key - QString currentCustom = theAddressee.custom( appIt.key(), addrIt.key() ); + TQString currentCustom = theAddressee.custom( appIt.key(), addrIt.key() ); // merge without duplicating - QString toWrite = unionContents( currentCustom, addrIt.data() ); + TQString toWrite = unionContents( currentCustom, addrIt.data() ); // write the result // Note if nothing ends up in the KABC data, this is because insertCustom does nothing if any param is empty. kdDebug( 14010 ) << k_funcinfo << "Writing: " << appIt.key() << ", " << addrIt.key() << ", " << toWrite << endl; @@ -178,7 +178,7 @@ void KABCPersistence::writeAddressBook( const KABC::Resource * res) if ( !s_addrBookWritePending ) { s_addrBookWritePending = true; - QTimer::singleShot( 2000, this, SLOT( slotWriteAddressBook() ) ); + TQTimer::singleShot( 2000, this, TQT_SLOT( slotWriteAddressBook() ) ); } } @@ -186,7 +186,7 @@ void KABCPersistence::slotWriteAddressBook() { //kdDebug( 14010 ) << k_funcinfo << endl; KABC::AddressBook* ab = addressBook(); - QPtrListIterator<KABC::Resource> it( s_pendingResources ); + TQPtrListIterator<KABC::Resource> it( s_pendingResources ); for ( ; it.current(); ++it ) { //kdDebug( 14010 ) << "Writing resource " << it.current()->resourceName() << endl; @@ -229,16 +229,16 @@ void KABCPersistence::removeKABC( MetaContact *) { // remove the link //kdDebug( 14010 ) << k_funcinfo << "...not found." << endl; - d->metaContactId=QString::null; + d->metaContactId=TQString::null; } else { //kdDebug( 14010 ) << k_funcinfo << "...FOUND ONE!" << endl; // Remove address book fields - QMap<QString, QMap<QString, QString> >::ConstIterator appIt = d->addressBook.begin(); + TQMap<TQString, TQMap<TQString, TQString> >::ConstIterator appIt = d->addressBook.begin(); for( ; appIt != d->addressBook.end(); ++appIt ) { - QMap<QString, QString>::ConstIterator addrIt = appIt.data().begin(); + TQMap<TQString, TQString>::ConstIterator addrIt = appIt.data().begin(); for( ; addrIt != appIt.data().end(); ++addrIt ) { // FIXME: This assumes Kopete is the only app writing these fields @@ -265,29 +265,29 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc ) if ( !addr.isEmpty() ) // if we are associated with KABC { // load the set of addresses from KABC - QStringList customs = addr.customs(); + TQStringList customs = addr.customs(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it = customs.begin(); it != customs.end(); ++it ) { - QString app, name, value; + TQString app, name, value; splitField( *it, app, name, value ); kdDebug( 14010 ) << "app=" << app << " name=" << name << " value=" << value << endl; - if ( app.startsWith( QString::fromLatin1( "messaging/" ) ) ) + if ( app.startsWith( TQString::fromLatin1( "messaging/" ) ) ) { - if ( name == QString::fromLatin1( "All" ) ) + if ( name == TQString::fromLatin1( "All" ) ) { kdDebug( 14010 ) << " syncing \"" << app << ":" << name << " with contactlist " << endl; // Get the protocol name from the custom field // by chopping the 'messaging/' prefix from the custom field app name - QString protocolName = app.right( app.length() - 10 ); + TQString protocolName = app.right( app.length() - 10 ); // munge Jabber hack - if ( protocolName == QString::fromLatin1( "xmpp" ) ) - protocolName = QString::fromLatin1( "jabber" ); + if ( protocolName == TQString::fromLatin1( "xmpp" ) ) + protocolName = TQString::fromLatin1( "jabber" ); // Check Kopete supports it - Protocol * proto = dynamic_cast<Protocol*>( PluginManager::self()->loadPlugin( QString::fromLatin1( "kopete_" ) + protocolName ) ); + Protocol * proto = dynamic_cast<Protocol*>( PluginManager::self()->loadPlugin( TQString::fromLatin1( "kopete_" ) + protocolName ) ); if ( !proto ) { KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, @@ -297,20 +297,20 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc ) } // See if we need to add each contact in this protocol - QStringList addresses = QStringList::split( QChar( 0xE000 ), value ); - QStringList::iterator end = addresses.end(); - for ( QStringList::iterator it = addresses.begin(); it != end; ++it ) + TQStringList addresses = TQStringList::split( TQChar( 0xE000 ), value ); + TQStringList::iterator end = addresses.end(); + for ( TQStringList::iterator it = addresses.begin(); it != end; ++it ) { // check whether each one is present in Kopete // Is it in the contact list? // First discard anything after an 0xE120, this is used by IRC to separate nick and server group name, but // IRC doesn't support this properly yet, so the user will have to select an appropriate account manually - int separatorPos = (*it).find( QChar( 0xE120 ) ); + int separatorPos = (*it).find( TQChar( 0xE120 ) ); if ( separatorPos != -1 ) *it = (*it).left( separatorPos ); - QDict<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts( proto ); - QDictIterator<Kopete::Account> acs(accounts); + TQDict<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts( proto ); + TQDictIterator<Kopete::Account> acs(accounts); Kopete::MetaContact *otherMc = 0; for ( acs.toFirst(); acs.current(); ++acs ) { @@ -332,14 +332,14 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc ) } kdDebug( 14010 ) << *it << " already exists in OTHER metacontact, move here?" << endl; // find the Kopete::Contact and attempt to move it to this metacontact. - otherMc->findContact( proto->pluginId(), QString::null, *it )->setMetaContact( mc ); + otherMc->findContact( proto->pluginId(), TQString::null, *it )->setMetaContact( mc ); } else { // if not, prompt to add it kdDebug( 14010 ) << proto->pluginId() << "://" << *it << " was not found in the contact list. Prompting to add..." << endl; if ( KMessageBox::Yes == KMessageBox::questionYesNo( Kopete::UI::Global::mainWidget(), - i18n( "<qt>An address was added to this contact by another application.<br>Would you like to use it in Kopete?<br><b>Protocol:</b> %1<br><b>Address:</b> %2</qt>" ).arg( proto->displayName() ).arg( *it ), i18n( "Import Address From Address Book" ), i18n("Use"), i18n("Do Not Use"), QString::fromLatin1( "ImportFromKABC" ) ) ) + i18n( "<qt>An address was added to this contact by another application.<br>Would you like to use it in Kopete?<br><b>Protocol:</b> %1<br><b>Address:</b> %2</qt>" ).arg( proto->displayName() ).arg( *it ), i18n( "Import Address From Address Book" ), i18n("Use"), i18n("Do Not Use"), TQString::fromLatin1( "ImportFromKABC" ) ) ) { // Check the accounts for this protocol are all connected // Most protocols do not allow you to add contacts while offline @@ -369,7 +369,7 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc ) AccountSelector *accSelector = new AccountSelector(proto, chooser, "accSelector"); chooser->setMainWidget(accSelector); - if ( chooser->exec() == QDialog::Rejected ) + if ( chooser->exec() == TQDialog::Rejected ) continue; chosen = accSelector->selectedItem(); @@ -418,11 +418,11 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc ) } // FIXME: Remove when IM address API is in KABC (KDE 4) -void KABCPersistence::splitField( const QString &str, QString &app, QString &name, QString &value ) +void KABCPersistence::splitField( const TQString &str, TQString &app, TQString &name, TQString &value ) { int colon = str.find( ':' ); if ( colon != -1 ) { - QString tmp = str.left( colon ); + TQString tmp = str.left( colon ); value = str.mid( colon + 1 ); int dash = tmp.find( '-' ); |