summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp26
-rw-r--r--noncore/net/mail/accountview.h6
-rw-r--r--noncore/net/mail/mainwindow.cpp29
-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, 64 insertions, 12 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
@@ -62,5 +62,5 @@ void IMAPviewItem::refresh(QList<RecMail>&)
{
QList<Folder> *folders = wrapper->listFolders();
-
+
QListViewItem *child = firstChild();
while ( child ) {
@@ -69,5 +69,5 @@ void IMAPviewItem::refresh(QList<RecMail>&)
delete tmp;
}
-
+
Folder *it;
for ( it = folders->first(); it; it = folders->next() ) {
@@ -81,5 +81,5 @@ RecBody IMAPviewItem::fetchBody(const RecMail&)
}
-IMAPfolderItem::~IMAPfolderItem()
+IMAPfolderItem::~IMAPfolderItem()
{
delete folder;
@@ -95,5 +95,5 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent )
}
-void IMAPfolderItem::refresh(QList<RecMail>&target)
+void IMAPfolderItem::refresh(QList<RecMail>&target)
{
imap->getWrapper()->listMessages( folder->getName(),target );
@@ -119,5 +119,5 @@ void AccountView::populate( QList<Account> list )
{
clear();
-
+
Account *it;
for ( it = list.first(); it; it = list.next() ) {
@@ -135,6 +135,8 @@ void AccountView::populate( QList<Account> list )
void AccountView::refresh(QListViewItem *item) {
+
qDebug("AccountView refresh...");
- if ( item ) {
+ if ( item ) {
+ m_currentItem = item;
QList<RecMail> headerlist;
headerlist.setAutoDelete(true);
@@ -145,7 +147,17 @@ 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
@@ -78,7 +78,11 @@ public slots:
void refreshAll();
void refresh(QListViewItem *item);
+ void refreshCurrent();
signals:
- void refreshMailview(QList<RecMail>*);
+ 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
@@ -61,4 +61,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
searchMails->addTo( mailMenu );
+ 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() ) );
editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
@@ -99,5 +104,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
SLOT( displayMail( QListViewItem * ) ) );
- connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
+ connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
@@ -132,5 +137,5 @@ void MainWindow::slotAdjustColumns()
void MainWindow::slotShowFolders( bool show )
{
- qDebug( "Show Folders" );
+ qDebug( "Show Folders" );
if ( show && folderView->isHidden() ) {
qDebug( "-> showing" );
@@ -154,4 +159,7 @@ void MainWindow::refreshMailView(QList<RecMail>*list)
void MainWindow::displayMail(QListViewItem*item)
{
+
+ m_currentItem = item;
+
if (!item) return;
RecMail mail = ((MailListViewItem*)item)->data();
@@ -163,7 +171,22 @@ void MainWindow::displayMail(QListViewItem*item)
readMail.showMaximized();
readMail.exec();
- ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
+
+ 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();
+}
+
+
+
MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
:QListViewItem(parent,item),mail_data()
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
@@ -27,4 +27,5 @@ protected slots:
virtual void refreshMailView(QList<RecMail>*);
virtual void displayMail(QListViewItem*);
+ virtual void slotDeleteMail();
void slotAdjustLayout();
@@ -33,8 +34,9 @@ protected:
QMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu;
- QAction *composeMail, *sendQueued, *showFolders, *searchMails,
+ QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
AccountView *folderView;
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
@@ -12,4 +12,5 @@
#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)
@@ -170,4 +171,5 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
connect(reply, SIGNAL(activated()), SLOT(slotReply()));
connect(forward, SIGNAL(activated()), SLOT(slotForward()));
+ connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) );
attachments->setEnabled(m_gotBody);
@@ -316,2 +318,8 @@ 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
@@ -31,4 +31,5 @@ public:
void setMail( RecMail mail );
void setBody( RecBody body );
+ bool deleted;
protected:
@@ -40,4 +41,6 @@ protected slots:
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
+ void slotDeleteMail( );
+
private: