summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-30 02:19:10 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-30 02:19:10 +0300
commit7b8493a8a977032b502e6df00b89f6b1a813b78b (patch)
tree6bd3a37411707724960ead54ccb7a7ea36586249 /src/gui/windows/mailwindow.cpp
parent780731dbb1d104f3f91eede326fa7dce75b0d6f3 (diff)
downloadplus-7b8493a8a977032b502e6df00b89f6b1a813b78b.tar.gz
plus-7b8493a8a977032b502e6df00b89f6b1a813b78b.tar.bz2
plus-7b8493a8a977032b502e6df00b89f6b1a813b78b.tar.xz
plus-7b8493a8a977032b502e6df00b89f6b1a813b78b.zip
In mail view window add buttons for open previous and next message.
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;
+ }
+ }
+}