-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index c410829..2b5870a 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -138,71 +138,69 @@ void MainWindow::slotShowFolders( bool show ) { qDebug( "Show Folders" ); if ( show && folderView->isHidden() ) { qDebug( "-> showing" ); folderView->show(); } else if ( !show && !folderView->isHidden() ) { qDebug( "-> hiding" ); folderView->hide(); } } 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(); + if (!mailView->currentItem()) return; + RecMail mail = ((MailListViewItem*)mailView->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") ); } setText(1,mail_data.getSubject()); setText(2,mail_data.getFrom()); setText(3,mail_data.getDate()); } void MailListViewItem::storeData(const RecMail&data) diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 8641510..21af190 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -16,29 +16,28 @@ class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); public slots: void slotAdjustColumns(); protected slots: virtual void slotShowFolders( bool show ); virtual void refreshMailView(QList<RecMail>*); virtual void displayMail(QListViewItem*); virtual void slotDeleteMail(); void slotAdjustLayout(); protected: QToolBar *toolBar; QMenuBar *menuBar; QPopupMenu *mailMenu, *settingsMenu; QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; AccountView *folderView; QListView *mailView; - QListViewItem* m_currentItem; QBoxLayout *layout; }; #endif |