summaryrefslogtreecommitdiff
path: root/noncore/net/mail/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp23
1 files changed, 23 insertions, 0 deletions
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
@@ -51,24 +51,29 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
connect(showFolders, SIGNAL( toggled( bool ) ),
SLOT( slotShowFolders( bool ) ) );
searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
0, 0, this );
searchMails->addTo( toolBar );
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,
0, 0, this );
editSettings->addTo( settingsMenu );
editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
0, 0, this );
editAccounts->addTo( settingsMenu );
QWidget *view = new QWidget( this );
setCentralWidget( view );
@@ -144,35 +149,53 @@ void MainWindow::slotShowFolders( bool show )
void MainWindow::refreshMailView(QList<RecMail>*list)
{
MailListViewItem*item = 0;
mailView->clear();
for (unsigned int i = 0; i < list->count();++i) {
item = new MailListViewItem(mailView,item);
item->storeData(*(list->at(i)));
item->showEntry();
}
}
void MainWindow::displayMail(QListViewItem*item)
{
+
+ m_currentItem = 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 (!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()
{
}
void MailListViewItem::showEntry()
{
if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
} else {
setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") );