summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-28 02:23:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-29 14:10:28 +0300
commite7379712454c42cabdc60cf2db11a5906949330f (patch)
tree1f88dafb7373ee7b0101d612ff2be9ebf3d538b8
parentddefda720d1ed957da01028e789f99cbd27a8b62 (diff)
downloadplus-e7379712454c42cabdc60cf2db11a5906949330f.tar.gz
plus-e7379712454c42cabdc60cf2db11a5906949330f.tar.bz2
plus-e7379712454c42cabdc60cf2db11a5906949330f.tar.xz
plus-e7379712454c42cabdc60cf2db11a5906949330f.zip
Show mail view window for open mail button.
-rw-r--r--src/gui/windows/mailwindow.cpp18
-rw-r--r--src/gui/windows/mailwindow.h2
2 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index 966077e93..e9933b307 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -27,6 +27,7 @@
#include "gui/mailmessage.h"
#include "gui/windows/mailedit.h"
+#include "gui/windows/mailview.h"
#include "gui/windows/setupwindow.h"
#include "gui/widgets/button.h"
@@ -110,6 +111,14 @@ void MailWindow::action(const ActionEvent &event)
{
new MailEdit();
}
+ else if (eventId == "open")
+ {
+ const int sel = mListBox->getSelected();
+ if (sel < 0)
+ return;
+ const MailMessage *const mail = mMessages[sel];
+ mailHandler->readMessage(mail->id);
+ }
}
void MailWindow::clear()
@@ -122,5 +131,12 @@ void MailWindow::clear()
void MailWindow::addMail(MailMessage *const message)
{
mMessages.push_back(message);
- mMailModel->add(message->title);
+ mMailModel->add(strprintf("%s %s",
+ message->unread ? " " : "U",
+ message->title.c_str()));
+}
+
+void MailWindow::showMessage(const MailMessage *const mail)
+{
+ new MailView(mail);
}
diff --git a/src/gui/windows/mailwindow.h b/src/gui/windows/mailwindow.h
index 459a6ffc7..b92b21d9e 100644
--- a/src/gui/windows/mailwindow.h
+++ b/src/gui/windows/mailwindow.h
@@ -54,6 +54,8 @@ class MailWindow final : public Window,
void clear();
+ void showMessage(const MailMessage *const mail);
+
private:
std::vector<MailMessage*> mMessages;
ExtendedNamesModel *mMailModel;