summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailview.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-29 14:01:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-29 14:10:28 +0300
commitf820365eed7e956e67e6122a8a5ab529e7df9474 (patch)
tree9ee43bae2f7cafa38ab0cf018b8dbaf49d531f38 /src/gui/windows/mailview.cpp
parent4b0f30b1e1879cee6d65394d826bba21eca6c40b (diff)
downloadplus-f820365eed7e956e67e6122a8a5ab529e7df9474.tar.gz
plus-f820365eed7e956e67e6122a8a5ab529e7df9474.tar.bz2
plus-f820365eed7e956e67e6122a8a5ab529e7df9474.tar.xz
plus-f820365eed7e956e67e6122a8a5ab529e7df9474.zip
Fix time in mail view window.
Also fix possible leaks in mail windows.
Diffstat (limited to 'src/gui/windows/mailview.cpp')
-rw-r--r--src/gui/windows/mailview.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/windows/mailview.cpp b/src/gui/windows/mailview.cpp
index 4c252c89d..32a207acf 100644
--- a/src/gui/windows/mailview.cpp
+++ b/src/gui/windows/mailview.cpp
@@ -36,6 +36,7 @@
#include "gui/widgets/layouttype.h"
#include "gui/widgets/textfield.h"
+#include "utils/delete2.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -47,9 +48,11 @@
#include "debug.h"
+MailView *mailViewWindow = nullptr;
+
MailView::MailView(const MailMessage *const message) :
// TRANSLATORS: mail view window name
- Window(_("View mail"), true, nullptr, "mailview.xml"),
+ Window(_("View mail"), false, nullptr, "mailview.xml"),
ActionListener(),
mMessage(message),
// TRANSLATORS: mail view window button
@@ -70,9 +73,8 @@ MailView::MailView(const MailMessage *const message) :
mMessageLabel(new Label(this, strprintf("%s %s", _("Message:"),
message->text.c_str()))),
// TRANSLATORS: mail view window label
- mItemLabel(new Label(this, std::string(_("Item:")).append(" "))),
- mMessageField(new TextField(this)),
- mIcon(new Icon(this, nullptr))
+ mItemLabel(nullptr),
+ mIcon(nullptr)
{
setWindowName("MailView");
setCloseButton(true);
@@ -89,8 +91,6 @@ MailView::MailView(const MailMessage *const message) :
ContainerPlacer placer;
placer = getPlacer(0, 0);
- mMessageField->setWidth(100);
-
int n = 0;
placer(0, n++, mTimeLabel);
placer(0, n++, mFromLabel);
@@ -111,7 +111,8 @@ MailView::MailView(const MailMessage *const message) :
paths.getStringValue("itemIcons").append(
item.getDisplay().image), item.getDyeColorsString(1)));
- mIcon->setImage(image);
+ mIcon = new Icon(this, image);
+ mItemLabel = new Label(this, std::string(_("Item:")).append(" "));
placer(0, n, mItemLabel);
placer(1, n++, mIcon);
}
@@ -125,6 +126,14 @@ MailView::MailView(const MailMessage *const message) :
MailView::~MailView()
{
+ if (mIcon)
+ {
+ Image *const image = mIcon->getImage();
+ if (image)
+ image->decRef();
+ }
+ delete2(mMessage);
+ mailViewWindow = nullptr;
}
void MailView::action(const ActionEvent &event)