From 7a94bb34d78f88c93e280da04dd8542b26686ed1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Aug 2017 20:06:09 +0300 Subject: Add support for getting attached money from mail message. --- src/gui/windows/mailviewwindow.cpp | 25 +++++++++++++++++++++++++ src/gui/windows/mailviewwindow.h | 2 ++ 2 files changed, 27 insertions(+) (limited to 'src/gui') diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index b250fad43..15c28480c 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -251,3 +251,28 @@ void MailViewWindow::removeItems(const int64_t mailId) if (mailWindow) mailWindow->refreshMailNames(); } + +void MailViewWindow::removeMoney(const int64_t mailId) +{ + if (mailId != mMessage->id) + return; + mMessage->type = static_cast( + CAST_S32(mMessage->type) | CAST_S32(MailMessageType::Money)); + mMessage->type = static_cast( + CAST_S32(mMessage->type) ^ CAST_S32(MailMessageType::Money)); + + mMessage->money = 0; + + if (mMoneyLabel == nullptr) + return; + + if (mGetMoneyButton) + mGetMoneyButton->setVisible(Visible_false); + + mMoneyLabel->setCaption(strprintf("%s %d", + // TRANSLATORS: mail view window label + _("Money:"), + 0)); + if (mailWindow) + mailWindow->refreshMailNames(); +} diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h index 13ad25676..c3f691629 100644 --- a/src/gui/windows/mailviewwindow.h +++ b/src/gui/windows/mailviewwindow.h @@ -53,6 +53,8 @@ class MailViewWindow final : public Window, void removeItems(const int64_t mailId); + void removeMoney(const int64_t mailId); + private: void updateAttachButton(); -- cgit v1.2.3-70-g09d2