summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore 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()
void Composer::exec()
{
show();
-
if (!_inLoop) {
_inLoop = true;
qApp->enter_loop();
@@ -94,11 +93,7 @@ void Composer::slotResizing()
{
from->setMaximumWidth(width() - fromBox->width());
from->resize(width() - fromBox->width(), y());
- if (_sendQueued)
- {
- slotSendQueued();
- close();
- }
+ if (_sendQueued) slotSendQueued();
}
void Composer::slotPopupHandler(int itemid)
@@ -171,15 +166,15 @@ void Composer::slotSendQueued()
qDebug("Sending queued messages");
Config cfg( "mailqueue", Config::User );
cfg.setGroup( "Settings" );
- int count = cfg.readNumEntry( "count", 0 );
- // tille: should not be here
- // but no error checking for the moment
- cfg.writeEntry( "count", 0 );
+ _sendCount = 0;
+ _sendError = 0;
+ _toSend = cfg.readNumEntry( "count", 0 );
+ if (_toSend == 0) close();
- qDebug("%i messages to send", count);
+ qDebug("%i messages to send", _toSend);
QString str;
- for (int i=1;i<=count;i++)
+ for (int i=1;i<=_toSend;i++)
{
qDebug("sending message %i",i);
cfg.setGroup( "Mail_" + QString::number(i) );
@@ -249,13 +244,10 @@ void Composer::slotSendQueued()
qDebug("Sending to %s",toAdr.latin1());
SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr);
- connect(handler, SIGNAL(finished()), SLOT(slotSendFinished()));
- connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &)));
+ connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished()));
+ connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &)));
connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &)));
- qDebug("remove mail %i", i);
- cfg.clearGroup();
- cfg.removeEntry( "Mail_" + QString::number(i) );
}
}
@@ -310,6 +302,14 @@ void Composer::slotSendError(const QString &error)
QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok"));
}
+void Composer::slotSendQueuedError(const QString &error)
+{
+ _sendError++;
+ qDebug("error send mail %i",_sendCount);
+ status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>"));
+ QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok"));
+}
+
void Composer::slotSendFinished()
{
QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok"));
@@ -318,6 +318,27 @@ void Composer::slotSendFinished()
abort->setEnabled(false);
}
+void Composer::slotSendQueuedFinished()
+{
+
+ _sendCount++;
+ qDebug("finished send mail %i of %i (error %i)",_sendCount,_toSend,_sendError);
+ if (_sendCount < _toSend) return;
+ if (_sendError == _toSend) close();
+ 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"));
+ Config cfg( "mailqueue", Config::User );
+ cfg.setGroup( "Settings" );
+ cfg.writeEntry( "count", 0 );
+ for (int i=1;i<=_sendCount;i++)
+ {
+ cfg.setGroup( "Mail_" + QString::number(i) );
+ qDebug("remove mail %i", i);
+ cfg.clearGroup();
+ cfg.removeEntry( "Mail_" + QString::number(i) );
+ }
+ close();
+}
+
void Composer::slotFillStuff()
{
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:
void slotQueueMail();
void slotSendError(const QString &);
void slotSendFinished();
+ void slotSendQueuedError(const QString &);
+ void slotSendQueuedFinished();
void slotResizing();
void slotFillStuff();
void slotFromChanged(int id);
@@ -54,6 +56,7 @@ protected:
private:
bool _sendQueued;
+ int _toSend, _sendCount, _sendError;
bool _inLoop;
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
@@ -8,6 +8,7 @@
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "listviewplus.h"
@@ -20,21 +21,28 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
setToolBarsMovable(false);
toolbar = new QPEToolBar(this);
+ menubar = new QPEMenuBar( toolbar );
+ mailmenu = new QPopupMenu( menubar );
+ menubar->insertItem( tr( "Mail" ), mailmenu );
addToolBar(toolbar);
toolbar->setHorizontalStretchable(true);
sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this);
sendmail->addTo(toolbar);
+ sendmail->addTo(mailmenu);
queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this);
queuemail->addTo(toolbar);
+ queuemail->addTo(mailmenu);
attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
attachfile->addTo(toolbar);
+ attachfile->addTo(mailmenu);
connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool)));
addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this);
addressbook->addTo(toolbar);
+ addressbook->addTo(mailmenu);
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
@@ -42,6 +50,7 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this);
abort->addTo(toolbar);
+ abort->addTo(mailmenu);
QWidget *main = new QWidget(this);
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;
class ListViewPlus;
class QPopupMenu;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class QComboBox;
class QLineEdit;
class QAction;
@@ -39,6 +41,8 @@ protected:
QMainWindow *attachWindow;
QPopupMenu *attachPopup;
QPEToolBar *toolbar, *attachToolbar;
+ QPEMenuBar *menubar;
+ QPopupMenu *mailmenu;
QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority;
QLineEdit *replyto, *to, *cc, *bcc, *subject;
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 @@
TEMPLATE = lib
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = configfile.h \
defines.h \
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 @@
TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = accounteditor.h \
addresspicker.h \
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 @@
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "mainwindowbase.h"
@@ -20,24 +21,35 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
setToolBarsMovable(false);
toolbar = new QPEToolBar(this);
+ menubar = new QPEMenuBar( toolbar );
+ mailmenu = new QPopupMenu( menubar );
+ servermenu = new QPopupMenu( menubar );
+ menubar->insertItem( tr( "Mail" ), mailmenu );
+ menubar->insertItem( tr( "Servers" ), servermenu );
+
addToolBar(toolbar);
toolbar->setHorizontalStretchable(true);
compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this);
compose->addTo(toolbar);
+ compose->addTo(mailmenu);
sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this);
sendQueue->addTo(toolbar);
+ sendQueue->addTo(mailmenu);
folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true);
folders->addTo(toolbar);
+ folders->addTo(servermenu);
connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool)));
findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this);
findmails->addTo(toolbar);
+ findmails->addTo(mailmenu);
configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this);
configure->addTo(toolbar);
+ configure->addTo(servermenu);
QLabel *spacer = new QLabel(toolbar);
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;
class QProgressBar;
class FolderWidget;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class MailTable;
class QAction;
class QLabel;
@@ -26,6 +28,8 @@ protected:
QProgressBar *statusProgress;
FolderWidget *folderView;
QPEToolBar *toolbar;
+ QPEMenuBar *menubar;
+ QPopupMenu *mailmenu, *servermenu;
MailTable *mailView;
QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop;
QLabel *statusLabel;