diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-28 02:23:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-29 14:10:28 +0300 |
commit | e7379712454c42cabdc60cf2db11a5906949330f (patch) | |
tree | 1f88dafb7373ee7b0101d612ff2be9ebf3d538b8 | |
parent | ddefda720d1ed957da01028e789f99cbd27a8b62 (diff) | |
download | mv-e7379712454c42cabdc60cf2db11a5906949330f.tar.gz mv-e7379712454c42cabdc60cf2db11a5906949330f.tar.bz2 mv-e7379712454c42cabdc60cf2db11a5906949330f.tar.xz mv-e7379712454c42cabdc60cf2db11a5906949330f.zip |
Show mail view window for open mail button.
-rw-r--r-- | src/gui/windows/mailwindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/windows/mailwindow.h | 2 |
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; |