Logo Search packages:      
Sourcecode: kdenetwork version File versions

KopeteAccount Class Reference

#include <kopeteaccount.h>

Inheritance diagram for KopeteAccount:

KopetePluginDataObject GroupWiseAccount Kopete::PasswordedAccount TestbedAccount WPAccount MSNAccount

List of all members.

Detailed Description

Olivier Goffart <ogoffart@tiscalinet.be>
The KopeteAccount class handles one account. Each protocol should subclass this class in their own custom accounts class. There are few pure virtual method that the protocol must implement. Examples are: The accountId is an constant unique id, which represents the login. The myself() contact is one of the most important contacts, which represents the user tied to this account. You must create this contact in the contructor of your account and use setMyself()

All account data is automatically saved to KConfig. This includes the accountId, the password (in a encrypted format), the autoconnect flag, the color, and all PluginData. KopeteAccount is a KopetePluginDataObject. In the account, you can call setPluginData( protocol() , "key" , "value") and pluginData( protocol , "key") see KopetePluginDataObject::setPluginData() and KopetePluginDataObject::pluginData() Note that plugin data are not availiable in the account constructor. They are only available after the XML file has been totally parsed. You can reimplement KopeteAccount::loaded() to do what you have to do right after the XML file is loaded. in the same way, you can't set pluginData in the destructor, because the XML file has already been written, and new changes will not be updated on the disk.

Definition at line 63 of file kopeteaccount.h.

Public Types

enum  AddMode { ChangeKABC = 0, DontChangeKABC = 1 }
 Describes what should be done when the contact is added to a metacontact.
enum  DisconnectReason {
  BadUserName = -2, InvalidHost = -1, Manual = 0, ConnectionReset = 1,
  Unknown = 99
 Describes how the account was disconnected. More...
enum  IconState {
  None, Open, Closed, Online,
  Away, Offline, Unknown

Public Slots

bool addContact (const QString &contactId, const QString &displayName=QString::null, KopeteMetaContact *parentContact=0L, const AddMode mode=DontChangeKABC, const QString &groupName=QString::null, bool isTemporary=false)
 Adds a contact to this protocol with the specified details.
virtual void connect (const KopeteOnlineStatus &initialStatus)
 Go online for this service using a different status.
virtual void connect ()=0
 Go online for this service.
virtual void disconnect (DisconnectReason reason)
 Disconnect from this service with the specified reason.
virtual void disconnect ()=0
 Disconnect from this service.
virtual void setAway (bool away, const QString &reason=QString::null)=0


void accountIdChanged ()
void colorChanged (const QColor &)
void iconAppearanceChanged ()
void iconChanged (KopetePluginDataObject::IconState, const QString &)
void pluginDataChanged ()
void useCustomIconChanged (bool useCustomIcon)

Public Member Functions

QPixmap accountIcon (const int size=0) const
 Get the icon for this account.
QString accountId () const
virtual KActionMenu * actionMenu ()
 Return the menu for this account.
bool autoLogin () const
 Get if the account should log in automatically.
const QColor color () const
 Get the color for this account.
QString configGroup () const
const QDict< KopeteContact > & contacts ()
 Retrieve the list of contacts for this protocol.
QString icon (IconState state=None) const
bool isAway () const
 Indicate whether the account is away.
bool isConnected () const
 Indicate whether the account is connected at all.
 KopeteAccount (KopeteProtocol *parent, const QString &accountID, const char *name=0L)
KopeteContactmyself () const
 Retrieve the 'myself' contact.
QString password (bool error=false, bool *ok=0L, unsigned int maxLength=0) const
 Get the password for this account.
QString pluginData (KopetePlugin *plugin, const QString &key) const
QMap< QString, QString > pluginData (KopetePlugin *plugin) const
const uint priority () const
 Get the priority of this account.
KopeteProtocolprotocol () const
void readConfig (const QString &configGroup)
 Read the account's configuration.
void registerContact (KopeteContact *c)
bool rememberPassword () const
 Get if the password is remembered.
void setAccountId (const QString &accountId)
void setAutoLogin (bool)
 Set if the account should log in automatically.
void setColor (const QColor &color)
 Set the color for this account.
void setIcon (const QString &icon, IconState=None)
void setPassword (const QString &pass=QString::null)
 Set the password for this account.
void setPluginData (KopetePlugin *plugin, const QString &key, const QString &value)
void setPluginData (KopetePlugin *plugin, const QMap< QString, QString > &value)
void setPriority (uint priority)
 Set the priority of this account.
void setUseCustomIcon (bool useCustomIcon)
bool suppressStatusNotification () const
bool useCustomIcon () const
void writeConfig (const QString &configGroup)

Protected Slots

virtual void loaded ()

Protected Member Functions

virtual bool addContactToMetaContact (const QString &contactId, const QString &displayName, KopeteMetaContact *parentContact)=0
bool fromXML (const QDomElement &element)
void setMyself (KopeteContact *myself)
 Set the 'myself' contact.
const QValueList< QDomElement > toXML ()
void writeConfig (const QString &configGroup) const


QPixmap accountIcon
QString accountId
bool autoLogin
QColor color
bool isAway
bool isConnected
QString password
uint priority
bool rememberPassword
bool suppressStatusNotification

Private Slots

void slotAccountReady ()
void slotKopeteContactDestroyed (KopeteContact *)
void slotOnlineStatusChanged (KopeteContact *contact, const KopeteOnlineStatus &newStatus, const KopeteOnlineStatus &oldStatus)
void slotStopSuppression ()

Private Attributes

KopeteAccountPrivate * d

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index