GKolabAgent.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Raphael Langerhorst                             *
00003  *   raphael-langerhorst@gmx.at                                            *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GKOLABAGENTH
00026 #define GKOLABAGENTH
00027 
00028 #include <GAgent.h>
00029 
00030 #include <QDomDocument>
00031 #include <QTcpSocket>
00032 
00033 class QStringList;
00034 
00035 namespace GBE
00036 {
00037 
00128 class GKolabAgent : public GCS::GAgent
00129 {
00130   Q_OBJECT
00131   
00132   protected:
00133   
00137     QTcpSocket Socket;
00138   
00145     int CommandCounter;
00146     
00150     QDomDocument KolabXml;
00151     
00156     bool ConnectInProgress;
00157     
00161     bool LoggedIn;
00162     
00170     QStringList ReadBuffer;
00171     
00172   protected:
00173   
00179     bool isConnectedToKolab() const;
00180     
00185     int getNextCommandNumber();
00186     
00187   protected slots:
00188     
00192     void connectToKolab();
00193     
00198     void socketConnected();
00199     
00206     void readSocketData();
00207     
00213     void interpretMessage();
00214     
00218     void socketError(QAbstractSocket::SocketError error);
00219     
00223     bool sendMail(const QString& content);
00224     
00231     bool sendMail(const QString& to, const QString& subject, const QString& body);
00232     
00233   public:
00234     
00238     GKolabAgent();
00239     
00243     virtual ~GKolabAgent();
00244     
00245     //BEGIN ACTION INTERFACE
00246     virtual QStringList getAvailableActions() const;
00247     virtual QString getActionDescription(const QString& action) const;
00248     virtual void performAction(const QString& action, QStringList params);
00249     //END ACTION INTERFACE
00250     
00251     /*
00252      * Overloads GCS::GAgent::run() and
00253      * initializes the connection to the Kolab server
00254      * note: not implemented, it should not connect by default, but through connect action
00255      */
00256 //     virtual void run();
00257     
00258   public slots:
00259     
00263     virtual void closeConnection();
00264     
00269     virtual void initKolabServerName(const QString& server);
00270     
00274     virtual void initKolabUserName(const QString& username);
00275     
00279     virtual void initKolabUserPassword(const QString& password);
00280     
00290     virtual void initKolabObject(const QString& objectpath);
00291 };
00292 
00293 }
00294 
00295 #endif

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7