-rw-r--r-- | kmicromail/opiemail.cpp | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 3fbdcec..251f15a 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -15,13 +15,13 @@ #include <qpe/qpeapplication.h> #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> /* OPIE */ //#include <qpe/resource.h> -#include <qpe/qpeapplication.h> +//#include <qpe/qpeapplication.h> /* QT */ using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) @@ -234,26 +234,33 @@ void OpieMail::slotDeleteMail() mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::slotDeleteAllMail() { - if (!mailView->currentItem()) return; - RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); + + QValueList<RecMailP> t; if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) - { - MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); - while ( item ) { - if ( item->isSelected() ) { - RecMailP mail = item->data(); - mail->Wrapper()->deleteMail( mail ); + { + MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); + while ( item ) { + if ( item->isSelected() ) { + t.append( item->data() ); + } + item = (MailListViewItem*)item->nextSibling(); } - item = (MailListViewItem*)item->nextSibling(); } - folderView->refreshCurrent(); - } + else + return; + if ( t.count() == 0 ) + return; + RecMailP mail = t.first(); + mail->Wrapper()->deleteMailList(t); + folderView->refreshCurrent(); + + } void OpieMail::clearSelection() { mailView->clearSelection(); } @@ -273,16 +280,16 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); } else { if (folderView->currentisDraft()) { m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); } m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); - m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); + m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); m->insertSeparator(); - m->insertItem(tr("Copy/Move all selected mail"),this,SLOT(slotMoveCopyAllMail())); + m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; @@ -347,33 +354,36 @@ void OpieMail::slotMoveCopyMail() if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { QMessageBox::critical(0,tr("Error creating new Folder"), tr("<center>Error while creating<br>new folder - breaking.</center>")); return; } + sels.hide(); + qApp->processEvents(); + // qDebug("hiding sels "); mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } void OpieMail::slotMoveCopyAllMail() { if (!mailView->currentItem()) return; QValueList<RecMailP> t; - if ( QMessageBox::warning(this, tr("Copy/Move all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) + // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); while ( item ) { if ( item->isSelected() ) { t.append( item->data() ); } item = (MailListViewItem*)item->nextSibling(); } } - else - return; + // else + // return; if ( t.count() == 0 ) return; RecMailP mail = t.first(); AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; @@ -389,12 +399,15 @@ void OpieMail::slotMoveCopyAllMail() if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { QMessageBox::critical(0,tr("Error creating new Folder"), tr("<center>Error while creating<br>new folder - breaking.</center>")); return; } + sels.hide(); + qApp->processEvents(); + //qDebug("hiding sels "); mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } void OpieMail::reEditMail() { |