-rw-r--r-- | kmicromail/opiemail.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 70fbcb2..d522ad0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,128 +1,129 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | 2 | ||
2 | #include "settingsdialog.h" | 3 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 4 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 5 | #include "editaccounts.h" |
5 | #include "composemail.h" | 6 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | 7 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 8 | #include "viewmail.h" |
8 | #include "selectstore.h" | 9 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 10 | #include "selectsmtp.h" |
10 | 11 | ||
11 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
12 | 13 | ||
13 | #include <qpe/qpeapplication.h> | 14 | #include <qpe/qpeapplication.h> |
14 | #include <libmailwrapper/smtpwrapper.h> | 15 | #include <libmailwrapper/smtpwrapper.h> |
15 | #include <libmailwrapper/mailtypes.h> | 16 | #include <libmailwrapper/mailtypes.h> |
16 | #include <libmailwrapper/abstractmail.h> | 17 | #include <libmailwrapper/abstractmail.h> |
17 | /* OPIE */ | 18 | /* OPIE */ |
18 | //#include <qpe/resource.h> | 19 | //#include <qpe/resource.h> |
19 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
20 | 21 | ||
21 | /* QT */ | 22 | /* QT */ |
22 | 23 | ||
23 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
24 | 25 | ||
25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 26 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
26 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 27 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
27 | { | 28 | { |
28 | settings = new Settings(); | 29 | settings = new Settings(); |
29 | 30 | ||
30 | folderView->populate( settings->getAccounts() ); | 31 | folderView->populate( settings->getAccounts() ); |
31 | 32 | ||
32 | } | 33 | } |
33 | 34 | ||
34 | OpieMail::~OpieMail() | 35 | OpieMail::~OpieMail() |
35 | { | 36 | { |
36 | if (settings) delete settings; | 37 | if (settings) delete settings; |
37 | } | 38 | } |
38 | 39 | ||
39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 40 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
40 | { | 41 | { |
41 | 42 | ||
42 | } | 43 | } |
43 | #include <stdlib.h> | 44 | #include <stdlib.h> |
44 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 45 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
45 | { | 46 | { |
46 | // copied from old mail2 | 47 | // copied from old mail2 |
47 | static int ii = 0; | 48 | static int ii = 0; |
48 | 49 | ||
49 | // block second call | 50 | // block second call |
50 | if ( ii < 2 ) { | 51 | if ( ii < 2 ) { |
51 | ++ii; | 52 | ++ii; |
52 | if ( ii > 1 ) { | 53 | if ( ii > 1 ) { |
53 | qDebug("qcop call blocked "); | 54 | qDebug("qcop call blocked "); |
54 | return; | 55 | return; |
55 | } | 56 | } |
56 | } | 57 | } |
57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 58 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
58 | if (msg == "writeMail(QString,QString)") | 59 | if (msg == "writeMail(QString,QString)") |
59 | { | 60 | { |
60 | QDataStream stream(data,IO_ReadOnly); | 61 | QDataStream stream(data,IO_ReadOnly); |
61 | QString name, email; | 62 | QString name, email; |
62 | stream >> name >> email; | 63 | stream >> name >> email; |
63 | // removing the whitespaces at beginning and end is needed! | 64 | // removing the whitespaces at beginning and end is needed! |
64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 65 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
65 | } | 66 | } |
66 | else if (msg == "newMail()") | 67 | else if (msg == "newMail()") |
67 | { | 68 | { |
68 | slotComposeMail(); | 69 | slotComposeMail(); |
69 | } | 70 | } |
70 | else if (msg == "newMail(QString)") | 71 | else if (msg == "newMail(QString)") |
71 | { | 72 | { |
72 | QDataStream stream(data,IO_ReadOnly); | 73 | QDataStream stream(data,IO_ReadOnly); |
73 | QString nameemail; | 74 | QString nameemail; |
74 | stream >> nameemail; | 75 | stream >> nameemail; |
75 | // the format is | 76 | // the format is |
76 | // NAME <EMAIL>:SUBJECT | 77 | // NAME <EMAIL>:SUBJECT |
77 | //qDebug("message %s ", nameemail.latin1()); | 78 | //qDebug("message %s ", nameemail.latin1()); |
78 | 79 | ||
79 | slotwriteMail2( nameemail ); | 80 | slotwriteMail2( nameemail ); |
80 | } | 81 | } |
81 | } | 82 | } |
82 | void OpieMail::slotwriteMail2(const QString& namemail ) | 83 | void OpieMail::slotwriteMail2(const QString& namemail ) |
83 | { | 84 | { |
84 | // qDebug("OpieMail::slotwriteMail2 "); | 85 | // qDebug("OpieMail::slotwriteMail2 "); |
85 | qApp->processEvents(); | 86 | qApp->processEvents(); |
86 | ComposeMail compose( settings, this, 0, true ); | 87 | ComposeMail compose( settings, this, 0, true ); |
87 | if ( !namemail.isEmpty() ) { | 88 | if ( !namemail.isEmpty() ) { |
88 | QString to = namemail; | 89 | QString to = namemail; |
89 | if ( namemail.find( " <") > 1 ) { | 90 | if ( namemail.find( " <") > 1 ) { |
90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 91 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
91 | } else | 92 | } else |
92 | if ( namemail.find( "<") > 1 ) { | 93 | if ( namemail.find( "<") > 1 ) { |
93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 94 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
94 | } | 95 | } |
95 | int sub = to.find( ">:"); | 96 | int sub = to.find( ">:"); |
96 | if ( sub > 0 ) { | 97 | if ( sub > 0 ) { |
97 | compose.setTo( to.left(sub+1) ); | 98 | compose.setTo( to.left(sub+1) ); |
98 | compose.setSubject( to.mid(sub+2) ); | 99 | compose.setSubject( to.mid(sub+2) ); |
99 | } else | 100 | } else |
100 | compose.setTo( to ); | 101 | compose.setTo( to ); |
101 | } | 102 | } |
102 | compose.slotAdjustColumns(); | 103 | compose.slotAdjustColumns(); |
103 | compose.showMaximized(); | 104 | compose.showMaximized(); |
104 | compose.exec(); | 105 | compose.exec(); |
105 | //qDebug("retttich "); | 106 | //qDebug("retttich "); |
106 | } | 107 | } |
107 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 108 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
108 | { | 109 | { |
109 | // qDebug("OpieMail::slotwriteMail "); | 110 | // qDebug("OpieMail::slotwriteMail "); |
110 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 111 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
111 | if (!email.isEmpty()) | 112 | if (!email.isEmpty()) |
112 | { | 113 | { |
113 | if (!name.isEmpty()) | 114 | if (!name.isEmpty()) |
114 | { | 115 | { |
115 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 116 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
116 | } | 117 | } |
117 | else | 118 | else |
118 | { | 119 | { |
119 | compose.setTo(email); | 120 | compose.setTo(email); |
120 | } | 121 | } |
121 | } | 122 | } |
122 | compose.slotAdjustColumns(); | 123 | compose.slotAdjustColumns(); |
123 | compose.showMaximized(); | 124 | compose.showMaximized(); |
124 | compose.exec(); | 125 | compose.exec(); |
125 | } | 126 | } |
126 | 127 | ||
127 | void OpieMail::slotComposeMail() | 128 | void OpieMail::slotComposeMail() |
128 | { | 129 | { |