summaryrefslogtreecommitdiff
authoreilers <eilers>2002-12-16 15:26:35 (UTC)
committer eilers <eilers>2002-12-16 15:26:35 (UTC)
commitcdf781e3243601bce6c7bcbb10f38e7a24f04887 (patch) (side-by-side diff)
tree55f2ba11a7c6285fa09e7bebb81786cc6cc325a2
parente555812af7b4183a9b6d276d0b9ac7f01b62eb2f (diff)
downloadopie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.zip
opie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.tar.gz
opie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.tar.bz2
Addressbook is now able to send mails through opie-mail..
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
@@ -1,18 +1,20 @@
#include <qmessagebox.h>
#include <qaction.h>
+#include <qpe/qcopenvelope_qws.h>
#include "mailstatusbar.h"
#include "folderwidget.h"
#include "mainwindow.h"
#include "configdiag.h"
#include "configfile.h"
#include "searchdiag.h"
#include "mailtable.h"
#include "composer.h"
#include "viewmail.h"
+#include "mailfactory.h"
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
: MainWindowBase(parent, name, fl)
{
status->setStopEnabled(false);
@@ -25,25 +27,63 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int)));
connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress()));
connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool)));
connect(status, SIGNAL(stop()), mailView, SLOT(stop()));
- connect(compose, SIGNAL(activated()), SLOT(slotCompose()));
+ connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams()));
connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued()));
connect(findmails, SIGNAL(activated()), SLOT(slotSearch()));
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();
composer.exec();
}
+void MainWindow::slotComposeNoParams()
+{
+ slotCompose( 0l, 0l);
+}
+
void MainWindow::slotSendQueued()
{
Composer composer(this, 0, true, true);
// composer.sendQueue();
composer.showMaximized();
composer.exec();
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
@@ -1,25 +1,29 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "mainwindowbase.h"
+#include <qstring.h>
+
class IMAPHandler;
class IMAPResponseFETCH;
class MainWindow : public MainWindowBase
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
protected slots:
- void slotCompose();
+ void slotCompose( const QString& name, const QString& email );
+ void slotComposeNoParams();
void slotSendQueued();
void slotSearch();
void slotConfigure();
void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler);
+ void appMessage(const QCString &msg, const QByteArray &data);
};
#endif