summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2005-06-10 11:53:12 (UTC)
committer zautrix <zautrix>2005-06-10 11:53:12 (UTC)
commitd2f00fc2034450bc9a3cd1d2c3510bef1758d3bc (patch) (unidiff)
tree0764371abfdb5d663ffebf408d47d49f0ca919f3 /kmicromail/opiemail.cpp
parente5ca8e0d8d6d08b597253f43de401aa1a99a6abe (diff)
downloadkdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.zip
kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.gz
kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.bz2
config dialog changes
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 4436ad6..8ac3451 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -55,384 +55,389 @@ OpieMail::OpieMail( QWidget *parent, const char *name )
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 folderView->setFocus(); 56 folderView->setFocus();
57} 57}
58 58
59OpieMail::~OpieMail() 59OpieMail::~OpieMail()
60{ 60{
61 if (settings) delete settings; 61 if (settings) delete settings;
62 if ( tb ) 62 if ( tb )
63 delete tb; 63 delete tb;
64} 64}
65 65
66void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 66void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
67{ 67{
68 68
69} 69}
70#include <stdlib.h> 70#include <stdlib.h>
71void OpieMail::message(const QCString &msg, const QByteArray &data) 71void OpieMail::message(const QCString &msg, const QByteArray &data)
72{ 72{
73 // copied from old mail2 73 // copied from old mail2
74 static int ii = 0; 74 static int ii = 0;
75 //qDebug("QCOP CALL ############################# %d ", ii); 75 //qDebug("QCOP CALL ############################# %d ", ii);
76 //QString mess ( msg ); 76 //QString mess ( msg );
77 //qDebug("Message = %s ",mess.latin1()); 77 //qDebug("Message = %s ",mess.latin1());
78 ++ii; 78 ++ii;
79 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 79 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
80 80
81 mPendingEmail = QString::null; 81 mPendingEmail = QString::null;
82 mPendingName = QString::null; 82 mPendingName = QString::null;
83 if (msg == "writeMail(QString,QString)") 83 if (msg == "writeMail(QString,QString)")
84 { 84 {
85 //qDebug("writeMail(QString,QString) "); 85 //qDebug("writeMail(QString,QString) ");
86 QDataStream stream(data,IO_ReadOnly); 86 QDataStream stream(data,IO_ReadOnly);
87 stream >> mPendingName >> mPendingEmail; 87 stream >> mPendingName >> mPendingEmail;
88 // removing the whitespaces at beginning and end is needed! 88 // removing the whitespaces at beginning and end is needed!
89 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 89 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
90 } 90 }
91 else if (msg == "newMail()") 91 else if (msg == "newMail()")
92 { 92 {
93 //qDebug("slotComposeMail() "); 93 //qDebug("slotComposeMail() ");
94 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 94 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
95 // and a QCOP call does not like a processevents in his execution 95 // and a QCOP call does not like a processevents in his execution
96 // with the Qtimer we call slotComposeMail() after we reached the main event loop 96 // with the Qtimer we call slotComposeMail() after we reached the main event loop
97 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 97 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
98 // slotComposeMail(); 98 // slotComposeMail();
99 } 99 }
100 else if (msg == "newMail(QString)") 100 else if (msg == "newMail(QString)")
101 { 101 {
102 //qDebug(" newMail(QString)"); 102 //qDebug(" newMail(QString)");
103 QDataStream stream(data,IO_ReadOnly); 103 QDataStream stream(data,IO_ReadOnly);
104 stream >> mPendingName; 104 stream >> mPendingName;
105 // the format is 105 // the format is
106 // NAME <EMAIL>:SUBJECT 106 // NAME <EMAIL>:SUBJECT
107 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 107 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
108 } else { 108 } else {
109 mPendingData = data; 109 mPendingData = data;
110 mPendingMessage = msg; 110 mPendingMessage = msg;
111 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 111 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
112 } 112 }
113 113
114 //qDebug("END OpieMail::message "); 114 //qDebug("END OpieMail::message ");
115} 115}
116void OpieMail::slotExtAppHandler() 116void OpieMail::slotExtAppHandler()
117{ 117{
118 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 118 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
119} 119}
120void OpieMail::slotwriteMail2(const QString& namemail ) 120void OpieMail::slotwriteMail2(const QString& namemail )
121{ 121{
122 //qDebug("OpieMail::slotwriteMail2 "); 122 //qDebug("OpieMail::slotwriteMail2 ");
123 //qApp->processEvents(); 123 //qApp->processEvents();
124 ComposeMail compose( settings, this, 0, true ); 124 ComposeMail compose( settings, this, 0, true );
125 if ( !namemail.isEmpty() ) { 125 if ( !namemail.isEmpty() ) {
126 QString to = namemail; 126 QString to = namemail;
127 if ( namemail.find( " <") > 1 ) { 127 if ( namemail.find( " <") > 1 ) {
128 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 128 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
129 } else 129 } else
130 if ( namemail.find( "<") > 1 ) { 130 if ( namemail.find( "<") > 1 ) {
131 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 131 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
132 } 132 }
133 int sub = to.find( ">:"); 133 int sub = to.find( ">:");
134 if ( sub > 0 ) { 134 if ( sub > 0 ) {
135 compose.setTo( to.left(sub+1) ); 135 compose.setTo( to.left(sub+1) );
136 compose.setSubject( to.mid(sub+2) ); 136 compose.setSubject( to.mid(sub+2) );
137 } else 137 } else
138 compose.setTo( to ); 138 compose.setTo( to );
139 } 139 }
140 compose.slotAdjustColumns(); 140 compose.slotAdjustColumns();
141#ifndef DESKTOP_VERSION 141#ifndef DESKTOP_VERSION
142 compose.showMaximized(); 142 compose.showMaximized();
143#endif 143#endif
144 mCurrentComposer = &compose; 144 mCurrentComposer = &compose;
145 compose.exec(); 145 compose.exec();
146 mCurrentComposer = 0; 146 mCurrentComposer = 0;
147 folderView->refreshOutgoing(); 147 folderView->refreshOutgoing();
148 raise(); 148 raise();
149 //qDebug("retttich "); 149 //qDebug("retttich ");
150} 150}
151void OpieMail::slotwriteMail(const QString&name,const QString&email) 151void OpieMail::slotwriteMail(const QString&name,const QString&email)
152{ 152{
153 // qDebug("OpieMail::slotwriteMail "); 153 // qDebug("OpieMail::slotwriteMail ");
154 ComposeMail compose( settings, this, 0, true ); 154 ComposeMail compose( settings, this, 0, true );
155 if (!email.isEmpty()) 155 if (!email.isEmpty())
156 { 156 {
157 if (!name.isEmpty()) 157 if (!name.isEmpty())
158 { 158 {
159 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 159 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
160 } 160 }
161 else 161 else
162 { 162 {
163 compose.setTo(email); 163 compose.setTo(email);
164 } 164 }
165 } 165 }
166 compose.slotAdjustColumns(); 166 compose.slotAdjustColumns();
167#ifndef DESKTOP_VERSION 167#ifndef DESKTOP_VERSION
168 compose.showMaximized(); 168 compose.showMaximized();
169#endif 169#endif
170 170
171 mCurrentComposer = &compose; 171 mCurrentComposer = &compose;
172 compose.exec(); 172 compose.exec();
173 mCurrentComposer = 0; 173 mCurrentComposer = 0;
174 folderView->refreshOutgoing(); 174 folderView->refreshOutgoing();
175 raise(); 175 raise();
176} 176}
177 177
178void OpieMail::slotComposeMail() 178void OpieMail::slotComposeMail()
179{ 179{
180 if ( mPendingEmail == QString::null && mPendingName == QString::null) 180 if ( mPendingEmail == QString::null && mPendingName == QString::null)
181 slotwriteMail2( QString () ); 181 slotwriteMail2( QString () );
182 else { 182 else {
183 if ( mPendingEmail == QString::null ) 183 if ( mPendingEmail == QString::null )
184 slotwriteMail2( mPendingName ); 184 slotwriteMail2( mPendingName );
185 else 185 else
186 slotwriteMail( mPendingName, mPendingEmail ); 186 slotwriteMail( mPendingName, mPendingEmail );
187 } 187 }
188 //slotwriteMail(0l,0l); 188 //slotwriteMail(0l,0l);
189} 189}
190 190
191void OpieMail::slotSendQueued() 191void OpieMail::slotSendQueued()
192{ 192{
193 SMTPaccount *smtp = 0; 193 SMTPaccount *smtp = 0;
194 194
195 QList<Account> list = settings->getAccounts(); 195 QList<Account> list = settings->getAccounts();
196 QList<SMTPaccount> smtpList; 196 QList<SMTPaccount> smtpList;
197 smtpList.setAutoDelete(false); 197 smtpList.setAutoDelete(false);
198 Account *it; 198 Account *it;
199 for ( it = list.first(); it; it = list.next() ) 199 for ( it = list.first(); it; it = list.next() )
200 { 200 {
201 if ( it->getType() == MAILLIB::A_SMTP ) 201 if ( it->getType() == MAILLIB::A_SMTP )
202 { 202 {
203 smtp = static_cast<SMTPaccount *>(it); 203 smtp = static_cast<SMTPaccount *>(it);
204 smtpList.append(smtp); 204 smtpList.append(smtp);
205 } 205 }
206 } 206 }
207 if (smtpList.count()==0) 207 if (smtpList.count()==0)
208 { 208 {
209 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n")); 209 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n"));
210 return; 210 return;
211 } 211 }
212 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 212 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
213 return; 213 return;
214 if (smtpList.count()==1) 214 if (smtpList.count()==1)
215 { 215 {
216 smtp = smtpList.at(0); 216 smtp = smtpList.at(0);
217 } 217 }
218 else 218 else
219 { 219 {
220 smtp = 0; 220 smtp = 0;
221 selectsmtp selsmtp; 221 selectsmtp selsmtp;
222 selsmtp.setSelectionlist(&smtpList); 222 selsmtp.setSelectionlist(&smtpList);
223 selsmtp.resize( selsmtp.sizeHint() ); 223 selsmtp.resize( selsmtp.sizeHint() );
224 if ( selsmtp.exec() == QDialog::Accepted ) 224 if ( selsmtp.exec() == QDialog::Accepted )
225 { 225 {
226 smtp = selsmtp.selected_smtp(); 226 smtp = selsmtp.selected_smtp();
227 } 227 }
228 } 228 }
229 if (smtp) 229 if (smtp)
230 { 230 {
231 231
232 Global::statusMessage("Sending mails...!"); 232 Global::statusMessage("Sending mails...!");
233 SMTPwrapper * wrap = new SMTPwrapper(smtp); 233 SMTPwrapper * wrap = new SMTPwrapper(smtp);
234 if ( wrap->flushOutbox() ) 234 if ( wrap->flushOutbox() )
235 { 235 {
236 Global::statusMessage("Mails sent!"); 236 Global::statusMessage("Mails sent!");
237 } 237 }
238 delete wrap; 238 delete wrap;
239 } 239 }
240 folderView->refreshOutgoing(); 240 folderView->refreshOutgoing();
241} 241}
242 242
243void OpieMail::slotSearchMails() 243void OpieMail::slotSearchMails()
244{ 244{
245 qDebug("OpieMail::slotSearchMails():not implemented "); 245 qDebug("OpieMail::slotSearchMails():not implemented ");
246} 246}
247void OpieMail::slotEditGlobalSettings()
248{
249 KPimPrefsGlobalDialog gc ( this );
250 gc.exec();
251}
247 252
248void OpieMail::slotEditSettings() 253void OpieMail::slotEditSettings()
249{ 254{
250 255
251 KOPrefsDialog settingsDialog( this, "koprefs", true ); 256 KOPrefsDialog settingsDialog( this, "koprefs", true );
252#ifndef DESKTOP_VERSION 257#ifndef DESKTOP_VERSION
253 settingsDialog.showMaximized(); 258 settingsDialog.showMaximized();
254#endif 259#endif
255 settingsDialog.exec(); 260 settingsDialog.exec();
256 261
257 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 262 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
258 // KApplication::execDialog(settingsDialog); 263 // KApplication::execDialog(settingsDialog);
259} 264}
260 265
261void OpieMail::slotEditAccounts() 266void OpieMail::slotEditAccounts()
262{ 267{
263 EditAccounts eaDialog( settings, this, 0, true ); 268 EditAccounts eaDialog( settings, this, 0, true );
264 eaDialog.slotAdjustColumns(); 269 eaDialog.slotAdjustColumns();
265#ifndef DESKTOP_VERSION 270#ifndef DESKTOP_VERSION
266 eaDialog.showMaximized(); 271 eaDialog.showMaximized();
267#endif 272#endif
268 eaDialog.exec(); 273 eaDialog.exec();
269 if ( settings ) delete settings; 274 if ( settings ) delete settings;
270 settings = new Settings(); 275 settings = new Settings();
271 276
272 folderView->populate( settings->getAccounts() ); 277 folderView->populate( settings->getAccounts() );
273} 278}
274void OpieMail::replyMail() 279void OpieMail::replyMail()
275{ 280{
276 281
277 QListViewItem*item = mailView->currentItem(); 282 QListViewItem*item = mailView->currentItem();
278 if (!item) return; 283 if (!item) return;
279 RecMailP mail = ((MailListViewItem*)item)->data(); 284 RecMailP mail = ((MailListViewItem*)item)->data();
280 RecBodyP body = folderView->fetchBody(mail); 285 RecBodyP body = folderView->fetchBody(mail);
281 286
282 QString rtext; 287 QString rtext;
283 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 288 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
284 .arg( mail->getFrom()) 289 .arg( mail->getFrom())
285 .arg( mail->getDate()); 290 .arg( mail->getDate());
286 291
287 QString text = body->Bodytext(); 292 QString text = body->Bodytext();
288 QStringList lines = QStringList::split(QRegExp("\\n"), text); 293 QStringList lines = QStringList::split(QRegExp("\\n"), text);
289 QStringList::Iterator it; 294 QStringList::Iterator it;
290 for (it = lines.begin(); it != lines.end(); it++) 295 for (it = lines.begin(); it != lines.end(); it++)
291 { 296 {
292 rtext += "> " + *it + "\n"; 297 rtext += "> " + *it + "\n";
293 } 298 }
294 rtext += "\n"; 299 rtext += "\n";
295 300
296 QString prefix; 301 QString prefix;
297 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 302 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
298 else prefix = "Re: "; // no i18n on purpose 303 else prefix = "Re: "; // no i18n on purpose
299 304
300 Settings *settings = new Settings(); 305 Settings *settings = new Settings();
301 ComposeMail composer( settings ,this, 0, true); 306 ComposeMail composer( settings ,this, 0, true);
302 if (mail->Replyto().isEmpty()) { 307 if (mail->Replyto().isEmpty()) {
303 composer.setTo( mail->getFrom()); 308 composer.setTo( mail->getFrom());
304 } else { 309 } else {
305 composer.setTo( mail->Replyto()); 310 composer.setTo( mail->Replyto());
306 } 311 }
307 composer.setSubject( prefix + mail->getSubject()); 312 composer.setSubject( prefix + mail->getSubject());
308 composer.setMessage( rtext ); 313 composer.setMessage( rtext );
309 composer.setInReplyTo( mail->Msgid()); 314 composer.setInReplyTo( mail->Msgid());
310 composer.setCharset( body->getCharset() ); 315 composer.setCharset( body->getCharset() );
311 316
312 mCurrentComposer = &composer; 317 mCurrentComposer = &composer;
313 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 318 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
314 { 319 {
315 mail->Wrapper()->answeredMail(mail); 320 mail->Wrapper()->answeredMail(mail);
316 } 321 }
317 mCurrentComposer = 0; 322 mCurrentComposer = 0;
318 folderView->refreshOutgoing(); 323 folderView->refreshOutgoing();
319 delete settings; 324 delete settings;
320 325
321} 326}
322void OpieMail::closeViewMail(ViewMail * vm) 327void OpieMail::closeViewMail(ViewMail * vm)
323{ 328{
324 vm->hide(); 329 vm->hide();
325} 330}
326 331
327void OpieMail::slotDownloadMail( ) 332void OpieMail::slotDownloadMail( )
328{ 333{
329 QListViewItem*item = mailView->currentItem(); 334 QListViewItem*item = mailView->currentItem();
330 if (!item ) { 335 if (!item ) {
331 Global::statusMessage("Error: No item slected!"); 336 Global::statusMessage("Error: No item slected!");
332 return; 337 return;
333 } 338 }
334 RecMailP mail = ((MailListViewItem*)item)->data(); 339 RecMailP mail = ((MailListViewItem*)item)->data();
335 Account * acc = mail->Wrapper()->getAccount(); 340 Account * acc = mail->Wrapper()->getAccount();
336 if ( !acc ) { 341 if ( !acc ) {
337 Global::statusMessage("Mail is already stored locally!"); 342 Global::statusMessage("Mail is already stored locally!");
338 return; 343 return;
339 } 344 }
340 QString lfName = acc->getLocalFolder(); 345 QString lfName = acc->getLocalFolder();
341 //qDebug("local folder " + lfName ); 346 //qDebug("local folder " + lfName );
342 if ( lfName.isEmpty() ) 347 if ( lfName.isEmpty() )
343 lfName = acc->getAccountName(); 348 lfName = acc->getAccountName();
344 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); 349 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
345 //qDebug("target %d %d ",targetMail,mail->Wrapper() ); 350 //qDebug("target %d %d ",targetMail,mail->Wrapper() );
346 if ( targetMail == mail->Wrapper() ) { 351 if ( targetMail == mail->Wrapper() ) {
347 Global::statusMessage("Mail is already locally stored!"); 352 Global::statusMessage("Mail is already locally stored!");
348 return; 353 return;
349 } 354 }
350 if ( !targetMail->createMbox(lfName)) { 355 if ( !targetMail->createMbox(lfName)) {
351 Global::statusMessage("Error creating folder!"); 356 Global::statusMessage("Error creating folder!");
352 return; 357 return;
353 } 358 }
354 Global::statusMessage("Fetching mail...please wait!"); 359 Global::statusMessage("Fetching mail...please wait!");
355 qApp->processEvents(); 360 qApp->processEvents();
356 encodedString*st = 0; 361 encodedString*st = 0;
357 st = mail->Wrapper()->fetchRawBody(mail); 362 st = mail->Wrapper()->fetchRawBody(mail);
358 if ( st ) { 363 if ( st ) {
359 targetMail->storeMessage(st->Content(),st->Length(),lfName); 364 targetMail->storeMessage(st->Content(),st->Length(),lfName);
360 Global::statusMessage("Mail stored in "+ lfName); 365 Global::statusMessage("Mail stored in "+ lfName);
361 delete st; 366 delete st;
362 } else { 367 } else {
363 Global::statusMessage("Error: Cannot fetch mail!"); 368 Global::statusMessage("Error: Cannot fetch mail!");
364 } 369 }
365} 370}
366 371
367 372
368void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 373void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
369{ 374{
370 QListViewItem*item = mailView->currentItem(); 375 QListViewItem*item = mailView->currentItem();
371 if (!item ) { 376 if (!item ) {
372 closeViewMail(vm); 377 closeViewMail(vm);
373 return; 378 return;
374 } 379 }
375 RecMailP mail = ((MailListViewItem*)item)->data(); 380 RecMailP mail = ((MailListViewItem*)item)->data();
376 mail->Wrapper()->deleteMail( mail ); 381 mail->Wrapper()->deleteMail( mail );
377 item = item->itemBelow(); 382 item = item->itemBelow();
378 if (!item ) { 383 if (!item ) {
379 closeViewMail(vm); 384 closeViewMail(vm);
380 return; 385 return;
381 } 386 }
382 mailView->setCurrentItem(item); 387 mailView->setCurrentItem(item);
383 mail = ((MailListViewItem*)item)->data(); 388 mail = ((MailListViewItem*)item)->data();
384 RecBodyP body = folderView->fetchBody(mail); 389 RecBodyP body = folderView->fetchBody(mail);
385 vm->setBody( body ); 390 vm->setBody( body );
386 vm->setMail( mail ); 391 vm->setMail( mail );
387} 392}
388void OpieMail::displayNextMail(ViewMail * vm) 393void OpieMail::displayNextMail(ViewMail * vm)
389{ 394{
390 QListViewItem*item = mailView->currentItem(); 395 QListViewItem*item = mailView->currentItem();
391 if (!item) return; 396 if (!item) return;
392 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 397 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
393 item = item->itemBelow(); 398 item = item->itemBelow();
394 if (!item) { 399 if (!item) {
395 vm->setCaption(i18n("End of List" )); 400 vm->setCaption(i18n("End of List" ));
396 return; 401 return;
397 } 402 }
398 mailView->setCurrentItem(item); 403 mailView->setCurrentItem(item);
399 RecMailP mail = ((MailListViewItem*)item)->data(); 404 RecMailP mail = ((MailListViewItem*)item)->data();
400 RecBodyP body = folderView->fetchBody(mail); 405 RecBodyP body = folderView->fetchBody(mail);
401 vm->setBody( body ); 406 vm->setBody( body );
402 vm->setMail( mail ); 407 vm->setMail( mail );
403} 408}
404void OpieMail::displayMail() 409void OpieMail::displayMail()
405{ 410{
406 QListViewItem*item = mailView->currentItem(); 411 QListViewItem*item = mailView->currentItem();
407 if (!item) return; 412 if (!item) return;
408 RecMailP mail = ((MailListViewItem*)item)->data(); 413 RecMailP mail = ((MailListViewItem*)item)->data();
409 RecBodyP body = folderView->fetchBody(mail); 414 RecBodyP body = folderView->fetchBody(mail);
410 ViewMail readMail( this,"", Qt::WType_Modal ); 415 ViewMail readMail( this,"", Qt::WType_Modal );
411 readMail.setBody( body ); 416 readMail.setBody( body );
412 readMail.setMail( mail ); 417 readMail.setMail( mail );
413#ifndef DESKTOP_VERSION 418#ifndef DESKTOP_VERSION
414 readMail.showMaximized(); 419 readMail.showMaximized();
415#else 420#else
416 readMail.resize( 640, 480); 421 readMail.resize( 640, 480);
417#endif 422#endif
418 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 423 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
419 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 424 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
420 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); 425 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
421 426
422 readMail.exec(); 427 readMail.exec();
423 428
424 if ( readMail.deleted ) 429 if ( readMail.deleted )
425 { 430 {
426 folderView->refreshCurrent(); 431 folderView->refreshCurrent();
427 } 432 }
428 else 433 else
429 { 434 {
430 QListViewItem*item = mailView->currentItem(); 435 QListViewItem*item = mailView->currentItem();
431 if (item) 436 if (item)
432 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 437 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
433 } 438 }
434} 439}
435void OpieMail::slotGetAllMail() 440void OpieMail::slotGetAllMail()
436{ 441{
437 QListViewItem * item = folderView->firstChild(); 442 QListViewItem * item = folderView->firstChild();
438 while ( item ){ 443 while ( item ){