Bunch of fixes and optimizations for activityList
authorDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Sun, 12 Jan 2020 16:52:51 +0000 (17:52 +0100)
committerDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Sun, 12 Jan 2020 16:52:51 +0000 (17:52 +0100)
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
src/gui/accountsettings.cpp
src/gui/systray.cpp
src/gui/systray.h
src/gui/tray/UserLine.qml
src/gui/tray/Window.qml

index 604abace1c51f7f34a093667c4debf3400a25226..c28096b968e8528c1a0e21256c86fe7d84e86707 100644 (file)
@@ -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);
 
index a241e5fc28558d548f8c1641459269e02438b20d..f26ad8717d9c968c813d309d546986168d77e840 100644 (file)
@@ -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()
index 60a44a3f91077099cec375ce3836f1786fe0501e..7125c1090216a11666ce278adeaf35539ca42d2e 100644 (file)
@@ -69,7 +69,7 @@ signals:
     Q_INVOKABLE void hideWindow();
     Q_INVOKABLE void showWindow();
 
-private slots:
+public slots:
     void slotChangeActivityModel();
 
 private:
index 6d41fc7d944f1d79512c68a68035d857c440f523..700951fefd5dd858344415989b63f313b1e6ef42 100644 (file)
@@ -25,7 +25,11 @@ MenuItem {
                 }\r
 \r
                 onClicked: {\r
-                    userModelBackend.switchCurrentUser(index)\r
+                    if (!isCurrentUser) {\r
+                        userModelBackend.switchCurrentUser(id)\r
+                    } else {\r
+                        accountMenu.close()\r
+                    }\r
                 }\r
 \r
                 RowLayout {\r
index a9094761571f60e304f93837c086cd289014e2d3..1cc2dd542d8decfbf0a2032c800e643c0eb4fbea 100644 (file)
@@ -31,6 +31,10 @@ Window {
         currentAccountStateIndicator.source = ""\r
         currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"\r
 \r
+        if (userModelBackend.isUserConnected(userModelBackend.currentUserId())) {\r
+            systrayBackend.slotChangeActivityModel()\r
+        }\r
+\r
         userLineInstantiator.active = false;\r
         userLineInstantiator.active = true;\r
     }\r
@@ -535,10 +539,6 @@ Window {
             }\r
 \r
             focus: true\r
-\r
-            // For interactive ListView/Animation testing only\r
-            //Keys.onSpacePressed: model.insert(0, { "name": "Item " + model.count })\r
-            //Keys.onTabPressed: model.remove(3)\r
         }\r
 \r
     }       // Rectangle trayWindowBackground\r