akonadi
session_p.h
00001 /* 00002 Copyright (c) 2007 Volker Krause <vkrause@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 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 // job management 00115 QQueue<Job*> queue; 00116 QQueue<Job*> pipeline; 00117 Job* currentJob; 00118 bool jobRunning; 00119 00120 // parser stuff 00121 ImapParser *parser; 00122 }; 00123 00124 } 00125 00126 #endif