diff options
Diffstat (limited to 'kopete/libkopete/kopetemetacontact.cpp')
-rw-r--r-- | kopete/libkopete/kopetemetacontact.cpp | 334 |
1 files changed, 167 insertions, 167 deletions
diff --git a/kopete/libkopete/kopetemetacontact.cpp b/kopete/libkopete/kopetemetacontact.cpp index e181f52e..9a908f32 100644 --- a/kopete/libkopete/kopetemetacontact.cpp +++ b/kopete/libkopete/kopetemetacontact.cpp @@ -46,12 +46,12 @@ namespace Kopete { // this is just to save typing -const QString NSCID_ELEM = QString::fromUtf8("nameSourceContactId" ); -const QString NSPID_ELEM = QString::fromUtf8( "nameSourcePluginId" ); -const QString NSAID_ELEM = QString::fromUtf8( "nameSourceAccountId" ); -const QString PSCID_ELEM = QString::fromUtf8( "photoSourceContactId" ); -const QString PSPID_ELEM = QString::fromUtf8( "photoSourcePluginId" ); -const QString PSAID_ELEM = QString::fromUtf8( "photoSourceAccountId" ); +const TQString NSCID_ELEM = TQString::fromUtf8("nameSourceContactId" ); +const TQString NSPID_ELEM = TQString::fromUtf8( "nameSourcePluginId" ); +const TQString NSAID_ELEM = TQString::fromUtf8( "nameSourceAccountId" ); +const TQString PSCID_ELEM = TQString::fromUtf8( "photoSourceContactId" ); +const TQString PSPID_ELEM = TQString::fromUtf8( "photoSourcePluginId" ); +const TQString PSAID_ELEM = TQString::fromUtf8( "photoSourceAccountId" ); class MetaContact::Private { public: @@ -64,7 +64,7 @@ class MetaContact::Private ~Private() {} - QPtrList<Contact> contacts; + TQPtrList<Contact> contacts; // property sources PropertySource photoSource; @@ -75,22 +75,22 @@ class MetaContact::Private Contact *photoSourceContact; // used when source is kabc - QString metaContactId; + TQString metaContactId; // used when source is custom - QString displayName; + TQString displayName; KURL photoUrl; - QPtrList<Group> groups; - QMap<QString, QMap<QString, QString> > addressBook; + TQPtrList<Group> groups; + TQMap<TQString, TQMap<TQString, TQString> > addressBook; bool temporary; OnlineStatus::StatusType onlineStatus; bool photoSyncedWithKABC; // Used to set contact source at load. - QString nameSourcePID, nameSourceAID, nameSourceCID; - QString photoSourcePID, photoSourceAID, photoSourceCID; + TQString nameSourcePID, nameSourceAID, nameSourceCID; + TQString photoSourcePID, photoSourceAID, photoSourceCID; // The photo cache. Reduce disk access and CPU usage. Picture customPicture, contactPicture, kabcPicture; @@ -101,18 +101,18 @@ MetaContact::MetaContact() { d = new Private; - connect( this, SIGNAL( pluginDataChanged() ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( iconChanged( Kopete::ContactListElement::IconState, const QString & ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( useCustomIconChanged( bool ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( displayNameChanged( const QString &, const QString & ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( movedToGroup( Kopete::MetaContact *, Kopete::Group *, Kopete::Group * ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( removedFromGroup( Kopete::MetaContact *, Kopete::Group * ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( addedToGroup( Kopete::MetaContact *, Kopete::Group * ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( contactAdded( Kopete::Contact * ) ), SIGNAL( persistentDataChanged() ) ); - connect( this, SIGNAL( contactRemoved( Kopete::Contact * ) ), SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( pluginDataChanged() ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( iconChanged( Kopete::ContactListElement::IconState, const TQString & ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( useCustomIconChanged( bool ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( displayNameChanged( const TQString &, const TQString & ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( movedToGroup( Kopete::MetaContact *, Kopete::Group *, Kopete::Group * ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( removedFromGroup( Kopete::MetaContact *, Kopete::Group * ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( addedToGroup( Kopete::MetaContact *, Kopete::Group * ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( contactAdded( Kopete::Contact * ) ), TQT_SIGNAL( persistentDataChanged() ) ); + connect( this, TQT_SIGNAL( contactRemoved( Kopete::Contact * ) ), TQT_SIGNAL( persistentDataChanged() ) ); // Update the KABC picture when the KDE Address book change. - connect(KABCPersistence::self()->addressBook(), SIGNAL(addressBookChanged(AddressBook *)), this, SLOT(slotUpdateAddressBookPicture())); + connect(KABCPersistence::self()->addressBook(), TQT_SIGNAL(addressBookChanged(AddressBook *)), this, TQT_SLOT(slotUpdateAddressBookPicture())); // make sure MetaContact is at least in one group addToGroup( Group::topLevel() ); @@ -135,17 +135,17 @@ void MetaContact::addContact( Contact *c ) { d->contacts.append( c ); - connect( c, SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), - SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) ); + connect( c, TQT_SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), + TQT_SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) ); - connect( c, SIGNAL( propertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ), - this, SLOT( slotPropertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ) ) ; + connect( c, TQT_SIGNAL( propertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ), + this, TQT_SLOT( slotPropertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ) ) ; - connect( c, SIGNAL( contactDestroyed( Kopete::Contact * ) ), - this, SLOT( slotContactDestroyed( Kopete::Contact * ) ) ); + connect( c, TQT_SIGNAL( contactDestroyed( Kopete::Contact * ) ), + this, TQT_SLOT( slotContactDestroyed( Kopete::Contact * ) ) ); - connect( c, SIGNAL( idleStateChanged( Kopete::Contact * ) ), - this, SIGNAL( contactIdleStateChanged( Kopete::Contact * ) ) ); + connect( c, TQT_SIGNAL( idleStateChanged( Kopete::Contact * ) ), + this, TQT_SIGNAL( contactIdleStateChanged( Kopete::Contact * ) ) ); emit contactAdded(c); @@ -174,7 +174,7 @@ void MetaContact::updateOnlineStatus() Kopete::OnlineStatus::StatusType newStatus = Kopete::OnlineStatus::Unknown; Kopete::OnlineStatus mostSignificantStatus; - for ( QPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) + for ( TQPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) { // find most significant status if ( it.current()->onlineStatus() > mostSignificantStatus ) @@ -203,7 +203,7 @@ void MetaContact::removeContact(Contact *c, bool deleted) bool wasTrackingName = ( !displayNameSourceContact() && (displayNameSource() == SourceContact) ); bool wasTrackingPhoto = ( !photoSourceContact() && (photoSource() == SourceContact) ); // save for later use - QString currDisplayName = displayName(); + TQString currDisplayName = displayName(); d->contacts.remove( c ); @@ -258,14 +258,14 @@ void MetaContact::removeContact(Contact *c, bool deleted) if(!deleted) { //If this function is tell by slotContactRemoved, c is maybe just a QObject - disconnect( c, SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), - this, SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) ); - disconnect( c, SIGNAL( propertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ), - this, SLOT( slotPropertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ) ) ; - disconnect( c, SIGNAL( contactDestroyed( Kopete::Contact * ) ), - this, SLOT( slotContactDestroyed( Kopete::Contact * ) ) ); - disconnect( c, SIGNAL( idleStateChanged( Kopete::Contact * ) ), - this, SIGNAL( contactIdleStateChanged( Kopete::Contact *) ) ); + disconnect( c, TQT_SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ), + this, TQT_SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) ); + disconnect( c, TQT_SIGNAL( propertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ), + this, TQT_SLOT( slotPropertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ) ) ; + disconnect( c, TQT_SIGNAL( contactDestroyed( Kopete::Contact * ) ), + this, TQT_SLOT( slotContactDestroyed( Kopete::Contact * ) ) ); + disconnect( c, TQT_SIGNAL( idleStateChanged( Kopete::Contact * ) ), + this, TQT_SIGNAL( contactIdleStateChanged( Kopete::Contact *) ) ); kdDebug( 14010 ) << k_funcinfo << "Contact disconnected" << endl; @@ -280,10 +280,10 @@ void MetaContact::removeContact(Contact *c, bool deleted) updateOnlineStatus(); } -Contact *MetaContact::findContact( const QString &protocolId, const QString &accountId, const QString &contactId ) +Contact *MetaContact::findContact( const TQString &protocolId, const TQString &accountId, const TQString &contactId ) { //kdDebug( 14010 ) << k_funcinfo << "Num contacts: " << d->contacts.count() << endl; - QPtrListIterator<Contact> it( d->contacts ); + TQPtrListIterator<Contact> it( d->contacts ); for( ; it.current(); ++it ) { //kdDebug( 14010 ) << k_funcinfo << "Trying " << it.current()->contactId() << ", proto " @@ -307,9 +307,9 @@ Contact *MetaContact::findContact( const QString &protocolId, const QString &acc void MetaContact::setDisplayNameSource(PropertySource source) { - QString oldName = displayName(); + TQString oldName = displayName(); d->displayNameSource = source; - QString newName = displayName(); + TQString newName = displayName(); if ( oldName != newName) emit displayNameChanged( oldName, newName ); } @@ -386,7 +386,7 @@ Contact *MetaContact::preferredContact() Contact *contact = 0; bool hasOpenView=false; //has the selected contact already an open chatwindow - for ( QPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) + for ( TQPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) { Contact *c=it.current(); @@ -451,7 +451,7 @@ Contact *MetaContact::execute() unsigned long int MetaContact::idleTime() const { unsigned long int time = 0; - QPtrListIterator<Contact> it( d->contacts ); + TQPtrListIterator<Contact> it( d->contacts ); for( ; it.current(); ++it ) { unsigned long int i = it.current()->idleTime(); @@ -463,7 +463,7 @@ unsigned long int MetaContact::idleTime() const return time; } -QString MetaContact::statusIcon() const +TQString MetaContact::statusIcon() const { switch( status() ) { @@ -471,31 +471,31 @@ QString MetaContact::statusIcon() const if( useCustomIcon() ) return icon( ContactListElement::Online ); else - return QString::fromUtf8( "metacontact_online" ); + return TQString::fromUtf8( "metacontact_online" ); case OnlineStatus::Away: if( useCustomIcon() ) return icon( ContactListElement::Away ); else - return QString::fromUtf8( "metacontact_away" ); + return TQString::fromUtf8( "metacontact_away" ); case OnlineStatus::Unknown: if( useCustomIcon() ) return icon( ContactListElement::Unknown ); if ( d->contacts.isEmpty() ) - return QString::fromUtf8( "metacontact_unknown" ); + return TQString::fromUtf8( "metacontact_unknown" ); else - return QString::fromUtf8( "metacontact_offline" ); + return TQString::fromUtf8( "metacontact_offline" ); case OnlineStatus::Offline: default: if( useCustomIcon() ) return icon( ContactListElement::Offline ); else - return QString::fromUtf8( "metacontact_offline" ); + return TQString::fromUtf8( "metacontact_offline" ); } } -QString MetaContact::statusString() const +TQString MetaContact::statusString() const { switch( status() ) { @@ -518,7 +518,7 @@ OnlineStatus::StatusType MetaContact::status() const bool MetaContact::isOnline() const { - QPtrListIterator<Contact> it( d->contacts ); + TQPtrListIterator<Contact> it( d->contacts ); for( ; it.current(); ++it ) { if( it.current()->isOnline() ) @@ -532,7 +532,7 @@ bool MetaContact::isReachable() const if ( isOnline() ) return true; - for ( QPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) + for ( TQPtrListIterator<Contact> it( d->contacts ); it.current(); ++it ) { if ( it.current()->account()->isConnected() && it.current()->isReachable() ) return true; @@ -546,7 +546,7 @@ bool MetaContact::canAcceptFiles() const if( !isOnline() ) return false; - QPtrListIterator<Contact> it( d->contacts ); + TQPtrListIterator<Contact> it( d->contacts ); for( ; it.current(); ++it ) { if( it.current()->canAcceptFiles() ) @@ -556,7 +556,7 @@ bool MetaContact::canAcceptFiles() const } //Slot for sending files -void MetaContact::sendFile( const KURL &sourceURL, const QString &altFileName, unsigned long fileSize ) +void MetaContact::sendFile( const KURL &sourceURL, const TQString &altFileName, unsigned long fileSize ) { //If we can't send any files then exit if( d->contacts.isEmpty() || !canAcceptFiles() ) @@ -564,7 +564,7 @@ void MetaContact::sendFile( const KURL &sourceURL, const QString &altFileName, u //Find the highest ranked protocol that can accept files Contact *contact = d->contacts.first(); - for( QPtrListIterator<Contact> it( d->contacts ) ; it.current(); ++it ) + for( TQPtrListIterator<Contact> it( d->contacts ) ; it.current(); ++it ) { if( ( *it )->onlineStatus() > contact->onlineStatus() && ( *it )->canAcceptFiles() ) contact = *it; @@ -581,7 +581,7 @@ void MetaContact::slotContactStatusChanged( Contact * c, const OnlineStatus &sta emit contactStatusChanged( c, status ); } -void MetaContact::setDisplayName( const QString &name ) +void MetaContact::setDisplayName( const TQString &name ) { /*kdDebug( 14010 ) << k_funcinfo << "Change displayName from " << d->displayName << " to " << name << ", d->trackChildNameChanges=" << d->trackChildNameChanges << endl; @@ -590,22 +590,22 @@ void MetaContact::setDisplayName( const QString &name ) if( name == d->displayName ) return; - const QString old = d->displayName; + const TQString old = d->displayName; d->displayName = name; emit displayNameChanged( old , name ); - for( QPtrListIterator<Kopete::Contact> it( d->contacts ) ; it.current(); ++it ) + for( TQPtrListIterator<Kopete::Contact> it( d->contacts ) ; it.current(); ++it ) ( *it )->sync(Contact::DisplayNameChanged); } -QString MetaContact::customDisplayName() const +TQString MetaContact::customDisplayName() const { return d->displayName; } -QString MetaContact::displayName() const +TQString MetaContact::displayName() const { PropertySource source = displayNameSource(); if ( source == SourceKABC ) @@ -637,7 +637,7 @@ QString MetaContact::displayName() const return d->displayName; } -QString nameFromKABC( const QString &id ) /*const*/ +TQString nameFromKABC( const TQString &id ) /*const*/ { KABC::AddressBook* ab = KABCPersistence::self()->addressBook(); if ( ! id.isEmpty() && !id.contains(':') ) @@ -653,20 +653,20 @@ QString nameFromKABC( const QString &id ) /*const*/ } } // no kabc association, return null image - return QString::null; + return TQString::null; } -QString nameFromContact( Kopete::Contact *c) /*const*/ +TQString nameFromContact( Kopete::Contact *c) /*const*/ { if ( !c ) - return QString::null; + return TQString::null; - QString contactName; + TQString contactName; if ( c->hasProperty( Kopete::Global::Properties::self()->nickName().key() ) ) contactName = c->property( Global::Properties::self()->nickName()).value().toString(); //the replace is there to workaround the Bug 95444 - return contactName.isEmpty() ? c->contactId() : contactName.replace('\n',QString::fromUtf8("")); + return contactName.isEmpty() ? c->contactId() : contactName.replace('\n',TQString::fromUtf8("")); } KURL MetaContact::customPhoto() const @@ -685,12 +685,12 @@ void MetaContact::setPhoto( const KURL &url ) } } -QImage MetaContact::photo() const +TQImage MetaContact::photo() const { if( picture().image().width() > 96 && picture().image().height() > 96 ) { kdDebug( 14010 ) << k_funcinfo << "Resizing image from " << picture().image().width() << " x " << picture().image().height() << endl; - return picture().image().smoothScale(96,96,QImage::ScaleMin); + return picture().image().smoothScale(96,96,TQImage::ScaleMin); } else return picture().image(); @@ -710,33 +710,33 @@ Picture &MetaContact::picture() const return d->customPicture; } -QImage MetaContact::photoFromCustom() const +TQImage MetaContact::photoFromCustom() const { return d->customPicture.image(); } -QImage photoFromContact( Kopete::Contact *contact) /*const*/ +TQImage photoFromContact( Kopete::Contact *contact) /*const*/ { if ( contact == 0L ) - return QImage(); + return TQImage(); - QVariant photoProp; + TQVariant photoProp; if ( contact->hasProperty( Kopete::Global::Properties::self()->photo().key() ) ) photoProp = contact->property( Kopete::Global::Properties::self()->photo().key() ).value(); - QImage img; - if(photoProp.canCast( QVariant::Image )) + TQImage img; + if(photoProp.canCast( TQVariant::Image )) img=photoProp.toImage(); - else if(photoProp.canCast( QVariant::Pixmap )) + else if(photoProp.canCast( TQVariant::Pixmap )) img=photoProp.toPixmap().convertToImage(); else if(!photoProp.asString().isEmpty()) { - img=QPixmap( photoProp.toString() ).convertToImage(); + img=TQPixmap( photoProp.toString() ).convertToImage(); } return img; } -QImage photoFromKABC( const QString &id ) /*const*/ +TQImage photoFromKABC( const TQString &id ) /*const*/ { KABC::AddressBook* ab = KABCPersistence::self()->addressBook(); if ( ! id.isEmpty() && !id.contains(':') ) @@ -758,12 +758,12 @@ QImage photoFromKABC( const QString &id ) /*const*/ } else { - return QPixmap( pic.url() ).convertToImage(); + return TQPixmap( pic.url() ).convertToImage(); } } } // no kabc association, return null image - return QImage(); + return TQImage(); } Contact *MetaContact::displayNameSourceContact() const @@ -793,13 +793,13 @@ void MetaContact::setPhotoSourceContact( Contact *contact ) // Create a cache for the contact photo. if(d->photoSourceContact != 0L) { - QVariant photoProp; + TQVariant photoProp; if ( contact->hasProperty( Kopete::Global::Properties::self()->photo().key() ) ) photoProp = contact->property( Kopete::Global::Properties::self()->photo().key() ).value(); - if(photoProp.canCast( QVariant::Image )) + if(photoProp.canCast( TQVariant::Image )) d->contactPicture.setPicture(photoProp.toImage()); - else if(photoProp.canCast( QVariant::Pixmap )) + else if(photoProp.canCast( TQVariant::Pixmap )) d->contactPicture.setPicture(photoProp.toPixmap().convertToImage()); else if(!photoProp.asString().isEmpty()) { @@ -813,8 +813,8 @@ void MetaContact::setPhotoSourceContact( Contact *contact ) } } -void MetaContact::slotPropertyChanged( Contact* subcontact, const QString &key, - const QVariant &oldValue, const QVariant &newValue ) +void MetaContact::slotPropertyChanged( Contact* subcontact, const TQString &key, + const TQVariant &oldValue, const TQVariant &newValue ) { if ( displayNameSource() == SourceContact ) { @@ -932,7 +932,7 @@ void MetaContact::addToGroup( Group *to ) emit addedToGroup( this, to ); } -QPtrList<Group> MetaContact::groups() const +TQPtrList<Group> MetaContact::groups() const { return d->groups; } @@ -942,36 +942,36 @@ void MetaContact::slotContactDestroyed( Contact *contact ) removeContact(contact,true); } -const QDomElement MetaContact::toXML(bool minimal) +const TQDomElement MetaContact::toXML(bool minimal) { // This causes each Kopete::Protocol subclass to serialise its contacts' data into the metacontact's plugin data and address book data emit aboutToSave(this); - QDomDocument metaContact; - metaContact.appendChild( metaContact.createElement( QString::fromUtf8( "meta-contact" ) ) ); - metaContact.documentElement().setAttribute( QString::fromUtf8( "contactId" ), metaContactId() ); + TQDomDocument metaContact; + metaContact.appendChild( metaContact.createElement( TQString::fromUtf8( "meta-contact" ) ) ); + metaContact.documentElement().setAttribute( TQString::fromUtf8( "contactId" ), metaContactId() ); // the custom display name, used for the custom name source - QDomElement displayName = metaContact.createElement( QString::fromUtf8("display-name" ) ); + TQDomElement displayName = metaContact.createElement( TQString::fromUtf8("display-name" ) ); displayName.appendChild( metaContact.createTextNode( d->displayName ) ); metaContact.documentElement().appendChild( displayName ); - QDomElement photo = metaContact.createElement( QString::fromUtf8("photo" ) ); + TQDomElement photo = metaContact.createElement( TQString::fromUtf8("photo" ) ); KURL photoUrl = d->photoUrl; photo.appendChild( metaContact.createTextNode( photoUrl.url() ) ); metaContact.documentElement().appendChild( photo ); // Property sources - QDomElement propertySources = metaContact.createElement( QString::fromUtf8("property-sources" ) ); - QDomElement _nameSource = metaContact.createElement( QString::fromUtf8("name") ); - QDomElement _photoSource = metaContact.createElement( QString::fromUtf8("photo") ); + TQDomElement propertySources = metaContact.createElement( TQString::fromUtf8("property-sources" ) ); + TQDomElement _nameSource = metaContact.createElement( TQString::fromUtf8("name") ); + TQDomElement _photoSource = metaContact.createElement( TQString::fromUtf8("photo") ); // set the contact source for display name - _nameSource.setAttribute(QString::fromUtf8("source"), sourceToString(displayNameSource())); + _nameSource.setAttribute(TQString::fromUtf8("source"), sourceToString(displayNameSource())); // set contact source metadata if (displayNameSourceContact()) { - QDomElement contactNameSource = metaContact.createElement( QString::fromUtf8("contact-source") ); + TQDomElement contactNameSource = metaContact.createElement( TQString::fromUtf8("contact-source") ); contactNameSource.setAttribute( NSCID_ELEM, displayNameSourceContact()->contactId() ); contactNameSource.setAttribute( NSPID_ELEM, displayNameSourceContact()->protocol()->pluginId() ); contactNameSource.setAttribute( NSAID_ELEM, displayNameSourceContact()->account()->accountId() ); @@ -979,16 +979,16 @@ const QDomElement MetaContact::toXML(bool minimal) } // set the contact source for photo - _photoSource.setAttribute(QString::fromUtf8("source"), sourceToString(photoSource())); + _photoSource.setAttribute(TQString::fromUtf8("source"), sourceToString(photoSource())); if( !d->metaContactId.isEmpty() ) - photo.setAttribute( QString::fromUtf8("syncWithKABC") , QString::fromUtf8( d->photoSyncedWithKABC ? "true" : "false" ) ); + photo.setAttribute( TQString::fromUtf8("syncWithKABC") , TQString::fromUtf8( d->photoSyncedWithKABC ? "true" : "false" ) ); if (photoSourceContact()) { //kdDebug(14010) << k_funcinfo << "serializing photo source " << nameFromContact(photoSourceContact()) << endl; // set contact source metadata for photo - QDomElement contactPhotoSource = metaContact.createElement( QString::fromUtf8("contact-source") ); + TQDomElement contactPhotoSource = metaContact.createElement( TQString::fromUtf8("contact-source") ); contactPhotoSource.setAttribute( NSCID_ELEM, photoSourceContact()->contactId() ); contactPhotoSource.setAttribute( NSPID_ELEM, photoSourceContact()->protocol()->pluginId() ); contactPhotoSource.setAttribute( NSAID_ELEM, photoSourceContact()->account()->accountId() ); @@ -1006,31 +1006,31 @@ const QDomElement MetaContact::toXML(bool minimal) // Store groups if ( !d->groups.isEmpty() ) { - QDomElement groups = metaContact.createElement( QString::fromUtf8("groups") ); + TQDomElement groups = metaContact.createElement( TQString::fromUtf8("groups") ); Group *g; for ( g = d->groups.first(); g; g = d->groups.next() ) { - QDomElement group = metaContact.createElement( QString::fromUtf8("group") ); - group.setAttribute( QString::fromUtf8("id"), g->groupId() ); + TQDomElement group = metaContact.createElement( TQString::fromUtf8("group") ); + group.setAttribute( TQString::fromUtf8("id"), g->groupId() ); groups.appendChild( group ); } metaContact.documentElement().appendChild( groups ); } // Store other plugin data - QValueList<QDomElement> pluginData = Kopete::ContactListElement::toXML(); - for( QValueList<QDomElement>::Iterator it = pluginData.begin(); it != pluginData.end(); ++it ) + TQValueList<TQDomElement> pluginData = Kopete::ContactListElement::toXML(); + for( TQValueList<TQDomElement>::Iterator it = pluginData.begin(); it != pluginData.end(); ++it ) metaContact.documentElement().appendChild( metaContact.importNode( *it, true ) ); // Store custom notification data - QDomElement notifyData = NotifyDataObject::notifyDataToXML(); + TQDomElement notifyData = NotifyDataObject::notifyDataToXML(); if ( notifyData.hasChildNodes() ) metaContact.documentElement().appendChild( metaContact.importNode( notifyData, true ) ); } return metaContact.documentElement(); } -bool MetaContact::fromXML( const QDomElement& element ) +bool MetaContact::fromXML( const TQDomElement& element ) { if( !element.hasChildNodes() ) return false; @@ -1038,7 +1038,7 @@ bool MetaContact::fromXML( const QDomElement& element ) bool oldPhotoTracking = false; bool oldNameTracking = false; - QString strContactId = element.attribute( QString::fromUtf8("contactId") ); + TQString strContactId = element.attribute( TQString::fromUtf8("contactId") ); if( !strContactId.isEmpty() ) { d->metaContactId = strContactId; @@ -1046,11 +1046,11 @@ bool MetaContact::fromXML( const QDomElement& element ) slotUpdateAddressBookPicture(); } - QDomElement contactElement = element.firstChild().toElement(); + TQDomElement contactElement = element.firstChild().toElement(); while( !contactElement.isNull() ) { - if( contactElement.tagName() == QString::fromUtf8( "display-name" ) ) + if( contactElement.tagName() == TQString::fromUtf8( "display-name" ) ) { // custom display name, used for the custom name source // WTF, why were we not loading the metacontact if nickname was empty. @@ -1058,7 +1058,7 @@ bool MetaContact::fromXML( const QDomElement& element ) // return false; //the replace is there to workaround the Bug 95444 - d->displayName = contactElement.text().replace('\n',QString::fromUtf8("")); + d->displayName = contactElement.text().replace('\n',TQString::fromUtf8("")); if ( contactElement.hasAttribute(NSCID_ELEM) && contactElement.hasAttribute(NSPID_ELEM) && contactElement.hasAttribute(NSAID_ELEM)) { @@ -1073,12 +1073,12 @@ bool MetaContact::fromXML( const QDomElement& element ) // else // kdDebug(14010) << k_funcinfo << "no old name tracking" << endl; } - else if( contactElement.tagName() == QString::fromUtf8( "photo" ) ) + else if( contactElement.tagName() == TQString::fromUtf8( "photo" ) ) { // custom photo, used for custom photo source setPhoto( KURL(contactElement.text()) ); - d->photoSyncedWithKABC = (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("1")) || (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("true")); + d->photoSyncedWithKABC = (contactElement.attribute(TQString::fromUtf8("syncWithKABC")) == TQString::fromUtf8("1")) || (contactElement.attribute(TQString::fromUtf8("syncWithKABC")) == TQString::fromUtf8("true")); // retrieve deprecated data (now stored in property-sources) // save temporarely, we will find a Contact* with this later @@ -1093,23 +1093,23 @@ bool MetaContact::fromXML( const QDomElement& element ) // else // kdDebug(14010) << k_funcinfo << "no old photo tracking" << endl; } - else if( contactElement.tagName() == QString::fromUtf8( "property-sources" ) ) + else if( contactElement.tagName() == TQString::fromUtf8( "property-sources" ) ) { - QDomNode property = contactElement.firstChild(); + TQDomNode property = contactElement.firstChild(); while( !property.isNull() ) { - QDomElement propertyElement = property.toElement(); + TQDomElement propertyElement = property.toElement(); - if( propertyElement.tagName() == QString::fromUtf8( "name" ) ) + if( propertyElement.tagName() == TQString::fromUtf8( "name" ) ) { - QString source = propertyElement.attribute( QString::fromUtf8("source") ); + TQString source = propertyElement.attribute( TQString::fromUtf8("source") ); setDisplayNameSource(stringToSource(source)); // find contact sources now. - QDomNode propertyParam = propertyElement.firstChild(); + TQDomNode propertyParam = propertyElement.firstChild(); while( !propertyParam.isNull() ) { - QDomElement propertyParamElement = propertyParam.toElement(); - if( propertyParamElement.tagName() == QString::fromUtf8( "contact-source" ) ) + TQDomElement propertyParamElement = propertyParam.toElement(); + if( propertyParamElement.tagName() == TQString::fromUtf8( "contact-source" ) ) { d->nameSourceCID = propertyParamElement.attribute( NSCID_ELEM ); d->nameSourcePID = propertyParamElement.attribute( NSPID_ELEM ); @@ -1118,16 +1118,16 @@ bool MetaContact::fromXML( const QDomElement& element ) propertyParam = propertyParam.nextSibling(); } } - if( propertyElement.tagName() == QString::fromUtf8( "photo" ) ) + if( propertyElement.tagName() == TQString::fromUtf8( "photo" ) ) { - QString source = propertyElement.attribute( QString::fromUtf8("source") ); + TQString source = propertyElement.attribute( TQString::fromUtf8("source") ); setPhotoSource(stringToSource(source)); // find contact sources now. - QDomNode propertyParam = propertyElement.firstChild(); + TQDomNode propertyParam = propertyElement.firstChild(); while( !propertyParam.isNull() ) { - QDomElement propertyParamElement = propertyParam.toElement(); - if( propertyParamElement.tagName() == QString::fromUtf8( "contact-source" ) ) + TQDomElement propertyParamElement = propertyParam.toElement(); + if( propertyParamElement.tagName() == TQString::fromUtf8( "contact-source" ) ) { d->photoSourceCID = propertyParamElement.attribute( NSCID_ELEM ); d->photoSourcePID = propertyParamElement.attribute( NSPID_ELEM ); @@ -1139,39 +1139,39 @@ bool MetaContact::fromXML( const QDomElement& element ) property = property.nextSibling(); } } - else if( contactElement.tagName() == QString::fromUtf8( "groups" ) ) + else if( contactElement.tagName() == TQString::fromUtf8( "groups" ) ) { - QDomNode group = contactElement.firstChild(); + TQDomNode group = contactElement.firstChild(); while( !group.isNull() ) { - QDomElement groupElement = group.toElement(); + TQDomElement groupElement = group.toElement(); - if( groupElement.tagName() == QString::fromUtf8( "group" ) ) + if( groupElement.tagName() == TQString::fromUtf8( "group" ) ) { - QString strGroupId = groupElement.attribute( QString::fromUtf8("id") ); + TQString strGroupId = groupElement.attribute( TQString::fromUtf8("id") ); if( !strGroupId.isEmpty() ) addToGroup( Kopete::ContactList::self()->group( strGroupId.toUInt() ) ); else //kopete 0.6 contactlist addToGroup( Kopete::ContactList::self()->findGroup( groupElement.text() ) ); } - else if( groupElement.tagName() == QString::fromUtf8( "top-level" ) ) //kopete 0.6 contactlist + else if( groupElement.tagName() == TQString::fromUtf8( "top-level" ) ) //kopete 0.6 contactlist addToGroup( Kopete::Group::topLevel() ); group = group.nextSibling(); } } - else if( contactElement.tagName() == QString::fromUtf8( "address-book-field" ) ) + else if( contactElement.tagName() == TQString::fromUtf8( "address-book-field" ) ) { - QString app = contactElement.attribute( QString::fromUtf8( "app" ), QString::null ); - QString key = contactElement.attribute( QString::fromUtf8( "key" ), QString::null ); - QString val = contactElement.text(); + TQString app = contactElement.attribute( TQString::fromUtf8( "app" ), TQString::null ); + TQString key = contactElement.attribute( TQString::fromUtf8( "key" ), TQString::null ); + TQString val = contactElement.text(); d->addressBook[ app ][ key ] = val; } - else if( contactElement.tagName() == QString::fromUtf8( "custom-notifications" ) ) + else if( contactElement.tagName() == TQString::fromUtf8( "custom-notifications" ) ) { Kopete::NotifyDataObject::notifyDataFromXML( contactElement ); } - else //if( groupElement.tagName() == QString::fromUtf8( "plugin-data" ) || groupElement.tagName() == QString::fromUtf8("custom-icons" )) + else //if( groupElement.tagName() == TQString::fromUtf8( "plugin-data" ) || groupElement.tagName() == TQString::fromUtf8("custom-icons" )) { Kopete::ContactListElement::fromXML(contactElement); } @@ -1215,16 +1215,16 @@ bool MetaContact::fromXML( const QDomElement& element ) } // If a plugin is loaded, load data cached - connect( Kopete::PluginManager::self(), SIGNAL( pluginLoaded(Kopete::Plugin*) ), - this, SLOT( slotPluginLoaded(Kopete::Plugin*) ) ); + connect( Kopete::PluginManager::self(), TQT_SIGNAL( pluginLoaded(Kopete::Plugin*) ), + this, TQT_SLOT( slotPluginLoaded(Kopete::Plugin*) ) ); // All plugins are already loaded, call manually the contact setting slot. if( Kopete::PluginManager::self()->isAllPluginsLoaded() ) slotAllPluginsLoaded(); else // When all plugins are loaded, set the source contact. - connect( Kopete::PluginManager::self(), SIGNAL( allPluginsLoaded() ), - this, SLOT( slotAllPluginsLoaded() ) ); + connect( Kopete::PluginManager::self(), TQT_SIGNAL( allPluginsLoaded() ), + this, TQT_SLOT( slotAllPluginsLoaded() ) ); // track changes only works if ONE Contact is inside the MetaContact // if (d->contacts.count() > 1) // Does NOT work as intended @@ -1234,36 +1234,36 @@ bool MetaContact::fromXML( const QDomElement& element ) return true; } -QString MetaContact::sourceToString(PropertySource source) const +TQString MetaContact::sourceToString(PropertySource source) const { if ( source == SourceCustom ) - return QString::fromUtf8("custom"); + return TQString::fromUtf8("custom"); else if ( source == SourceKABC ) - return QString::fromUtf8("addressbook"); + return TQString::fromUtf8("addressbook"); else if ( source == SourceContact ) - return QString::fromUtf8("contact"); + return TQString::fromUtf8("contact"); else // recovery return sourceToString(SourceCustom); } -MetaContact::PropertySource MetaContact::stringToSource(const QString &name) const +MetaContact::PropertySource MetaContact::stringToSource(const TQString &name) const { - if ( name == QString::fromUtf8("custom") ) + if ( name == TQString::fromUtf8("custom") ) return SourceCustom; - else if ( name == QString::fromUtf8("addressbook") ) + else if ( name == TQString::fromUtf8("addressbook") ) return SourceKABC; - else if ( name == QString::fromUtf8("contact") ) + else if ( name == TQString::fromUtf8("contact") ) return SourceContact; else // recovery return SourceCustom; } -QString MetaContact::addressBookField( Kopete::Plugin * /* p */, const QString &app, const QString & key ) const +TQString MetaContact::addressBookField( Kopete::Plugin * /* p */, const TQString &app, const TQString & key ) const { return d->addressBook[ app ][ key ]; } -void Kopete::MetaContact::setAddressBookField( Kopete::Plugin * /* p */, const QString &app, const QString &key, const QString &value ) +void Kopete::MetaContact::setAddressBookField( Kopete::Plugin * /* p */, const TQString &app, const TQString &key, const TQString &value ) { d->addressBook[ app ][ key ] = value; } @@ -1273,7 +1273,7 @@ void MetaContact::slotPluginLoaded( Plugin *p ) if( !p ) return; - QMap<QString, QString> map= pluginData( p ); + TQMap<TQString, TQString> map= pluginData( p ); if(!map.isEmpty()) { p->deserialize(this,map); @@ -1290,7 +1290,7 @@ void MetaContact::slotAllPluginsLoaded() void MetaContact::slotUpdateAddressBookPicture() { KABC::AddressBook* ab = KABCPersistence::self()->addressBook(); - QString id = metaContactId(); + TQString id = metaContactId(); if ( !id.isEmpty() && !id.contains(':') ) { KABC::Addressee theAddressee = ab->findByUid(id); @@ -1332,19 +1332,19 @@ void MetaContact::setTemporary( bool isTemporary, Group *group ) moveToGroup(temporaryGroup, group ? group : Group::topLevel()); } -QString MetaContact::metaContactId() const +TQString MetaContact::metaContactId() const { if(d->metaContactId.isEmpty()) { Contact *c=d->contacts.first(); if(!c) - return QString::null; - return c->protocol()->pluginId()+QString::fromUtf8(":")+c->account()->accountId()+QString::fromUtf8(":") + c->contactId() ; + return TQString::null; + return c->protocol()->pluginId()+TQString::fromUtf8(":")+c->account()->accountId()+TQString::fromUtf8(":") + c->contactId() ; } return d->metaContactId; } -void MetaContact::setMetaContactId( const QString& newMetaContactId ) +void MetaContact::setMetaContactId( const TQString& newMetaContactId ) { if(newMetaContactId == d->metaContactId) return; @@ -1374,7 +1374,7 @@ void MetaContact::setPhotoSyncedWithKABC(bool b) d->photoSyncedWithKABC=b; if(b) { - QVariant newValue; + TQVariant newValue; switch( photoSource() ) { @@ -1402,10 +1402,10 @@ void MetaContact::setPhotoSyncedWithKABC(bool b) if ( !theAddressee.isEmpty() ) { - QImage img; - if(newValue.canCast( QVariant::Image )) + TQImage img; + if(newValue.canCast( TQVariant::Image )) img=newValue.toImage(); - else if(newValue.canCast( QVariant::Pixmap )) + else if(newValue.canCast( TQVariant::Pixmap )) img=newValue.toPixmap().convertToImage(); if(img.isNull()) @@ -1415,7 +1415,7 @@ void MetaContact::setPhotoSyncedWithKABC(bool b) // to sync with kabc but try first to embed the // photo data in the kabc addressee, because it could // be remote resource and the local url makes no sense - QImage fallBackImage = QImage(newValue.toString()); + TQImage fallBackImage = TQImage(newValue.toString()); if(fallBackImage.isNull()) theAddressee.setPhoto(newValue.toString()); else @@ -1431,7 +1431,7 @@ void MetaContact::setPhotoSyncedWithKABC(bool b) } } -QPtrList<Contact> MetaContact::contacts() const +TQPtrList<Contact> MetaContact::contacts() const { return d->contacts; } |