-rw-r--r-- | kmicromail/opiemail.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index e159b73..f68467c 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,672 +1,672 @@ | |||
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 | 4 | ||
5 | #define protected public | 5 | #define protected public |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #undef protected | 7 | #undef protected |
8 | #include "koprefsdialog.h" | 8 | #include "koprefsdialog.h" |
9 | #include <kapplication.h> | 9 | #include <kapplication.h> |
10 | #include <libkdepim/externalapphandler.h> | 10 | #include <libkdepim/externalapphandler.h> |
11 | #include <libkdepim/kpimglobalprefs.h> | 11 | #include <libkdepim/kpimglobalprefs.h> |
12 | #ifdef MINIKDE_KDIALOG_H | 12 | #ifdef MINIKDE_KDIALOG_H |
13 | #undef MINIKDE_KDIALOG_H | 13 | #undef MINIKDE_KDIALOG_H |
14 | #endif | 14 | #endif |
15 | #include "settingsdialog.h" | 15 | #include "settingsdialog.h" |
16 | #include "opiemail.h" | 16 | #include "opiemail.h" |
17 | #include "editaccounts.h" | 17 | #include "editaccounts.h" |
18 | #include "composemail.h" | 18 | #include "composemail.h" |
19 | #include "mailistviewitem.h" | 19 | #include "mailistviewitem.h" |
20 | #include "viewmail.h" | 20 | #include "viewmail.h" |
21 | #include "selectstore.h" | 21 | #include "selectstore.h" |
22 | #include "selectsmtp.h" | 22 | #include "selectsmtp.h" |
23 | #include "accountitem.h" | 23 | #include "accountitem.h" |
24 | #include "accountview.h" | 24 | #include "accountview.h" |
25 | #include "klocale.h" | 25 | #include "klocale.h" |
26 | 26 | ||
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qcursor.h> | 29 | #include <qcursor.h> |
30 | #include <qtextbrowser.h> | 30 | #include <qtextbrowser.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
33 | 33 | ||
34 | #ifdef DESKTOP_VERSION | 34 | #ifdef DESKTOP_VERSION |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #else | 36 | #else |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #endif | 38 | #endif |
39 | #include <libmailwrapper/smtpwrapper.h> | 39 | #include <libmailwrapper/smtpwrapper.h> |
40 | #include <libmailwrapper/mailtypes.h> | 40 | #include <libmailwrapper/mailtypes.h> |
41 | #include <libmailwrapper/abstractmail.h> | 41 | #include <libmailwrapper/abstractmail.h> |
42 | #include "koprefs.h" | 42 | #include "koprefs.h" |
43 | 43 | ||
44 | //using namespace Opie::Core; | 44 | //using namespace Opie::Core; |
45 | 45 | ||
46 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 46 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
47 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 47 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
48 | { | 48 | { |
49 | mCurrentComposer = 0; | 49 | mCurrentComposer = 0; |
50 | settings = new Settings(); | 50 | settings = new Settings(); |
51 | tb = 0; | 51 | tb = 0; |
52 | setIcon(SmallIcon( "kmicromail" ) ); | 52 | setIcon(SmallIcon( "kmicromail" ) ); |
53 | folderView->populate( settings->getAccounts() ); | 53 | folderView->populate( settings->getAccounts() ); |
54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
56 | } | 56 | } |
57 | 57 | ||
58 | OpieMail::~OpieMail() | 58 | OpieMail::~OpieMail() |
59 | { | 59 | { |
60 | if (settings) delete settings; | 60 | if (settings) delete settings; |
61 | if ( tb ) | 61 | if ( tb ) |
62 | delete tb; | 62 | delete tb; |
63 | } | 63 | } |
64 | 64 | ||
65 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 65 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
66 | { | 66 | { |
67 | 67 | ||
68 | } | 68 | } |
69 | #include <stdlib.h> | 69 | #include <stdlib.h> |
70 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 70 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
71 | { | 71 | { |
72 | // copied from old mail2 | 72 | // copied from old mail2 |
73 | static int ii = 0; | 73 | static int ii = 0; |
74 | //qDebug("QCOP CALL ############################# %d ", ii); | 74 | //qDebug("QCOP CALL ############################# %d ", ii); |
75 | //QString mess ( msg ); | 75 | //QString mess ( msg ); |
76 | //qDebug("Message = %s ",mess.latin1()); | 76 | //qDebug("Message = %s ",mess.latin1()); |
77 | ++ii; | 77 | ++ii; |
78 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 78 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
79 | 79 | ||
80 | mPendingEmail = QString::null; | 80 | mPendingEmail = QString::null; |
81 | mPendingName = QString::null; | 81 | mPendingName = QString::null; |
82 | if (msg == "writeMail(QString,QString)") | 82 | if (msg == "writeMail(QString,QString)") |
83 | { | 83 | { |
84 | //qDebug("writeMail(QString,QString) "); | 84 | //qDebug("writeMail(QString,QString) "); |
85 | QDataStream stream(data,IO_ReadOnly); | 85 | QDataStream stream(data,IO_ReadOnly); |
86 | stream >> mPendingName >> mPendingEmail; | 86 | stream >> mPendingName >> mPendingEmail; |
87 | // removing the whitespaces at beginning and end is needed! | 87 | // removing the whitespaces at beginning and end is needed! |
88 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 88 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
89 | } | 89 | } |
90 | else if (msg == "newMail()") | 90 | else if (msg == "newMail()") |
91 | { | 91 | { |
92 | //qDebug("slotComposeMail() "); | 92 | //qDebug("slotComposeMail() "); |
93 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 93 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
94 | // and a QCOP call does not like a processevents in his execution | 94 | // and a QCOP call does not like a processevents in his execution |
95 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 95 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
96 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 96 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
97 | // slotComposeMail(); | 97 | // slotComposeMail(); |
98 | } | 98 | } |
99 | else if (msg == "newMail(QString)") | 99 | else if (msg == "newMail(QString)") |
100 | { | 100 | { |
101 | //qDebug(" newMail(QString)"); | 101 | //qDebug(" newMail(QString)"); |
102 | QDataStream stream(data,IO_ReadOnly); | 102 | QDataStream stream(data,IO_ReadOnly); |
103 | stream >> mPendingName; | 103 | stream >> mPendingName; |
104 | // the format is | 104 | // the format is |
105 | // NAME <EMAIL>:SUBJECT | 105 | // NAME <EMAIL>:SUBJECT |
106 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 106 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
107 | } else { | 107 | } else { |
108 | mPendingData = data; | 108 | mPendingData = data; |
109 | mPendingMessage = msg; | 109 | mPendingMessage = msg; |
110 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 110 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
111 | } | 111 | } |
112 | 112 | ||
113 | //qDebug("END OpieMail::message "); | 113 | //qDebug("END OpieMail::message "); |
114 | } | 114 | } |
115 | void OpieMail::slotExtAppHandler() | 115 | void OpieMail::slotExtAppHandler() |
116 | { | 116 | { |
117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
118 | } | 118 | } |
119 | void OpieMail::slotwriteMail2(const QString& namemail ) | 119 | void OpieMail::slotwriteMail2(const QString& namemail ) |
120 | { | 120 | { |
121 | //qDebug("OpieMail::slotwriteMail2 "); | 121 | //qDebug("OpieMail::slotwriteMail2 "); |
122 | //qApp->processEvents(); | 122 | //qApp->processEvents(); |
123 | ComposeMail compose( settings, this, 0, true ); | 123 | ComposeMail compose( settings, this, 0, true ); |
124 | if ( !namemail.isEmpty() ) { | 124 | if ( !namemail.isEmpty() ) { |
125 | QString to = namemail; | 125 | QString to = namemail; |
126 | if ( namemail.find( " <") > 1 ) { | 126 | if ( namemail.find( " <") > 1 ) { |
127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
128 | } else | 128 | } else |
129 | if ( namemail.find( "<") > 1 ) { | 129 | if ( namemail.find( "<") > 1 ) { |
130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
131 | } | 131 | } |
132 | int sub = to.find( ">:"); | 132 | int sub = to.find( ">:"); |
133 | if ( sub > 0 ) { | 133 | if ( sub > 0 ) { |
134 | compose.setTo( to.left(sub+1) ); | 134 | compose.setTo( to.left(sub+1) ); |
135 | compose.setSubject( to.mid(sub+2) ); | 135 | compose.setSubject( to.mid(sub+2) ); |
136 | } else | 136 | } else |
137 | compose.setTo( to ); | 137 | compose.setTo( to ); |
138 | } | 138 | } |
139 | compose.slotAdjustColumns(); | 139 | compose.slotAdjustColumns(); |
140 | #ifndef DESKTOP_VERSION | 140 | #ifndef DESKTOP_VERSION |
141 | compose.showMaximized(); | 141 | compose.showMaximized(); |
142 | #endif | 142 | #endif |
143 | mCurrentComposer = &compose; | 143 | mCurrentComposer = &compose; |
144 | compose.exec(); | 144 | compose.exec(); |
145 | mCurrentComposer = 0; | 145 | mCurrentComposer = 0; |
146 | raise(); | 146 | raise(); |
147 | //qDebug("retttich "); | 147 | //qDebug("retttich "); |
148 | } | 148 | } |
149 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 149 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
150 | { | 150 | { |
151 | // qDebug("OpieMail::slotwriteMail "); | 151 | // qDebug("OpieMail::slotwriteMail "); |
152 | ComposeMail compose( settings, this, 0, true ); | 152 | ComposeMail compose( settings, this, 0, true ); |
153 | if (!email.isEmpty()) | 153 | if (!email.isEmpty()) |
154 | { | 154 | { |
155 | if (!name.isEmpty()) | 155 | if (!name.isEmpty()) |
156 | { | 156 | { |
157 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 157 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
158 | } | 158 | } |
159 | else | 159 | else |
160 | { | 160 | { |
161 | compose.setTo(email); | 161 | compose.setTo(email); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | compose.slotAdjustColumns(); | 164 | compose.slotAdjustColumns(); |
165 | #ifndef DESKTOP_VERSION | 165 | #ifndef DESKTOP_VERSION |
166 | compose.showMaximized(); | 166 | compose.showMaximized(); |
167 | #endif | 167 | #endif |
168 | 168 | ||
169 | mCurrentComposer = &compose; | 169 | mCurrentComposer = &compose; |
170 | compose.exec(); | 170 | compose.exec(); |
171 | mCurrentComposer = 0; | 171 | mCurrentComposer = 0; |
172 | raise(); | 172 | raise(); |
173 | } | 173 | } |
174 | 174 | ||
175 | void OpieMail::slotComposeMail() | 175 | void OpieMail::slotComposeMail() |
176 | { | 176 | { |
177 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 177 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
178 | slotwriteMail2( QString () ); | 178 | slotwriteMail2( QString () ); |
179 | else { | 179 | else { |
180 | if ( mPendingEmail == QString::null ) | 180 | if ( mPendingEmail == QString::null ) |
181 | slotwriteMail2( mPendingName ); | 181 | slotwriteMail2( mPendingName ); |
182 | else | 182 | else |
183 | slotwriteMail( mPendingName, mPendingEmail ); | 183 | slotwriteMail( mPendingName, mPendingEmail ); |
184 | } | 184 | } |
185 | //slotwriteMail(0l,0l); | 185 | //slotwriteMail(0l,0l); |
186 | } | 186 | } |
187 | 187 | ||
188 | void OpieMail::slotSendQueued() | 188 | void OpieMail::slotSendQueued() |
189 | { | 189 | { |
190 | SMTPaccount *smtp = 0; | 190 | SMTPaccount *smtp = 0; |
191 | 191 | ||
192 | QList<Account> list = settings->getAccounts(); | 192 | QList<Account> list = settings->getAccounts(); |
193 | QList<SMTPaccount> smtpList; | 193 | QList<SMTPaccount> smtpList; |
194 | smtpList.setAutoDelete(false); | 194 | smtpList.setAutoDelete(false); |
195 | Account *it; | 195 | Account *it; |
196 | for ( it = list.first(); it; it = list.next() ) | 196 | for ( it = list.first(); it; it = list.next() ) |
197 | { | 197 | { |
198 | if ( it->getType() == MAILLIB::A_SMTP ) | 198 | if ( it->getType() == MAILLIB::A_SMTP ) |
199 | { | 199 | { |
200 | smtp = static_cast<SMTPaccount *>(it); | 200 | smtp = static_cast<SMTPaccount *>(it); |
201 | smtpList.append(smtp); | 201 | smtpList.append(smtp); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | if (smtpList.count()==0) | 204 | if (smtpList.count()==0) |
205 | { | 205 | { |
206 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); | 206 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 209 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
210 | return; | 210 | return; |
211 | if (smtpList.count()==1) | 211 | if (smtpList.count()==1) |
212 | { | 212 | { |
213 | smtp = smtpList.at(0); | 213 | smtp = smtpList.at(0); |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | smtp = 0; | 217 | smtp = 0; |
218 | selectsmtp selsmtp; | 218 | selectsmtp selsmtp; |
219 | selsmtp.setSelectionlist(&smtpList); | 219 | selsmtp.setSelectionlist(&smtpList); |
220 | #ifndef DESKTOP_VERSION | 220 | #ifndef DESKTOP_VERSION |
221 | selsmtp.showMaximized(); | 221 | selsmtp.showMaximized(); |
222 | #endif | 222 | #endif |
223 | if ( selsmtp.exec() == QDialog::Accepted ) | 223 | if ( selsmtp.exec() == QDialog::Accepted ) |
224 | { | 224 | { |
225 | smtp = selsmtp.selected_smtp(); | 225 | smtp = selsmtp.selected_smtp(); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | if (smtp) | 228 | if (smtp) |
229 | { | 229 | { |
230 | 230 | ||
231 | Global::statusMessage("Sending mails...!"); | 231 | Global::statusMessage("Sending mails...!"); |
232 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 232 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
233 | if ( wrap->flushOutbox() ) | 233 | if ( wrap->flushOutbox() ) |
234 | { | 234 | { |
235 | Global::statusMessage("Mails sent!"); | 235 | Global::statusMessage("Mails sent!"); |
236 | } | 236 | } |
237 | delete wrap; | 237 | delete wrap; |
238 | } | 238 | } |
239 | // pending refresh list view, if outgoing is displayed | 239 | folderView->refreshOutgoing(); |
240 | } | 240 | } |
241 | 241 | ||
242 | void OpieMail::slotSearchMails() | 242 | void OpieMail::slotSearchMails() |
243 | { | 243 | { |
244 | qDebug("OpieMail::slotSearchMails():not implemented "); | 244 | qDebug("OpieMail::slotSearchMails():not implemented "); |
245 | } | 245 | } |
246 | 246 | ||
247 | void OpieMail::slotEditSettings() | 247 | void OpieMail::slotEditSettings() |
248 | { | 248 | { |
249 | 249 | ||
250 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 250 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
251 | #ifndef DESKTOP_VERSION | 251 | #ifndef DESKTOP_VERSION |
252 | settingsDialog.showMaximized(); | 252 | settingsDialog.showMaximized(); |
253 | #endif | 253 | #endif |
254 | settingsDialog.exec(); | 254 | settingsDialog.exec(); |
255 | 255 | ||
256 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 256 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
257 | // KApplication::execDialog(settingsDialog); | 257 | // KApplication::execDialog(settingsDialog); |
258 | } | 258 | } |
259 | 259 | ||
260 | void OpieMail::slotEditAccounts() | 260 | void OpieMail::slotEditAccounts() |
261 | { | 261 | { |
262 | EditAccounts eaDialog( settings, this, 0, true ); | 262 | EditAccounts eaDialog( settings, this, 0, true ); |
263 | eaDialog.slotAdjustColumns(); | 263 | eaDialog.slotAdjustColumns(); |
264 | #ifndef DESKTOP_VERSION | 264 | #ifndef DESKTOP_VERSION |
265 | eaDialog.showMaximized(); | 265 | eaDialog.showMaximized(); |
266 | #endif | 266 | #endif |
267 | eaDialog.exec(); | 267 | eaDialog.exec(); |
268 | if ( settings ) delete settings; | 268 | if ( settings ) delete settings; |
269 | settings = new Settings(); | 269 | settings = new Settings(); |
270 | 270 | ||
271 | folderView->populate( settings->getAccounts() ); | 271 | folderView->populate( settings->getAccounts() ); |
272 | } | 272 | } |
273 | void OpieMail::replyMail() | 273 | void OpieMail::replyMail() |
274 | { | 274 | { |
275 | 275 | ||
276 | QListViewItem*item = mailView->currentItem(); | 276 | QListViewItem*item = mailView->currentItem(); |
277 | if (!item) return; | 277 | if (!item) return; |
278 | RecMailP mail = ((MailListViewItem*)item)->data(); | 278 | RecMailP mail = ((MailListViewItem*)item)->data(); |
279 | RecBodyP body = folderView->fetchBody(mail); | 279 | RecBodyP body = folderView->fetchBody(mail); |
280 | 280 | ||
281 | QString rtext; | 281 | QString rtext; |
282 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 282 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
283 | .arg( mail->getFrom()) | 283 | .arg( mail->getFrom()) |
284 | .arg( mail->getDate()); | 284 | .arg( mail->getDate()); |
285 | 285 | ||
286 | QString text = body->Bodytext(); | 286 | QString text = body->Bodytext(); |
287 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 287 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
288 | QStringList::Iterator it; | 288 | QStringList::Iterator it; |
289 | for (it = lines.begin(); it != lines.end(); it++) | 289 | for (it = lines.begin(); it != lines.end(); it++) |
290 | { | 290 | { |
291 | rtext += "> " + *it + "\n"; | 291 | rtext += "> " + *it + "\n"; |
292 | } | 292 | } |
293 | rtext += "\n"; | 293 | rtext += "\n"; |
294 | 294 | ||
295 | QString prefix; | 295 | QString prefix; |
296 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 296 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
297 | else prefix = "Re: "; // no i18n on purpose | 297 | else prefix = "Re: "; // no i18n on purpose |
298 | 298 | ||
299 | Settings *settings = new Settings(); | 299 | Settings *settings = new Settings(); |
300 | ComposeMail composer( settings ,this, 0, true); | 300 | ComposeMail composer( settings ,this, 0, true); |
301 | if (mail->Replyto().isEmpty()) { | 301 | if (mail->Replyto().isEmpty()) { |
302 | composer.setTo( mail->getFrom()); | 302 | composer.setTo( mail->getFrom()); |
303 | } else { | 303 | } else { |
304 | composer.setTo( mail->Replyto()); | 304 | composer.setTo( mail->Replyto()); |
305 | } | 305 | } |
306 | composer.setSubject( prefix + mail->getSubject()); | 306 | composer.setSubject( prefix + mail->getSubject()); |
307 | composer.setMessage( rtext ); | 307 | composer.setMessage( rtext ); |
308 | composer.setInReplyTo( mail->Msgid()); | 308 | composer.setInReplyTo( mail->Msgid()); |
309 | composer.setCharset( body->getCharset() ); | 309 | composer.setCharset( body->getCharset() ); |
310 | 310 | ||
311 | mCurrentComposer = &composer; | 311 | mCurrentComposer = &composer; |
312 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 312 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
313 | { | 313 | { |
314 | mail->Wrapper()->answeredMail(mail); | 314 | mail->Wrapper()->answeredMail(mail); |
315 | } | 315 | } |
316 | mCurrentComposer = 0; | 316 | mCurrentComposer = 0; |
317 | delete settings; | 317 | delete settings; |
318 | 318 | ||
319 | } | 319 | } |
320 | void OpieMail::closeViewMail(ViewMail * vm) | 320 | void OpieMail::closeViewMail(ViewMail * vm) |
321 | { | 321 | { |
322 | vm->hide(); | 322 | vm->hide(); |
323 | } | 323 | } |
324 | 324 | ||
325 | void OpieMail::slotDownloadMail( ) | 325 | void OpieMail::slotDownloadMail( ) |
326 | { | 326 | { |
327 | QListViewItem*item = mailView->currentItem(); | 327 | QListViewItem*item = mailView->currentItem(); |
328 | if (!item ) { | 328 | if (!item ) { |
329 | Global::statusMessage("Error: No item slected!"); | 329 | Global::statusMessage("Error: No item slected!"); |
330 | return; | 330 | return; |
331 | } | 331 | } |
332 | RecMailP mail = ((MailListViewItem*)item)->data(); | 332 | RecMailP mail = ((MailListViewItem*)item)->data(); |
333 | Account * acc = mail->Wrapper()->getAccount(); | 333 | Account * acc = mail->Wrapper()->getAccount(); |
334 | if ( !acc ) { | 334 | if ( !acc ) { |
335 | Global::statusMessage("Mail is already stored locally!"); | 335 | Global::statusMessage("Mail is already stored locally!"); |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | QString lfName = acc->getLocalFolder(); | 338 | QString lfName = acc->getLocalFolder(); |
339 | //qDebug("local folder " + lfName ); | 339 | //qDebug("local folder " + lfName ); |
340 | if ( lfName.isEmpty() ) | 340 | if ( lfName.isEmpty() ) |
341 | lfName = acc->getAccountName(); | 341 | lfName = acc->getAccountName(); |
342 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); | 342 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); |
343 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); | 343 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); |
344 | if ( targetMail == mail->Wrapper() ) { | 344 | if ( targetMail == mail->Wrapper() ) { |
345 | Global::statusMessage("Mail is already locally stored!"); | 345 | Global::statusMessage("Mail is already locally stored!"); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | if ( !targetMail->createMbox(lfName)) { | 348 | if ( !targetMail->createMbox(lfName)) { |
349 | Global::statusMessage("Error creating folder!"); | 349 | Global::statusMessage("Error creating folder!"); |
350 | return; | 350 | return; |
351 | } | 351 | } |
352 | Global::statusMessage("Fetching mail...please wait!"); | 352 | Global::statusMessage("Fetching mail...please wait!"); |
353 | qApp->processEvents(); | 353 | qApp->processEvents(); |
354 | encodedString*st = 0; | 354 | encodedString*st = 0; |
355 | st = mail->Wrapper()->fetchRawBody(mail); | 355 | st = mail->Wrapper()->fetchRawBody(mail); |
356 | if ( st ) { | 356 | if ( st ) { |
357 | targetMail->storeMessage(st->Content(),st->Length(),lfName); | 357 | targetMail->storeMessage(st->Content(),st->Length(),lfName); |
358 | Global::statusMessage("Mail stored in "+ lfName); | 358 | Global::statusMessage("Mail stored in "+ lfName); |
359 | delete st; | 359 | delete st; |
360 | } else { | 360 | } else { |
361 | Global::statusMessage("Error: Cannot fetch mail!"); | 361 | Global::statusMessage("Error: Cannot fetch mail!"); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | 365 | ||
366 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 366 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) |
367 | { | 367 | { |
368 | QListViewItem*item = mailView->currentItem(); | 368 | QListViewItem*item = mailView->currentItem(); |
369 | if (!item ) { | 369 | if (!item ) { |
370 | closeViewMail(vm); | 370 | closeViewMail(vm); |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | RecMailP mail = ((MailListViewItem*)item)->data(); | 373 | RecMailP mail = ((MailListViewItem*)item)->data(); |
374 | mail->Wrapper()->deleteMail( mail ); | 374 | mail->Wrapper()->deleteMail( mail ); |
375 | item = item->itemBelow(); | 375 | item = item->itemBelow(); |
376 | if (!item ) { | 376 | if (!item ) { |
377 | closeViewMail(vm); | 377 | closeViewMail(vm); |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | mailView->setCurrentItem(item); | 380 | mailView->setCurrentItem(item); |
381 | mail = ((MailListViewItem*)item)->data(); | 381 | mail = ((MailListViewItem*)item)->data(); |
382 | RecBodyP body = folderView->fetchBody(mail); | 382 | RecBodyP body = folderView->fetchBody(mail); |
383 | vm->setBody( body ); | 383 | vm->setBody( body ); |
384 | vm->setMail( mail ); | 384 | vm->setMail( mail ); |
385 | } | 385 | } |
386 | void OpieMail::displayNextMail(ViewMail * vm) | 386 | void OpieMail::displayNextMail(ViewMail * vm) |
387 | { | 387 | { |
388 | QListViewItem*item = mailView->currentItem(); | 388 | QListViewItem*item = mailView->currentItem(); |
389 | if (!item) return; | 389 | if (!item) return; |
390 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 390 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
391 | item = item->itemBelow(); | 391 | item = item->itemBelow(); |
392 | if (!item) { | 392 | if (!item) { |
393 | vm->setCaption(i18n("End of List" )); | 393 | vm->setCaption(i18n("End of List" )); |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | mailView->setCurrentItem(item); | 396 | mailView->setCurrentItem(item); |
397 | RecMailP mail = ((MailListViewItem*)item)->data(); | 397 | RecMailP mail = ((MailListViewItem*)item)->data(); |
398 | RecBodyP body = folderView->fetchBody(mail); | 398 | RecBodyP body = folderView->fetchBody(mail); |
399 | vm->setBody( body ); | 399 | vm->setBody( body ); |
400 | vm->setMail( mail ); | 400 | vm->setMail( mail ); |
401 | } | 401 | } |
402 | void OpieMail::displayMail() | 402 | void OpieMail::displayMail() |
403 | { | 403 | { |
404 | QListViewItem*item = mailView->currentItem(); | 404 | QListViewItem*item = mailView->currentItem(); |
405 | if (!item) return; | 405 | if (!item) return; |
406 | RecMailP mail = ((MailListViewItem*)item)->data(); | 406 | RecMailP mail = ((MailListViewItem*)item)->data(); |
407 | RecBodyP body = folderView->fetchBody(mail); | 407 | RecBodyP body = folderView->fetchBody(mail); |
408 | ViewMail readMail( this,"", Qt::WType_Modal ); | 408 | ViewMail readMail( this,"", Qt::WType_Modal ); |
409 | readMail.setBody( body ); | 409 | readMail.setBody( body ); |
410 | readMail.setMail( mail ); | 410 | readMail.setMail( mail ); |
411 | #ifndef DESKTOP_VERSION | 411 | #ifndef DESKTOP_VERSION |
412 | readMail.showMaximized(); | 412 | readMail.showMaximized(); |
413 | #else | 413 | #else |
414 | readMail.resize( 640, 480); | 414 | readMail.resize( 640, 480); |
415 | #endif | 415 | #endif |
416 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); | 416 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); |
417 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); | 417 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); |
418 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); | 418 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); |
419 | 419 | ||
420 | readMail.exec(); | 420 | readMail.exec(); |
421 | 421 | ||
422 | if ( readMail.deleted ) | 422 | if ( readMail.deleted ) |
423 | { | 423 | { |
424 | folderView->refreshCurrent(); | 424 | folderView->refreshCurrent(); |
425 | } | 425 | } |
426 | else | 426 | else |
427 | { | 427 | { |
428 | QListViewItem*item = mailView->currentItem(); | 428 | QListViewItem*item = mailView->currentItem(); |
429 | if (item) | 429 | if (item) |
430 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 430 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | void OpieMail::slotGetAllMail() | 433 | void OpieMail::slotGetAllMail() |
434 | { | 434 | { |
435 | QListViewItem * item = folderView->firstChild(); | 435 | QListViewItem * item = folderView->firstChild(); |
436 | while ( item ){ | 436 | while ( item ){ |
437 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 437 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
438 | item = item->nextSibling (); | 438 | item = item->nextSibling (); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | void OpieMail::slotGetMail() | 441 | void OpieMail::slotGetMail() |
442 | { | 442 | { |
443 | QListViewItem * item = folderView->currentItem(); | 443 | QListViewItem * item = folderView->currentItem(); |
444 | if ( ! item ) return; | 444 | if ( ! item ) return; |
445 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 445 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
446 | } | 446 | } |
447 | void OpieMail::slotDeleteMail() | 447 | void OpieMail::slotDeleteMail() |
448 | { | 448 | { |
449 | if (!mailView->currentItem()) return; | 449 | if (!mailView->currentItem()) return; |
450 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 450 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
451 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 451 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
452 | { | 452 | { |
453 | mail->Wrapper()->deleteMail( mail ); | 453 | mail->Wrapper()->deleteMail( mail ); |
454 | folderView->refreshCurrent(); | 454 | folderView->refreshCurrent(); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | void OpieMail::slotDeleteAllMail() | 457 | void OpieMail::slotDeleteAllMail() |
458 | { | 458 | { |
459 | 459 | ||
460 | QValueList<RecMailP> t; | 460 | QValueList<RecMailP> t; |
461 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 461 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
462 | { | 462 | { |
463 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 463 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
464 | while ( item ) { | 464 | while ( item ) { |
465 | if ( item->isSelected() ) { | 465 | if ( item->isSelected() ) { |
466 | t.append( item->data() ); | 466 | t.append( item->data() ); |
467 | } | 467 | } |
468 | item = (MailListViewItem*)item->nextSibling(); | 468 | item = (MailListViewItem*)item->nextSibling(); |
469 | } | 469 | } |
470 | } | 470 | } |
471 | else | 471 | else |
472 | return; | 472 | return; |
473 | if ( t.count() == 0 ) | 473 | if ( t.count() == 0 ) |
474 | return; | 474 | return; |
475 | RecMailP mail = t.first(); | 475 | RecMailP mail = t.first(); |
476 | mail->Wrapper()->deleteMailList(t); | 476 | mail->Wrapper()->deleteMailList(t); |
477 | folderView->refreshCurrent(); | 477 | folderView->refreshCurrent(); |
478 | 478 | ||
479 | 479 | ||
480 | } | 480 | } |
481 | void OpieMail::clearSelection() | 481 | void OpieMail::clearSelection() |
482 | { | 482 | { |
483 | mailView->clearSelection(); | 483 | mailView->clearSelection(); |
484 | 484 | ||
485 | } | 485 | } |
486 | 486 | ||
487 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 487 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
488 | { | 488 | { |
489 | if (!mailView->currentItem()) return; | 489 | if (!mailView->currentItem()) return; |
490 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 490 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
491 | /* just the RIGHT button - or hold on pda */ | 491 | /* just the RIGHT button - or hold on pda */ |
492 | if (button!=2) {return;} | 492 | if (button!=2) {return;} |
493 | if (!item) return; | 493 | if (!item) return; |
494 | QPopupMenu *m = new QPopupMenu(0); | 494 | QPopupMenu *m = new QPopupMenu(0); |
495 | if (m) | 495 | if (m) |
496 | { | 496 | { |
497 | if (mailtype==MAILLIB::A_NNTP) { | 497 | if (mailtype==MAILLIB::A_NNTP) { |
498 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 498 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
499 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 499 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
500 | m->insertSeparator(); | 500 | m->insertSeparator(); |
501 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 501 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
502 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 502 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
503 | } else { | 503 | } else { |
504 | if (folderView->currentisDraft()) { | 504 | if (folderView->currentisDraft()) { |
505 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 505 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
506 | } | 506 | } |
507 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 507 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
508 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 508 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
509 | m->insertSeparator(); | 509 | m->insertSeparator(); |
510 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 510 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
511 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 511 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
512 | m->insertSeparator(); | 512 | m->insertSeparator(); |
513 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 513 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
514 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 514 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
515 | m->insertSeparator(); | 515 | m->insertSeparator(); |
516 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 516 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
517 | } | 517 | } |
518 | m->setFocus(); | 518 | m->setFocus(); |
519 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 519 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
520 | delete m; | 520 | delete m; |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | void OpieMail::slotShowFolders( bool show ) | 524 | void OpieMail::slotShowFolders( bool show ) |
525 | { | 525 | { |
526 | if ( show && folderView->isHidden() ) | 526 | if ( show && folderView->isHidden() ) |
527 | { | 527 | { |
528 | folderView->show(); | 528 | folderView->show(); |
529 | } | 529 | } |
530 | else if ( !show && !folderView->isHidden() ) | 530 | else if ( !show && !folderView->isHidden() ) |
531 | { | 531 | { |
532 | folderView->hide(); | 532 | folderView->hide(); |
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 536 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
537 | { | 537 | { |
538 | MailListViewItem*item = 0; | 538 | MailListViewItem*item = 0; |
539 | mailView->clear(); | 539 | mailView->clear(); |
540 | 540 | ||
541 | QValueList<RecMailP>::ConstIterator it; | 541 | QValueList<RecMailP>::ConstIterator it; |
542 | for (it = list.begin(); it != list.end();++it) | 542 | for (it = list.begin(); it != list.end();++it) |
543 | { | 543 | { |
544 | item = new MailListViewItem(mailView,item); | 544 | item = new MailListViewItem(mailView,item); |
545 | item->storeData((*it)); | 545 | item->storeData((*it)); |
546 | item->showEntry(); | 546 | item->showEntry(); |
547 | } | 547 | } |
548 | mailView->setSorting ( 4, false ); | 548 | mailView->setSorting ( 4, false ); |
549 | } | 549 | } |
550 | 550 | ||
551 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 551 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
552 | { | 552 | { |
553 | mailView->clearSelection(); | 553 | mailView->clearSelection(); |
554 | /* just LEFT button - or tap with stylus on pda */ | 554 | /* just LEFT button - or tap with stylus on pda */ |
555 | //if (button!=1) return; | 555 | //if (button!=1) return; |
556 | if (!item) return; | 556 | if (!item) return; |
557 | if (folderView->currentisDraft()) { | 557 | if (folderView->currentisDraft()) { |
558 | reEditMail(); | 558 | reEditMail(); |
559 | } else { | 559 | } else { |
560 | displayMail(); | 560 | displayMail(); |
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | void OpieMail::slotMoveCopyMail() | 564 | void OpieMail::slotMoveCopyMail() |
565 | { | 565 | { |
566 | if (!mailView->currentItem()) return; | 566 | if (!mailView->currentItem()) return; |
567 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 567 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
568 | AbstractMail*targetMail = 0; | 568 | AbstractMail*targetMail = 0; |
569 | QString targetFolder = ""; | 569 | QString targetFolder = ""; |
570 | Selectstore sels; | 570 | Selectstore sels; |
571 | folderView->setupFolderselect(&sels); | 571 | folderView->setupFolderselect(&sels); |
572 | if (!sels.exec()) return; | 572 | if (!sels.exec()) return; |
573 | targetMail = sels.currentMail(); | 573 | targetMail = sels.currentMail(); |
574 | targetFolder = sels.currentFolder(); | 574 | targetFolder = sels.currentFolder(); |
575 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 575 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
576 | targetFolder.isEmpty()) | 576 | targetFolder.isEmpty()) |
577 | { | 577 | { |
578 | return; | 578 | return; |
579 | } | 579 | } |
580 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 580 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
581 | { | 581 | { |
582 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 582 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
583 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 583 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
584 | return; | 584 | return; |
585 | } | 585 | } |
586 | sels.hide(); | 586 | sels.hide(); |
587 | qApp->processEvents(); | 587 | qApp->processEvents(); |
588 | // qDebug("hiding sels "); | 588 | // qDebug("hiding sels "); |
589 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 589 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
590 | folderView->refreshCurrent(); | 590 | folderView->refreshCurrent(); |
591 | } | 591 | } |
592 | 592 | ||
593 | void OpieMail::slotMoveCopyAllMail() | 593 | void OpieMail::slotMoveCopyAllMail() |
594 | { | 594 | { |
595 | 595 | ||
596 | if (!mailView->currentItem()) return; | 596 | if (!mailView->currentItem()) return; |
597 | QValueList<RecMailP> t; | 597 | QValueList<RecMailP> t; |
598 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 598 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
599 | { | 599 | { |
600 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 600 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
601 | while ( item ) { | 601 | while ( item ) { |
602 | if ( item->isSelected() ) { | 602 | if ( item->isSelected() ) { |
603 | t.append( item->data() ); | 603 | t.append( item->data() ); |
604 | } | 604 | } |
605 | item = (MailListViewItem*)item->nextSibling(); | 605 | item = (MailListViewItem*)item->nextSibling(); |
606 | } | 606 | } |
607 | } | 607 | } |
608 | // else | 608 | // else |
609 | // return; | 609 | // return; |
610 | if ( t.count() == 0 ) | 610 | if ( t.count() == 0 ) |
611 | return; | 611 | return; |
612 | RecMailP mail = t.first(); | 612 | RecMailP mail = t.first(); |
613 | AbstractMail*targetMail = 0; | 613 | AbstractMail*targetMail = 0; |
614 | QString targetFolder = ""; | 614 | QString targetFolder = ""; |
615 | Selectstore sels; | 615 | Selectstore sels; |
616 | folderView->setupFolderselect(&sels); | 616 | folderView->setupFolderselect(&sels); |
617 | if (!sels.exec()) return; | 617 | if (!sels.exec()) return; |
618 | targetMail = sels.currentMail(); | 618 | targetMail = sels.currentMail(); |
619 | targetFolder = sels.currentFolder(); | 619 | targetFolder = sels.currentFolder(); |
620 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 620 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
621 | targetFolder.isEmpty()) | 621 | targetFolder.isEmpty()) |
622 | { | 622 | { |
623 | return; | 623 | return; |
624 | } | 624 | } |
625 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 625 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
626 | { | 626 | { |
627 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 627 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
628 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 628 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
629 | return; | 629 | return; |
630 | } | 630 | } |
631 | sels.hide(); | 631 | sels.hide(); |
632 | qApp->processEvents(); | 632 | qApp->processEvents(); |
633 | //qDebug("hiding sels "); | 633 | //qDebug("hiding sels "); |
634 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 634 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
635 | folderView->refreshCurrent(); | 635 | folderView->refreshCurrent(); |
636 | } | 636 | } |
637 | 637 | ||
638 | void OpieMail::reEditMail() | 638 | void OpieMail::reEditMail() |
639 | { | 639 | { |
640 | if (!mailView->currentItem()) return; | 640 | if (!mailView->currentItem()) return; |
641 | 641 | ||
642 | ComposeMail compose( settings, this, 0, true ); | 642 | ComposeMail compose( settings, this, 0, true ); |
643 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 643 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
644 | compose.slotAdjustColumns(); | 644 | compose.slotAdjustColumns(); |
645 | #ifndef DESKTOP_VERSION | 645 | #ifndef DESKTOP_VERSION |
646 | compose.showMaximized(); | 646 | compose.showMaximized(); |
647 | #else | 647 | #else |
648 | compose.resize(640,480); | 648 | compose.resize(640,480); |
649 | #endif | 649 | #endif |
650 | mCurrentComposer = &compose; | 650 | mCurrentComposer = &compose; |
651 | compose.exec(); | 651 | compose.exec(); |
652 | mCurrentComposer = 0; | 652 | mCurrentComposer = 0; |
653 | } | 653 | } |
654 | 654 | ||
655 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 655 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
656 | { | 656 | { |
657 | 657 | ||
658 | if ( mCurrentComposer ) { | 658 | if ( mCurrentComposer ) { |
659 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 659 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
660 | } else { | 660 | } else { |
661 | ComposeMail compose( settings, this, 0, true ); | 661 | ComposeMail compose( settings, this, 0, true ); |
662 | compose.slotAdjustColumns(); | 662 | compose.slotAdjustColumns(); |
663 | #ifndef DESKTOP_VERSION | 663 | #ifndef DESKTOP_VERSION |
664 | compose.showMaximized(); | 664 | compose.showMaximized(); |
665 | #endif | 665 | #endif |
666 | mCurrentComposer = &compose; | 666 | mCurrentComposer = &compose; |
667 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 667 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
668 | compose.exec(); | 668 | compose.exec(); |
669 | mCurrentComposer = 0; | 669 | mCurrentComposer = 0; |
670 | raise(); | 670 | raise(); |
671 | } | 671 | } |
672 | } | 672 | } |