summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-25 02:18:56 (UTC)
committer alwin <alwin>2003-12-25 02:18:56 (UTC)
commitdd78bcd2bf8dd6432b54af61e17a75dcc05c2406 (patch) (unidiff)
tree0f90dcf1c777768f0ee8bc23380dc338ca095670
parentaf6b80a3d184e8984575a2cf7741058302c1c30b (diff)
downloadopie-dd78bcd2bf8dd6432b54af61e17a75dcc05c2406.zip
opie-dd78bcd2bf8dd6432b54af61e17a75dcc05c2406.tar.gz
opie-dd78bcd2bf8dd6432b54af61e17a75dcc05c2406.tar.bz2
activated qcop message "writeMail(name,email)"
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp21
-rw-r--r--noncore/net/mail/opiemail.h1
2 files changed, 17 insertions, 5 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 0dede90..2909893 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,99 +1,110 @@
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> 6#include <qpe/qcopenvelope_qws.h>
7#include <qaction.h> 7#include <qaction.h>
8#include <qapplication.h> 8#include <qapplication.h>
9 9
10OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 10OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
11 : MainWindow( parent, name, flags ) 11 : MainWindow( parent, name, flags )
12{ 12{
13 settings = new Settings(); 13 settings = new Settings();
14 14
15 folderView->populate( settings->getAccounts() ); 15 folderView->populate( settings->getAccounts() );
16 16
17 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 17 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
18 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 18 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
19// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 19// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
20 connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); 20 connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) );
21 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 21 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
22 // Added by Stefan Eilers to allow starting by addressbook.. 22 // Added by Stefan Eilers to allow starting by addressbook..
23 // copied from old mail2 23 // copied from old mail2
24#if !defined(QT_NO_COP) 24#if !defined(QT_NO_COP)
25 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 25 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
26 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 26 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
27#endif 27#endif
28} 28}
29 29
30void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 30void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
31{ 31{
32 // copied from old mail2 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)") { 33 if (msg == "writeMail(QString,QString)") {
36 QDataStream stream(data,IO_ReadOnly); 34 QDataStream stream(data,IO_ReadOnly);
37 QString name, email; 35 QString name, email;
38 stream >> name >> email; 36 stream >> name >> email;
39 slotComposeMail(); 37 // removing the whitespaces at beginning and end is needed!
38 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
40 } else if (msg == "newMail()") { 39 } else if (msg == "newMail()") {
41 slotComposeMail(); 40 slotComposeMail();
42 } 41 }
43} 42}
44 43
45void OpieMail::slotComposeMail() 44void OpieMail::slotwriteMail(const QString&name,const QString&email)
46{ 45{
47 qDebug( "Compose Mail" );
48 ComposeMail compose( settings, this, 0 , true ); 46 ComposeMail compose( settings, this, 0 , true );
47 if (!email.isEmpty()) {
48 if (!name.isEmpty()) {
49 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
50 } else {
51 compose.setTo(email);
52 }
53 }
49 compose.showMaximized(); 54 compose.showMaximized();
50 compose.slotAdjustColumns(); 55 compose.slotAdjustColumns();
51 compose.exec(); 56 compose.exec();
52} 57}
53 58
59void OpieMail::slotComposeMail()
60{
61 qDebug( "Compose Mail" );
62 slotwriteMail(0l,0l);
63}
64
54void OpieMail::slotSendQueued() 65void OpieMail::slotSendQueued()
55{ 66{
56 qDebug( "Send Queued" ); 67 qDebug( "Send Queued" );
57 SMTPaccount *smtp = 0; 68 SMTPaccount *smtp = 0;
58 69
59 QList<Account> list = settings->getAccounts(); 70 QList<Account> list = settings->getAccounts();
60 Account *it; 71 Account *it;
61// if (list.count()==1) { 72// if (list.count()==1) {
62 for ( it = list.first(); it; it = list.next() ) { 73 for ( it = list.first(); it; it = list.next() ) {
63 if ( it->getType().compare( "SMTP" ) == 0 ) { 74 if ( it->getType().compare( "SMTP" ) == 0 ) {
64 smtp = static_cast<SMTPaccount *>(it); 75 smtp = static_cast<SMTPaccount *>(it);
65 break; 76 break;
66 } 77 }
67 } 78 }
68// } 79// }
69 if (smtp) { 80 if (smtp) {
70 SMTPwrapper * wrap = new SMTPwrapper(settings); 81 SMTPwrapper * wrap = new SMTPwrapper(settings);
71 if ( wrap->flushOutbox(smtp) ) { 82 if ( wrap->flushOutbox(smtp) ) {
72 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 83 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
73 } 84 }
74 } 85 }
75} 86}
76 87
77void OpieMail::slotSearchMails() 88void OpieMail::slotSearchMails()
78{ 89{
79 qDebug( "Search Mails" ); 90 qDebug( "Search Mails" );
80} 91}
81 92
82void OpieMail::slotEditSettings() 93void OpieMail::slotEditSettings()
83{ 94{
84 qDebug( "Edit Settings" ); 95 qDebug( "Edit Settings" );
85} 96}
86 97
87void OpieMail::slotEditAccounts() 98void OpieMail::slotEditAccounts()
88{ 99{
89 qDebug( "Edit Accounts" ); 100 qDebug( "Edit Accounts" );
90 EditAccounts eaDialog( settings, this, 0, true ); 101 EditAccounts eaDialog( settings, this, 0, true );
91 eaDialog.showMaximized(); 102 eaDialog.showMaximized();
92 eaDialog.slotAdjustColumns(); 103 eaDialog.slotAdjustColumns();
93 eaDialog.exec(); 104 eaDialog.exec();
94 if ( settings ) delete settings; 105 if ( settings ) delete settings;
95 settings = new Settings(); 106 settings = new Settings();
96 107
97 folderView->populate( settings->getAccounts() ); 108 folderView->populate( settings->getAccounts() );
98} 109}
99 110
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 3cf5972..8cbcaa4 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -1,28 +1,29 @@
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
7class OpieMail : public MainWindow 7class OpieMail : public MainWindow
8{ 8{
9 Q_OBJECT 9 Q_OBJECT
10 10
11public: 11public:
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
15public slots: 15public slots:
16 void slotwriteMail(const QString&name,const QString&email);
16 void slotComposeMail(); 17 void slotComposeMail();
17 void appMessage(const QCString &msg, const QByteArray &data); 18 void appMessage(const QCString &msg, const QByteArray &data);
18protected slots: 19protected slots:
19 void slotSendQueued(); 20 void slotSendQueued();
20 void slotSearchMails(); 21 void slotSearchMails();
21 void slotEditSettings(); 22 void slotEditSettings();
22 void slotEditAccounts(); 23 void slotEditAccounts();
23private: 24private:
24 Settings *settings; 25 Settings *settings;
25 26
26}; 27};
27 28
28#endif 29#endif