summary refs log tree commit diff
path: root/src/ChatPage.cc
diff options
context:
space:
mode:
authorMax Sandholm <max@sandholm.org>2018-07-11 17:33:02 +0300
committermujx <mujx@users.noreply.github.com>2018-07-11 17:33:02 +0300
commit80ebe3f29debb7f2020757252d1e2b4ae8a45869 (patch)
tree07a9bb42e559503787fbde1fd4eec7922bbafed0 /src/ChatPage.cc
parentUse QSharedPointer::data to be compatible with Qt < 5.11 (diff)
downloadnheko-80ebe3f29debb7f2020757252d1e2b4ae8a45869.tar.xz
Working D-Bus desktop notifications (#361)
* Working D-Bus desktop notifications

* Remove return type on constructor

* Fix the Windows placeholder class

* Fix wrong variable name

* Fix windows and macOS versions of notificationsmanager
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc

index 29747fbe..336ea7c3 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -56,6 +56,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) : QWidget(parent) , isConnected_(true) , userSettings_{userSettings} + , notificationsManager(this) { setObjectName("chatPage"); @@ -541,6 +542,15 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) room_list_->setRoomFilter(communities_[communityId]->getRoomList()); }); + connect(&notificationsManager, + &NotificationsManager::notificationClicked, + this, + [this](const QString &roomid, const QString &eventid) { + Q_UNUSED(eventid) + room_list_->highlightSelectedRoom(roomid); + activateWindow(); + }); + setGroupViewState(userSettings_->isGroupViewEnabled()); connect(userSettings_.data(), @@ -998,11 +1008,14 @@ ChatPage::sendDesktopNotifications(const mtx::responses::Notifications &res) if (isRoomActive(room_id)) continue; - NotificationsManager::postNotification( + notificationsManager.postNotification( + room_id, + QString::fromStdString(event_id), QString::fromStdString( cache::client()->singleRoomInfo(item.room_id).name), Cache::displayName(room_id, user_id), - utils::event_body(item.event)); + utils::event_body(item.event), + cache::client()->getRoomAvatar(room_id)); } } catch (const lmdb::error &e) { nhlog::db()->warn("error while sending desktop notification: {}", e.what());