author | tille <tille> | 2002-06-18 23:53:27 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-18 23:53:27 (UTC) |
commit | 14881bb4baf3ac470a135bdde6ffb115c91ea124 (patch) (unidiff) | |
tree | 6d088cdacd769076e64496abe6b9043168b75928 /noncore/unsupported | |
parent | f2ecc05c1156ae0f99ea0528646609d63eaa84c0 (diff) | |
download | opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.zip opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.gz opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.bz2 |
added menu and fix send queued
-rw-r--r-- | noncore/unsupported/mail2/composer.cpp | 55 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composer.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.cpp | 9 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/mail2/libmail/libmail.pro | 3 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mail.pro | 3 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.cpp | 12 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.h | 4 |
8 files changed, 74 insertions, 19 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp index 1d793ee..72a7242 100644 --- a/noncore/unsupported/mail2/composer.cpp +++ b/noncore/unsupported/mail2/composer.cpp | |||
@@ -67,5 +67,4 @@ void Composer::exec() | |||
67 | { | 67 | { |
68 | show(); | 68 | show(); |
69 | |||
70 | if (!_inLoop) { | 69 | if (!_inLoop) { |
71 | _inLoop = true; | 70 | _inLoop = true; |
@@ -95,9 +94,5 @@ void Composer::slotResizing() | |||
95 | from->setMaximumWidth(width() - fromBox->width()); | 94 | from->setMaximumWidth(width() - fromBox->width()); |
96 | from->resize(width() - fromBox->width(), y()); | 95 | from->resize(width() - fromBox->width(), y()); |
97 | if (_sendQueued) | 96 | if (_sendQueued) slotSendQueued(); |
98 | { | ||
99 | slotSendQueued(); | ||
100 | close(); | ||
101 | } | ||
102 | } | 97 | } |
103 | 98 | ||
@@ -172,13 +167,13 @@ void Composer::slotSendQueued() | |||
172 | Config cfg( "mailqueue", Config::User ); | 167 | Config cfg( "mailqueue", Config::User ); |
173 | cfg.setGroup( "Settings" ); | 168 | cfg.setGroup( "Settings" ); |
174 | int count = cfg.readNumEntry( "count", 0 ); | 169 | _sendCount = 0; |
175 | // tille: should not be here | 170 | _sendError = 0; |
176 | // but no error checking for the moment | 171 | _toSend = cfg.readNumEntry( "count", 0 ); |
177 | cfg.writeEntry( "count", 0 ); | ||
178 | 172 | ||
173 | if (_toSend == 0) close(); | ||
179 | 174 | ||
180 | qDebug("%i messages to send", count); | 175 | qDebug("%i messages to send", _toSend); |
181 | QString str; | 176 | QString str; |
182 | for (int i=1;i<=count;i++) | 177 | for (int i=1;i<=_toSend;i++) |
183 | { | 178 | { |
184 | qDebug("sending message %i",i); | 179 | qDebug("sending message %i",i); |
@@ -250,11 +245,8 @@ void Composer::slotSendQueued() | |||
250 | SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); | 245 | SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); |
251 | 246 | ||
252 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); | 247 | connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished())); |
253 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); | 248 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &))); |
254 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); | 249 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); |
255 | 250 | ||
256 | qDebug("remove mail %i", i); | ||
257 | cfg.clearGroup(); | ||
258 | cfg.removeEntry( "Mail_" + QString::number(i) ); | ||
259 | } | 251 | } |
260 | } | 252 | } |
@@ -311,4 +303,12 @@ void Composer::slotSendError(const QString &error) | |||
311 | } | 303 | } |
312 | 304 | ||
305 | void Composer::slotSendQueuedError(const QString &error) | ||
306 | { | ||
307 | _sendError++; | ||
308 | qDebug("error send mail %i",_sendCount); | ||
309 | status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); | ||
310 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); | ||
311 | } | ||
312 | |||
313 | void Composer::slotSendFinished() | 313 | void Composer::slotSendFinished() |
314 | { | 314 | { |
@@ -319,4 +319,25 @@ void Composer::slotSendFinished() | |||
319 | } | 319 | } |
320 | 320 | ||
321 | void Composer::slotSendQueuedFinished() | ||
322 | { | ||
323 | |||
324 | _sendCount++; | ||
325 | qDebug("finished send mail %i of %i (error %i)",_sendCount,_toSend,_sendError); | ||
326 | if (_sendCount < _toSend) return; | ||
327 | if (_sendError == _toSend) close(); | ||
328 | QMessageBox::information(this, tr("Success"), tr("<p>The queued mails ")+QString::number(_toSend-_sendError)+tr(" of ")+QString::number(_toSend)+(" were sent successfully.</p>"), tr("Ok")); | ||
329 | Config cfg( "mailqueue", Config::User ); | ||
330 | cfg.setGroup( "Settings" ); | ||
331 | cfg.writeEntry( "count", 0 ); | ||
332 | for (int i=1;i<=_sendCount;i++) | ||
333 | { | ||
334 | cfg.setGroup( "Mail_" + QString::number(i) ); | ||
335 | qDebug("remove mail %i", i); | ||
336 | cfg.clearGroup(); | ||
337 | cfg.removeEntry( "Mail_" + QString::number(i) ); | ||
338 | } | ||
339 | close(); | ||
340 | } | ||
341 | |||
321 | void Composer::slotFillStuff() | 342 | void Composer::slotFillStuff() |
322 | { | 343 | { |
diff --git a/noncore/unsupported/mail2/composer.h b/noncore/unsupported/mail2/composer.h index 00235bf..0b2a54c 100644 --- a/noncore/unsupported/mail2/composer.h +++ b/noncore/unsupported/mail2/composer.h | |||
@@ -43,4 +43,6 @@ protected slots: | |||
43 | void slotSendError(const QString &); | 43 | void slotSendError(const QString &); |
44 | void slotSendFinished(); | 44 | void slotSendFinished(); |
45 | void slotSendQueuedError(const QString &); | ||
46 | void slotSendQueuedFinished(); | ||
45 | void slotResizing(); | 47 | void slotResizing(); |
46 | void slotFillStuff(); | 48 | void slotFillStuff(); |
@@ -55,4 +57,5 @@ protected: | |||
55 | private: | 57 | private: |
56 | bool _sendQueued; | 58 | bool _sendQueued; |
59 | int _toSend, _sendCount, _sendError; | ||
57 | bool _inLoop; | 60 | bool _inLoop; |
58 | QString _inReplyTo; | 61 | QString _inReplyTo; |
diff --git a/noncore/unsupported/mail2/composerbase.cpp b/noncore/unsupported/mail2/composerbase.cpp index 6627701..ff00a73 100644 --- a/noncore/unsupported/mail2/composerbase.cpp +++ b/noncore/unsupported/mail2/composerbase.cpp | |||
@@ -9,4 +9,5 @@ | |||
9 | 9 | ||
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qpemenubar.h> | ||
11 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
12 | 13 | ||
@@ -21,4 +22,7 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) | |||
21 | 22 | ||
22 | toolbar = new QPEToolBar(this); | 23 | toolbar = new QPEToolBar(this); |
24 | menubar = new QPEMenuBar( toolbar ); | ||
25 | mailmenu = new QPopupMenu( menubar ); | ||
26 | menubar->insertItem( tr( "Mail" ), mailmenu ); | ||
23 | addToolBar(toolbar); | 27 | addToolBar(toolbar); |
24 | toolbar->setHorizontalStretchable(true); | 28 | toolbar->setHorizontalStretchable(true); |
@@ -26,14 +30,18 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) | |||
26 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); | 30 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); |
27 | sendmail->addTo(toolbar); | 31 | sendmail->addTo(toolbar); |
32 | sendmail->addTo(mailmenu); | ||
28 | 33 | ||
29 | queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this); | 34 | queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this); |
30 | queuemail->addTo(toolbar); | 35 | queuemail->addTo(toolbar); |
36 | queuemail->addTo(mailmenu); | ||
31 | 37 | ||
32 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); | 38 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); |
33 | attachfile->addTo(toolbar); | 39 | attachfile->addTo(toolbar); |
40 | attachfile->addTo(mailmenu); | ||
34 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); | 41 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); |
35 | 42 | ||
36 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); | 43 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); |
37 | addressbook->addTo(toolbar); | 44 | addressbook->addTo(toolbar); |
45 | addressbook->addTo(mailmenu); | ||
38 | 46 | ||
39 | QLabel *spacer = new QLabel(toolbar); | 47 | QLabel *spacer = new QLabel(toolbar); |
@@ -43,4 +51,5 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) | |||
43 | abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); | 51 | abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); |
44 | abort->addTo(toolbar); | 52 | abort->addTo(toolbar); |
53 | abort->addTo(mailmenu); | ||
45 | 54 | ||
46 | QWidget *main = new QWidget(this); | 55 | QWidget *main = new QWidget(this); |
diff --git a/noncore/unsupported/mail2/composerbase.h b/noncore/unsupported/mail2/composerbase.h index 9d3e4fc..d832623 100644 --- a/noncore/unsupported/mail2/composerbase.h +++ b/noncore/unsupported/mail2/composerbase.h | |||
@@ -8,4 +8,6 @@ class ListViewPlus; | |||
8 | class QPopupMenu; | 8 | class QPopupMenu; |
9 | class QPEToolBar; | 9 | class QPEToolBar; |
10 | class QPEMenuBar; | ||
11 | class QPopupMenu; | ||
10 | class QComboBox; | 12 | class QComboBox; |
11 | class QLineEdit; | 13 | class QLineEdit; |
@@ -40,4 +42,6 @@ protected: | |||
40 | QPopupMenu *attachPopup; | 42 | QPopupMenu *attachPopup; |
41 | QPEToolBar *toolbar, *attachToolbar; | 43 | QPEToolBar *toolbar, *attachToolbar; |
44 | QPEMenuBar *menubar; | ||
45 | QPopupMenu *mailmenu; | ||
42 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; | 46 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; |
43 | QLineEdit *replyto, *to, *cc, *bcc, *subject; | 47 | QLineEdit *replyto, *to, *cc, *bcc, *subject; |
diff --git a/noncore/unsupported/mail2/libmail/libmail.pro b/noncore/unsupported/mail2/libmail/libmail.pro index 662af90..ddabd07 100644 --- a/noncore/unsupported/mail2/libmail/libmail.pro +++ b/noncore/unsupported/mail2/libmail/libmail.pro | |||
@@ -1,4 +1,5 @@ | |||
1 | TEMPLATE =lib | 1 | TEMPLATE =lib |
2 | CONFIG =qt warn_on release | 2 | CONFIG =qt warn_on debug |
3 | #CONFIG =qt warn_on release | ||
3 | HEADERS =configfile.h \ | 4 | HEADERS =configfile.h \ |
4 | defines.h \ | 5 | defines.h \ |
diff --git a/noncore/unsupported/mail2/mail.pro b/noncore/unsupported/mail2/mail.pro index 50d7c68..76b7996 100644 --- a/noncore/unsupported/mail2/mail.pro +++ b/noncore/unsupported/mail2/mail.pro | |||
@@ -1,4 +1,5 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | ||
3 | HEADERS = accounteditor.h \ | 4 | HEADERS = accounteditor.h \ |
4 | addresspicker.h \ | 5 | addresspicker.h \ |
diff --git a/noncore/unsupported/mail2/mainwindowbase.cpp b/noncore/unsupported/mail2/mainwindowbase.cpp index 24f030f..9ffe6f0 100644 --- a/noncore/unsupported/mail2/mainwindowbase.cpp +++ b/noncore/unsupported/mail2/mainwindowbase.cpp | |||
@@ -8,4 +8,5 @@ | |||
8 | 8 | ||
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qpemenubar.h> | ||
10 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
11 | 12 | ||
@@ -21,4 +22,10 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) | |||
21 | 22 | ||
22 | toolbar = new QPEToolBar(this); | 23 | toolbar = new QPEToolBar(this); |
24 | menubar = new QPEMenuBar( toolbar ); | ||
25 | mailmenu = new QPopupMenu( menubar ); | ||
26 | servermenu = new QPopupMenu( menubar ); | ||
27 | menubar->insertItem( tr( "Mail" ), mailmenu ); | ||
28 | menubar->insertItem( tr( "Servers" ), servermenu ); | ||
29 | |||
23 | addToolBar(toolbar); | 30 | addToolBar(toolbar); |
24 | toolbar->setHorizontalStretchable(true); | 31 | toolbar->setHorizontalStretchable(true); |
@@ -26,17 +33,22 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) | |||
26 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); | 33 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); |
27 | compose->addTo(toolbar); | 34 | compose->addTo(toolbar); |
35 | compose->addTo(mailmenu); | ||
28 | 36 | ||
29 | sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this); | 37 | sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this); |
30 | sendQueue->addTo(toolbar); | 38 | sendQueue->addTo(toolbar); |
39 | sendQueue->addTo(mailmenu); | ||
31 | 40 | ||
32 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); | 41 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); |
33 | folders->addTo(toolbar); | 42 | folders->addTo(toolbar); |
43 | folders->addTo(servermenu); | ||
34 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); | 44 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); |
35 | 45 | ||
36 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); | 46 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); |
37 | findmails->addTo(toolbar); | 47 | findmails->addTo(toolbar); |
48 | findmails->addTo(mailmenu); | ||
38 | 49 | ||
39 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); | 50 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); |
40 | configure->addTo(toolbar); | 51 | configure->addTo(toolbar); |
52 | configure->addTo(servermenu); | ||
41 | 53 | ||
42 | QLabel *spacer = new QLabel(toolbar); | 54 | QLabel *spacer = new QLabel(toolbar); |
diff --git a/noncore/unsupported/mail2/mainwindowbase.h b/noncore/unsupported/mail2/mainwindowbase.h index 232d656..d8faeba 100644 --- a/noncore/unsupported/mail2/mainwindowbase.h +++ b/noncore/unsupported/mail2/mainwindowbase.h | |||
@@ -8,4 +8,6 @@ class QProgressBar; | |||
8 | class FolderWidget; | 8 | class FolderWidget; |
9 | class QPEToolBar; | 9 | class QPEToolBar; |
10 | class QPEMenuBar; | ||
11 | class QPopupMenu; | ||
10 | class MailTable; | 12 | class MailTable; |
11 | class QAction; | 13 | class QAction; |
@@ -27,4 +29,6 @@ protected: | |||
27 | FolderWidget *folderView; | 29 | FolderWidget *folderView; |
28 | QPEToolBar *toolbar; | 30 | QPEToolBar *toolbar; |
31 | QPEMenuBar *menubar; | ||
32 | QPopupMenu *mailmenu, *servermenu; | ||
29 | MailTable *mailView; | 33 | MailTable *mailView; |
30 | QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop; | 34 | QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop; |