-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 391b55e..e466d9b 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -1,29 +1,30 @@ #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> +#include <qmessagebox.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include "defines.h" #include "mainwindow.h" #include "viewmail.h" #include "mailtypes.h" #include "mailistviewitem.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name, flags ) { setCaption( tr( "Mail" ) ); setToolBarsMovable( false ); toolBar = new QToolBar( this ); menuBar = new QMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Settings" ), settingsMenu ); addToolBar( toolBar ); @@ -160,50 +161,52 @@ void MainWindow::refreshMailView(QList<RecMail>*list) void MainWindow::displayMail(QListViewItem*item) { if (!item) return; RecMail mail = ((MailListViewItem*)item)->data(); RecBody body = folderView->fetchBody(mail); ViewMail readMail( this ); readMail.setBody( body ); readMail.setMail( mail ); readMail.showMaximized(); readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } else { ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); } } void MainWindow::slotDeleteMail() { if (!mailView->currentItem()) return; RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); - mail.Wrapper()->deleteMail( mail ); - folderView->refreshCurrent(); + if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { + mail.Wrapper()->deleteMail( mail ); + folderView->refreshCurrent(); + } } MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) :QListViewItem(parent,item),mail_data() { } void MailListViewItem::showEntry() { if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); } else { setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); } setText(1,mail_data.getSubject()); setText(2,mail_data.getFrom()); setText(3,mail_data.getDate()); } void MailListViewItem::storeData(const RecMail&data) { mail_data = data; diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 163ffb7..2415c82 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -1,26 +1,26 @@ #include <qtextbrowser.h> -#include <qmessagebox.h> +#include <qmessagebox.h>? #include <qtextstream.h> #include <qaction.h> #include <qpopupmenu.h> #include <qapplication.h> #include <opie/ofiledialog.h> #include "settings.h" #include "composemail.h" #include "viewmail.h" #include "abstractmail.h" #include "accountview.h" AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) : QListViewItem(parent,after),_partNum(num) { setText(0, mime); setText(1, file); setText(2, desc); } void ViewMail::setBody( RecBody body ) { m_body = body; @@ -298,28 +298,30 @@ void ViewMail::slotForward() ftext += QString("Date: %1\n") .arg( m_mail[3] ); if (!m_mail[0].isNull()) ftext += QString("From: %1\n") .arg( m_mail[0] ); if (!m_mail[1].isNull()) ftext += QString("Subject: %1\n") .arg( m_mail[1] ); ftext += QString("\n%1\n") .arg( m_mail[2]); ftext += QString("----- End forwarded message -----\n"); Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); composer.setSubject( "Fwd: " + m_mail[1] ); composer.setMessage( ftext ); composer.showMaximized(); composer.exec(); } void ViewMail::slotDeleteMail( ) { - m_recMail.Wrapper()->deleteMail( m_recMail ); - hide(); - deleted = true; + if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { + m_recMail.Wrapper()->deleteMail( m_recMail ); + hide(); + deleted = true; + } } |