summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 2f87e44..b153292 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,114 +1,126 @@
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
#include "selectsmtp.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
/* QT */
/* UNIX */
#include <signal.h>
using namespace Opie::Core;
-OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
+OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
: MainWindow( parent, name, WStyle_ContextHelp )
{
setup_signalblocking();
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
}
void OpieMail::setup_signalblocking()
{
/* for networking we must block SIGPIPE and Co. */
struct sigaction blocking_action,temp_action;
blocking_action.sa_handler = SIG_IGN;
sigemptyset(&(blocking_action.sa_mask));
blocking_action.sa_flags = 0;
sigaction(SIGPIPE,&blocking_action,&temp_action);
}
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()")
{
slotComposeMail();
}
}
+/**
+ * Konqueror calls us with the mailto:name@address
+ */
+void OpieMail::setDocument(const QString& mail)
+{
+ /*
+ * It looks like a mailto address, lets try it
+ */
+ if( mail.startsWith(QString::fromLatin1("mailto:")) )
+ slotwriteMail(QString::null, mail.mid(7));
+}
+
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
QPEApplication::execDialog( &compose );
}
void OpieMail::slotComposeMail()
{
odebug << "Compose Mail" << oendl;
slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
odebug << "Send Queued" << oendl;
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
return;
}
if (smtpList.count()==1)
{