summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-14 02:03:25 (UTC)
committer harlekin <harlekin>2003-12-14 02:03:25 (UTC)
commit568f23df5f4d5b1835c3b89ad54eeb6fc53157e6 (patch) (unidiff)
tree944c4745d4cdb642e873e480b45479d5116ea33a
parent154e03927d2b97f3f76f807fe104ac9d74035215 (diff)
downloadopie-568f23df5f4d5b1835c3b89ad54eeb6fc53157e6.zip
opie-568f23df5f4d5b1835c3b89ad54eeb6fc53157e6.tar.gz
opie-568f23df5f4d5b1835c3b89ad54eeb6fc53157e6.tar.bz2
check back before deleting a mail
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp7
-rw-r--r--noncore/net/mail/viewmail.cpp10
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 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qmessagebox.h>
6 7
7#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
8#include <qpe/resource.h> 9#include <qpe/resource.h>
9 10
10#include "defines.h" 11#include "defines.h"
11#include "mainwindow.h" 12#include "mainwindow.h"
12#include "viewmail.h" 13#include "viewmail.h"
13#include "mailtypes.h" 14#include "mailtypes.h"
14#include "mailistviewitem.h" 15#include "mailistviewitem.h"
15 16
16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 17MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
17 : QMainWindow( parent, name, flags ) 18 : QMainWindow( parent, name, flags )
18{ 19{
19 setCaption( tr( "Mail" ) ); 20 setCaption( tr( "Mail" ) );
20 setToolBarsMovable( false ); 21 setToolBarsMovable( false );
21 22
22 toolBar = new QToolBar( this ); 23 toolBar = new QToolBar( this );
23 menuBar = new QMenuBar( toolBar ); 24 menuBar = new QMenuBar( toolBar );
24 mailMenu = new QPopupMenu( menuBar ); 25 mailMenu = new QPopupMenu( menuBar );
25 menuBar->insertItem( tr( "Mail" ), mailMenu ); 26 menuBar->insertItem( tr( "Mail" ), mailMenu );
26 settingsMenu = new QPopupMenu( menuBar ); 27 settingsMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 28 menuBar->insertItem( tr( "Settings" ), settingsMenu );
28 29
29 addToolBar( toolBar ); 30 addToolBar( toolBar );
@@ -160,50 +161,52 @@ void MainWindow::refreshMailView(QList<RecMail>*list)
160void MainWindow::displayMail(QListViewItem*item) 161void MainWindow::displayMail(QListViewItem*item)
161{ 162{
162 163
163 if (!item) return; 164 if (!item) return;
164 RecMail mail = ((MailListViewItem*)item)->data(); 165 RecMail mail = ((MailListViewItem*)item)->data();
165 RecBody body = folderView->fetchBody(mail); 166 RecBody body = folderView->fetchBody(mail);
166 167
167 ViewMail readMail( this ); 168 ViewMail readMail( this );
168 readMail.setBody( body ); 169 readMail.setBody( body );
169 readMail.setMail( mail ); 170 readMail.setMail( mail );
170 readMail.showMaximized(); 171 readMail.showMaximized();
171 readMail.exec(); 172 readMail.exec();
172 173
173 if ( readMail.deleted ) { 174 if ( readMail.deleted ) {
174 folderView->refreshCurrent(); 175 folderView->refreshCurrent();
175 } else { 176 } else {
176 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 177 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
177 } 178 }
178} 179}
179 180
180void MainWindow::slotDeleteMail() 181void MainWindow::slotDeleteMail()
181{ 182{
182 if (!mailView->currentItem()) return; 183 if (!mailView->currentItem()) return;
183 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 184 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
184 mail.Wrapper()->deleteMail( mail ); 185 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 ) {
185 folderView->refreshCurrent(); 186 mail.Wrapper()->deleteMail( mail );
187 folderView->refreshCurrent();
188 }
186} 189}
187 190
188 191
189 192
190MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 193MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
191 :QListViewItem(parent,item),mail_data() 194 :QListViewItem(parent,item),mail_data()
192{ 195{
193} 196}
194 197
195void MailListViewItem::showEntry() 198void MailListViewItem::showEntry()
196{ 199{
197 if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { 200 if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
198 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 201 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
199 } else { 202 } else {
200 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); 203 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") );
201 } 204 }
202 setText(1,mail_data.getSubject()); 205 setText(1,mail_data.getSubject());
203 setText(2,mail_data.getFrom()); 206 setText(2,mail_data.getFrom());
204 setText(3,mail_data.getDate()); 207 setText(3,mail_data.getDate());
205} 208}
206 209
207void MailListViewItem::storeData(const RecMail&data) 210void MailListViewItem::storeData(const RecMail&data)
208{ 211{
209 mail_data = data; 212 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 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>?
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8#include <opie/ofiledialog.h> 8#include <opie/ofiledialog.h>
9 9
10#include "settings.h" 10#include "settings.h"
11#include "composemail.h" 11#include "composemail.h"
12#include "viewmail.h" 12#include "viewmail.h"
13#include "abstractmail.h" 13#include "abstractmail.h"
14#include "accountview.h" 14#include "accountview.h"
15 15
16AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) 16AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num)
17 : QListViewItem(parent,after),_partNum(num) 17 : QListViewItem(parent,after),_partNum(num)
18{ 18{
19 setText(0, mime); 19 setText(0, mime);
20 setText(1, file); 20 setText(1, file);
21 setText(2, desc); 21 setText(2, desc);
22} 22}
23 23
24void ViewMail::setBody( RecBody body ) { 24void ViewMail::setBody( RecBody body ) {
25 25
26m_body = body; 26m_body = body;
@@ -298,28 +298,30 @@ void ViewMail::slotForward()
298 ftext += QString("Date: %1\n") 298 ftext += QString("Date: %1\n")
299 .arg( m_mail[3] ); 299 .arg( m_mail[3] );
300 if (!m_mail[0].isNull()) 300 if (!m_mail[0].isNull())
301 ftext += QString("From: %1\n") 301 ftext += QString("From: %1\n")
302 .arg( m_mail[0] ); 302 .arg( m_mail[0] );
303 if (!m_mail[1].isNull()) 303 if (!m_mail[1].isNull())
304 ftext += QString("Subject: %1\n") 304 ftext += QString("Subject: %1\n")
305 .arg( m_mail[1] ); 305 .arg( m_mail[1] );
306 306
307 ftext += QString("\n%1\n") 307 ftext += QString("\n%1\n")
308 .arg( m_mail[2]); 308 .arg( m_mail[2]);
309 309
310 ftext += QString("----- End forwarded message -----\n"); 310 ftext += QString("----- End forwarded message -----\n");
311 311
312 Settings *settings = new Settings(); 312 Settings *settings = new Settings();
313 ComposeMail composer( settings ,this, 0, true); 313 ComposeMail composer( settings ,this, 0, true);
314 composer.setSubject( "Fwd: " + m_mail[1] ); 314 composer.setSubject( "Fwd: " + m_mail[1] );
315 composer.setMessage( ftext ); 315 composer.setMessage( ftext );
316 composer.showMaximized(); 316 composer.showMaximized();
317 composer.exec(); 317 composer.exec();
318} 318}
319 319
320void ViewMail::slotDeleteMail( ) 320void ViewMail::slotDeleteMail( )
321{ 321{
322 m_recMail.Wrapper()->deleteMail( m_recMail ); 322 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 ) {
323 hide(); 323 m_recMail.Wrapper()->deleteMail( m_recMail );
324 deleted = true; 324 hide();
325 deleted = true;
326 }
325} 327}