-rw-r--r-- | noncore/net/mail/opiemail.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
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,74 +1,98 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include "opiemail.h" | 2 | #include "opiemail.h" |
3 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
4 | #include "composemail.h" | 4 | #include "composemail.h" |
5 | #include "smtpwrapper.h" | 5 | #include "smtpwrapper.h" |
6 | #include <qpe/qcopenvelope_qws.h> | ||
7 | #include <qaction.h> | ||
8 | #include <qapplication.h> | ||
6 | 9 | ||
7 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 10 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
8 | : MainWindow( parent, name, flags ) | 11 | : MainWindow( parent, name, flags ) |
9 | { | 12 | { |
10 | settings = new Settings(); | 13 | settings = new Settings(); |
11 | 14 | ||
12 | folderView->populate( settings->getAccounts() ); | 15 | folderView->populate( settings->getAccounts() ); |
13 | 16 | ||
14 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 17 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
15 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 18 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
16 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 19 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
17 | connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); | 20 | connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); |
18 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 21 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
22 | // Added by Stefan Eilers to allow starting by addressbook.. | ||
23 | // copied from old mail2 | ||
24 | #if !defined(QT_NO_COP) | ||
25 | connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), | ||
26 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | ||
27 | #endif | ||
28 | } | ||
29 | |||
30 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | ||
31 | { | ||
32 | // copied from old mail2 | ||
33 | // TODO: compose mail should get parameters of a recipient for starting | ||
34 | // from addressbook. (qcop signal "writeMail(string,string)") | ||
35 | if (msg == "writeMail(QString,QString)") { | ||
36 | QDataStream stream(data,IO_ReadOnly); | ||
37 | QString name, email; | ||
38 | stream >> name >> email; | ||
39 | slotComposeMail(); | ||
40 | } else if (msg == "newMail()") { | ||
41 | slotComposeMail(); | ||
42 | } | ||
19 | } | 43 | } |
20 | 44 | ||
21 | void OpieMail::slotComposeMail() | 45 | void OpieMail::slotComposeMail() |
22 | { | 46 | { |
23 | qDebug( "Compose Mail" ); | 47 | qDebug( "Compose Mail" ); |
24 | ComposeMail compose( settings, this, 0 , true ); | 48 | ComposeMail compose( settings, this, 0 , true ); |
25 | compose.showMaximized(); | 49 | compose.showMaximized(); |
26 | compose.slotAdjustColumns(); | 50 | compose.slotAdjustColumns(); |
27 | compose.exec(); | 51 | compose.exec(); |
28 | } | 52 | } |
29 | 53 | ||
30 | void OpieMail::slotSendQueued() | 54 | void OpieMail::slotSendQueued() |
31 | { | 55 | { |
32 | qDebug( "Send Queued" ); | 56 | qDebug( "Send Queued" ); |
33 | SMTPaccount *smtp = 0; | 57 | SMTPaccount *smtp = 0; |
34 | 58 | ||
35 | QList<Account> list = settings->getAccounts(); | 59 | QList<Account> list = settings->getAccounts(); |
36 | Account *it; | 60 | Account *it; |
37 | // if (list.count()==1) { | 61 | // if (list.count()==1) { |
38 | for ( it = list.first(); it; it = list.next() ) { | 62 | for ( it = list.first(); it; it = list.next() ) { |
39 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 63 | if ( it->getType().compare( "SMTP" ) == 0 ) { |
40 | smtp = static_cast<SMTPaccount *>(it); | 64 | smtp = static_cast<SMTPaccount *>(it); |
41 | break; | 65 | break; |
42 | } | 66 | } |
43 | } | 67 | } |
44 | // } | 68 | // } |
45 | if (smtp) { | 69 | if (smtp) { |
46 | SMTPwrapper * wrap = new SMTPwrapper(settings); | 70 | SMTPwrapper * wrap = new SMTPwrapper(settings); |
47 | wrap->flushOutbox(smtp); | 71 | wrap->flushOutbox(smtp); |
48 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 72 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
49 | } | 73 | } |
50 | } | 74 | } |
51 | 75 | ||
52 | void OpieMail::slotSearchMails() | 76 | void OpieMail::slotSearchMails() |
53 | { | 77 | { |
54 | qDebug( "Search Mails" ); | 78 | qDebug( "Search Mails" ); |
55 | } | 79 | } |
56 | 80 | ||
57 | void OpieMail::slotEditSettings() | 81 | void OpieMail::slotEditSettings() |
58 | { | 82 | { |
59 | qDebug( "Edit Settings" ); | 83 | qDebug( "Edit Settings" ); |
60 | } | 84 | } |
61 | 85 | ||
62 | void OpieMail::slotEditAccounts() | 86 | void OpieMail::slotEditAccounts() |
63 | { | 87 | { |
64 | qDebug( "Edit Accounts" ); | 88 | qDebug( "Edit Accounts" ); |
65 | EditAccounts eaDialog( settings, this, 0, true ); | 89 | EditAccounts eaDialog( settings, this, 0, true ); |
66 | eaDialog.showMaximized(); | 90 | eaDialog.showMaximized(); |
67 | eaDialog.slotAdjustColumns(); | 91 | eaDialog.slotAdjustColumns(); |
68 | eaDialog.exec(); | 92 | eaDialog.exec(); |
69 | if ( settings ) delete settings; | 93 | if ( settings ) delete settings; |
70 | settings = new Settings(); | 94 | settings = new Settings(); |
71 | 95 | ||
72 | folderView->populate( settings->getAccounts() ); | 96 | folderView->populate( settings->getAccounts() ); |
73 | } | 97 | } |
74 | 98 | ||
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 @@ | |||
1 | #ifndef OPIEMAIL_H | 1 | #ifndef OPIEMAIL_H |
2 | #define OPIEMAIL_H | 2 | #define OPIEMAIL_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include "settings.h" | 5 | #include "settings.h" |
6 | 6 | ||
7 | class OpieMail : public MainWindow | 7 | class OpieMail : public MainWindow |
8 | { | 8 | { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
13 | static QString appName() { return QString::fromLatin1("opiemail"); } | 13 | static QString appName() { return QString::fromLatin1("opiemail"); } |
14 | 14 | ||
15 | public slots: | 15 | public slots: |
16 | void slotComposeMail(); | 16 | void slotComposeMail(); |
17 | void appMessage(const QCString &msg, const QByteArray &data); | ||
17 | protected slots: | 18 | protected slots: |
18 | void slotSendQueued(); | 19 | void slotSendQueued(); |
19 | void slotSearchMails(); | 20 | void slotSearchMails(); |
20 | void slotEditSettings(); | 21 | void slotEditSettings(); |
21 | void slotEditAccounts(); | 22 | void slotEditAccounts(); |
22 | private: | 23 | private: |
23 | Settings *settings; | 24 | Settings *settings; |
24 | 25 | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | #endif | 28 | #endif |