-rw-r--r-- | kmicromail/opiemail.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 3aa7905..a32983c 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,165 +1,164 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | #include "accountitem.h" | 12 | #include "accountitem.h" |
13 | #include "koprefsdialog.h" | 13 | #include "koprefsdialog.h" |
14 | #include "klocale.h" | 14 | #include "klocale.h" |
15 | 15 | ||
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <qtimer.h> | 17 | #include <qtimer.h> |
18 | #include <libkdepim/externalapphandler.h> | 18 | #include <libkdepim/externalapphandler.h> |
19 | #include <libkdepim/kpimglobalprefs.h> | 19 | #include <libkdepim/kpimglobalprefs.h> |
20 | 20 | ||
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <libmailwrapper/smtpwrapper.h> | 22 | #include <libmailwrapper/smtpwrapper.h> |
23 | #include <libmailwrapper/mailtypes.h> | 23 | #include <libmailwrapper/mailtypes.h> |
24 | #include <libmailwrapper/abstractmail.h> | 24 | #include <libmailwrapper/abstractmail.h> |
25 | /* OPIE */ | 25 | /* OPIE */ |
26 | //#include <qpe/resource.h> | 26 | //#include <qpe/resource.h> |
27 | //#include <qpe/qpeapplication.h> | 27 | //#include <qpe/qpeapplication.h> |
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | 30 | ||
31 | //using namespace Opie::Core; | 31 | //using namespace Opie::Core; |
32 | 32 | ||
33 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 33 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
34 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 34 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
35 | { | 35 | { |
36 | settings = new Settings(); | 36 | settings = new Settings(); |
37 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
38 | 37 | ||
39 | folderView->populate( settings->getAccounts() ); | 38 | folderView->populate( settings->getAccounts() ); |
40 | 39 | ||
41 | } | 40 | } |
42 | 41 | ||
43 | OpieMail::~OpieMail() | 42 | OpieMail::~OpieMail() |
44 | { | 43 | { |
45 | if (settings) delete settings; | 44 | if (settings) delete settings; |
46 | } | 45 | } |
47 | 46 | ||
48 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 47 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
49 | { | 48 | { |
50 | 49 | ||
51 | } | 50 | } |
52 | #include <stdlib.h> | 51 | #include <stdlib.h> |
53 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 52 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
54 | { | 53 | { |
55 | // copied from old mail2 | 54 | // copied from old mail2 |
56 | static int ii = 0; | 55 | static int ii = 0; |
57 | //qDebug("QCOP CALL ############################# %d ", ii); | 56 | //qDebug("QCOP CALL ############################# %d ", ii); |
58 | //QString mess ( msg ); | 57 | //QString mess ( msg ); |
59 | //qDebug("Message = %s ",mess.latin1()); | 58 | //qDebug("Message = %s ",mess.latin1()); |
60 | ++ii; | 59 | ++ii; |
61 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 60 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
62 | 61 | ||
63 | mPendingEmail = QString::null; | 62 | mPendingEmail = QString::null; |
64 | mPendingName = QString::null; | 63 | mPendingName = QString::null; |
65 | if (msg == "writeMail(QString,QString)") | 64 | if (msg == "writeMail(QString,QString)") |
66 | { | 65 | { |
67 | //qDebug("writeMail(QString,QString) "); | 66 | //qDebug("writeMail(QString,QString) "); |
68 | QDataStream stream(data,IO_ReadOnly); | 67 | QDataStream stream(data,IO_ReadOnly); |
69 | stream >> mPendingName >> mPendingEmail; | 68 | stream >> mPendingName >> mPendingEmail; |
70 | // removing the whitespaces at beginning and end is needed! | 69 | // removing the whitespaces at beginning and end is needed! |
71 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 70 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
72 | } | 71 | } |
73 | else if (msg == "newMail()") | 72 | else if (msg == "newMail()") |
74 | { | 73 | { |
75 | //qDebug("slotComposeMail() "); | 74 | //qDebug("slotComposeMail() "); |
76 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 75 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
77 | // and a QCOP call does not like a processevents in his execution | 76 | // and a QCOP call does not like a processevents in his execution |
78 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 77 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
79 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 78 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
80 | // slotComposeMail(); | 79 | // slotComposeMail(); |
81 | } | 80 | } |
82 | else if (msg == "newMail(QString)") | 81 | else if (msg == "newMail(QString)") |
83 | { | 82 | { |
84 | //qDebug(" newMail(QString)"); | 83 | //qDebug(" newMail(QString)"); |
85 | QDataStream stream(data,IO_ReadOnly); | 84 | QDataStream stream(data,IO_ReadOnly); |
86 | stream >> mPendingName; | 85 | stream >> mPendingName; |
87 | // the format is | 86 | // the format is |
88 | // NAME <EMAIL>:SUBJECT | 87 | // NAME <EMAIL>:SUBJECT |
89 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 88 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
90 | } else { | 89 | } else { |
91 | mPendingData = data; | 90 | mPendingData = data; |
92 | mPendingMessage = msg; | 91 | mPendingMessage = msg; |
93 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 92 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
94 | } | 93 | } |
95 | 94 | ||
96 | //qDebug("END OpieMail::message "); | 95 | //qDebug("END OpieMail::message "); |
97 | } | 96 | } |
98 | void OpieMail::slotExtAppHandler() | 97 | void OpieMail::slotExtAppHandler() |
99 | { | 98 | { |
100 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 99 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
101 | } | 100 | } |
102 | void OpieMail::slotwriteMail2(const QString& namemail ) | 101 | void OpieMail::slotwriteMail2(const QString& namemail ) |
103 | { | 102 | { |
104 | //qDebug("OpieMail::slotwriteMail2 "); | 103 | //qDebug("OpieMail::slotwriteMail2 "); |
105 | //qApp->processEvents(); | 104 | //qApp->processEvents(); |
106 | ComposeMail compose( settings, this, 0, true ); | 105 | ComposeMail compose( settings, this, 0, true ); |
107 | if ( !namemail.isEmpty() ) { | 106 | if ( !namemail.isEmpty() ) { |
108 | QString to = namemail; | 107 | QString to = namemail; |
109 | if ( namemail.find( " <") > 1 ) { | 108 | if ( namemail.find( " <") > 1 ) { |
110 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 109 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
111 | } else | 110 | } else |
112 | if ( namemail.find( "<") > 1 ) { | 111 | if ( namemail.find( "<") > 1 ) { |
113 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 112 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
114 | } | 113 | } |
115 | int sub = to.find( ">:"); | 114 | int sub = to.find( ">:"); |
116 | if ( sub > 0 ) { | 115 | if ( sub > 0 ) { |
117 | compose.setTo( to.left(sub+1) ); | 116 | compose.setTo( to.left(sub+1) ); |
118 | compose.setSubject( to.mid(sub+2) ); | 117 | compose.setSubject( to.mid(sub+2) ); |
119 | } else | 118 | } else |
120 | compose.setTo( to ); | 119 | compose.setTo( to ); |
121 | } | 120 | } |
122 | compose.slotAdjustColumns(); | 121 | compose.slotAdjustColumns(); |
123 | compose.showMaximized(); | 122 | compose.showMaximized(); |
124 | compose.exec(); | 123 | compose.exec(); |
125 | raise(); | 124 | raise(); |
126 | //qDebug("retttich "); | 125 | //qDebug("retttich "); |
127 | } | 126 | } |
128 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 127 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
129 | { | 128 | { |
130 | // qDebug("OpieMail::slotwriteMail "); | 129 | // qDebug("OpieMail::slotwriteMail "); |
131 | ComposeMail compose( settings, this, 0, true ); | 130 | ComposeMail compose( settings, this, 0, true ); |
132 | if (!email.isEmpty()) | 131 | if (!email.isEmpty()) |
133 | { | 132 | { |
134 | if (!name.isEmpty()) | 133 | if (!name.isEmpty()) |
135 | { | 134 | { |
136 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 135 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
137 | } | 136 | } |
138 | else | 137 | else |
139 | { | 138 | { |
140 | compose.setTo(email); | 139 | compose.setTo(email); |
141 | } | 140 | } |
142 | } | 141 | } |
143 | compose.slotAdjustColumns(); | 142 | compose.slotAdjustColumns(); |
144 | compose.showMaximized(); | 143 | compose.showMaximized(); |
145 | compose.exec(); | 144 | compose.exec(); |
146 | raise(); | 145 | raise(); |
147 | } | 146 | } |
148 | 147 | ||
149 | void OpieMail::slotComposeMail() | 148 | void OpieMail::slotComposeMail() |
150 | { | 149 | { |
151 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 150 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
152 | slotwriteMail2( QString () ); | 151 | slotwriteMail2( QString () ); |
153 | else { | 152 | else { |
154 | if ( mPendingEmail == QString::null ) | 153 | if ( mPendingEmail == QString::null ) |
155 | slotwriteMail2( mPendingName ); | 154 | slotwriteMail2( mPendingName ); |
156 | else | 155 | else |
157 | slotwriteMail( mPendingName, mPendingEmail ); | 156 | slotwriteMail( mPendingName, mPendingEmail ); |
158 | } | 157 | } |
159 | //slotwriteMail(0l,0l); | 158 | //slotwriteMail(0l,0l); |
160 | } | 159 | } |
161 | 160 | ||
162 | void OpieMail::slotSendQueued() | 161 | void OpieMail::slotSendQueued() |
163 | { | 162 | { |
164 | SMTPaccount *smtp = 0; | 163 | SMTPaccount *smtp = 0; |
165 | 164 | ||