author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kmicromail/opiemail.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kmicromail/opiemail.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 75a75b9..f453be5 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -3,8 +3,13 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | #define protected public | 5 | #define protected public |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3ValueList> | ||
9 | #include <Q3CString> | ||
10 | #include <QPixmap> | ||
11 | #include <Q3PopupMenu> | ||
7 | #undef protected | 12 | #undef protected |
8 | #include "koprefsdialog.h" | 13 | #include "koprefsdialog.h" |
9 | #include <kapplication.h> | 14 | #include <kapplication.h> |
10 | #include <libkdepim/externalapphandler.h> | 15 | #include <libkdepim/externalapphandler.h> |
@@ -26,9 +31,9 @@ | |||
26 | 31 | ||
27 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
28 | #include <qtimer.h> | 33 | #include <qtimer.h> |
29 | #include <qcursor.h> | 34 | #include <qcursor.h> |
30 | #include <qtextbrowser.h> | 35 | #include <q3textbrowser.h> |
31 | #include <qregexp.h> | 36 | #include <qregexp.h> |
32 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
33 | 38 | ||
34 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
@@ -62,14 +67,14 @@ OpieMail::~OpieMail() | |||
62 | if ( tb ) | 67 | if ( tb ) |
63 | delete tb; | 68 | delete tb; |
64 | } | 69 | } |
65 | 70 | ||
66 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 71 | void OpieMail::appMessage(const Q3CString &msg, const QByteArray &data) |
67 | { | 72 | { |
68 | 73 | ||
69 | } | 74 | } |
70 | #include <stdlib.h> | 75 | #include <stdlib.h> |
71 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 76 | void OpieMail::message(const Q3CString &msg, const QByteArray &data) |
72 | { | 77 | { |
73 | // copied from old mail2 | 78 | // copied from old mail2 |
74 | static int ii = 0; | 79 | static int ii = 0; |
75 | //qDebug("QCOP CALL ############################# %d ", ii); | 80 | //qDebug("QCOP CALL ############################# %d ", ii); |
@@ -82,9 +87,9 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) | |||
82 | mPendingName = QString::null; | 87 | mPendingName = QString::null; |
83 | if (msg == "writeMail(QString,QString)") | 88 | if (msg == "writeMail(QString,QString)") |
84 | { | 89 | { |
85 | //qDebug("writeMail(QString,QString) "); | 90 | //qDebug("writeMail(QString,QString) "); |
86 | QDataStream stream(data,IO_ReadOnly); | 91 | QDataStream stream(data,QIODevice::ReadOnly); |
87 | stream >> mPendingName >> mPendingEmail; | 92 | stream >> mPendingName >> mPendingEmail; |
88 | // removing the whitespaces at beginning and end is needed! | 93 | // removing the whitespaces at beginning and end is needed! |
89 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 94 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
90 | } | 95 | } |
@@ -99,9 +104,9 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) | |||
99 | } | 104 | } |
100 | else if (msg == "newMail(QString)") | 105 | else if (msg == "newMail(QString)") |
101 | { | 106 | { |
102 | //qDebug(" newMail(QString)"); | 107 | //qDebug(" newMail(QString)"); |
103 | QDataStream stream(data,IO_ReadOnly); | 108 | QDataStream stream(data,QIODevice::ReadOnly); |
104 | stream >> mPendingName; | 109 | stream >> mPendingName; |
105 | // the format is | 110 | // the format is |
106 | // NAME <EMAIL>:SUBJECT | 111 | // NAME <EMAIL>:SUBJECT |
107 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 112 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
@@ -278,9 +283,9 @@ void OpieMail::slotEditAccounts() | |||
278 | } | 283 | } |
279 | void OpieMail::replyMail() | 284 | void OpieMail::replyMail() |
280 | { | 285 | { |
281 | 286 | ||
282 | QListViewItem*item = mailView->currentItem(); | 287 | Q3ListViewItem*item = mailView->currentItem(); |
283 | if (!item) return; | 288 | if (!item) return; |
284 | RecMailP mail = ((MailListViewItem*)item)->data(); | 289 | RecMailP mail = ((MailListViewItem*)item)->data(); |
285 | RecBodyP body = folderView->fetchBody(mail); | 290 | RecBodyP body = folderView->fetchBody(mail); |
286 | 291 | ||
@@ -330,9 +335,9 @@ void OpieMail::closeViewMail(ViewMail * vm) | |||
330 | } | 335 | } |
331 | 336 | ||
332 | void OpieMail::slotDownloadMail( ) | 337 | void OpieMail::slotDownloadMail( ) |
333 | { | 338 | { |
334 | QListViewItem*item = mailView->currentItem(); | 339 | Q3ListViewItem*item = mailView->currentItem(); |
335 | if (!item ) { | 340 | if (!item ) { |
336 | Global::statusMessage("Error: No item slected!"); | 341 | Global::statusMessage("Error: No item slected!"); |
337 | return; | 342 | return; |
338 | } | 343 | } |
@@ -371,9 +376,9 @@ void OpieMail::slotDownloadMail( ) | |||
371 | 376 | ||
372 | 377 | ||
373 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 378 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) |
374 | { | 379 | { |
375 | QListViewItem*item = mailView->currentItem(); | 380 | Q3ListViewItem*item = mailView->currentItem(); |
376 | if (!item ) { | 381 | if (!item ) { |
377 | closeViewMail(vm); | 382 | closeViewMail(vm); |
378 | return; | 383 | return; |
379 | } | 384 | } |
@@ -391,9 +396,9 @@ void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | |||
391 | vm->setMail( mail ); | 396 | vm->setMail( mail ); |
392 | } | 397 | } |
393 | void OpieMail::displayNextMail(ViewMail * vm) | 398 | void OpieMail::displayNextMail(ViewMail * vm) |
394 | { | 399 | { |
395 | QListViewItem*item = mailView->currentItem(); | 400 | Q3ListViewItem*item = mailView->currentItem(); |
396 | if (!item) return; | 401 | if (!item) return; |
397 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 402 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
398 | item = item->itemBelow(); | 403 | item = item->itemBelow(); |
399 | if (!item) { | 404 | if (!item) { |
@@ -407,9 +412,9 @@ void OpieMail::displayNextMail(ViewMail * vm) | |||
407 | vm->setMail( mail ); | 412 | vm->setMail( mail ); |
408 | } | 413 | } |
409 | void OpieMail::displayMail() | 414 | void OpieMail::displayMail() |
410 | { | 415 | { |
411 | QListViewItem*item = mailView->currentItem(); | 416 | Q3ListViewItem*item = mailView->currentItem(); |
412 | if (!item) return; | 417 | if (!item) return; |
413 | RecMailP mail = ((MailListViewItem*)item)->data(); | 418 | RecMailP mail = ((MailListViewItem*)item)->data(); |
414 | RecBodyP body = folderView->fetchBody(mail); | 419 | RecBodyP body = folderView->fetchBody(mail); |
415 | ViewMail readMail( this,"", Qt::WType_Modal ); | 420 | ViewMail readMail( this,"", Qt::WType_Modal ); |
@@ -431,24 +436,24 @@ void OpieMail::displayMail() | |||
431 | folderView->refreshCurrent(); | 436 | folderView->refreshCurrent(); |
432 | } | 437 | } |
433 | else | 438 | else |
434 | { | 439 | { |
435 | QListViewItem*item = mailView->currentItem(); | 440 | Q3ListViewItem*item = mailView->currentItem(); |
436 | if (item) | 441 | if (item) |
437 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 442 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
438 | } | 443 | } |
439 | } | 444 | } |
440 | void OpieMail::slotGetAllMail() | 445 | void OpieMail::slotGetAllMail() |
441 | { | 446 | { |
442 | QListViewItem * item = folderView->firstChild(); | 447 | Q3ListViewItem * item = folderView->firstChild(); |
443 | while ( item ){ | 448 | while ( item ){ |
444 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 449 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
445 | item = item->nextSibling (); | 450 | item = item->nextSibling (); |
446 | } | 451 | } |
447 | } | 452 | } |
448 | void OpieMail::slotGetMail() | 453 | void OpieMail::slotGetMail() |
449 | { | 454 | { |
450 | QListViewItem * item = folderView->currentItem(); | 455 | Q3ListViewItem * item = folderView->currentItem(); |
451 | if ( ! item ) return; | 456 | if ( ! item ) return; |
452 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 457 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
453 | } | 458 | } |
454 | void OpieMail::slotDeleteMail() | 459 | void OpieMail::slotDeleteMail() |
@@ -463,9 +468,9 @@ void OpieMail::slotDeleteMail() | |||
463 | } | 468 | } |
464 | void OpieMail::slotDeleteAllMail() | 469 | void OpieMail::slotDeleteAllMail() |
465 | { | 470 | { |
466 | 471 | ||
467 | QValueList<RecMailP> t; | 472 | Q3ValueList<RecMailP> t; |
468 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 473 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
469 | { | 474 | { |
470 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 475 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
471 | while ( item ) { | 476 | while ( item ) { |
@@ -491,23 +496,23 @@ void OpieMail::clearSelection() | |||
491 | 496 | ||
492 | } | 497 | } |
493 | void OpieMail::selectAll() | 498 | void OpieMail::selectAll() |
494 | { | 499 | { |
495 | QListViewItem* item = mailView->firstChild (); | 500 | Q3ListViewItem* item = mailView->firstChild (); |
496 | while ( item ) { | 501 | while ( item ) { |
497 | mailView->setSelected ( item, true ); | 502 | mailView->setSelected ( item, true ); |
498 | item = item->nextSibling(); | 503 | item = item->nextSibling(); |
499 | } | 504 | } |
500 | } | 505 | } |
501 | 506 | ||
502 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 507 | void OpieMail::mailHold(int button, Q3ListViewItem *item,const QPoint&,int ) |
503 | { | 508 | { |
504 | if (!mailView->currentItem()) return; | 509 | if (!mailView->currentItem()) return; |
505 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 510 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
506 | /* just the RIGHT button - or hold on pda */ | 511 | /* just the RIGHT button - or hold on pda */ |
507 | if (button!=2) {return;} | 512 | if (button!=2) {return;} |
508 | if (!item) return; | 513 | if (!item) return; |
509 | QPopupMenu *m = new QPopupMenu(0); | 514 | Q3PopupMenu *m = new Q3PopupMenu(0); |
510 | if (m) | 515 | if (m) |
511 | { | 516 | { |
512 | if (mailtype==MAILLIB::A_NNTP) { | 517 | if (mailtype==MAILLIB::A_NNTP) { |
513 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 518 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
@@ -552,14 +557,14 @@ void OpieMail::slotShowFolders( bool show ) | |||
552 | //slotAdjustColumnsWide(); | 557 | //slotAdjustColumnsWide(); |
553 | } | 558 | } |
554 | } | 559 | } |
555 | 560 | ||
556 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 561 | void OpieMail::refreshMailView(const Q3ValueList<RecMailP>&list) |
557 | { | 562 | { |
558 | MailListViewItem*item = 0; | 563 | MailListViewItem*item = 0; |
559 | mailView->clear(); | 564 | mailView->clear(); |
560 | 565 | ||
561 | QValueList<RecMailP>::ConstIterator it; | 566 | Q3ValueList<RecMailP>::ConstIterator it; |
562 | for (it = list.begin(); it != list.end();++it) | 567 | for (it = list.begin(); it != list.end();++it) |
563 | { | 568 | { |
564 | item = new MailListViewItem(mailView,item); | 569 | item = new MailListViewItem(mailView,item); |
565 | item->storeData((*it)); | 570 | item->storeData((*it)); |
@@ -567,9 +572,9 @@ void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | |||
567 | } | 572 | } |
568 | mailView->setSorting ( 4, false ); | 573 | mailView->setSorting ( 4, false ); |
569 | } | 574 | } |
570 | 575 | ||
571 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 576 | void OpieMail::mailLeftClicked( Q3ListViewItem *item ) |
572 | { | 577 | { |
573 | mailView->clearSelection(); | 578 | mailView->clearSelection(); |
574 | /* just LEFT button - or tap with stylus on pda */ | 579 | /* just LEFT button - or tap with stylus on pda */ |
575 | //if (button!=1) return; | 580 | //if (button!=1) return; |
@@ -613,9 +618,9 @@ void OpieMail::slotMoveCopyMail() | |||
613 | void OpieMail::slotMoveCopyAllMail() | 618 | void OpieMail::slotMoveCopyAllMail() |
614 | { | 619 | { |
615 | 620 | ||
616 | if (!mailView->currentItem()) return; | 621 | if (!mailView->currentItem()) return; |
617 | QValueList<RecMailP> t; | 622 | Q3ValueList<RecMailP> t; |
618 | // 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 ) | 623 | // 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 ) |
619 | { | 624 | { |
620 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 625 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
621 | while ( item ) { | 626 | while ( item ) { |