• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/libkopete

Kopete::MetaContact

Kopete::MetaContact Class Reference

#include <kopetemetacontact.h>

Inheritance diagram for Kopete::MetaContact:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Will Stephenson <will@stevello.free-online.co.uk>

Author:
Martijn Klingens <klingens@kde.org>

Duncan Mac-Vicar Prett <duncan@kde.org>

Olivier Goffart <ogoffart@kde.org>

A metacontact represent a person. This is a kind of entry to the contact list. All information of a contact is contained in the metacontact. Plugins can store data in it with all ContactListElement methods

Definition at line 52 of file kopetemetacontact.h.


Public Types

typedef QList< MetaContact * > List
enum  PropertySource { SourceContact, SourceKABC, SourceCustom }

Public Slots

void addToGroup (Kopete::Group *to)
void emitAboutToSave ()
Contact * execute ()
void moveToGroup (Kopete::Group *from, Kopete::Group *to)
void removeFromGroup (Kopete::Group *from)
void sendFile (const KUrl &sourceURL, const QString &altFileName=QString(), unsigned long fileSize=0L)
Contact * sendMessage ()
void setTemporary (bool b=true, Kopete::Group *group=0L)
void slotAllPluginsLoaded ()
void slotPluginLoaded (Kopete::Plugin *plugin)
Contact * startChat ()

Signals

void aboutToSave (Kopete::MetaContact *metaContact)
void addedToGroup (Kopete::MetaContact *contact, Kopete::Group *to)
void contactAdded (Kopete::Contact *c)
void contactIdleStateChanged (Kopete::Contact *contact)
void contactRemoved (Kopete::Contact *c)
void contactStatusChanged (Kopete::Contact *contact, const Kopete::OnlineStatus &status)
void displayNameChanged (const QString &oldName, const QString &newName)
void movedToGroup (Kopete::MetaContact *contact, Kopete::Group *from, Kopete::Group *to)
void onlineStatusChanged (Kopete::MetaContact *contact, Kopete::OnlineStatus::StatusType status)
void persistentDataChanged ()
void photoChanged ()
void removedFromGroup (Kopete::MetaContact *contact, Kopete::Group *group)

Public Member Functions

void addContact (Contact *c)
QString addressBookField (Plugin *p, const QString &app, const QString &key) const
bool canAcceptFiles () const
QList< Contact * > contacts () const
QString customDisplayName () const
KUrl customPhoto () const
QString displayName () const
PropertySource displayNameSource () const
Contact * displayNameSourceContact () const
Contact * findContact (const QString &protocolId, const QString &accountId, const QString &contactId)
QList< Group * > groups () const
unsigned long int idleTime () const
bool isOnline () const
bool isPhotoSyncedWithKABC () const
bool isReachable () const
bool isTemporary () const
 MetaContact ()
QString metaContactId () const
KDE_DEPRECATED QImage photo () const
PropertySource photoSource () const
Contact * photoSourceContact () const
Picture & picture () const
Contact * preferredContact ()
void removeContact (Contact *c, bool deleted=false)
void setAddressBookField (Plugin *p, const QString &app, const QString &key, const QString &value)
void setDisplayName (const QString &name)
void setDisplayNameSource (const QString &nameSourcePID, const QString &nameSourceAID, const QString &nameSourceCID)
void setDisplayNameSource (PropertySource source)
void setDisplayNameSourceContact (Contact *contact)
void setMetaContactId (const QString &newMetaContactId)
void setPhoto (const KUrl &url)
void setPhotoSource (const QString &photoSourcePID, const QString &photoSourceAID, const QString &photoSourceCID)
void setPhotoSource (PropertySource source)
void setPhotoSourceContact (Contact *contact)
void setPhotoSyncedWithKABC (bool b)
OnlineStatus::StatusType status () const
QString statusIcon () const
QString statusString () const
 ~MetaContact ()

Protected Member Functions

QImage photoFromCustom () const

Properties

bool canAcceptFiles
QString displayName
bool isOnline
bool isReachable
bool isTemporary
QString metaContactId
bool photoSyncedWithKABC
QString statusIcon
QString statusString

Member Typedef Documentation

typedef QList<MetaContact *> Kopete::MetaContact::List

Definition at line 68 of file kopetemetacontact.h.


Member Enumeration Documentation

enum Kopete::MetaContact::PropertySource

Enumeration of possible sources for a property (which may be photos, see setPhotoSource() for instance).

Enumerator:
SourceContact  Data comes from the contact itself.

SourceKABC  Data comes from KABC (addressbook).

SourceCustom  Data comes from somewhere else.

Definition at line 73 of file kopetemetacontact.h.


Constructor & Destructor Documentation

Kopete::MetaContact::MetaContact (  ) 

constructor

Definition at line 46 of file kopetemetacontact.cpp.

Kopete::MetaContact::~MetaContact (  ) 

destructor

Definition at line 70 of file kopetemetacontact.cpp.


Member Function Documentation

void Kopete::MetaContact::aboutToSave ( Kopete::MetaContact *  metaContact  )  [signal]

This metaContact is going to be saved to the contact list.

Plugins should connect to this signal to update data with setPluginData()

void Kopete::MetaContact::addContact ( Contact *  c  ) 

Add a contact which has just been deserialised to the meta contact.

Parameters:
c The Contact being added

Definition at line 75 of file kopetemetacontact.cpp.

void Kopete::MetaContact::addedToGroup ( Kopete::MetaContact *  contact,
Kopete::Group *  to 
) [signal]

The contact was added to another group.

QString Kopete::MetaContact::addressBookField ( Kopete::Plugin *  p,
const QString &  app,
const QString &  key 
) const

Get or set a field for the KDE address book backend.

Fields not registered during the call to Plugin::addressBookFields() cannot be altered!

Parameters:
p The Plugin by which uses this field
app refers to the application id in the libkabc database. This should be a standardized format to make sense in the address book in the first place - if you could use "" as application then probably you should use the plugin data API instead of the address book fields.
key The name of the address book field to get or set
Todo:
: In the code the requirement that fields are registered first is already lifted, but the API needs some review before we can remove it here too. Probably it requires once more some rewrites to get it working properly :( - Martijn

Definition at line 951 of file kopetemetacontact.cpp.

void Kopete::MetaContact::addToGroup ( Kopete::Group *  to  )  [slot]

Add a contact to another group.

Definition at line 918 of file kopetemetacontact.cpp.

bool Kopete::MetaContact::canAcceptFiles (  )  const

Returns whether this contact can accept files.

Returns:
True if the user is online with a file capable protocol, false otherwise

void Kopete::MetaContact::contactAdded ( Kopete::Contact *  c  )  [signal]

a contact has been added into this metacontact

This signal is emitted when a contact is added to this metacontact

void Kopete::MetaContact::contactIdleStateChanged ( Kopete::Contact *  contact  )  [signal]

One of the subcontacts' idle status has changed.

As with online status, this can occur without the metacontact changing idle state

void Kopete::MetaContact::contactRemoved ( Kopete::Contact *  c  )  [signal]

a contact has been removed from this metacontact

This signal is emitted when a contact is removed from this metacontact

QList< Contact * > Kopete::MetaContact::contacts (  )  const

Retrieve the list of contacts that are part of the meta contact.

Definition at line 1135 of file kopetemetacontact.cpp.

void Kopete::MetaContact::contactStatusChanged ( Kopete::Contact *  contact,
const Kopete::OnlineStatus &  status 
) [signal]

A contact's online status changed.

this signal differs from onlineStatusChanged because a contact can change his status without changing MetaContact status. It is mainly used to update the small icons in the contact list

QString Kopete::MetaContact::customDisplayName (  )  const

Returns the custom display name.

See also:
displayName()

displayNameSource()

Definition at line 604 of file kopetemetacontact.cpp.

KUrl Kopete::MetaContact::customPhoto (  )  const

Returns the custom display photo.

See also:
photo()

photoSource()

Definition at line 673 of file kopetemetacontact.cpp.

QString Kopete::MetaContact::displayName (  )  const

the display name showed in the contact list window

The displayname is the name which should be shown almost everywere to represent the metacontact. (in the contact list, in the chatwindow, ...)

This is a kind of alias, set by the kopete user, as opposed to a nickname set by the contact itself.

If the protocol support alias serverside, the metacontact displayname should probably be synchronized with the alias on the server.

This displayName is obtained from the source set with setDisplayNameSource

void Kopete::MetaContact::displayNameChanged ( const QString &  oldName,
const QString &  newName 
) [signal]

The meta contact's display name changed.

MetaContact::PropertySource Kopete::MetaContact::displayNameSource (  )  const

get the source of metacontact display name

This method obtains the current name source for one of the sources defined in PropertySource

See also:
PropertySource

Definition at line 276 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::displayNameSourceContact (  )  const

get the subcontact being tracked for its displayname (null if not set)

The MetaContact will adjust its displayName() every time the "nameSource" changes its nickname property.

Definition at line 764 of file kopetemetacontact.cpp.

void Kopete::MetaContact::emitAboutToSave (  )  [slot]

Emit aboutToSave signal to notify plugins that this metaContact is going to be saved.

Definition at line 549 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::execute (  )  [slot]

Contact another user.

Depending on the config settings, call sendMessage() or startChat()

returns the Contact that was chosen as the preferred

Definition at line 399 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::findContact ( const QString &  protocolId,
const QString &  accountId,
const QString &  contactId 
)

Find the Contact to a given contact.

If contact is not found, a null pointer is returned. if protocolId or accountId are null, it is searched over all protocols/accounts

Definition at line 234 of file kopetemetacontact.cpp.

QList< Group * > Kopete::MetaContact::groups (  )  const

The groups the contact is stored in.

Definition at line 941 of file kopetemetacontact.cpp.

unsigned long int Kopete::MetaContact::idleTime (  )  const

return the time in second the contact is idle.

Definition at line 418 of file kopetemetacontact.cpp.

bool Kopete::MetaContact::isOnline (  )  const

Returns whether this contact can be reached online for at least one FIXME: Make that an enum, because status can be unknown for certain protocols.

bool Kopete::MetaContact::isPhotoSyncedWithKABC (  )  const

Returns:
true if when a subcontact change his photo, the photo will be set to the kabc contact.

Definition at line 1067 of file kopetemetacontact.cpp.

bool Kopete::MetaContact::isReachable (  )  const

Like isOnline, but returns true even if the contact is not online, but can be reached trough offline-messages.

it it return false, you are unable to open a chatwindow

Todo:
: Here too, use preference order, not append order!
Todo:
: Here too an enum.

bool Kopete::MetaContact::isTemporary (  )  const

Temporary contacts will not be serialized.

If they are added to the contact list, they appears in a special "Not in your contact list" group. (the Group::temporary group)

QString Kopete::MetaContact::metaContactId (  )  const

Returns this metacontact's ID.

Every metacontact has a unique id, set by when creating the contact, or reading the contact list TODO: make it real

void Kopete::MetaContact::movedToGroup ( Kopete::MetaContact *  contact,
Kopete::Group *  from,
Kopete::Group *  to 
) [signal]

The contact was moved.

void Kopete::MetaContact::moveToGroup ( Kopete::Group *  from,
Kopete::Group *  to 
) [slot]

Move a contact from one group to another.

Definition at line 863 of file kopetemetacontact.cpp.

void Kopete::MetaContact::onlineStatusChanged ( Kopete::MetaContact *  contact,
Kopete::OnlineStatus::StatusType  status 
) [signal]

The MetaContact online status changed.

void Kopete::MetaContact::persistentDataChanged (  )  [signal]

Some part of this object's persistent data (as returned by toXML) has changed.

QImage Kopete::MetaContact::photo (  )  const

the photo showed in the contact list window

Returns a image for the metacontact. If the metacontact photo source is the KDE addressbook. it will return the picture stored in the addressbook It can also use a subcontact as the photo source.

This photo is obtained from the source set with setPhotoSource

Deprecated:
Use picture().image() instead.

Definition at line 689 of file kopetemetacontact.cpp.

void Kopete::MetaContact::photoChanged (  )  [signal]

The meta contact's photo changed.

QImage Kopete::MetaContact::photoFromCustom (  )  const [protected]

Definition at line 708 of file kopetemetacontact.cpp.

MetaContact::PropertySource Kopete::MetaContact::photoSource (  )  const

get the source of metacontact photo

This method obtains the current photo source for one of the sources defined in PropertySource

See also:
PropertySource

Definition at line 298 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::photoSourceContact (  )  const

get the subcontact being tracked for its photo

Definition at line 769 of file kopetemetacontact.cpp.

Picture & Kopete::MetaContact::picture (  )  const

Return the correct Kopete::Picture object depending of the metacontact photo source.

This photo is obtained from the source set with setPhotoSource

KDE4 TODO: Rename this to photo() and use the new object.

Definition at line 694 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::preferredContact (  ) 

Returns:
the preferred child Contact for communication, or 0 if none is suitable (all unreachable).

Definition at line 340 of file kopetemetacontact.cpp.

void Kopete::MetaContact::removeContact ( Contact *  c,
bool  deleted = false 
)

remove the contact from this metacontact

set 'deleted' to true if the Contact is already deleted

Parameters:
c is the contact to remove
deleted : if it is false, it will disconnect the old contact, and call some method.

Definition at line 145 of file kopetemetacontact.cpp.

void Kopete::MetaContact::removedFromGroup ( Kopete::MetaContact *  contact,
Kopete::Group *  group 
) [signal]

The contact was removed from group.

void Kopete::MetaContact::removeFromGroup ( Kopete::Group *  from  )  [slot]

Remove a contact from one group.

Definition at line 895 of file kopetemetacontact.cpp.

void Kopete::MetaContact::sendFile ( const KUrl &  sourceURL,
const QString &  altFileName = QString(),
unsigned long  fileSize = 0L 
) [slot]

Send a file to this metacontact.

This is the MetaContact level slot for sending files. It may be called through the "Send File" entry in the GUI, or over DCOP. If the function is called through the GUI, no parameters are sent and they assume default values. This slot calls the slotSendFile with identical params of the highest ranked contact capable of sending files (if any)

Parameters:
sourceURL The actual KUrl of the file you are sending
altFileName (Optional) An alternate name for the file - what the receiver will see
fileSize (Optional) Size of the file being sent. Used when sending a nondeterminate file size (such as over a socket)

Definition at line 529 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::sendMessage (  )  [slot]

Send a single message, classic ICQ style.

The actual sending is done by the Contact, but the meta contact does the GUI side of things. This is a slot to allow being called easily from e.g. a GUI.

returns the Contact that was chosen as the preferred

Definition at line 304 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setAddressBookField ( Kopete::Plugin *  p,
const QString &  app,
const QString &  key,
const QString &  value 
)

set an address book field

See also:
also addressBookField()
Parameters:
p The Plugin by which uses this field
app The application ID in the KABC database
key The name of the address book field to set
value The value of the address book field to set

Definition at line 956 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setDisplayName ( const QString &  name  ) 

Set the custom displayName.

This display name is used when name source is Custom this metohd may emit displayNameChanged signal. And will call Kopete::Contact::sync

See also:
displayName()

displayNameSource()

Definition at line 560 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setDisplayNameSource ( const QString &  nameSourcePID,
const QString &  nameSourceAID,
const QString &  nameSourceCID 
)

Definition at line 269 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setDisplayNameSource ( PropertySource  source  ) 

Set the source of metacontact displayName.

This method selects the display name source for one of the sources defined in PropertySource

See also:
PropertySource

Definition at line 260 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setDisplayNameSourceContact ( Contact *  contact  ) 

set the subcontact whose name is to be tracked (set to null to disable tracking)

See also:
nameSource

Definition at line 774 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setMetaContactId ( const QString &  newMetaContactId  ) 

Add or change the link to a KDE addressbook (KABC) Addressee.

FIXME: Use with care. You could create 1 to many relationships with the current implementation

Definition at line 1040 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setPhoto ( const KUrl &  url  ) 

Set the custom photo.

This photo is used when photo source is set toCustom this metohd may emit photoChanged signal.

See also:
photo()

photoSource()

Definition at line 678 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setPhotoSource ( const QString &  photoSourcePID,
const QString &  photoSourceAID,
const QString &  photoSourceCID 
)

Definition at line 291 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setPhotoSource ( PropertySource  source  ) 

Set the source of metacontact photo.

This method selects the photo source for one of the sources defined in PropertySource

See also:
PropertySource

Definition at line 281 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setPhotoSourceContact ( Contact *  contact  ) 

set the subcontact to use for SourceContact source

Definition at line 784 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setPhotoSyncedWithKABC ( bool  b  ) 

Set if the photo should be synced with the adressbook when the photosource change his photo.

If b is true, the photo will be synced immediately if possible

Definition at line 1072 of file kopetemetacontact.cpp.

void Kopete::MetaContact::setTemporary ( bool  b = true,
Kopete::Group *  group = 0L 
) [slot]

Set if this is a temporary contact.

(see isTemporary)

Parameters:
b if the contact is or not temporary
group if the contact was temporary and b is false, then the contact will be moved to this group. if group is null, it will be moved to top-level

Definition at line 1007 of file kopetemetacontact.cpp.

void Kopete::MetaContact::slotAllPluginsLoaded (  )  [slot]

When all the plugins are loaded, set the Contact Source.

Definition at line 973 of file kopetemetacontact.cpp.

void Kopete::MetaContact::slotPluginLoaded ( Kopete::Plugin *  plugin  )  [slot]

If a plugin is loaded, maybe data about this plugin are already cached in the metacontact.

Definition at line 961 of file kopetemetacontact.cpp.

Contact * Kopete::MetaContact::startChat (  )  [slot]

Start a chat in a persistent chat window.

Like sendMessage, but this time a full-blown chat will be opened. Most protocols can't distinguish between the two and are either completely session based like MSN or completely message based like ICQ the only true difference is the GUI shown to the user.

returns the Contact that was chosen as the preferred

Definition at line 322 of file kopetemetacontact.cpp.

OnlineStatus::StatusType Kopete::MetaContact::status (  )  const

Return a more fine-grained status.

Online means at least one sub-contact is online, away means at least one is away, but nobody is online and offline speaks for itself

Definition at line 482 of file kopetemetacontact.cpp.

QString Kopete::MetaContact::statusIcon (  )  const

The name of the icon associated with the contact's status.

Todo:
improve with OnlineStatus

QString Kopete::MetaContact::statusString (  )  const

The status string of the contact.

See also:
status()
Todo:
improve with OnlineStatus


Property Documentation

bool Kopete::MetaContact::canAcceptFiles [read]

Definition at line 62 of file kopetemetacontact.h.

QString Kopete::MetaContact::displayName [read, write]

Definition at line 56 of file kopetemetacontact.h.

bool Kopete::MetaContact::isOnline [read]

Definition at line 59 of file kopetemetacontact.h.

bool Kopete::MetaContact::isReachable [read]

Definition at line 60 of file kopetemetacontact.h.

bool Kopete::MetaContact::isTemporary [read]

Definition at line 61 of file kopetemetacontact.h.

QString Kopete::MetaContact::metaContactId [read, write]

Definition at line 64 of file kopetemetacontact.h.

bool Kopete::MetaContact::photoSyncedWithKABC [read, write]

Definition at line 65 of file kopetemetacontact.h.

QString Kopete::MetaContact::statusIcon [read]

Definition at line 58 of file kopetemetacontact.h.

QString Kopete::MetaContact::statusString [read]

Definition at line 57 of file kopetemetacontact.h.


The documentation for this class was generated from the following files:
  • kopetemetacontact.h
  • kopetemetacontact.cpp

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages