summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
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;