summaryrefslogtreecommitdiff
authortille <tille>2002-06-18 23:53:27 (UTC)
committer tille <tille>2002-06-18 23:53:27 (UTC)
commit14881bb4baf3ac470a135bdde6ffb115c91ea124 (patch) (side-by-side diff)
tree6d088cdacd769076e64496abe6b9043168b75928
parentf2ecc05c1156ae0f99ea0528646609d63eaa84c0 (diff)
downloadopie-14881bb4baf3ac470a135bdde6ffb115c91ea124.zip
opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.gz
opie-14881bb4baf3ac470a135bdde6ffb115c91ea124.tar.bz2
added menu and fix send queued
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
@@ -67,5 +67,4 @@ void Composer::exec()
{
show();
-
if (!_inLoop) {
_inLoop = true;
@@ -95,9 +94,5 @@ void Composer::slotResizing()
from->setMaximumWidth(width() - fromBox->width());
from->resize(width() - fromBox->width(), y());
- if (_sendQueued)
- {
- slotSendQueued();
- close();
- }
+ if (_sendQueued) slotSendQueued();
}
@@ -172,13 +167,13 @@ void Composer::slotSendQueued()
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);
@@ -250,11 +245,8 @@ void Composer::slotSendQueued()
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) );
}
}
@@ -311,4 +303,12 @@ void Composer::slotSendError(const QString &error)
}
+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()
{
@@ -319,4 +319,25 @@ void Composer::slotSendFinished()
}
+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()
{
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:
void slotSendError(const QString &);
void slotSendFinished();
+ void slotSendQueuedError(const QString &);
+ void slotSendQueuedFinished();
void slotResizing();
void slotFillStuff();
@@ -55,4 +57,5 @@ 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
@@ -9,4 +9,5 @@
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
@@ -21,4 +22,7 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
toolbar = new QPEToolBar(this);
+ menubar = new QPEMenuBar( toolbar );
+ mailmenu = new QPopupMenu( menubar );
+ menubar->insertItem( tr( "Mail" ), mailmenu );
addToolBar(toolbar);
toolbar->setHorizontalStretchable(true);
@@ -26,14 +30,18 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
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);
@@ -43,4 +51,5 @@ 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);
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;
class QPopupMenu;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class QComboBox;
class QLineEdit;
@@ -40,4 +42,6 @@ protected:
QPopupMenu *attachPopup;
QPEToolBar *toolbar, *attachToolbar;
+ QPEMenuBar *menubar;
+ QPopupMenu *mailmenu;
QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority;
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 @@
TEMPLATE = lib
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = configfile.h \
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 @@
TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
HEADERS = accounteditor.h \
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 @@
#include <qpe/qpetoolbar.h>
+#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
@@ -21,4 +22,10 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
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);
@@ -26,17 +33,22 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
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);
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;
class FolderWidget;
class QPEToolBar;
+class QPEMenuBar;
+class QPopupMenu;
class MailTable;
class QAction;
@@ -27,4 +29,6 @@ protected:
FolderWidget *folderView;
QPEToolBar *toolbar;
+ QPEMenuBar *menubar;
+ QPopupMenu *mailmenu, *servermenu;
MailTable *mailView;
QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop;