From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> Date: Sun, 12 Jan 2020 16:52:51 +0000 (+0100) Subject: Bunch of fixes and optimizations for activityList X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~54 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1c2916052d4ab9e4645443fda70d7aa4c94c412f;p=nextcloud-desktop.git Bunch of fixes and optimizations for activityList Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 604abace1..c28096b96 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -192,6 +192,10 @@ 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/systray.cpp b/src/gui/systray.cpp index a241e5fc2..f26ad8717 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -61,10 +61,6 @@ Systray::Systray() _trayComponent = new QQmlComponent(_trayEngine, QUrl(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml"))); - if (!AccountManager::instance()->accounts().isEmpty()) { - slotChangeActivityModel(); - } - connect(UserModel::instance(), &UserModel::newUserSelected, this, &Systray::slotChangeActivityModel); @@ -83,7 +79,7 @@ void Systray::create() void Systray::slotChangeActivityModel() { _trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel()); - emit currentUserChanged(); + //UserModel::instance()->currentActivityModel()->slotRefreshActivity(); } bool Systray::isOpen() diff --git a/src/gui/systray.h b/src/gui/systray.h index 60a44a3f9..7125c1090 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -69,7 +69,7 @@ signals: Q_INVOKABLE void hideWindow(); Q_INVOKABLE void showWindow(); -private slots: +public slots: void slotChangeActivityModel(); private: diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 6d41fc7d9..700951fef 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -25,7 +25,11 @@ MenuItem { } onClicked: { - userModelBackend.switchCurrentUser(index) + if (!isCurrentUser) { + userModelBackend.switchCurrentUser(id) + } else { + accountMenu.close() + } } RowLayout { diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index a90947615..1cc2dd542 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -31,6 +31,10 @@ 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; } @@ -535,10 +539,6 @@ Window { } focus: true - - // For interactive ListView/Animation testing only - //Keys.onSpacePressed: model.insert(0, { "name": "Item " + model.count }) - //Keys.onTabPressed: model.remove(3) } } // Rectangle trayWindowBackground