author | harlekin <harlekin> | 2003-12-14 00:20:38 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-14 00:20:38 (UTC) |
commit | ff2b84787e454f8a11aaef7a4ce18941ac0d28fd (patch) (side-by-side diff) | |
tree | 44bf51f9a3935542cdcfa5dafcc212e4f01ee8ce /noncore | |
parent | b0a71314013a3367767526b68928a7168b4ad460 (diff) | |
download | opie-ff2b84787e454f8a11aaef7a4ce18941ac0d28fd.zip opie-ff2b84787e454f8a11aaef7a4ce18941ac0d28fd.tar.gz opie-ff2b84787e454f8a11aaef7a4ce18941ac0d28fd.tar.bz2 |
deleting of mails working
-rw-r--r-- | noncore/net/mail/accountview.cpp | 26 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 3 |
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 @@ -63,3 +63,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) QList<Folder> *folders = wrapper->listFolders(); - + QListViewItem *child = firstChild(); @@ -70,3 +70,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) } - + Folder *it; @@ -82,3 +82,3 @@ RecBody IMAPviewItem::fetchBody(const RecMail&) -IMAPfolderItem::~IMAPfolderItem() +IMAPfolderItem::~IMAPfolderItem() { @@ -96,3 +96,3 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent ) -void IMAPfolderItem::refresh(QList<RecMail>&target) +void IMAPfolderItem::refresh(QList<RecMail>&target) { @@ -120,3 +120,3 @@ void AccountView::populate( QList<Account> list ) clear(); - + Account *it; @@ -136,4 +136,6 @@ void AccountView::populate( QList<Account> list ) void AccountView::refresh(QListViewItem *item) { + qDebug("AccountView refresh..."); - if ( item ) { + if ( item ) { + m_currentItem = item; QList<RecMail> headerlist; @@ -146,5 +148,15 @@ 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,5 +79,9 @@ public slots: 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 @@ -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() ) ); @@ -100,3 +105,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) - connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); + connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); @@ -133,3 +138,3 @@ void MainWindow::slotShowFolders( bool show ) { - qDebug( "Show Folders" ); + qDebug( "Show Folders" ); if ( show && folderView->isHidden() ) { @@ -155,2 +160,5 @@ void MainWindow::displayMail(QListViewItem*item) { + + m_currentItem = item; + if (!item) return; @@ -164,5 +172,20 @@ void MainWindow::displayMail(QListViewItem*item) 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 ) 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( ); + |