summaryrefslogtreecommitdiff
path: root/noncore/net/mail/opiemail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/opiemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index d3d3cdb..ea0019d 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,39 +1,40 @@
#include <qmessagebox.h>
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
#include <qaction.h>
#include <qapplication.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
+#include "selectsmtp.h"
OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
: MainWindow( parent, name, WStyle_ContextHelp )
{
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
}
void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
{
// copied from old mail2
if (msg == "writeMail(QString,QString)") {
QDataStream stream(data,IO_ReadOnly);
QString name, email;
stream >> name >> email;
// removing the whitespaces at beginning and end is needed!
slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
} else if (msg == "newMail()") {
@@ -47,57 +48,72 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
if (!email.isEmpty()) {
if (!name.isEmpty()) {
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
} else {
compose.setTo(email);
}
}
compose.showMaximized();
compose.slotAdjustColumns();
compose.exec();
}
void OpieMail::slotComposeMail()
{
qDebug( "Compose Mail" );
slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
qDebug( "Send Queued" );
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
+ QList<SMTPaccount> smtpList;
+ smtpList.setAutoDelete(false);
Account *it;
-// if (list.count()==1) {
for ( it = list.first(); it; it = list.next() ) {
if ( it->getType().compare( "SMTP" ) == 0 ) {
smtp = static_cast<SMTPaccount *>(it);
- break;
+ smtpList.append(smtp);
+ }
+ }
+ if (smtpList.count()==0) {
+ QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
+ return;
+ }
+ if (smtpList.count()==1) {
+ smtp = smtpList.at(0);
+ } else {
+ smtp = 0;
+ selectsmtp selsmtp;
+ selsmtp.setSelectionlist(&smtpList);
+ selsmtp.showMaximized();
+ if (selsmtp.exec()==QDialog::Accepted) {
+ smtp = selsmtp.selected_smtp();
}
}
-// }
if (smtp) {
SMTPwrapper * wrap = new SMTPwrapper(settings);
if ( wrap->flushOutbox(smtp) ) {
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}
}
}
void OpieMail::slotSearchMails()
{
qDebug( "Search Mails" );
}
void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
settingsDialog.showMaximized();
settingsDialog.exec();
}
void OpieMail::slotEditAccounts()
{
qDebug( "Edit Accounts" );
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );