summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/mainwindow.cpp44
-rw-r--r--noncore/unsupported/mail2/mainwindow.h6
2 files changed, 47 insertions, 3 deletions
diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp
index 047c54b..a596653 100644
--- a/noncore/unsupported/mail2/mainwindow.cpp
+++ b/noncore/unsupported/mail2/mainwindow.cpp
@@ -2,2 +2,3 @@
#include <qaction.h>
+#include <qpe/qcopenvelope_qws.h>
@@ -12,2 +13,3 @@
#include "viewmail.h"
+#include "mailfactory.h"
@@ -30,3 +32,3 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
- connect(compose, SIGNAL(activated()), SLOT(slotCompose()));
+ connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams()));
connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued()));
@@ -34,7 +36,40 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
connect(configure, SIGNAL(activated()), SLOT(slotConfigure()));
+
+ // Added by Stefan Eilers to allow starting by addressbook..
+#if !defined(QT_NO_COP)
+ QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this );
+ connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
+ this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
+#endif
+}
+
+// Added by Stefan Eilers to allow starting by addressbook..
+void MainWindow::appMessage(const QCString &msg, const QByteArray &data)
+{
+ if (msg == "writeMail(QString,QString)") {
+ QDataStream stream(data,IO_ReadOnly);
+ QString name, email;
+ stream >> name >> email;
+
+ qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() );
+
+ slotCompose( name, email );
+
+ }else{
+ QString str_message = msg;
+ qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() );
+ }
}
-void MainWindow::slotCompose()
+void MainWindow::slotCompose( const QString& name, const QString& email )
{
Composer composer(this, 0, true);
+
+ // If there is a mailaddress given, create message..
+ if ( ! name.isEmpty() ){
+ qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() );
+ SendMail compMail;
+ compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">");
+ composer.setSendMail( compMail );
+ }
composer.showMaximized();
@@ -43,2 +78,7 @@ void MainWindow::slotCompose()
+void MainWindow::slotComposeNoParams()
+{
+ slotCompose( 0l, 0l);
+}
+
void MainWindow::slotSendQueued()
diff --git a/noncore/unsupported/mail2/mainwindow.h b/noncore/unsupported/mail2/mainwindow.h
index 27b527d..1ed0559 100644
--- a/noncore/unsupported/mail2/mainwindow.h
+++ b/noncore/unsupported/mail2/mainwindow.h
@@ -5,2 +5,4 @@
+#include <qstring.h>
+
class IMAPHandler;
@@ -16,3 +18,4 @@ public:
protected slots:
- void slotCompose();
+ void slotCompose( const QString& name, const QString& email );
+ void slotComposeNoParams();
void slotSendQueued();
@@ -21,2 +24,3 @@ protected slots:
void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler);
+ void appMessage(const QCString &msg, const QByteArray &data);