From d3f61bb7da045c7d0a955a3859aac713d1bfc6e7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Aug 2017 18:39:30 +0300 Subject: In mail view window show buttons for get attach and money. Also fix default window height. --- src/gui/windows/mailviewwindow.cpp | 25 ++++++++++++++++++++----- src/gui/windows/mailviewwindow.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index 2f6c1c28b..56367ef78 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -60,8 +60,11 @@ MailViewWindow::MailViewWindow(const MailMessage *const message, Window(_("View mail"), Modal_false, nullptr, "mailview.xml"), ActionListener(), mMessage(message), - // TRANSLATORS: mail view attach button - mGetAttachButton(new Button(this, _("Get attach"), "attach", this)), + mGetAttachButton(new Button(this, + // TRANSLATORS: mail view attach / items button + settings.enableNewMailSystem ? _("Get items") : _("Get attach"), + "attach", this)), + mGetMoneyButton(nullptr), // TRANSLATORS: mail view window button mCloseButton(new Button(this, _("Close"), "close", this)), mPrevButton(new Button(this, "<", "prev", this)), @@ -95,12 +98,11 @@ MailViewWindow::MailViewWindow(const MailMessage *const message, setStickyButtonLock(true); setVisible(Visible_true); - setDefaultSize(380, 230, ImagePosition::CENTER); + setDefaultSize(380, 370, ImagePosition::CENTER); setMinWidth(200); setMinHeight(100); center(); mItemScrollArea->setHeight(100); - mItemScrollArea->setWidth(100); mItemScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); @@ -121,6 +123,14 @@ MailViewWindow::MailViewWindow(const MailMessage *const message, placer(0, n++, mMessageLabel); placer(0, n++, mItemScrollArea); + if (mUseMail2 && message->money != 0) + { + mGetMoneyButton = new Button(this, + // TRANSLATORS: mail view attached money button + _("Get money"), + "attach", this); + placer(0, n++, mGetMoneyButton); + } placer(0, n++, mGetAttachButton); updateAttachButton(); @@ -139,9 +149,14 @@ MailViewWindow::MailViewWindow(const MailMessage *const message, MailViewWindow::~MailViewWindow() { if (mUseMail2) + { mMessage = nullptr; + } else + { delete2(mMessage); + delete2(mGetMoneyButton); + } delete2(mInventory); mailViewWindow = nullptr; } @@ -189,7 +204,7 @@ Inventory *MailViewWindow::getInventory() const void MailViewWindow::updateAttachButton() { - if (mMessage->money != 0 || + if ((mMessage->money != 0 && !mUseMail2) || mMessage->itemId != 0 || mInventory->getLastUsedSlot() != -1) { diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h index 9f09bb9a7..524c029d4 100644 --- a/src/gui/windows/mailviewwindow.h +++ b/src/gui/windows/mailviewwindow.h @@ -56,6 +56,7 @@ class MailViewWindow final : public Window, const MailMessage *mMessage; Button *mGetAttachButton; + Button *mGetMoneyButton; Button *mCloseButton; Button *mPrevButton; Button *mNextButton; -- cgit v1.2.3-60-g2f50