summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-24 02:56:27 (UTC)
committer alwin <alwin>2003-12-24 02:56:27 (UTC)
commitff20f6d33cffd84222029df9f118a9e5db5ec3e5 (patch) (side-by-side diff)
tree5617a3d099c2ced644a05cbd94956ba851f68f95
parentfa581423c0ffcf35cbc403645e2131e84342dae4 (diff)
downloadopie-ff20f6d33cffd84222029df9f118a9e5db5ec3e5.zip
opie-ff20f6d33cffd84222029df9f118a9e5db5ec3e5.tar.gz
opie-ff20f6d33cffd84222029df9f118a9e5db5ec3e5.tar.bz2
setup interface for qcop signal "newMail()"
TODO: setup composer to get a recipient address for calling from addressbook!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp24
-rw-r--r--noncore/net/mail/opiemail.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 9257866..833cac2 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,42 +1,66 @@
#include <qmessagebox.h>
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "smtpwrapper.h"
+#include <qpe/qcopenvelope_qws.h>
+#include <qaction.h>
+#include <qapplication.h>
OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
: MainWindow( parent, name, flags )
{
settings = new Settings();
folderView->populate( settings->getAccounts() );
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
+ // Added by Stefan Eilers to allow starting by addressbook..
+ // copied from old mail2
+#if !defined(QT_NO_COP)
+ connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
+ this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
+#endif
+}
+
+void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
+{
+ // copied from old mail2
+ // TODO: compose mail should get parameters of a recipient for starting
+ // from addressbook. (qcop signal "writeMail(string,string)")
+ if (msg == "writeMail(QString,QString)") {
+ QDataStream stream(data,IO_ReadOnly);
+ QString name, email;
+ stream >> name >> email;
+ slotComposeMail();
+ } else if (msg == "newMail()") {
+ slotComposeMail();
+ }
}
void OpieMail::slotComposeMail()
{
qDebug( "Compose Mail" );
ComposeMail compose( settings, this, 0 , true );
compose.showMaximized();
compose.slotAdjustColumns();
compose.exec();
}
void OpieMail::slotSendQueued()
{
qDebug( "Send Queued" );
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
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;
}
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index ba60297..3cf5972 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -1,27 +1,28 @@
#ifndef OPIEMAIL_H
#define OPIEMAIL_H
#include "mainwindow.h"
#include "settings.h"
class OpieMail : public MainWindow
{
Q_OBJECT
public:
OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
static QString appName() { return QString::fromLatin1("opiemail"); }
public slots:
void slotComposeMail();
+ void appMessage(const QCString &msg, const QByteArray &data);
protected slots:
void slotSendQueued();
void slotSearchMails();
void slotEditSettings();
void slotEditAccounts();
private:
Settings *settings;
};
#endif