00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef EMAILCLIENT_H
00021 #define EMAILCLIENT_H
00022
00023 #include <qlist.h>
00024 #include <qcstring.h>
00025 #include <qmainwindow.h>
00026
00027 #include <qtoolbar.h>
00028 #include <qcheckbox.h>
00029 #include <qlabel.h>
00030 #include <qlineedit.h>
00031 #include <qlistview.h>
00032 #include <qaction.h>
00033 #include <qlayout.h>
00034 #include <qtooltip.h>
00035 #include <qtoolbutton.h>
00036 #include <qimage.h>
00037 #include <qpixmap.h>
00038 #include <qstringlist.h>
00039 #include <qprogressbar.h>
00040 #include <qstatusbar.h>
00041 #include <qdir.h>
00042 #include <stdlib.h>
00043 #include <opie/otabwidget.h>
00044 #include <qpe/qcopenvelope_qws.h>
00045 #include <qtimer.h>
00046
00047 #include "emailhandler.h"
00048 #include "emaillistitem.h"
00049 #include "textparser.h"
00050 #include "editaccount.h"
00051 #include "maillist.h"
00052 #include "addresslist.h"
00053
00054 #include <qpe/config.h>
00055
00056 class AccountList : public QList<MailAccount>
00057 {
00058 public:
00059 Item newItem(Item d);
00060 private:
00061 MailAccount* dupl(MailAccount *in);
00062 MailAccount *ac;
00063 };
00064
00065
00066 class EmailClient : public QMainWindow
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 EmailClient( QWidget* parent, const char* name, WFlags fl = 0 );
00072 ~EmailClient();
00073 AddressList* getAdrListRef();
00074
00075 protected:
00076
00077
00078 signals:
00079 void composeRequested();
00080 void viewEmail(QListView *, Email *);
00081 void mailUpdated(Email *);
00082 void newCaption(const QString &);
00083 void replyRequested(Email&, bool&);
00084 void forwardRequested(Email&);
00085 void removeItem(EmailListItem*, bool&);
00086
00087
00088
00089
00090
00091 public slots:
00092 void compose();
00093 void cancel();
00094 void enqueMail(const Email &mail);
00095 void setMailAccount();
00096 void sendQuedMail();
00097 void mailSent();
00098 void deleteItem();
00099 void getNewMail();
00100 void getAllNewMail();
00101 void smtpError(int code, const QString & Msg );
00102 void popError(int code, const QString & Msg);
00103 void inboxItemSelected();
00104 void outboxItemSelected();
00105 void inboxItemPressed();
00106 void inboxItemReleased();
00107 void mailArrived(const Email &mail, bool fromDisk);
00108 void allMailArrived(int);
00109 void saveMail(const QString &fileName, QListView *view);
00110 void selectAccount(int);
00111 void editAccount(int);
00112 void updateAccounts();
00113 void deleteAccount(int);
00114 void deleteMail(EmailListItem *mailItem, bool &inbox);
00115 void setTotalSize(int);
00116 void setMailSize(int);
00117 void setDownloadedSize(int);
00118 void moveMailFront(Email *mailPtr);
00119 void download(Email*);
00120
00121
00122
00123
00124
00125 private slots:
00126 void receive(const QCString&, const QByteArray&);
00127
00128 private:
00129 void init();
00130 void initStatusBar(QWidget*);
00131 void readMail();
00132 QString getPath(bool enclosurePath);
00133 void readSettings();
00134 void saveSettings();
00135 Email* getCurrentMail();
00136 int timerID;
00137 Config *mailconf;
00138 int newAccountId, idCount, mailIdCount;
00139 int accountIdCount;
00140 AccountList accountList;
00141 AddressList *addressList;
00142
00143 EditAccount *editAccountView;
00144 EmailListItem *item;
00145 EmailHandler *emailHandler;
00146 QList<Email> quedMessages;
00147 MailList mailDownloadList;
00148 MailList tempMailDownloadList;
00149
00150 bool sending, receiving, previewingMail, allAccounts;
00151 QString lineShift;
00152 MailAccount account, *currentAccount;
00153
00154 QCopChannel* channel;
00155
00156 QToolBar *bar;
00157 QProgressBar *progressBar;
00158 QStatusBar *statusBar;
00159 QLabel *status1Label, *status2Label;
00160 QToolButton *getMailButton;
00161 QAction *sendMailButton;
00162 QAction *composeButton;
00163 QAction *cancelButton;
00164 QAction *deleteButton;
00165
00166
00167 QMenuBar *mb;
00168 QPopupMenu *selectAccountMenu;
00169 QPopupMenu *editAccountMenu;
00170 QPopupMenu *deleteAccountMenu;
00171 QPopupMenu *setAccountMenu;
00172
00173 OTabWidget* mailboxView;
00174 QListView* inboxView;
00175 QListView* outboxView;
00176
00177 QGridLayout* grid_2;
00178 QGridLayout* grid_3;
00179 };
00180
00181 #endif // EMAILCLIENT_H