summaryrefslogtreecommitdiff
Unidiff
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,74 +1,114 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qaction.h> 2#include <qaction.h>
3#include <qpe/qcopenvelope_qws.h>
3 4
4#include "mailstatusbar.h" 5#include "mailstatusbar.h"
5#include "folderwidget.h" 6#include "folderwidget.h"
6#include "mainwindow.h" 7#include "mainwindow.h"
7#include "configdiag.h" 8#include "configdiag.h"
8#include "configfile.h" 9#include "configfile.h"
9#include "searchdiag.h" 10#include "searchdiag.h"
10#include "mailtable.h" 11#include "mailtable.h"
11#include "composer.h" 12#include "composer.h"
12#include "viewmail.h" 13#include "viewmail.h"
14#include "mailfactory.h"
13 15
14MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) 16MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
15 : MainWindowBase(parent, name, fl) 17 : MainWindowBase(parent, name, fl)
16{ 18{
17 status->setStopEnabled(false); 19 status->setStopEnabled(false);
18 20
19 connect(folderView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 21 connect(folderView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &)));
20 connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); 22 connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder)));
21 23
22 connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); 24 connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *)));
23 connect(mailView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 25 connect(mailView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &)));
24 connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int))); 26 connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int)));
25 connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int))); 27 connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int)));
26 connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress())); 28 connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress()));
27 connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool))); 29 connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool)));
28 30
29 connect(status, SIGNAL(stop()), mailView, SLOT(stop())); 31 connect(status, SIGNAL(stop()), mailView, SLOT(stop()));
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()));
33 connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); 35 connect(findmails, SIGNAL(activated()), SLOT(slotSearch()));
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..
47void 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
37void MainWindow::slotCompose() 64void 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();
41 composer.exec(); 76 composer.exec();
42} 77}
43 78
79void MainWindow::slotComposeNoParams()
80{
81 slotCompose( 0l, 0l);
82}
83
44void MainWindow::slotSendQueued() 84void MainWindow::slotSendQueued()
45{ 85{
46 Composer composer(this, 0, true, true); 86 Composer composer(this, 0, true, true);
47 // composer.sendQueue(); 87 // composer.sendQueue();
48 composer.showMaximized(); 88 composer.showMaximized();
49 composer.exec(); 89 composer.exec();
50 //composer.close(); 90 //composer.close();
51} 91}
52 92
53void MainWindow::slotSearch() 93void MainWindow::slotSearch()
54{ 94{
55 SearchDiag searchDiag(this, 0, true); 95 SearchDiag searchDiag(this, 0, true);
56 searchDiag.showMaximized(); 96 searchDiag.showMaximized();
57 searchDiag.exec(); 97 searchDiag.exec();
58} 98}
59 99
60void MainWindow::slotConfigure() 100void MainWindow::slotConfigure()
61{ 101{
62 ConfigDiag configDiag(this, 0, true); 102 ConfigDiag configDiag(this, 0, true);
63 configDiag.showMaximized(); 103 configDiag.showMaximized();
64 configDiag.exec(); 104 configDiag.exec();
65 105
66 connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); 106 connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update()));
67} 107}
68 108
69void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler) 109void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler)
70{ 110{
71 ViewMail viewMail(mail, handler, this, 0, true); 111 ViewMail viewMail(mail, handler, this, 0, true);
72 viewMail.showMaximized(); 112 viewMail.showMaximized();
73 viewMail.exec(); 113 viewMail.exec();
74} 114}
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 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include "mainwindowbase.h" 4#include "mainwindowbase.h"
5 5
6#include <qstring.h>
7
6class IMAPHandler; 8class IMAPHandler;
7class IMAPResponseFETCH; 9class IMAPResponseFETCH;
8 10
9class MainWindow : public MainWindowBase 11class MainWindow : public MainWindowBase
10{ 12{
11 Q_OBJECT 13 Q_OBJECT
12 14
13public: 15public:
14 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 16 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
15 17
16protected slots: 18protected slots:
17 void slotCompose(); 19 void slotCompose( const QString& name, const QString& email );
20 void slotComposeNoParams();
18 void slotSendQueued(); 21 void slotSendQueued();
19 void slotSearch(); 22 void slotSearch();
20 void slotConfigure(); 23 void slotConfigure();
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
23}; 27};
24 28
25#endif 29#endif