author | tille <tille> | 2002-06-18 23:53:27 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-18 23:53:27 (UTC) |
commit | 14881bb4baf3ac470a135bdde6ffb115c91ea124 (patch) (side-by-side diff) | |
tree | 6d088cdacd769076e64496abe6b9043168b75928 | |
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 @@ -68,3 +68,2 @@ void Composer::exec() show(); - if (!_inLoop) { @@ -96,7 +95,3 @@ void Composer::slotResizing() from->resize(width() - fromBox->width(), y()); - if (_sendQueued) - { - slotSendQueued(); - close(); - } + if (_sendQueued) slotSendQueued(); } @@ -173,11 +168,11 @@ void Composer::slotSendQueued() 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++) { @@ -251,9 +246,6 @@ void Composer::slotSendQueued() - 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) ); } @@ -312,2 +304,10 @@ 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() @@ -320,2 +320,23 @@ 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 @@ -44,2 +44,4 @@ protected slots: void slotSendFinished(); + void slotSendQueuedError(const QString &); + void slotSendQueuedFinished(); void slotResizing(); @@ -56,2 +58,3 @@ private: bool _sendQueued; + int _toSend, _sendCount, _sendError; bool _inLoop; 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 @@ -10,2 +10,3 @@ #include <qpe/qpetoolbar.h> +#include <qpe/qpemenubar.h> #include <qpe/resource.h> @@ -22,2 +23,5 @@ 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); @@ -27,2 +31,3 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) sendmail->addTo(toolbar); + sendmail->addTo(mailmenu); @@ -30,2 +35,3 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) queuemail->addTo(toolbar); + queuemail->addTo(mailmenu); @@ -33,2 +39,3 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) attachfile->addTo(toolbar); + attachfile->addTo(mailmenu); connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); @@ -37,2 +44,3 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) addressbook->addTo(toolbar); + addressbook->addTo(mailmenu); @@ -44,2 +52,3 @@ ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) abort->addTo(toolbar); + abort->addTo(mailmenu); 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 @@ -9,2 +9,4 @@ class QPopupMenu; class QPEToolBar; +class QPEMenuBar; +class QPopupMenu; class QComboBox; @@ -41,2 +43,4 @@ protected: QPEToolBar *toolbar, *attachToolbar; + QPEMenuBar *menubar; + QPopupMenu *mailmenu; QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; 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,3 +1,4 @@ TEMPLATE = lib -CONFIG = qt warn_on release +CONFIG = qt warn_on debug +#CONFIG = qt warn_on release HEADERS = configfile.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,3 +1,4 @@ TEMPLATE = app -CONFIG = qt warn_on release +CONFIG = qt warn_on debug +#CONFIG = qt warn_on release HEADERS = accounteditor.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 @@ -9,2 +9,3 @@ #include <qpe/qpetoolbar.h> +#include <qpe/qpemenubar.h> #include <qpe/resource.h> @@ -22,2 +23,8 @@ 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); @@ -27,2 +34,3 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) compose->addTo(toolbar); + compose->addTo(mailmenu); @@ -30,2 +38,3 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) sendQueue->addTo(toolbar); + sendQueue->addTo(mailmenu); @@ -33,2 +42,3 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) folders->addTo(toolbar); + folders->addTo(servermenu); connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); @@ -37,2 +47,3 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) findmails->addTo(toolbar); + findmails->addTo(mailmenu); @@ -40,2 +51,3 @@ MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) configure->addTo(toolbar); + configure->addTo(servermenu); 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 @@ -9,2 +9,4 @@ class FolderWidget; class QPEToolBar; +class QPEMenuBar; +class QPopupMenu; class MailTable; @@ -28,2 +30,4 @@ protected: QPEToolBar *toolbar; + QPEMenuBar *menubar; + QPopupMenu *mailmenu, *servermenu; MailTable *mailView; |