summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-24 20:47:07 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-24 20:47:07 +0300
commitf2f123e95adc6aa6a1a81bef0414705df30986e3 (patch)
tree5a0d7adf14a8410c65865aaf82a03f8e45e4c9be /src/gui/windows
parent42531b3cf82aace768f2960f0ea6d07815274026 (diff)
downloadmv-f2f123e95adc6aa6a1a81bef0414705df30986e3.tar.gz
mv-f2f123e95adc6aa6a1a81bef0414705df30986e3.tar.bz2
mv-f2f123e95adc6aa6a1a81bef0414705df30986e3.tar.xz
mv-f2f123e95adc6aa6a1a81bef0414705df30986e3.zip
Refresh mail list from new mail system.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/mailwindow.cpp18
-rw-r--r--src/gui/windows/mailwindow.h3
2 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index 063f1a29f..3d157ad3b 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -20,8 +20,11 @@
#include "gui/windows/mailwindow.h"
+#include "settings.h"
+
#include "enums/gui/layouttype.h"
+#include "net/mail2handler.h"
#include "net/mailhandler.h"
#include "gui/models/extendednamesmodel.h"
@@ -70,7 +73,8 @@ MailWindow::MailWindow() :
// TRANSLATORS: mail window button
mReturnButton(new Button(this, _("Return"), "return", this)),
// TRANSLATORS: mail window button
- mOpenButton(new Button(this, _("Open"), "open", this))
+ mOpenButton(new Button(this, _("Open"), "open", this)),
+ mUseMail2(settings.enableNewMailSystem)
{
setWindowName("Mail");
setCloseButton(true);
@@ -119,7 +123,7 @@ void MailWindow::action(const ActionEvent &event)
const std::string &eventId = event.getId();
if (eventId == "refresh")
{
- mailHandler->refresh();
+ refreshMails();
}
else if (eventId == "new")
{
@@ -284,7 +288,15 @@ void MailWindow::mouseClicked(MouseEvent &event)
void MailWindow::postConnection()
{
- mailHandler->refresh();
+ refreshMails();
+}
+
+void MailWindow::refreshMails()
+{
+ if (mUseMail2)
+ mail2Handler->refreshMailList(MailOpenType::Mail, 0);
+ else
+ mailHandler->refresh();
}
void MailWindow::createMail(const std::string &to)
diff --git a/src/gui/windows/mailwindow.h b/src/gui/windows/mailwindow.h
index 40be426d6..9ac4a5069 100644
--- a/src/gui/windows/mailwindow.h
+++ b/src/gui/windows/mailwindow.h
@@ -68,6 +68,8 @@ class MailWindow final : public Window,
void createMail(const std::string &to);
private:
+ void refreshMails();
+
STD_VECTOR<MailMessage*> mMessages;
std::map<int, MailMessage*> mMessagesMap;
ExtendedNamesModel *mMailModel;
@@ -78,6 +80,7 @@ class MailWindow final : public Window,
Button *mDeleteButton;
Button *mReturnButton;
Button *mOpenButton;
+ bool mUseMail2;
};
extern MailWindow *mailWindow;