summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-27 18:20:50 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-27 19:55:54 +0300
commit9af27292809ee8bf42f46e214c21c305c3cd810f (patch)
tree99a6ba2d4943932742255ba05eba1a0a94305754 /src/gui/windows/mailwindow.cpp
parent22ba86a17c2a7ce05cad3cdd1713081a6ea1b2fe (diff)
downloadmv-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.gz
mv-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.bz2
mv-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.xz
mv-9af27292809ee8bf42f46e214c21c305c3cd810f.zip
eathena: impliment packet SMSG_MAIL_MAILS_LIST.
Diffstat (limited to 'src/gui/windows/mailwindow.cpp')
-rw-r--r--src/gui/windows/mailwindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index 873242e5d..966077e93 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -24,6 +24,8 @@
#include "gui/models/extendednamesmodel.h"
+#include "gui/mailmessage.h"
+
#include "gui/windows/mailedit.h"
#include "gui/windows/setupwindow.h"
@@ -34,6 +36,8 @@
#include "gui/widgets/layout.h"
#include "gui/widgets/layouttype.h"
+#include "utils/delete2.h"
+#include "utils/dtor.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -45,6 +49,7 @@ MailWindow::MailWindow() :
// TRANSLATORS: mail window name
Window(_("Mail"), false, nullptr, "mail.xml"),
ActionListener(),
+ mMessages(),
mMailModel(new ExtendedNamesModel),
mListBox(new ExtendedListBox(this, mMailModel, "extendedlistbox.xml")),
// TRANSLATORS: mail window button
@@ -90,6 +95,8 @@ MailWindow::MailWindow() :
MailWindow::~MailWindow()
{
+ delete_all(mMessages);
+ delete2(mMailModel);
}
void MailWindow::action(const ActionEvent &event)
@@ -104,3 +111,16 @@ void MailWindow::action(const ActionEvent &event)
new MailEdit();
}
}
+
+void MailWindow::clear()
+{
+ delete_all(mMessages);
+ mMailModel->clear();
+ mListBox->setSelected(-1);
+}
+
+void MailWindow::addMail(MailMessage *const message)
+{
+ mMessages.push_back(message);
+ mMailModel->add(message->title);
+}