kopete/libkopete
xmlcontactstorage.cpp
Go to the documentation of this file.
213 kWarning(14010) << "Unknown element '" << element.tagName() << "' in XML contact list storage!" << endl;
256 doc.documentElement().appendChild( doc.importNode( storeGroup( Kopete::Group::topLevel() ), true ) );
292 bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, const QDomElement &element )
325 if ( contactElement.hasAttribute(NSCID_ELEM) && contactElement.hasAttribute(NSPID_ELEM) && contactElement.hasAttribute(NSAID_ELEM))
341 bool photoSyncedWithKABC = (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("1")) || (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("true"));
346 if ( contactElement.hasAttribute(PSCID_ELEM) && contactElement.hasAttribute(PSPID_ELEM) && contactElement.hasAttribute(PSAID_ELEM))
431 else //if( groupElement.tagName() == QString::fromUtf8( "plugin-data" ) || groupElement.tagName() == QString::fromUtf8("custom-icons" ))
440 /* if (displayNameSourceContact() ) <- doesn't work because the contact is only set up when all plugin are loaded (BUG 111956) */
451 if ( !metaContact->kabcId().isEmpty() && ( metaContact->customDisplayName() == nameFromKABC( metaContact->kabcId() )) )
474 //FIXME if we ensure that XmlContactStorage is still in memory when signal allPluginsLoaded is emitted than
475 // slotAllPluginsLoaded can be in this object with helper QStrings from MetaConctact ( nameSourcePID, nameSourceAID, nameSourceCID,
511 if ( group->type() != Kopete::Group::Temporary && group->type() != Kopete::Group::TopLevel && group->type() != Kopete::Group::Offline )
589 bool XmlContactStorage::parseContactListElement( Kopete::ContactListElement *contactListElement, const QDomElement &element )
629 contactListElement->setUseCustomIcon( element.attribute( QLatin1String( "use" ), QLatin1String( "1" ) ) == QLatin1String( "1" ) );
666 const QDomElement XmlContactStorage::storeMetaContact( Kopete::MetaContact *metaContact, bool minimal ) const
668 // This causes each Kopete::Protocol subclass to serialise its contacts' data into the metacontact's plugin data and address book data
672 metaContactDoc.appendChild( metaContactDoc.createElement( QString::fromUtf8( "meta-contact" ) ) );
673 metaContactDoc.documentElement().setAttribute( QString::fromUtf8( "contactId" ), metaContact->metaContactId() );
674 metaContactDoc.documentElement().setAttribute( QString::fromUtf8( "kabcId" ), metaContact->kabcId() );
686 QDomElement propertySources = metaContactDoc.createElement( QString::fromUtf8("property-sources" ) );
691 _nameSource.setAttribute( QString::fromUtf8("source"), sourceToString( metaContact->displayNameSource() ) );
696 QDomElement contactNameSource = metaContactDoc.createElement( QString::fromUtf8("contact-source") );
697 contactNameSource.setAttribute( NSCID_ELEM, metaContact->displayNameSourceContact()->contactId() );
698 contactNameSource.setAttribute( NSPID_ELEM, metaContact->displayNameSourceContact()->protocol()->pluginId() );
699 contactNameSource.setAttribute( NSAID_ELEM, metaContact->displayNameSourceContact()->account()->accountId() );
704 _photoSource.setAttribute( QString::fromUtf8("source"), sourceToString( metaContact->photoSource() ) );
707 photo.setAttribute( QString::fromUtf8("syncWithKABC") , QString::fromUtf8( metaContact->isPhotoSyncedWithKABC() ? "true" : "false" ) );
713 QDomElement contactPhotoSource = metaContactDoc.createElement( QString::fromUtf8("contact-source") );
715 contactPhotoSource.setAttribute( NSPID_ELEM, metaContact->photoSourceContact()->protocol()->pluginId() );
716 contactPhotoSource.setAttribute( NSAID_ELEM, metaContact->photoSourceContact()->account()->accountId() );
753 groupDoc.documentElement().setAttribute( QLatin1String( "groupId" ), QString::number( group->groupId() ) );
774 groupDoc.documentElement().setAttribute( QLatin1String( "view" ), QLatin1String( group->isExpanded() ? "expanded" : "collapsed" ) );
790 const QList<QDomElement> XmlContactStorage::storeContactListElement( Kopete::ContactListElement *contactListElement ) const
819 const QMap<QString, Kopete::ContactListElement::ContactDataList > pluginsContactData = contactListElement->pluginContactData();
822 QMap<QString, Kopete::ContactListElement::ContactDataList >::ConstIterator pluginIt, pluginItEnd = pluginsContactData.end();
849 iconsElement.setAttribute( QLatin1String( "use" ), contactListElement->useCustomIcon() ? QLatin1String( "1" ) : QLatin1String( "0" ) );
893 QDomNodeList metaContactElements = rootElement.elementsByTagName( QLatin1String( "meta-contact" ) );
916 QDomNodeList metaContactElementList = rootElement.elementsByTagName( QLatin1String( "meta-contact" ) );
926 QDomNodeList pluginElementList = metaContactElement.elementsByTagName( QLatin1String( "plugin-data" ) );
943 QString key = fieldElement.attribute( QLatin1String( "key" ), QLatin1String( "undefined-key" ) );
974 QDomElement pluginElement = metaContactElement.ownerDocument().createElement( QLatin1String( "plugin-contact-data" ) );
980 QDomElement pluginDataField = metaContactElement.ownerDocument().createElement( QLatin1String( "plugin-data-field" ) );
1014 Kopete::MetaContact::PropertySource XmlContactStorage::stringToSource( const QString &name ) const
QMap< QString, ContactDataList > pluginContactData() const
Get the settings as stored previously by calls to setPluginContactData() Note that plugins shouldn't ...
Definition: kopetecontactlistelement.cpp:112
static ContactList * self()
The contact list is a singleton object.
Definition: kopetecontactlist.cpp:71
Kopete::Group * findGroup(const QString &displayName, int type=Kopete::Group::Normal)
Find a group with his displayName.
Definition: kopetecontactliststorage.cpp:77
void setPluginData(Plugin *plugin, const QMap< QString, QString > &value)
Set the plugin-specific data.
Definition: kopetecontactlistelement.cpp:66
void appendPluginContactData(const QString &pluginId, const ContactData &data)
Convenience method to append plugin specific data for single contact Note that plugins shouldn't use ...
Definition: kopetecontactlistelement.cpp:144
void setUniqueGroupId(uint uniqueGroupId)
Definition: kopetegroup.cpp:160
void addToGroup(Kopete::Group *to)
Add a contact to another group.
Definition: kopetemetacontact.cpp:1037
void setUseCustomIcon(bool useCustomIcon)
set if the user want to show custom icon he set with setIcon this does not clear icons string if you ...
Definition: kopetecontactlistelement.cpp:186
void setDisplayName(const QString &name)
Set the custom displayName.
Definition: kopetemetacontact.cpp:614
Kopete::Group * group(unsigned int groupId) const
Get the Group with the given id for this storage.
Definition: kopetecontactliststorage.cpp:67
const IconMap icons() const
return all registered icons
Definition: kopetecontactlistelement.cpp:157
Group::List groups() const
Get the Group list for this storage.
Definition: kopetecontactliststorage.cpp:47
~XmlContactStorage()
Definition: xmlcontactstorage.cpp:91
void slotAllPluginsLoaded()
When all the plugins are loaded, set the Contact Source.
Definition: kopetemetacontact.cpp:1108
Account * account() const
Get the account that this contact belongs to.
Definition: kopetecontact.cpp:498
QList< MetaContact * > metaContacts() const
return a list of all metacontact of the contact list Retrieve the list of all available meta contacts...
Definition: kopetecontactlist.cpp:112
void setIcon(const QString &icon, IconState=None)
Set the icon in the given state To clear an entry, set a QString()
Definition: kopetecontactlistelement.cpp:170
void setLoading(bool value)
Set if we are in loading stage.
Definition: kopetecontactlistelement.cpp:56
PropertySource
Enumeration of possible sources for a property (which may be photos, see setPhotoSource() for instanc...
Definition: kopetemetacontact.h:75
Contact * photoSourceContact() const
get the subcontact being tracked for its photo
Definition: kopetemetacontact.cpp:819
bool parseMetaContact(Kopete::MetaContact *metaContact, const QDomElement &element)
Definition: xmlcontactstorage.cpp:292
uint readVersion(QDomElement &rootElement) const
Definition: xmlcontactstorage.cpp:993
QString customDisplayName() const
Returns the custom display name.
Definition: kopetemetacontact.cpp:657
void setPhotoSyncedWithKABC(bool b)
Set if the photo should be synced with the adressbook when the photosource change his photo...
Definition: kopetemetacontact.cpp:1207
Data comes from the contact itself.
Definition: kopetemetacontact.h:76
bool parseGroup(Kopete::Group *group, const QDomElement &element)
Definition: xmlcontactstorage.cpp:498
void setDisplayNameSource(PropertySource source)
Set the source of metacontact displayName.
Definition: kopetemetacontact.cpp:276
const QList< QDomElement > storeContactListElement(Kopete::ContactListElement *contactListElement) const
Definition: xmlcontactstorage.cpp:790
PropertySource displayNameSource() const
get the source of metacontact display name
Definition: kopetemetacontact.cpp:296
bool updateFrom10to11(QDomElement &rootElement) const
Definition: xmlcontactstorage.cpp:891
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:493
QMap< IconState, QString > IconMap
Definition: kopetecontactlistelement.h:159
virtual QString errorMessage() const
Get a nice error message.
Definition: xmlcontactstorage.cpp:101
Data comes from KABC (addressbook).
Definition: kopetemetacontact.h:77
virtual bool isBusy() const
Check if the current ContactListStorage is busy.
Definition: xmlcontactstorage.cpp:106
Definition: kopetegroup.h:56
bool parseContactListElement(Kopete::ContactListElement *contactListElement, const QDomElement &element)
Definition: xmlcontactstorage.cpp:589
Definition: kopetegroup.h:56
const QDomElement storeGroup(Kopete::Group *group) const
Definition: xmlcontactstorage.cpp:749
bool updateFrom11to12(QDomElement &rootElement) const
Definition: xmlcontactstorage.cpp:914
PropertySource photoSource() const
get the source of metacontact photo
Definition: kopetemetacontact.cpp:318
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
QMap< QString, QString > ContactData
Definition: kopetecontactlistelement.h:115
QMap< QString, QMap< QString, QString > > PluginDataMap
Definition: kopetecontactlistelement.h:113
void setMetaContactId(const QUuid &newMetaContactId)
Definition: kopetemetacontact.cpp:85
void setPhotoSource(PropertySource source)
Set the source of metacontact photo.
Definition: kopetemetacontact.cpp:301
void serialize()
Serialize this metaContact This causes each Kopete::Protocol subclass to serialise its contacts' data...
Definition: kopetemetacontact.cpp:589
const QDomElement storeMetaContact(Kopete::MetaContact *metaContact, bool minimal=false) const
Definition: xmlcontactstorage.cpp:666
Definition: kopetegroup.h:56
QList< Group * > groups() const
The groups the contact is stored in.
Definition: kopetemetacontact.cpp:1061
QMap< QString, QString > pluginData(Plugin *plugin) const
Get the settings as stored previously by calls to setPluginData()
Definition: kopetecontactlistelement.cpp:91
virtual bool isValid() const
Check if the current ContactListStorage.
Definition: xmlcontactstorage.cpp:96
Definition: kopetemetacontact.h:54
Definition: kopetegroup.h:56
void setAddressBookField(Plugin *p, const QString &app, const QString &key, const QString &value)
set an address book field
Definition: kopetemetacontact.cpp:1076
void setKabcId(const QString &newKabcId)
Set the KABC id for this metacontact Use with care! You could create a one to many relationship...
Definition: kopetemetacontact.cpp:1175
void addGroup(Kopete::Group *group)
Add a Group to internal list.
Definition: kopetecontactliststorage.cpp:62
Provide a storage for Kopete Contact List.
Definition: kopetecontactliststorage.h:34
bool useCustomIcon() const
return if yes or no the user wants to display some custom icon.
Definition: kopetecontactlistelement.cpp:181
void addMetaContact(Kopete::MetaContact *metaContact)
Add a MetaContact to internal list.
Definition: kopetecontactliststorage.cpp:57
bool isPhotoSyncedWithKABC() const
Definition: kopetemetacontact.cpp:1202
Contact * displayNameSourceContact() const
get the subcontact being tracked for its displayname (null if not set)
Definition: kopetemetacontact.cpp:814
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.