summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/mailwindow.cpp')
-rw-r--r--src/gui/windows/mailwindow.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index ecef7b54e..aec30ce89 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -210,3 +210,51 @@ void MailWindow::showMessage(MailMessage *const mail)
delete mailViewWindow;
mailViewWindow = new MailViewWindow(mail);
}
+
+void MailWindow::viewNext(const int id)
+{
+ FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages)
+ {
+ MailMessage *message = *it;
+ if (message && message->id == id)
+ {
+ ++ it;
+ if (it == mMessages.end())
+ {
+ it = mMessages.begin();
+ mListBox->setSelected(0);
+ }
+ else
+ {
+ mListBox->setSelected(mListBox->getSelected() + 1);
+ }
+ message = *it;
+ mailHandler->readMessage(message->id);
+ return;
+ }
+ }
+}
+
+void MailWindow::viewPrev(const int id)
+{
+ FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages)
+ {
+ MailMessage *message = *it;
+ if (message && message->id == id)
+ {
+ if (it == mMessages.begin())
+ {
+ it = mMessages.end();
+ mListBox->setSelected(mMessages.size() - 1);
+ }
+ else
+ {
+ mListBox->setSelected(mListBox->getSelected() - 1);
+ }
+ -- it;
+ message = *it;
+ mailHandler->readMessage(message->id);
+ return;
+ }
+ }
+}