00001 #ifndef IMAPBASE_H 00002 #define IMAPBASE_H 00003 00004 #include <qobject.h> 00005 00006 #include "configfile.h" 00007 00008 class QSocket; 00009 00010 class IMAPBase : public QObject 00011 { 00012 Q_OBJECT 00013 00014 public: 00015 IMAPBase(const Account &account); 00016 00017 enum Error { IMAPErrConnectionRefused, IMAPErrHostNotFound, 00018 IMAPErrSocketRead, IMAPErrUnknownError, 00019 IMAPErrLoginFailed }; 00020 00021 void sendCommand(const QString &command); 00022 void disconnect(); 00023 00024 signals: 00025 void dataReceived(const QString &data); 00026 void lookingUpHost(); 00027 void hostFound(); 00028 void connected(); 00029 void disconnected(); 00030 void error(int err); 00031 00032 protected: 00033 void makeConnect(); 00034 00035 protected slots: 00036 void writeCommands(); 00037 void slotError(int error); 00038 void slotHostFound(); 00039 void slotConnected(); 00040 void slotDisconnected(); 00041 void slotDataAvailiable(); 00042 void tryRead ( QString & ); 00043 00044 private: 00045 Account _account; 00046 QString _data; 00047 QSocket *_socket; 00048 QStringList _commandQueue; 00049 bool _connected, _writingAllowed; 00050 QString _lasttag; 00051 }; 00052 00053 #endif
1.4.2