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
@@ -65,9 +65,8 @@ void Composer::hide()
void Composer::exec()
{
show();
-
if (!_inLoop) {
_inLoop = true;
qApp->enter_loop();
}
@@ -93,13 +92,9 @@ void Composer::setSendMail(SendMail &sendMail)
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)
{
@@ -170,17 +165,17 @@ 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) );
SendMail smail;
@@ -248,15 +243,12 @@ 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) );
}
}
void Composer::slotQueueMail()
@@ -309,16 +301,45 @@ void Composer::slotSendError(const QString &error)
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::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"));
status->setText(QString(0));
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();
int i = 0;
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
@@ -41,8 +41,10 @@ protected slots:
void slotSendMail();
void slotQueueMail();
void slotSendError(const QString &);
void slotSendFinished();
+ void slotSendQueuedError(const QString &);
+ void slotSendQueuedFinished();
void slotResizing();
void slotFillStuff();
void slotFromChanged(int id);
void slotOpenAddressPicker();
@@ -53,8 +55,9 @@ protected:
QValueList<Account> accountsLoaded;
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
@@ -7,8 +7,9 @@
#include <qlabel.h>
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "listviewplus.h"
#include "composerbase.h"
@@ -19,30 +20,38 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
setCaption(tr("Compose Message"));
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);
toolbar->setStretchableWidget(spacer);
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
@@ -6,8 +6,10 @@
class QMultiLineEdit;
class ListViewPlus;
class QPopupMenu;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class QComboBox;
class QLineEdit;
class QAction;
class QLabel;
@@ -38,8 +40,10 @@ protected:
ListViewPlus *attachView;
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;
QLabel *fromLabel, *status;
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,6 +1,7 @@
TEMPLATE = lib
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = configfile.h \
defines.h \
imapbase.h \
imaphandler.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,6 +1,7 @@
TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = accounteditor.h \
addresspicker.h \
attachdiag.h \
composer.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
@@ -6,8 +6,9 @@
#include <qlabel.h>
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "mainwindowbase.h"
#include "folderwidget.h"
@@ -19,26 +20,37 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
setCaption(tr("E-Mail"));
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);
toolbar->setStretchableWidget(spacer);
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
@@ -6,8 +6,10 @@
class ServerConnection;
class QProgressBar;
class FolderWidget;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class MailTable;
class QAction;
class QLabel;
@@ -25,8 +27,10 @@ protected:
ServerConnection *serverConnection;
QProgressBar *statusProgress;
FolderWidget *folderView;
QPEToolBar *toolbar;
+ QPEMenuBar *menubar;
+ QPopupMenu *mailmenu, *servermenu;
MailTable *mailView;
QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop;
QLabel *statusLabel;