diff options
Diffstat (limited to 'src/gui/windows/mailwindow.cpp')
-rw-r--r-- | src/gui/windows/mailwindow.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index 15faf779a..ecef7b54e 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -164,6 +164,37 @@ void MailWindow::addMail(MailMessage *const message) mMessagesMap[message->id] = message; } +void MailWindow::removeMail(const int id) +{ + std::map<int, MailMessage*>::iterator it1 = mMessagesMap.find(id); + if (it1 != mMessagesMap.end()) + mMessagesMap.erase(it1); + + mMailModel->clear(); + + FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages) + { + MailMessage *message = *it; + if (message && message->id == id) + { + mMessages.erase(it); + delete message; + break; + } + } + + FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages) + { + MailMessage *message = *it; + if (message) + { + mMailModel->add(strprintf("%s %s", + message->unread ? " " : "U", + message->title.c_str())); + } + } +} + void MailWindow::showMessage(MailMessage *const mail) { if (!mail) |