summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-26 02:00:31 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-26 02:00:31 +0300
commit651dee7fb3c45ed18c490dc039677daed1c33aa9 (patch)
tree0c544404cc19323c6ff9fb13f2c48f68a2501a14 /src/gui/windows/mailwindow.cpp
parent5b8c92a15a877bc05812c091ca1841cacf989f30 (diff)
downloadmv-651dee7fb3c45ed18c490dc039677daed1c33aa9.tar.gz
mv-651dee7fb3c45ed18c490dc039677daed1c33aa9.tar.bz2
mv-651dee7fb3c45ed18c490dc039677daed1c33aa9.tar.xz
mv-651dee7fb3c45ed18c490dc039677daed1c33aa9.zip
Allow request to load old mail messages by pages.
Diffstat (limited to 'src/gui/windows/mailwindow.cpp')
-rw-r--r--src/gui/windows/mailwindow.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index f41017543..18371b7ad 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -72,11 +72,14 @@ MailWindow::MailWindow() :
// TRANSLATORS: mail window button
mDeleteButton(new Button(this, _("Delete"), "delete", this)),
// TRANSLATORS: mail window button
- mReturnButton(new Button(this, _("Return"), "return", this)),
+ mReturnButton(new Button(this,
+ settings.enableNewMailSystem ? _("Get old") : _("Return"),
+ "return", this)),
// TRANSLATORS: mail window button
mOpenButton(new Button(this, _("Open"), "open", this)),
mOpenType(MailOpenType::Mail),
- mUseMail2(settings.enableNewMailSystem)
+ mUseMail2(settings.enableNewMailSystem),
+ mLastPage(false)
{
setWindowName("Mail");
setCloseButton(true);
@@ -158,11 +161,22 @@ void MailWindow::action(const ActionEvent &event)
}
else if (eventId == "return")
{
- const int sel = mListBox->getSelected();
- if (sel < 0)
- return;
- const MailMessage *const mail = mMessages[sel];
- mailHandler->returnMessage(mail->id);
+ if (mUseMail2)
+ {
+ const size_t idx = mMessages.size();
+ if (idx == 0)
+ mail2Handler->refreshMailList(MailOpenType::Mail, 0);
+ else
+ mail2Handler->nextPage(mOpenType, mMessages[idx - 1]->id);
+ }
+ else
+ {
+ const int sel = mListBox->getSelected();
+ if (sel < 0)
+ return;
+ const MailMessage *const mail = mMessages[sel];
+ mailHandler->returnMessage(mail->id);
+ }
}
}
@@ -330,6 +344,8 @@ void MailWindow::refreshMails()
{
clear();
mail2Handler->refreshMailList(MailOpenType::Mail, 0);
+ mLastPage = false;
+ mReturnButton->setEnabled(true);
}
else
{
@@ -353,3 +369,9 @@ MailMessage *MailWindow::findMail(const int64_t id)
return (*it).second;
return nullptr;
}
+
+void MailWindow::setLastPage()
+{
+ mLastPage = true;
+ mReturnButton->setEnabled(false);
+}