diff options
author | Michael Schuster <michael@schuster.ms> | 2020-01-15 18:42:06 +0300 |
---|---|---|
committer | Michael Schuster <michael@schuster.ms> | 2020-01-15 18:42:06 +0300 |
commit | b4b6366ba8aa6eaa19aa37c2e1f00fb2c5ff0178 (patch) | |
tree | 14ffb54d75e295d99e59db5b63299874af695342 /src/gui/systray.cpp | |
parent | 7b740f5e9a91fb6c814fae6946b3f8ca4260855e (diff) |
Add App list menu to Tray UI
- Modify Window.qml and Systray to show the App menu upon clicking the App button
on the top-right. Fall back to opening the general URL in case no apps are found.
- Introduce a new UserAppsModel in UserModel.cpp to access the fetched server Apps
from AccountState (propagated down from the User class).
Signed-off-by: Michael Schuster <michael@schuster.ms>
Diffstat (limited to 'src/gui/systray.cpp')
-rw-r--r-- | src/gui/systray.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index b817054d1..6becf1662 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -57,12 +57,13 @@ Systray::Systray() _trayEngine = new QQmlEngine; _trayEngine->addImageProvider("avatars", new ImageProvider); _trayEngine->rootContext()->setContextProperty("userModelBackend", UserModel::instance()); + _trayEngine->rootContext()->setContextProperty("appsMenuModelBackend", UserAppsModel::instance()); _trayEngine->rootContext()->setContextProperty("systrayBackend", this); _trayComponent = new QQmlComponent(_trayEngine, QUrl(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml"))); connect(UserModel::instance(), &UserModel::newUserSelected, - this, &Systray::slotChangeActivityModel); + this, &Systray::slotNewUserSelected); connect(AccountManager::instance(), &AccountManager::accountAdded, this, &Systray::showWindow); @@ -77,9 +78,13 @@ void Systray::create() } } -void Systray::slotChangeActivityModel() +void Systray::slotNewUserSelected() { + // Change ActivityModel _trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel()); + + // Rebuild App list + UserAppsModel::instance()->buildAppList(); } bool Systray::isOpen() |