summaryrefslogtreecommitdiff
authortille <tille>2002-06-18 23:53:27 (UTC)
committer tille <tille>2002-06-18 23:53:27 (UTC)
commit14881bb4baf3ac470a135bdde6ffb115c91ea124 (patch) (unidiff)
tree6d088cdacd769076e64496abe6b9043168b75928
parentf2ecc05c1156ae0f99ea0528646609d63eaa84c0 (diff)
downloadopie-14881bb4baf3ac470a135bdde6ffb115c91ea124.zip
opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.gz
opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.bz2
added menu and fix send queued
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/mail2/composer.cpp55
-rw-r--r--noncore/unsupported/mail2/composer.h3
-rw-r--r--noncore/unsupported/mail2/composerbase.cpp9
-rw-r--r--noncore/unsupported/mail2/composerbase.h4
-rw-r--r--noncore/unsupported/mail2/libmail/libmail.pro3
-rw-r--r--noncore/unsupported/mail2/mail.pro3
-rw-r--r--noncore/unsupported/mail2/mainwindowbase.cpp12
-rw-r--r--noncore/unsupported/mail2/mainwindowbase.h4
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
@@ -66,7 +66,6 @@ void Composer::hide()
66void Composer::exec() 66void Composer::exec()
67{ 67{
68 show(); 68 show();
69
70 if (!_inLoop) { 69 if (!_inLoop) {
71 _inLoop = true; 70 _inLoop = true;
72 qApp->enter_loop(); 71 qApp->enter_loop();
@@ -94,11 +93,7 @@ void Composer::slotResizing()
94{ 93{
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
104void Composer::slotPopupHandler(int itemid) 99void Composer::slotPopupHandler(int itemid)
@@ -171,15 +166,15 @@ void Composer::slotSendQueued()
171 qDebug("Sending queued messages"); 166 qDebug("Sending queued messages");
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);
185 cfg.setGroup( "Mail_" + QString::number(i) ); 180 cfg.setGroup( "Mail_" + QString::number(i) );
@@ -249,13 +244,10 @@ void Composer::slotSendQueued()
249 qDebug("Sending to %s",toAdr.latin1()); 244 qDebug("Sending to %s",toAdr.latin1());
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}
261 253
@@ -310,6 +302,14 @@ void Composer::slotSendError(const QString &error)
310 QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); 302 QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok"));
311} 303}
312 304
305void 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
313void Composer::slotSendFinished() 313void Composer::slotSendFinished()
314{ 314{
315 QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); 315 QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok"));
@@ -318,6 +318,27 @@ void Composer::slotSendFinished()
318 abort->setEnabled(false); 318 abort->setEnabled(false);
319} 319}
320 320
321void 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
321void Composer::slotFillStuff() 342void Composer::slotFillStuff()
322{ 343{
323 QValueList<Account> accounts = ConfigFile::getAccounts(); 344 QValueList<Account> accounts = ConfigFile::getAccounts();
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
@@ -42,6 +42,8 @@ protected slots:
42 void slotQueueMail(); 42 void slotQueueMail();
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();
47 void slotFromChanged(int id); 49 void slotFromChanged(int id);
@@ -54,6 +56,7 @@ protected:
54 56
55private: 57private:
56 bool _sendQueued; 58 bool _sendQueued;
59 int _toSend, _sendCount, _sendError;
57 bool _inLoop; 60 bool _inLoop;
58 QString _inReplyTo; 61 QString _inReplyTo;
59 62
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
@@ -8,6 +8,7 @@
8#include <qvbox.h> 8#include <qvbox.h>
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
13#include "listviewplus.h" 14#include "listviewplus.h"
@@ -20,21 +21,28 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
20 setToolBarsMovable(false); 21 setToolBarsMovable(false);
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);
25 29
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);
40 spacer->setBackgroundMode(QWidget::PaletteButton); 48 spacer->setBackgroundMode(QWidget::PaletteButton);
@@ -42,6 +50,7 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
42 50
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);
47 setCentralWidget(main); 56 setCentralWidget(main);
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
@@ -7,6 +7,8 @@ class QMultiLineEdit;
7class ListViewPlus; 7class ListViewPlus;
8class QPopupMenu; 8class QPopupMenu;
9class QPEToolBar; 9class QPEToolBar;
10class QPEMenuBar;
11class QPopupMenu;
10class QComboBox; 12class QComboBox;
11class QLineEdit; 13class QLineEdit;
12class QAction; 14class QAction;
@@ -39,6 +41,8 @@ protected:
39 QMainWindow *attachWindow; 41 QMainWindow *attachWindow;
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;
44 QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach; 48 QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach;
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,5 +1,6 @@
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 \
5 imapbase.h \ 6 imapbase.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,5 +1,6 @@
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 \
5 attachdiag.h \ 6 attachdiag.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
@@ -7,6 +7,7 @@
7#include <qvbox.h> 7#include <qvbox.h>
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
12#include "mainwindowbase.h" 13#include "mainwindowbase.h"
@@ -20,24 +21,35 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
20 setToolBarsMovable(false); 21 setToolBarsMovable(false);
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);
25 32
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);
43 spacer->setBackgroundMode(QWidget::PaletteButton); 55 spacer->setBackgroundMode(QWidget::PaletteButton);
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
@@ -7,6 +7,8 @@ class ServerConnection;
7class QProgressBar; 7class QProgressBar;
8class FolderWidget; 8class FolderWidget;
9class QPEToolBar; 9class QPEToolBar;
10class QPEMenuBar;
11class QPopupMenu;
10class MailTable; 12class MailTable;
11class QAction; 13class QAction;
12class QLabel; 14class QLabel;
@@ -26,6 +28,8 @@ protected:
26 QProgressBar *statusProgress; 28 QProgressBar *statusProgress;
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;
31 QLabel *statusLabel; 35 QLabel *statusLabel;