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 "session.h"
00024 #include "imapparser_p.h"
00025 #include "akonadiprivate_export.h"
00026 #include "servermanager.h"
00027
00028 #include <QtNetwork/QLocalSocket>
00029
00030 #include <QtCore/QQueue>
00031 #include <QtCore/QThreadStorage>
00032
00033 class QIODevice;
00034
00035 namespace Akonadi {
00036
00040 class AKONADI_TESTS_EXPORT SessionPrivate
00041 {
00042 public:
00043 SessionPrivate( Session *parent );
00044
00045 virtual ~SessionPrivate()
00046 {
00047 delete parser;
00048 }
00049
00050 virtual void init( const QByteArray &sessionId );
00051
00052 void startNext();
00053 void reconnect();
00054 void serverStateChanged( ServerManager::State );
00055 void socketDisconnected();
00056 void socketError( QLocalSocket::LocalSocketError error );
00057 void socketError( QAbstractSocket::SocketError error );
00058 void dataReceived();
00059 void doStartNext();
00060 void startJob( Job* job );
00061
00065 void endJob( Job* job );
00066
00067 void jobDone( KJob* job );
00068 void jobWriteFinished( Akonadi::Job* job );
00069 void jobDestroyed( QObject *job );
00070
00071 bool canPipelineNext();
00072
00082 static void createDefaultSession( const QByteArray &sessionId );
00083
00087 virtual void addJob( Job* job );
00088
00092 int nextTag();
00093
00097 void writeData( const QByteArray &data );
00098
00099 static int minimumProtocolVersion() { return 26; }
00100
00101 Session *mParent;
00102 QByteArray sessionId;
00103 QIODevice* socket;
00104 bool connected;
00105 int theNextTag;
00106 int protocolVersion;
00107
00108
00109 QQueue<Job*> queue;
00110 QQueue<Job*> pipeline;
00111 Job* currentJob;
00112 bool jobRunning;
00113
00114
00115 ImapParser *parser;
00116 };
00117
00118 }
00119
00120 #endif