author | eilers <eilers> | 2002-12-16 15:26:35 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-16 15:26:35 (UTC) |
commit | cdf781e3243601bce6c7bcbb10f38e7a24f04887 (patch) (unidiff) | |
tree | 55f2ba11a7c6285fa09e7bebb81786cc6cc325a2 | |
parent | e555812af7b4183a9b6d276d0b9ac7f01b62eb2f (diff) | |
download | opie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.zip opie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.tar.gz opie-cdf781e3243601bce6c7bcbb10f38e7a24f04887.tar.bz2 |
Addressbook is now able to send mails through opie-mail..
-rw-r--r-- | noncore/unsupported/mail2/mainwindow.cpp | 44 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindow.h | 6 |
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 @@ | |||
2 | #include <qaction.h> | 2 | #include <qaction.h> |
3 | #include <qpe/qcopenvelope_qws.h> | ||
3 | 4 | ||
@@ -12,2 +13,3 @@ | |||
12 | #include "viewmail.h" | 13 | #include "viewmail.h" |
14 | #include "mailfactory.h" | ||
13 | 15 | ||
@@ -30,3 +32,3 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) | |||
30 | 32 | ||
31 | connect(compose, SIGNAL(activated()), SLOT(slotCompose())); | 33 | connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams())); |
32 | connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); | 34 | connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); |
@@ -34,7 +36,40 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) | |||
34 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); | 36 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); |
37 | |||
38 | // Added by Stefan Eilers to allow starting by addressbook.. | ||
39 | #if !defined(QT_NO_COP) | ||
40 | QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this ); | ||
41 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | ||
42 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | ||
43 | #endif | ||
44 | } | ||
45 | |||
46 | // Added by Stefan Eilers to allow starting by addressbook.. | ||
47 | void MainWindow::appMessage(const QCString &msg, const QByteArray &data) | ||
48 | { | ||
49 | if (msg == "writeMail(QString,QString)") { | ||
50 | QDataStream stream(data,IO_ReadOnly); | ||
51 | QString name, email; | ||
52 | stream >> name >> email; | ||
53 | |||
54 | qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() ); | ||
55 | |||
56 | slotCompose( name, email ); | ||
57 | |||
58 | }else{ | ||
59 | QString str_message = msg; | ||
60 | qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() ); | ||
61 | } | ||
35 | } | 62 | } |
36 | 63 | ||
37 | void MainWindow::slotCompose() | 64 | void MainWindow::slotCompose( const QString& name, const QString& email ) |
38 | { | 65 | { |
39 | Composer composer(this, 0, true); | 66 | Composer composer(this, 0, true); |
67 | |||
68 | // If there is a mailaddress given, create message.. | ||
69 | if ( ! name.isEmpty() ){ | ||
70 | qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() ); | ||
71 | SendMail compMail; | ||
72 | compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">"); | ||
73 | composer.setSendMail( compMail ); | ||
74 | } | ||
40 | composer.showMaximized(); | 75 | composer.showMaximized(); |
@@ -43,2 +78,7 @@ void MainWindow::slotCompose() | |||
43 | 78 | ||
79 | void MainWindow::slotComposeNoParams() | ||
80 | { | ||
81 | slotCompose( 0l, 0l); | ||
82 | } | ||
83 | |||
44 | void MainWindow::slotSendQueued() | 84 | 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 @@ | |||
5 | 5 | ||
6 | #include <qstring.h> | ||
7 | |||
6 | class IMAPHandler; | 8 | class IMAPHandler; |
@@ -16,3 +18,4 @@ public: | |||
16 | protected slots: | 18 | protected slots: |
17 | void slotCompose(); | 19 | void slotCompose( const QString& name, const QString& email ); |
20 | void slotComposeNoParams(); | ||
18 | void slotSendQueued(); | 21 | void slotSendQueued(); |
@@ -21,2 +24,3 @@ protected slots: | |||
21 | void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler); | 24 | void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler); |
25 | void appMessage(const QCString &msg, const QByteArray &data); | ||
22 | 26 | ||