From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> Date: Sun, 12 Jan 2020 20:19:18 +0000 (+0100) Subject: Show activitylist on initial tray opening when logged in X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~52 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=715924cac68061c5e47281bea4a0a6b743805b3a;p=nextcloud-desktop.git Show activitylist on initial tray opening when logged in Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 20822b068..1c9e3b47d 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -189,10 +189,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) connect(_accountState, &AccountState::stateChanged, this, &AccountSettings::slotAccountStateChanged); slotAccountStateChanged(); - if (!AccountManager::instance()->accounts().isEmpty()) { - Systray::instance()->slotChangeActivityModel(); - } - connect(&_quotaInfo, &QuotaInfo::quotaUpdated, this, &AccountSettings::slotUpdateQuota); diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 45b06ae40..4cfcab31d 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -266,6 +266,8 @@ Application::Application(int &argc, char **argv) // Allow other classes to hook into isShowingSettingsDialog() signals (re-auth widgets, for example) connect(_gui.data(), &ownCloudGui::isShowingSettingsDialog, this, &Application::slotGuiIsShowingSettings); + + _gui->createTray(); } Application::~Application() diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 5375786fd..b62122395 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -111,6 +111,10 @@ ownCloudGui::ownCloudGui(Application *parent) connect(Logger::instance(), &Logger::guiMessage, this, &ownCloudGui::slotShowGuiMessage); +} + +void ownCloudGui::createTray() +{ _tray->create(); } diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h index 518be8b16..9efd34e8b 100644 --- a/src/gui/owncloudgui.h +++ b/src/gui/owncloudgui.h @@ -63,6 +63,7 @@ public: void setupCloudProviders(); bool cloudProviderApiAvailable(); #endif + void createTray(); signals: void setupProxy(); diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 52222586d..62efff23a 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -71,6 +71,7 @@ Systray::Systray() void Systray::create() { if (_trayContext == nullptr) { + _trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel()); _trayContext = _trayEngine->contextForObject(_trayComponent->create()); hideWindow(); } diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index 510bbcbbc..aea75264a 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -275,8 +275,8 @@ Q_INVOKABLE void UserModel::switchCurrentUser(const int &id) _users[_currentUserId]->setCurrentUser(false); _users[id]->setCurrentUser(true); _currentUserId = id; - emit newUserSelected(); emit refreshCurrentUserGui(); + emit newUserSelected(); } Q_INVOKABLE void UserModel::login(const int &id) { @@ -371,6 +371,13 @@ bool UserModel::currentUserHasActivities() return _users[currentUserIndex()]->hasActivities(); } +void UserModel::fetchCurrentActivityModel() +{ + if (_users[currentUserId()]->isConnected()) { + _users[currentUserId()]->getActivityModel()->fetchMore(QModelIndex()); + } +} + /*-------------------------------------------------------------------------------------*/ ImageProvider::ImageProvider() diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h index 9f9ad55d7..3775e66b2 100644 --- a/src/gui/tray/UserModel.h +++ b/src/gui/tray/UserModel.h @@ -58,6 +58,7 @@ public: QImage avatarById(const int &id); + Q_INVOKABLE void fetchCurrentActivityModel(); Q_INVOKABLE void openCurrentAccountLocalFolder(); Q_INVOKABLE void openCurrentAccountTalk(); Q_INVOKABLE void openCurrentAccountServer(); diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 1cc2dd542..169c02ac8 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -31,10 +31,6 @@ Window { currentAccountStateIndicator.source = "" currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg" - if (userModelBackend.isUserConnected(userModelBackend.currentUserId())) { - systrayBackend.slotChangeActivityModel() - } - userLineInstantiator.active = false; userLineInstantiator.active = true; } @@ -65,6 +61,7 @@ Window { trayWindow.setX( systrayBackend.calcTrayWindowX()); trayWindow.setY( systrayBackend.calcTrayWindowY()); systrayBackend.setOpened(); + userModelBackend.fetchCurrentActivityModel(); } onHideWindow: { trayWindow.hide();