summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/accountview.h4
-rw-r--r--noncore/net/mail/mainwindow.cpp23
-rw-r--r--noncore/net/mail/mainwindow.h4
-rw-r--r--noncore/net/mail/viewmail.cpp8
-rw-r--r--noncore/net/mail/viewmail.h3
6 files changed, 53 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 1069b9f..ac4f0e0 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -136,4 +136,6 @@ void AccountView::populate( QList<Account> list )
void AccountView::refresh(QListViewItem *item) {
+
qDebug("AccountView refresh...");
if ( item ) {
+ m_currentItem = item;
QList<RecMail> headerlist;
@@ -146,2 +148,12 @@ void AccountView::refresh(QListViewItem *item) {
+void AccountView::refreshCurrent()
+{
+ if ( !m_currentItem ) return;
+ QList<RecMail> headerlist;
+ headerlist.setAutoDelete(true);
+ AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
+ view->refresh(headerlist);
+ emit refreshMailview(&headerlist);
+}
+
void AccountView::refreshAll()
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 83d49af..cdc87ce 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -79,2 +79,3 @@ public slots:
void refresh(QListViewItem *item);
+ void refreshCurrent();
@@ -82,2 +83,5 @@ signals:
void refreshMailview(QList<RecMail>*);
+
+private:
+ QListViewItem* m_currentItem;
};
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 8ef7ddd..c410829 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -62,2 +62,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
+ deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
+ deleteMails->addTo( toolBar );
+ deleteMails->addTo( mailMenu );
+ connect( deleteMails, SIGNAL( activated() ),
+ SLOT( slotDeleteMail() ) );
@@ -155,2 +160,5 @@ void MainWindow::displayMail(QListViewItem*item)
{
+
+ m_currentItem = item;
+
if (!item) return;
@@ -164,4 +172,19 @@ void MainWindow::displayMail(QListViewItem*item)
readMail.exec();
+
+ if ( readMail.deleted ) {
+ folderView->refreshCurrent();
+ } else {
( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
}
+}
+
+void MainWindow::slotDeleteMail()
+{
+ if (!m_currentItem) return;
+ RecMail mail = ((MailListViewItem*)m_currentItem)->data();
+ mail.Wrapper()->deleteMail( mail );
+ folderView->refreshCurrent();
+}
+
+
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 6c1cda0..8641510 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -28,2 +28,3 @@ protected slots:
virtual void displayMail(QListViewItem*);
+ virtual void slotDeleteMail();
void slotAdjustLayout();
@@ -34,3 +35,3 @@ protected:
QPopupMenu *mailMenu, *settingsMenu;
- QAction *composeMail, *sendQueued, *showFolders, *searchMails,
+ QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
@@ -38,2 +39,3 @@ protected:
QListView *mailView;
+ QListViewItem* m_currentItem;
QBoxLayout *layout;
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 42707e3..163ffb7 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -13,2 +13,3 @@
#include "abstractmail.h"
+#include "accountview.h"
@@ -171,2 +172,3 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
connect(forward, SIGNAL(activated()), SLOT(slotForward()));
+ connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) );
@@ -317 +319,7 @@ void ViewMail::slotForward()
+void ViewMail::slotDeleteMail( )
+{
+ m_recMail.Wrapper()->deleteMail( m_recMail );
+ hide();
+ deleted = true;
+}
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index bc12da1..765464c 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -32,2 +32,3 @@ public:
void setBody( RecBody body );
+ bool deleted;
@@ -41,2 +42,4 @@ protected slots:
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
+ void slotDeleteMail( );
+