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

kopete/libkopete

  • Kopete
  • Protocol
Public Types | Public Member Functions | Protected Member Functions | List of all members
Kopete::Protocol Class Referenceabstract

#include <kopeteprotocol.h>

Inheritance diagram for Kopete::Protocol:
Inheritance graph
[legend]

Public Types

enum  Capability {
  BaseFgColor = 0x1, BaseBgColor = 0x2, RichFgColor = 0x4, RichBgColor = 0x8,
  BaseFont = 0x10, RichFont = 0x20, BaseUFormatting = 0x40, BaseIFormatting = 0x80,
  BaseBFormatting = 0x100, RichUFormatting = 0x200, RichIFormatting = 0x400, RichBFormatting = 0x800,
  Alignment = 0x1000, BaseFormatting = BaseIFormatting | BaseUFormatting | BaseBFormatting, RichFormatting = RichIFormatting | RichUFormatting | RichBFormatting, RichColor = RichBgColor | RichFgColor,
  BaseColor = BaseBgColor | BaseFgColor, FullRTF = RichFormatting | Alignment | RichFont | RichFgColor | RichBgColor, CanSendOffline = 0x10000
}
 
- Public Types inherited from Kopete::Plugin
enum  AddressBookFieldAddMode { AddOnly, MakeIndexField }
 

Public Member Functions

virtual ~Protocol ()
 
virtual void aboutToUnload ()
 
Kopete::OnlineStatus accountOfflineStatus () const
 
bool canAddMyself () const
 
Capabilities capabilities () const
 
virtual AddContactPage * createAddContactWidget (QWidget *parent, Account *account)=0
 
virtual KopeteEditAccountWidget * createEditAccountWidget (Account *account, QWidget *parent)=0
 
virtual Account * createNewAccount (const QString &accountId)=0
 
virtual KJob * createProtocolTask (const QString &taskType)
 
virtual void deserialize (MetaContact *metaContact, const QMap< QString, QString > &serializedData)
 
virtual Contact * deserializeContact (MetaContact *metaContact, const QMap< QString, QString > &serializedData, const QMap< QString, QString > &addressBookData)
 
virtual void deserializeContactList (MetaContact *metaContact, const QList< QMap< QString, QString > > &dataList)
 
void serialize (Kopete::MetaContact *metaContact)
 
virtual bool validatePassword (const QString &password) const
 
- Public Member Functions inherited from Kopete::Plugin
 Plugin (const KComponentData &instance, QObject *parent)
 
virtual ~Plugin ()
 
void addAddressBookField (const QString &field, AddressBookFieldAddMode mode=AddOnly)
 
QStringList addressBookFields () const
 
QString addressBookIndexField () const
 
QString displayName () const
 
QString pluginIcon () const
 
QString pluginId () const
 
KPluginInfo pluginInfo () const
 
Q_INVOKABLE bool shouldExitOnclose ()
 
Q_INVOKABLE bool showCloseWindowMessage ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Protected Member Functions

 Protocol (const KComponentData &instance, QObject *parent, bool canAddMyself=false)
 
void setCapabilities (Capabilities)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Slots inherited from Kopete::Plugin
- Signals inherited from Kopete::Plugin
void readyForUnload ()
 
void settingsChanged ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

base class of every protocol.

A protocol is just a particular case of Plugin

Protocol is an abstract class, you need to reimplement createNewAccount, createAddContactPage, createEditAccountWidget

Author
Duncan Mac-Vicar Prett dunca.nosp@m.n@kd.nosp@m.e.org
Martijn Klingens kling.nosp@m.ens@.nosp@m.kde.o.nosp@m.rg
Olivier Goffart <ogoffart@kde.org>

Definition at line 62 of file kopeteprotocol.h.

Member Enumeration Documentation

enum Kopete::Protocol::Capability

Available capabilities.

capabilities() returns an ORed list of these, which the edit widget interperts to determine what buttons to show

Enumerator
BaseFgColor 

Setting the bg color of the whole edit widget / message.

BaseBgColor 

Setting the fg color of the whole edit widget / message.

RichFgColor 

Setting the fg/bg color of text portions individually.

RichBgColor 

Setting the fg/bg color of text portions individually.

BaseFont 

Setting the font of the whole edit widget / message.

RichFont 

Setting the font of text portions individually.

BaseUFormatting 

Setting the formatting of the whole edit widget / message.

BaseIFormatting 
BaseBFormatting 
RichUFormatting 

Setting the formatting of text portions individually.

RichIFormatting 
RichBFormatting 
Alignment 

Setting the alignment of text portions.

BaseFormatting 

Setting the formatting of the whole edit widget / message.

RichFormatting 

Setting the formatting of text portions individually.

RichColor 
BaseColor 
FullRTF 
CanSendOffline 

If it's possible to send offline messages.

Definition at line 110 of file kopeteprotocol.h.

Constructor & Destructor Documentation

Kopete::Protocol::~Protocol ( )
virtual
Todo:
Ideally, the destructor should be protected. but we need it public to allow QPtrList<Protocol>

Definition at line 63 of file kopeteprotocol.cpp.

Kopete::Protocol::Protocol ( const KComponentData &  instance,
QObject *  parent,
bool  canAddMyself = false 
)
protected

Constructor for Protocol.

Parameters
instanceThe protocol's instance, every plugin needs to have a KComponentData of its own
parentThe protocol's parent object
nameThe protocol's name

Definition at line 53 of file kopeteprotocol.cpp.

Member Function Documentation

void Kopete::Protocol::aboutToUnload ( )
virtual

Reimplemented from Kopete::Plugin.

This method disconnects all accounts and deletes them, after which it will emit readyForUnload.

Note that this is an asynchronous operation that may take some time with active chats. It's no longer immediate as it used to be in Kopete 0.7.x and before. This also means that you can do a clean shutdown.

Note
The method is not private to allow subclasses to reimplement it even more, but if you need to do this please explain why on the list first. It might make more sense to add another virtual for protocols that's called instead, but for now I actually think protocols don't need their own implementation at all, so I left out the necessary hooks on purpose.
  • Martijn

Reimplemented from Kopete::Plugin.

Definition at line 130 of file kopeteprotocol.cpp.

Kopete::OnlineStatus Kopete::Protocol::accountOfflineStatus ( ) const

Returns the status used for contacts when accounts of this protocol are offline.

Definition at line 94 of file kopeteprotocol.cpp.

bool Kopete::Protocol::canAddMyself ( ) const

true if account can add own contact into a contact list

Definition at line 89 of file kopeteprotocol.cpp.

Protocol::Capabilities Kopete::Protocol::capabilities ( ) const

a bitmask of the capabilities of this protocol

See also
setCapabilities

Definition at line 79 of file kopeteprotocol.cpp.

virtual AddContactPage* Kopete::Protocol::createAddContactWidget ( QWidget *  parent,
Account *  account 
)
pure virtual

Create a new AddContactPage widget to be shown in the Add Contact Wizard.

Returns
A new AddContactPage to be shown in the Add Contact Wizard
virtual KopeteEditAccountWidget* Kopete::Protocol::createEditAccountWidget ( Account *  account,
QWidget *  parent 
)
pure virtual

Create a new KopeteEditAccountWidget.

Returns
A new KopeteEditAccountWidget to be shown in the account part of the configurations.
Parameters
accountis the KopeteAccount to edit. If it's 0L, then we create a new account
parentThe parent of the 'to be returned' widget
virtual Account* Kopete::Protocol::createNewAccount ( const QString &  accountId)
pure virtual

Create an empty Account.

This method is called during the loading of the config file.

Parameters
accountId- the account ID to create the account with. This is usually the login name of the account

you don't need to register the account to the AccountManager in this function. But if you want to use this function don't forget to call AccountManager::registerAccount

Returns
The new Account object created by this function
KJob * Kopete::Protocol::createProtocolTask ( const QString &  taskType)
virtual

Factory method to create a protocol Task.

Protocols Task are tasks needed for executing specific commands for the given protocol. This method creates the required task for the given task type.

If a task type is not available in the protocol, just return a null pointer, like the default implementation.

Example of a implementation of createProtocolTask()

KJob* JabberProtocol::createProtocolTask(const QString &taskType)
{
if( taskType == QLatin1String("DeleteContactTask") )
{
return new JabberDeleteContactTask();
}
if( taskType == QLatin1String("AddContactTask") )
{
return new JabberAddContactTask();
}
return 0;
}
Parameters
taskTypea task type as a string. Check each task for name.

Definition at line 314 of file kopeteprotocol.cpp.

void Kopete::Protocol::deserialize ( MetaContact *  metaContact,
const QMap< QString, QString > &  serializedData 
)
virtual

Deserialize the plugin data for a meta contact.

This method splits up the data into the independent Kopete::Contact objects and calls deserializeContact() for each contact.

Note that you can still reimplement this method if you prefer, but you are strongly recommended to use this version of the method instead, unless you want to do VERY special things with the data...

Todo:
we probably should think to another way to save the contacltist.

Reimplemented from Kopete::Plugin.

Definition at line 296 of file kopeteprotocol.cpp.

Contact * Kopete::Protocol::deserializeContact ( MetaContact *  metaContact,
const QMap< QString, QString > &  serializedData,
const QMap< QString, QString > &  addressBookData 
)
virtual

Deserialize a single contact.

This method is called by deserialize() for each separate contact, so you don't need to add your own hooks for multiple contacts in a single meta contact yourself. serializedData and addressBookData will be the data the contact provided in Kopete::Contact::serialize.

The default implementation does nothing.

Returns
The contact created from the data
See also
Contact::serialize
Todo:
we probably should think to another way to save the contacltist.

Definition at line 302 of file kopeteprotocol.cpp.

void Kopete::Protocol::deserializeContactList ( MetaContact *  metaContact,
const QList< QMap< QString, QString > > &  dataList 
)
virtual

Deserialize the plugin data for a meta contact's contacts.

Definition at line 234 of file kopeteprotocol.cpp.

void Kopete::Protocol::serialize ( Kopete::MetaContact *  metaContact)

Serialize meta contact into the metacontact's plugin data Call serialize() for all contained contacts for this protocol.

it's public because for example, Contact::setMetaContact uses it.

Todo:
we probably should think to another way to save the contacltist.

Definition at line 175 of file kopeteprotocol.cpp.

void Kopete::Protocol::setCapabilities ( Capabilities  )
protected

Sets the capabilities of this protcol.

The subclass contructor is a good place for calling it.

See also
capabilities()

Definition at line 84 of file kopeteprotocol.cpp.

bool Kopete::Protocol::validatePassword ( const QString &  password) const
virtual

Check whether a password is valid for this protocol.

The default implementation validates every password

Parameters
passwordThe password to check

Definition at line 321 of file kopeteprotocol.cpp.


The documentation for this class was generated from the following files:
  • kopeteprotocol.h
  • kopeteprotocol.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

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

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal