summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailviewwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-26 19:33:11 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-26 19:33:11 +0300
commit86735e142e86391e46b0eafbcb7ef01e25fc969a (patch)
treea717ba215baae052de204ed7b8e50b20c453882a /src/gui/windows/mailviewwindow.cpp
parentd3f61bb7da045c7d0a955a3859aac713d1bfc6e7 (diff)
downloadmv-86735e142e86391e46b0eafbcb7ef01e25fc969a.tar.gz
mv-86735e142e86391e46b0eafbcb7ef01e25fc969a.tar.bz2
mv-86735e142e86391e46b0eafbcb7ef01e25fc969a.tar.xz
mv-86735e142e86391e46b0eafbcb7ef01e25fc969a.zip
Add support for getting attached items from mail message.
Diffstat (limited to 'src/gui/windows/mailviewwindow.cpp')
-rw-r--r--src/gui/windows/mailviewwindow.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp
index 56367ef78..b250fad43 100644
--- a/src/gui/windows/mailviewwindow.cpp
+++ b/src/gui/windows/mailviewwindow.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "settings.h"
+#include "net/mail2handler.h"
#include "net/mailhandler.h"
#include "gui/mailmessage.h"
@@ -54,7 +55,7 @@
MailViewWindow *mailViewWindow = nullptr;
-MailViewWindow::MailViewWindow(const MailMessage *const message,
+MailViewWindow::MailViewWindow(MailMessage *const message,
const int itemsCount) :
// TRANSLATORS: mail view window name
Window(_("View mail"), Modal_false, nullptr, "mailview.xml"),
@@ -128,7 +129,7 @@ MailViewWindow::MailViewWindow(const MailMessage *const message,
mGetMoneyButton = new Button(this,
// TRANSLATORS: mail view attached money button
_("Get money"),
- "attach", this);
+ "money", this);
placer(0, n++, mGetMoneyButton);
}
placer(0, n++, mGetAttachButton);
@@ -170,8 +171,23 @@ void MailViewWindow::action(const ActionEvent &event)
}
else if (eventId == "attach")
{
- if (mGetAttachButton != nullptr)
+ if (mUseMail2)
+ {
+ mail2Handler->requestItems(mailWindow->getOpenType(),
+ mMessage->id);
+ }
+ else
+ {
mailHandler->getAttach(mMessage->id);
+ }
+ }
+ else if (eventId == "money")
+ {
+ if (mUseMail2)
+ {
+ mail2Handler->requestMoney(mailWindow->getOpenType(),
+ mMessage->id);
+ }
}
else if (eventId == "next")
{
@@ -221,3 +237,17 @@ void MailViewWindow::updateItems()
mItemContainer->updateMatrix();
updateAttachButton();
}
+
+void MailViewWindow::removeItems(const int64_t mailId)
+{
+ if (mailId != mMessage->id)
+ return;
+ mInventory->clear();
+ mMessage->type = static_cast<MailMessageType::Type>(
+ CAST_S32(mMessage->type) | CAST_S32(MailMessageType::Item));
+ mMessage->type = static_cast<MailMessageType::Type>(
+ CAST_S32(mMessage->type) ^ CAST_S32(MailMessageType::Item));
+ updateAttachButton();
+ if (mailWindow)
+ mailWindow->refreshMailNames();
+}