From 7b8493a8a977032b502e6df00b89f6b1a813b78b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 Apr 2015 02:19:10 +0300 Subject: In mail view window add buttons for open previous and next message. --- src/gui/windows/mailwindow.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/gui/windows/mailwindow.cpp') 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::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::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; + } + } +} -- cgit v1.2.3-70-g09d2