~ubuntu-branches/ubuntu/vivid/akonadi/vivid-proposed

« back to all changes in this revision

Viewing changes to server/src/connection.h

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-07-18 15:38:49 UTC
  • mfrom: (1.1.52)
  • Revision ID: package-import@ubuntu.com-20140718153849-mrt24e3jsxxikq7m
Tags: 1.12.91-0ubuntu1
* New upstream release needed for KDE 4.13.90 beta 2
* Remove patches applied upstream.
* Update symbols with batchpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *   You should have received a copy of the GNU Library General Public     *
15
15
 *   License along with this program; if not, write to the                 *
16
16
 *   Free Software Foundation, Inc.,                                       *
17
 
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
18
18
 ***************************************************************************/
 
19
 
19
20
#ifndef AKONADI_CONNECTION_H
20
21
#define AKONADI_CONNECTION_H
21
22
 
26
27
#include "entities.h"
27
28
#include "global.h"
28
29
#include "clientcapabilities.h"
 
30
#include "commandcontext.h"
29
31
 
30
32
namespace Akonadi {
31
33
namespace Server {
35
37
class DataStore;
36
38
class Collection;
37
39
class ImapStreamParser;
 
40
class CollectionReferenceManager;
38
41
 
39
42
/**
40
 
    An AkonadiConnection represents one connection of a client to the server.
 
43
    An Connection represents one connection of a client to the server.
41
44
*/
42
 
class Connection : public QThread
 
45
class Connection : public QObject
43
46
{
44
47
    Q_OBJECT
45
48
public:
46
 
    Connection( quintptr socketDescriptor, QObject *parent );
 
49
    Connection( quintptr socketDescriptor, QObject *parent = 0 );
47
50
    virtual ~Connection();
48
 
    void run();
 
51
 
 
52
    static int protocolVersion();
49
53
 
50
54
    virtual DataStore *storageBackend();
51
 
    qint64 selectedCollectionId() const;
52
 
    void setSelectedCollection( qint64 collection );
53
 
 
54
 
    Resource resourceContext() const;
55
 
    void setResourceContext( const Resource &res );
 
55
 
 
56
    CollectionReferenceManager *collectionReferenceManager();
 
57
 
 
58
    CommandContext *context() const;
 
59
 
56
60
    /**
57
61
      Returns @c true if this connection belongs to the owning resource of @p item.
58
62
    */
59
63
    bool isOwnerResource( const PimItem &item ) const;
60
64
    bool isOwnerResource( const Collection &collection ) const;
61
65
 
62
 
    const Collection selectedCollection();
63
 
 
64
66
    void addStatusMessage( const QByteArray &msg );
65
67
    void flushStatusMessageQueue();
66
68
 
73
75
    /** Returns @c true if permanent cache verification is enabled. */
74
76
    bool verifyCacheOnRetrieval() const;
75
77
 
 
78
Q_SIGNALS:
 
79
    void disconnected();
 
80
 
76
81
protected Q_SLOTS:
77
 
    void slotDisconnected();
78
82
    /**
79
83
     * New data arrived from the client. Creates a handler for it and passes the data to the handler.
80
84
     */
81
85
    void slotNewData();
82
 
    void slotResponseAvailable( const Akonadi::Server::Response &response );
83
86
    void slotConnectionStateChange( ConnectionState );
84
87
 
 
88
    virtual void slotResponseAvailable( const Akonadi::Server::Response &response );
 
89
 
85
90
protected:
86
 
    Connection() {} // used for testing
 
91
    Connection(QObject *parent = 0); // used for testing
 
92
 
87
93
    void writeOut( const QByteArray &data );
88
 
    Handler *findHandlerForCommand( const QByteArray &command );
 
94
    virtual Handler *findHandlerForCommand( const QByteArray &command );
89
95
 
90
 
private:
 
96
protected:
91
97
    quintptr m_socketDescriptor;
92
 
    QLocalSocket *m_socket;
 
98
    QIODevice *m_socket;
93
99
    QPointer<Handler> m_currentHandler;
94
100
    ConnectionState m_connectionState;
95
101
    mutable DataStore *m_backend;
96
 
    qint64 m_selectedConnection;
97
102
    QList<QByteArray> m_statusMessageQueue;
98
103
    QString m_identifier;
99
104
    QByteArray m_sessionId;
100
105
    ImapStreamParser *m_streamParser;
101
 
    Resource m_resourceContext;
102
106
    ClientCapabilities m_clientCapabilities;
103
107
    bool m_verifyCacheOnRetrieval;
 
108
    CommandContext m_context;
 
109
 
104
110
};
105
111
 
106
112
} // namespace Server