Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 23 |
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 ) | |||
51 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 51 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
52 | 0, 0, this, 0, true ); | 52 | 0, 0, this, 0, true ); |
53 | showFolders->addTo( toolBar ); | 53 | showFolders->addTo( toolBar ); |
54 | showFolders->addTo( mailMenu ); | 54 | showFolders->addTo( mailMenu ); |
55 | connect(showFolders, SIGNAL( toggled( bool ) ), | 55 | connect(showFolders, SIGNAL( toggled( bool ) ), |
56 | SLOT( slotShowFolders( bool ) ) ); | 56 | SLOT( slotShowFolders( bool ) ) ); |
57 | 57 | ||
58 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, | 58 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, |
59 | 0, 0, this ); | 59 | 0, 0, this ); |
60 | searchMails->addTo( toolBar ); | 60 | searchMails->addTo( toolBar ); |
61 | searchMails->addTo( mailMenu ); | 61 | searchMails->addTo( mailMenu ); |
62 | 62 | ||
63 | deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | ||
64 | deleteMails->addTo( toolBar ); | ||
65 | deleteMails->addTo( mailMenu ); | ||
66 | connect( deleteMails, SIGNAL( activated() ), | ||
67 | SLOT( slotDeleteMail() ) ); | ||
63 | 68 | ||
64 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, | 69 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, |
65 | 0, 0, this ); | 70 | 0, 0, this ); |
66 | editSettings->addTo( settingsMenu ); | 71 | editSettings->addTo( settingsMenu ); |
67 | 72 | ||
68 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, | 73 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, |
69 | 0, 0, this ); | 74 | 0, 0, this ); |
70 | editAccounts->addTo( settingsMenu ); | 75 | editAccounts->addTo( settingsMenu ); |
71 | 76 | ||
72 | QWidget *view = new QWidget( this ); | 77 | QWidget *view = new QWidget( this ); |
73 | setCentralWidget( view ); | 78 | setCentralWidget( view ); |
74 | 79 | ||
@@ -144,35 +149,53 @@ void MainWindow::slotShowFolders( bool show ) | |||
144 | void MainWindow::refreshMailView(QList<RecMail>*list) | 149 | void MainWindow::refreshMailView(QList<RecMail>*list) |
145 | { | 150 | { |
146 | MailListViewItem*item = 0; | 151 | MailListViewItem*item = 0; |
147 | mailView->clear(); | 152 | mailView->clear(); |
148 | for (unsigned int i = 0; i < list->count();++i) { | 153 | for (unsigned int i = 0; i < list->count();++i) { |
149 | item = new MailListViewItem(mailView,item); | 154 | item = new MailListViewItem(mailView,item); |
150 | item->storeData(*(list->at(i))); | 155 | item->storeData(*(list->at(i))); |
151 | item->showEntry(); | 156 | item->showEntry(); |
152 | } | 157 | } |
153 | } | 158 | } |
154 | void MainWindow::displayMail(QListViewItem*item) | 159 | void MainWindow::displayMail(QListViewItem*item) |
155 | { | 160 | { |
161 | |||
162 | m_currentItem = item; | ||
163 | |||
156 | if (!item) return; | 164 | if (!item) return; |
157 | RecMail mail = ((MailListViewItem*)item)->data(); | 165 | RecMail mail = ((MailListViewItem*)item)->data(); |
158 | RecBody body = folderView->fetchBody(mail); | 166 | RecBody body = folderView->fetchBody(mail); |
159 | 167 | ||
160 | ViewMail readMail( this ); | 168 | ViewMail readMail( this ); |
161 | readMail.setBody( body ); | 169 | readMail.setBody( body ); |
162 | readMail.setMail( mail ); | 170 | readMail.setMail( mail ); |
163 | readMail.showMaximized(); | 171 | readMail.showMaximized(); |
164 | readMail.exec(); | 172 | readMail.exec(); |
173 | |||
174 | if ( readMail.deleted ) { | ||
175 | folderView->refreshCurrent(); | ||
176 | } else { | ||
165 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); | 177 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); |
166 | } | 178 | } |
179 | } | ||
180 | |||
181 | void MainWindow::slotDeleteMail() | ||
182 | { | ||
183 | if (!m_currentItem) return; | ||
184 | RecMail mail = ((MailListViewItem*)m_currentItem)->data(); | ||
185 | mail.Wrapper()->deleteMail( mail ); | ||
186 | folderView->refreshCurrent(); | ||
187 | } | ||
188 | |||
189 | |||
167 | 190 | ||
168 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 191 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
169 | :QListViewItem(parent,item),mail_data() | 192 | :QListViewItem(parent,item),mail_data() |
170 | { | 193 | { |
171 | } | 194 | } |
172 | 195 | ||
173 | void MailListViewItem::showEntry() | 196 | void MailListViewItem::showEntry() |
174 | { | 197 | { |
175 | if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { | 198 | if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { |
176 | setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); | 199 | setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); |
177 | } else { | 200 | } else { |
178 | setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); | 201 | setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); |