summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2005-01-24 16:32:44 (UTC)
committer zautrix <zautrix>2005-01-24 16:32:44 (UTC)
commit6c89efd80c1e94a0c070025d07c7a4c656f2a81e (patch) (unidiff)
tree44e8cac0fe7b117be19ec8c1f14c9c888838fdb3 /kmicromail/opiemail.cpp
parentd4f5ce1bedd03191da5ecef2dc68381c10ef1fba (diff)
downloadkdepimpi-6c89efd80c1e94a0c070025d07c7a4c656f2a81e.zip
kdepimpi-6c89efd80c1e94a0c070025d07c7a4c656f2a81e.tar.gz
kdepimpi-6c89efd80c1e94a0c070025d07c7a4c656f2a81e.tar.bz2
view source
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 915b3e8..6e54bf4 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,76 +1,83 @@
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
5#define protected public
6#include <qwidget.h>
7#undef protected
4#include "koprefsdialog.h" 8#include "koprefsdialog.h"
5#include <kapplication.h> 9#include <kapplication.h>
6#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
7#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
8#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
9#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
10#endif 14#endif
11#include "settingsdialog.h" 15#include "settingsdialog.h"
12#include "opiemail.h" 16#include "opiemail.h"
13#include "editaccounts.h" 17#include "editaccounts.h"
14#include "composemail.h" 18#include "composemail.h"
15#include "mailistviewitem.h" 19#include "mailistviewitem.h"
16#include "viewmail.h" 20#include "viewmail.h"
17#include "selectstore.h" 21#include "selectstore.h"
18#include "selectsmtp.h" 22#include "selectsmtp.h"
19#include "accountitem.h" 23#include "accountitem.h"
20#include "klocale.h" 24#include "klocale.h"
21 25
22#include <qmessagebox.h> 26#include <qmessagebox.h>
23#include <qtimer.h> 27#include <qtimer.h>
24#include <qcursor.h> 28#include <qcursor.h>
29#include <qtextbrowser.h>
25#include <qregexp.h> 30#include <qregexp.h>
26#include <qpe/global.h> 31#include <qpe/global.h>
27 32
28#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
29#include <qapplication.h> 34#include <qapplication.h>
30#else 35#else
31#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
32#endif 37#endif
33#include <libmailwrapper/smtpwrapper.h> 38#include <libmailwrapper/smtpwrapper.h>
34#include <libmailwrapper/mailtypes.h> 39#include <libmailwrapper/mailtypes.h>
35#include <libmailwrapper/abstractmail.h> 40#include <libmailwrapper/abstractmail.h>
36#include "koprefs.h" 41#include "koprefs.h"
37 42
38//using namespace Opie::Core; 43//using namespace Opie::Core;
39 44
40OpieMail::OpieMail( QWidget *parent, const char *name ) 45OpieMail::OpieMail( QWidget *parent, const char *name )
41 : MainWindow( parent, name) //, WStyle_ContextHelp ) 46 : MainWindow( parent, name) //, WStyle_ContextHelp )
42{ 47{
43 settings = new Settings(); 48 settings = new Settings();
44 49 tb = 0;
45 setIcon(SmallIcon( "kmicromail" ) ); 50 setIcon(SmallIcon( "kmicromail" ) );
46 folderView->populate( settings->getAccounts() ); 51 folderView->populate( settings->getAccounts() );
47 52
48} 53}
49 54
50OpieMail::~OpieMail() 55OpieMail::~OpieMail()
51{ 56{
52 if (settings) delete settings; 57 if (settings) delete settings;
58 if ( tb )
59 delete tb;
53} 60}
54 61
55void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 62void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
56{ 63{
57 64
58} 65}
59#include <stdlib.h> 66#include <stdlib.h>
60void OpieMail::message(const QCString &msg, const QByteArray &data) 67void OpieMail::message(const QCString &msg, const QByteArray &data)
61{ 68{
62 // copied from old mail2 69 // copied from old mail2
63 static int ii = 0; 70 static int ii = 0;
64 //qDebug("QCOP CALL ############################# %d ", ii); 71 //qDebug("QCOP CALL ############################# %d ", ii);
65 //QString mess ( msg ); 72 //QString mess ( msg );
66 //qDebug("Message = %s ",mess.latin1()); 73 //qDebug("Message = %s ",mess.latin1());
67 ++ii; 74 ++ii;
68 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 75 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
69 76
70 mPendingEmail = QString::null; 77 mPendingEmail = QString::null;
71 mPendingName = QString::null; 78 mPendingName = QString::null;
72 if (msg == "writeMail(QString,QString)") 79 if (msg == "writeMail(QString,QString)")
73 { 80 {
74 //qDebug("writeMail(QString,QString) "); 81 //qDebug("writeMail(QString,QString) ");
75 QDataStream stream(data,IO_ReadOnly); 82 QDataStream stream(data,IO_ReadOnly);
76 stream >> mPendingName >> mPendingEmail; 83 stream >> mPendingName >> mPendingEmail;
@@ -282,48 +289,55 @@ void OpieMail::replyMail()
282 else prefix = "Re: "; // no i18n on purpose 289 else prefix = "Re: "; // no i18n on purpose
283 290
284 Settings *settings = new Settings(); 291 Settings *settings = new Settings();
285 ComposeMail composer( settings ,this, 0, true); 292 ComposeMail composer( settings ,this, 0, true);
286 if (mail->Replyto().isEmpty()) { 293 if (mail->Replyto().isEmpty()) {
287 composer.setTo( mail->getFrom()); 294 composer.setTo( mail->getFrom());
288 } else { 295 } else {
289 composer.setTo( mail->Replyto()); 296 composer.setTo( mail->Replyto());
290 } 297 }
291 composer.setSubject( prefix + mail->getSubject()); 298 composer.setSubject( prefix + mail->getSubject());
292 composer.setMessage( rtext ); 299 composer.setMessage( rtext );
293 composer.setInReplyTo( mail->Msgid()); 300 composer.setInReplyTo( mail->Msgid());
294 composer.setCharset( body->getCharset() ); 301 composer.setCharset( body->getCharset() );
295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 302 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
296 { 303 {
297 mail->Wrapper()->answeredMail(mail); 304 mail->Wrapper()->answeredMail(mail);
298 } 305 }
299 delete settings; 306 delete settings;
300 307
301} 308}
302void OpieMail::closeViewMail(ViewMail * vm) 309void OpieMail::closeViewMail(ViewMail * vm)
303{ 310{
304 vm->hide(); 311 vm->hide();
305} 312}
313
314void OpieMail::slotDownloadMail( )
315{
316 qDebug("slotDownloadMail( ) ");
317}
318
319
306void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 320void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
307{ 321{
308 QListViewItem*item = mailView->currentItem(); 322 QListViewItem*item = mailView->currentItem();
309 if (!item ) { 323 if (!item ) {
310 closeViewMail(vm); 324 closeViewMail(vm);
311 return; 325 return;
312 } 326 }
313 RecMailP mail = ((MailListViewItem*)item)->data(); 327 RecMailP mail = ((MailListViewItem*)item)->data();
314 mail->Wrapper()->deleteMail( mail ); 328 mail->Wrapper()->deleteMail( mail );
315 item = item->itemBelow(); 329 item = item->itemBelow();
316 if (!item ) { 330 if (!item ) {
317 closeViewMail(vm); 331 closeViewMail(vm);
318 return; 332 return;
319 } 333 }
320 mailView->setCurrentItem(item); 334 mailView->setCurrentItem(item);
321 mail = ((MailListViewItem*)item)->data(); 335 mail = ((MailListViewItem*)item)->data();
322 RecBodyP body = folderView->fetchBody(mail); 336 RecBodyP body = folderView->fetchBody(mail);
323 vm->setBody( body ); 337 vm->setBody( body );
324 vm->setMail( mail ); 338 vm->setMail( mail );
325} 339}
326void OpieMail::displayNextMail(ViewMail * vm) 340void OpieMail::displayNextMail(ViewMail * vm)
327{ 341{
328 QListViewItem*item = mailView->currentItem(); 342 QListViewItem*item = mailView->currentItem();
329 if (!item) return; 343 if (!item) return;
@@ -334,48 +348,49 @@ void OpieMail::displayNextMail(ViewMail * vm)
334 return; 348 return;
335 } 349 }
336 mailView->setCurrentItem(item); 350 mailView->setCurrentItem(item);
337 RecMailP mail = ((MailListViewItem*)item)->data(); 351 RecMailP mail = ((MailListViewItem*)item)->data();
338 RecBodyP body = folderView->fetchBody(mail); 352 RecBodyP body = folderView->fetchBody(mail);
339 vm->setBody( body ); 353 vm->setBody( body );
340 vm->setMail( mail ); 354 vm->setMail( mail );
341} 355}
342void OpieMail::displayMail() 356void OpieMail::displayMail()
343{ 357{
344 QListViewItem*item = mailView->currentItem(); 358 QListViewItem*item = mailView->currentItem();
345 if (!item) return; 359 if (!item) return;
346 RecMailP mail = ((MailListViewItem*)item)->data(); 360 RecMailP mail = ((MailListViewItem*)item)->data();
347 RecBodyP body = folderView->fetchBody(mail); 361 RecBodyP body = folderView->fetchBody(mail);
348 ViewMail readMail( this,"", Qt::WType_Modal ); 362 ViewMail readMail( this,"", Qt::WType_Modal );
349 readMail.setBody( body ); 363 readMail.setBody( body );
350 readMail.setMail( mail ); 364 readMail.setMail( mail );
351#ifndef DESKTOP_VERSION 365#ifndef DESKTOP_VERSION
352 readMail.showMaximized(); 366 readMail.showMaximized();
353#else 367#else
354 readMail.resize( 640, 480); 368 readMail.resize( 640, 480);
355#endif 369#endif
356 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 370 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
357 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 371 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
372 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
358 373
359 readMail.exec(); 374 readMail.exec();
360 375
361 if ( readMail.deleted ) 376 if ( readMail.deleted )
362 { 377 {
363 folderView->refreshCurrent(); 378 folderView->refreshCurrent();
364 } 379 }
365 else 380 else
366 { 381 {
367 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 382 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
368 } 383 }
369} 384}
370void OpieMail::slotGetAllMail() 385void OpieMail::slotGetAllMail()
371{ 386{
372 QListViewItem * item = folderView->firstChild(); 387 QListViewItem * item = folderView->firstChild();
373 while ( item ){ 388 while ( item ){
374 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 389 ((AccountViewItem *)item)->contextMenuSelected( 101 );
375 item = item->nextSibling (); 390 item = item->nextSibling ();
376 } 391 }
377} 392}
378void OpieMail::slotGetMail() 393void OpieMail::slotGetMail()
379{ 394{
380 QListViewItem * item = folderView->currentItem(); 395 QListViewItem * item = folderView->currentItem();
381 if ( ! item ) return; 396 if ( ! item ) return;