00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_SESSION_P_H
00021 #define AKONADI_SESSION_P_H
00022
00023 #include "akonadiprivate_export.h"
00024 #include "session.h"
00025 #include "imapparser_p.h"
00026 #include "item.h"
00027 #include "servermanager.h"
00028
00029 #include <QtNetwork/QLocalSocket>
00030
00031 #include <QtCore/QQueue>
00032 #include <QtCore/QThreadStorage>
00033
00034 class QIODevice;
00035
00036 namespace Akonadi {
00037
00041 class AKONADI_TESTS_EXPORT SessionPrivate
00042 {
00043 public:
00044 SessionPrivate( Session *parent );
00045
00046 virtual ~SessionPrivate()
00047 {
00048 delete parser;
00049 }
00050
00051 virtual void init( const QByteArray &sessionId );
00052
00053 void startNext();
00054 void reconnect();
00055 void serverStateChanged( ServerManager::State );
00056 void socketDisconnected();
00057 void socketError( QLocalSocket::LocalSocketError error );
00058 void socketError( QAbstractSocket::SocketError error );
00059 void dataReceived();
00060 void doStartNext();
00061 void startJob( Job* job );
00062
00066 void endJob( Job* job );
00067
00068 void jobDone( KJob* job );
00069 void jobWriteFinished( Akonadi::Job* job );
00070 void jobDestroyed( QObject *job );
00071
00072 bool canPipelineNext();
00073
00083 static void createDefaultSession( const QByteArray &sessionId );
00084
00088 virtual void addJob( Job* job );
00089
00093 int nextTag();
00094
00098 void writeData( const QByteArray &data );
00099
00103 void itemRevisionChanged( Akonadi::Item::Id itemId, int oldRevision, int newRevision );
00104
00105 static int minimumProtocolVersion() { return 28; }
00106
00107 Session *mParent;
00108 QByteArray sessionId;
00109 QIODevice* socket;
00110 bool connected;
00111 int theNextTag;
00112 int protocolVersion;
00113
00114
00115 QQueue<Job*> queue;
00116 QQueue<Job*> pipeline;
00117 Job* currentJob;
00118 bool jobRunning;
00119
00120
00121 ImapParser *parser;
00122 };
00123
00124 }
00125
00126 #endif