#include <GKolabAgent.h>
Inheritance diagram for GBE::GKolabAgent:


Public Slots | |
| virtual void | closeConnection () |
| virtual void | initKolabServerName (const QString &server) |
| virtual void | initKolabUserName (const QString &username) |
| virtual void | initKolabUserPassword (const QString &password) |
| virtual void | initKolabObject (const QString &objectpath) |
Public Member Functions | |
| GKolabAgent () | |
| virtual | ~GKolabAgent () |
| virtual QStringList | getAvailableActions () const |
| virtual QString | getActionDescription (const QString &action) const |
| virtual void | performAction (const QString &action, QStringList params) |
Protected Slots | |
| void | connectToKolab () |
| void | socketConnected () |
| void | readSocketData () |
| void | interpretMessage () |
| void | socketError (QAbstractSocket::SocketError error) |
| bool | sendMail (const QString &content) |
| TODO implement (tricky, need to connect to SMTP first! | |
| bool | sendMail (const QString &to, const QString &subject, const QString &body) |
| TODO implement (tricky, need to connect to SMTP first! | |
Protected Member Functions | |
| bool | isConnectedToKolab () const |
| int | getNextCommandNumber () |
Protected Attributes | |
| QTcpSocket | Socket |
| int | CommandCounter |
| QDomDocument | KolabXml |
| bool | ConnectInProgress |
| bool | LoggedIn |
| QStringList | ReadBuffer |
The architecture of Kolab integration is as follows: An element that contains the GKolabAgent (hereafter called the top-most kolab element) creates a subhierarchy of elements for the individual kolab.xml data packages and emails as well. These child elements won't be connected to the Kolab server, only the top-most kolab element since Cyrus is limited to one simulatneous TCP connection(!) If that restriction would not be the case the overal design would be even simpler.
The child elements have themselves various child elements: One child element that is always present will be connected to the top-most kolab element, in order to provide useful relations. The other child elements will depend on the actual kolab.xml data. For example Kolab Calendar events will have relations to other users and freebusy data.
Using the GObject::Connection is crucial to benefit from the general G System architecture.
The Kolab xml formats usually share a common base format that can also be taken advantage of by this Kolab agent in terms of a common child elements hierarchy.
Besides this generated element hierarchy other elements will be used to perform various useful tasks on the element hierarchy like building a calendar on a monthly and weekly basis. The general idea is to simplify common groupware tasks through such special agents and elements. Other special agents will be used to collect freebusy data for event scheduling, or create a calendar of all users by using the freebusy data.
It is important to recognize that within the G System environment the features and capabilities of the Kolab groupware server can be enhanced (like a global all-user calendar, see above).
In particular these agents will make it possible to write a highly simplified webinterface to the Kolab server.
It also might be a good idea to reference (with ID) such special elements within the top-most kolab element so they are easy to find and utilize for the user.
Infrastructure for sending mails:
Sending can be done from within this agent, directly. Composing emails should be done with child elements, each representing an email with additional child elements attached for parts of the mail, like recipient, subject, message body, attachements. Most of these child elements of the mail element are linked to various things within the G Universe. This way an attachment can be connected to a specific other element. Or the recipient can be linked to a different user element and such things.
This way the kolab element can collect multiple child elements that are composed emails and send them per request.
In a first simple implementation, the KolabAgent will accept emails directly through an action and send it (sendMail action).
Each element can have a /contact/ tag in the element data that contains things like email address of the element owner. If a sender or receiver child element of the mail element is connected to such an element, then this contact data is used.
| GBE::GKolabAgent::GKolabAgent | ( | ) |
Constructor.
| GBE::GKolabAgent::~GKolabAgent | ( | ) | [virtual] |
Virtual Destructor.
| void GBE::GKolabAgent::closeConnection | ( | ) | [virtual, slot] |
Closes the IMAP connection to the Kolab server.
| void GBE::GKolabAgent::connectToKolab | ( | ) | [protected, slot] |
Connects to the Kolab IMAP server.
| QString GBE::GKolabAgent::getActionDescription | ( | const QString & | action | ) | const [virtual] |
Needs to be reimplemented in a subclass.
Reimplemented from GCS::GAgent.
| QStringList GBE::GKolabAgent::getAvailableActions | ( | ) | const [virtual] |
By default this returns an empty list. It needs to be reimplemented in a subclass.
Reimplemented from GCS::GAgent.
| int GBE::GKolabAgent::getNextCommandNumber | ( | ) | [protected] |
Used to generate the next unique tag for an IMAP command.
| void GBE::GKolabAgent::initKolabObject | ( | const QString & | objectpath | ) | [virtual, slot] |
Sets the actual kolab object to operate on.
This can be a folder or a particular email, for example /INBOX/Sent works on the Sent folder of your inbox.
By default (empty path), the inbox of the user is used.
| void GBE::GKolabAgent::initKolabServerName | ( | const QString & | server | ) | [virtual, slot] |
Sets the fully qualified domain name of the Kolab server to which this agent should connect.
| void GBE::GKolabAgent::initKolabUserName | ( | const QString & | username | ) | [virtual, slot] |
Sets the user name to connect with
| void GBE::GKolabAgent::initKolabUserPassword | ( | const QString & | password | ) | [virtual, slot] |
Sets the password for the user.
| void GBE::GKolabAgent::interpretMessage | ( | ) | [protected, slot] |
Interpretes the content of ReadBuffer. This is called as soon as the complete response is read.
| bool GBE::GKolabAgent::isConnectedToKolab | ( | ) | const [protected] |
| void GBE::GKolabAgent::readSocketData | ( | ) | [protected, slot] |
Whenever data is available from the kolab server, it is interpreted here. When the response is complete, interpretMessage is called.
| bool GBE::GKolabAgent::sendMail | ( | const QString & | to, | |
| const QString & | subject, | |||
| const QString & | body | |||
| ) | [protected, slot] |
TODO implement (tricky, need to connect to SMTP first!
Constructs a valid email with given parameters and sends it.
| to | the receiver of the mail | |
| subject | the subject line of the mail | |
| body | the actual message. |
| bool GBE::GKolabAgent::sendMail | ( | const QString & | content | ) | [protected, slot] |
TODO implement (tricky, need to connect to SMTP first!
Sends given email.
| void GBE::GKolabAgent::socketConnected | ( | ) | [protected, slot] |
Slot used to detect socket connections. The login process is done here.
| void GBE::GKolabAgent::socketError | ( | QAbstractSocket::SocketError | error | ) | [protected, slot] |
Slot used to detect and respond to socket errors.
int GBE::GKolabAgent::CommandCounter [protected] |
IMAP commands start with a tag that has a strict monotonic increasing number, like a1, a2, and so on. The CommandCounter provides this number and is increased before each use.
bool GBE::GKolabAgent::ConnectInProgress [protected] |
Set to true while connecting to the kolab server is in progress. This is set to false as soon as the user is successfully logged in.
QDomDocument GBE::GKolabAgent::KolabXml [protected] |
Contains the actual kolab xml data.
bool GBE::GKolabAgent::LoggedIn [protected] |
Set to true when the user is logged in.
QStringList GBE::GKolabAgent::ReadBuffer [protected] |
Contains all lines read so far. In case a response does not come in one complete TCP packet it might happen that it is split up. For this reason all lines are stored here until the response is complete, then it is interpreted.
QTcpSocket GBE::GKolabAgent::Socket [protected] |
The socket for the Kolab IMAP connection.
1.4.7