-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 @@ -21,348 +21,369 @@ AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) : QListViewItem(parent), _attachment(attachment) { setPixmap(0, _attachment.docLnk().pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk().pixmap()); setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); setText(1, _attachment.description()); } Composer::Composer(QWidget *parent, const char *name, WFlags fl, bool sendQueue) : ComposerBase(parent, name, fl), _inLoop(false) { _sendQueued = sendQueue; abort->setEnabled(false); to->setFocus(); connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); connect(queuemail, SIGNAL(activated()), SLOT(slotQueueMail())); connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); QTimer::singleShot(0, this, SLOT(slotFillStuff())); QTimer::singleShot(0, this, SLOT(slotResizing())); } Composer::~Composer() { hide(); } void Composer::hide() { QWidget::hide(); if (_inLoop) { _inLoop = false; qApp->exit_loop(); } } void Composer::exec() { show(); - if (!_inLoop) { _inLoop = true; qApp->enter_loop(); } } void Composer::setSendMail(SendMail &sendMail) { to->setText(sendMail.to()); cc->setText(sendMail.cc()); bcc->setText(sendMail.bcc()); subject->setText(sendMail.subject()); message->setText(sendMail.message()); _inReplyTo = sendMail.inReplyTo(); QValueList<Attachment> attachments = sendMail.attachments(); QValueList<Attachment>::Iterator it; for (it = attachments.begin(); it != attachments.end(); it++) { (void) new AttachViewItem(attachView, *it); if (attachView->isHidden()) attachView->show(); } } 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) { if (attachView->currentItem() == NULL) { QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); return; } if (itemid == POPUP_ATTACH_RENAME) { QString tmp = Rename::rename(attachView->currentItem()->text(0), this); if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); } else if (itemid == POPUP_ATTACH_DESC) { QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); } else if (itemid == POPUP_ATTACH_REMOVE) { attachView->takeItem(attachView->currentItem()); } } void Composer::slotSendMail() { if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); return; } SendMail smail; smail.setFrom(from->currentText()); smail.setReplyTo(replyto->text()); smail.setTo(to->text()); smail.setCc(cc->text()); smail.setBcc(bcc->text()); smail.setSubject(subject->text()); smail.setMessage(message->text()); smail.setNeedsMime(attachView->childCount() == 0 ? false : true); smail.setAccount(accountsLoaded[from->currentItem()]); if (priority->currentItem() == POPUP_PRIO_LOW) { smail.setPriority("Low"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { smail.setPriority("Normal"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_HIGH) { smail.setPriority("High"); // No i18n on purpose } QValueList<Attachment> attachments; QListViewItem *item; for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { attachments.append(((AttachViewItem *)item)->attachment()); } smail.setAttachments(attachments); QString header, message; MailFactory::genMail(header, message, smail, this); if (header.isNull() || message.isNull()) return; // Aborted. abort->setEnabled(true); SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); } 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; str = cfg.readEntry("from"); qDebug("setFrom %s",str.latin1()); smail.setFrom( str ); str = cfg.readEntry("reply"); qDebug("setReplyTo %s",str.latin1()); smail.setReplyTo( str ); QString toAdr = cfg.readEntry("to"); qDebug("to %s",toAdr.latin1()); smail.setTo( toAdr ); //to->text()); str = cfg.readEntry("cc"); qDebug("setCc %s",str.latin1()); smail.setCc( str ); //cc->text()); smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); str = cfg.readEntry("subject"); qDebug("setSubject %s",str.latin1()); smail.setSubject( str ); //subject->text()); str = cfg.readEntryCrypt("message"); qDebug("setMessage %s",str.latin1()); smail.setMessage( str ); //message->text()); smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); qDebug("setting account [%i]",cfg.readNumEntry("account")); Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); int prio = cfg.readNumEntry( "priority" ); qDebug("setting priority %i",prio); if (prio == POPUP_PRIO_LOW) { smail.setPriority("Low"); // No i18n on purpose } else if (prio == POPUP_PRIO_NORMAL) { smail.setPriority("Normal"); // No i18n on purpose } else if (prio == POPUP_PRIO_HIGH) { smail.setPriority("High"); // No i18n on purpose } QValueList<Attachment> attachments; Attachment a; QString an; int ac = cfg.readNumEntry( "attachments", 0 ); qDebug("%i Attachments",ac); for (int j = 0; i < ac; ac++) { an = "Attachment_" + QString::number( j ); qDebug(an.latin1()); a.setFileName(cfg.readEntry( an + "fileName" )); a.setNewName(cfg.readEntry( an + "newName" )); a.setDescription(cfg.readEntry( an + "description" )); a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); attachments.append( a ); } smail.setAttachments(attachments); qDebug("putting mail together"); QString header, message; MailFactory::genMail(header, message, smail, this); if (header.isNull() || message.isNull()) continue;//return; // Aborted. // abort->setEnabled(true); 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() { if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); return; } Config cfg( "mailqueue", Config::User ); cfg.setGroup( "Settings" ); int count = cfg.readNumEntry( "count", 0 ); count++; cfg.writeEntry( "count", count ); qDebug("queueing mail %i",count); cfg.setGroup( "Mail_" + QString::number( count )); cfg.writeEntry( "from", from->currentText() ); cfg.writeEntry( "reply", replyto->text()); cfg.writeEntry( "to", to->text()); cfg.writeEntry( "cc", cc->text()); cfg.writeEntry( "bcc", bcc->text()); cfg.writeEntry( "subject", subject->text()); cfg.writeEntryCrypt( "message", message->text()); cfg.writeEntry( "mime", attachView->childCount() == 0 ); cfg.writeEntry( "account", from->currentItem()); cfg.writeEntry( "priority", priority->currentItem() ); cfg.writeEntry( "attachments", attachView->childCount() ); Attachment a; QListViewItem *item; QString an; int i = 0; for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { a = ((AttachViewItem *)item)->attachment(); an = "Attachment_" + QString::number( i++ ); cfg.writeEntry( an + "fileName", a.fileName() ); cfg.writeEntry( an + "newName", a.newName() ); cfg.writeEntry( an + "description", a.description() ); cfg.writeEntry( an + "docLnk", a.docLnk().file() ); } QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok")); } 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; QValueList<Account>::Iterator it; for (it = accounts.begin(); it != accounts.end(); it++) { if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { if (!(*it).realName().isEmpty()) from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); else from->insertItem((*it).email()); accountsLoaded.append(*it); i++; } } } void Composer::slotFromChanged(int id) { Account account = accountsLoaded[id]; if (account.defaultCc()) cc->setText(account.cc()); if (account.defaultBcc()) bcc->setText(account.bcc()); if (account.defaultReplyTo()) replyto->setText(account.replyTo()); if (!account.signature().isEmpty()) message->setText(message->text() + "\n\n-- \n" + account.signature()); } void Composer::slotOpenAddressPicker() { if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) { if (to->text().isEmpty()) { to->setText(AddressPicker::getNames()); } else { to->setText(to->text() + ", " + AddressPicker::getNames()); } } else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) { if (cc->text().isEmpty()) { cc->setText(AddressPicker::getNames()); } else { cc->setText(cc->text() + ", " + AddressPicker::getNames()); } } else if (to->isHidden() && cc->isHidden() && !bcc->isHidden()) { if (bcc->text().isEmpty()) { bcc->setText(AddressPicker::getNames()); } else { 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 @@ -1,62 +1,65 @@ #ifndef COMPOSER_H #define COMPOSER_H #include <qlistview.h> #include <qpe/applnk.h> #include "mailfactory.h" #include "composerbase.h" #include "configfile.h" class AttachViewItem : public QListViewItem { public: AttachViewItem(QListView *parent, Attachment &attachment); Attachment attachment() { return _attachment; } private: Attachment _attachment; }; class Composer : public ComposerBase { Q_OBJECT public: Composer(QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal, bool sendQueue = false); ~Composer(); void hide(); void exec(); void setSendMail(SendMail &sendMail); public slots: void slotSendQueued(); protected slots: void slotPopupHandler(int itemid); 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(); void slotAddAttach(); void slotDelAttach(); protected: QValueList<Account> accountsLoaded; private: bool _sendQueued; + int _toSend, _sendCount, _sendError; bool _inLoop; QString _inReplyTo; }; #endif 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 @@ -1,92 +1,101 @@ #include <qmultilineedit.h> #include <qpopupmenu.h> #include <qcombobox.h> #include <qlineedit.h> #include <qlayout.h> #include <qaction.h> #include <qlabel.h> #include <qvbox.h> #include <qpe/qpetoolbar.h> +#include <qpe/qpemenubar.h> #include <qpe/resource.h> #include "listviewplus.h" #include "composerbase.h" ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, 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); QGridLayout *layout = new QGridLayout(main); fromBox = new QComboBox(main); fromBox->insertItem(tr("From"), POPUP_FROM_FROM); fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO); layout->addWidget(fromBox, 0, 0); connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int))); QHBoxLayout *fromLayout = new QHBoxLayout(); layout->addLayout(fromLayout, 0, 1); from = new QComboBox(main); fromLayout->addWidget(from); replyto = new QLineEdit(main); replyto->hide(); fromLayout->addWidget(replyto); receiversBox = new QComboBox(main); receiversBox->insertItem(tr("To"), POPUP_RECV_TO); receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC); receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC); layout->addWidget(receiversBox, 1, 0); connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int))); QHBoxLayout *receiverLayout = new QHBoxLayout(); layout->addLayout(receiverLayout, 1, 1); to = new QLineEdit(main); receiverLayout->addWidget(to); cc = new QLineEdit(main); cc->hide(); receiverLayout->addWidget(cc); bcc = new QLineEdit(main); bcc->hide(); receiverLayout->addWidget(bcc); subjectBox = new QComboBox(main); subjectBox->insertItem(tr("Subj."), POPUP_SUBJ_SUBJECT); subjectBox->insertItem(tr("Prio."), POPUP_SUBJ_PRIORITY); 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 @@ -1,55 +1,59 @@ #ifndef COMPOSERBASE_H #define COMPOSERBASE_H #include <qmainwindow.h> class QMultiLineEdit; class ListViewPlus; class QPopupMenu; class QPEToolBar; +class QPEMenuBar; +class QPopupMenu; class QComboBox; class QLineEdit; class QAction; class QLabel; class ComposerBase : public QMainWindow { Q_OBJECT public: ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); protected: static const int POPUP_FROM_FROM = 0; static const int POPUP_FROM_REPLYTO = 1; static const int POPUP_RECV_TO = 0; static const int POPUP_RECV_CC = 1; static const int POPUP_RECV_BCC = 2; static const int POPUP_SUBJ_SUBJECT = 0; static const int POPUP_SUBJ_PRIORITY = 1; static const int POPUP_PRIO_LOW = 0; static const int POPUP_PRIO_NORMAL = 1; static const int POPUP_PRIO_HIGH = 2; static const int POPUP_ATTACH_RENAME = 0; static const int POPUP_ATTACH_DESC = 1; static const int POPUP_ATTACH_REMOVE = 2; QMultiLineEdit *message; 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; protected slots: void slotAttachfileChanged(bool toggled); void slotFromMenuChanged(int id); void slotReceiverMenuChanged(int id); void slotSubjectMenuChanged(int id); }; #endif 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,26 +1,27 @@ 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 \ imapresponse.h \ mailfactory.h \ md5.cpp \ miscfunctions.h \ sharp_char.h \ smtphandler.h \ zaurusstuff.h SOURCES = configfile.cpp \ imapbase.cpp \ imaphandler.cpp \ imapresponse.cpp \ mailfactory.cpp \ md5.h \ miscfunctions.cpp \ smtphandler.cpp \ zaurusstuff.cpp INCLUDEPATH += $(OPIEDIR)/include LIBS += -L$(OPIEDIR)/lib -lqpe TARGET = mail DESTDIR = $(QTDIR)/lib 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,45 +1,46 @@ 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 \ composerbase.h \ configdiag.h \ folderwidget.h \ listviewplus.h \ mailtable.h \ mainwindow.h \ mainwindowbase.h \ opendiag.h \ rename.h \ searchdiag.h \ viewmail.h \ viewmailbase.h SOURCES = accounteditor.cpp \ addresspicker.cpp \ attachdiag.cpp \ composer.cpp \ composerbase.cpp \ configdiag.cpp \ folderwidget.cpp \ listviewplus.cpp \ mailtable.cpp \ main.cpp \ mainwindow.cpp \ mainwindowbase.cpp \ opendiag.cpp \ rename.cpp \ searchdiag.cpp \ viewmail.cpp \ viewmailbase.cpp INTERFACES = accounteditorbase.ui \ addresspickerbase.ui \ configdiagbase.ui \ opendiagbase.ui \ renamebase.ui \ searchdiagbase.ui INCLUDEPATH += $(OPIEDIR)/include libmail LIBS += -lmail -lqpe TARGET = mail DESTDIR = $(OPIEDIR)/bin 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 @@ -1,78 +1,90 @@ #include <qprogressbar.h> #include <qtoolbutton.h> #include <qpopupmenu.h> #include <qaction.h> #include <qheader.h> #include <qlabel.h> #include <qvbox.h> #include <qpe/qpetoolbar.h> +#include <qpe/qpemenubar.h> #include <qpe/resource.h> #include "mainwindowbase.h" #include "folderwidget.h" #include "mailtable.h" MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, 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); stop = new QAction(tr("Abort"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); stop->addTo(toolbar); QVBox *view = new QVBox(this); setCentralWidget(view); folderView = new FolderWidget(view); folderView->setMinimumHeight(90); folderView->setMaximumHeight(90); folderView->hide(); mailView = new MailTable(view); mailView->setMinimumHeight(50); QHBox *status = new QHBox(view); statusLabel = new QLabel(status); QFont tmpFont = statusLabel->font(); tmpFont.setPixelSize(8); statusLabel->setFont(tmpFont); statusProgress = new QProgressBar(status); statusProgress->setCenterIndicator(true); statusProgress->setMaximumHeight(15); statusProgress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); } void MainWindowBase::slotFoldersToggled(bool toggled) { if (folderView->isHidden() && toggled) folderView->show(); if (!folderView->isHidden() && !toggled) folderView->hide(); } 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 @@ -1,35 +1,39 @@ #ifndef MAINWINDOWBASE_H #define MAINWINDOWBASE_H #include <qmainwindow.h> class ServerConnection; class QProgressBar; class FolderWidget; class QPEToolBar; +class QPEMenuBar; +class QPopupMenu; class MailTable; class QAction; class QLabel; class MainWindowBase : public QMainWindow { Q_OBJECT public: MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); protected slots: void slotFoldersToggled(bool toggled); 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; }; #endif |