diff options
author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-07-08 16:44:35 +0200 |
---|---|---|
committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-07-08 16:44:35 +0200 |
commit | acf033cbb15641a79a093c301efa3fd478237c2a (patch) | |
tree | c5fff9bbbaa6a5ffcca1306c9fcfee700b3268dd | |
parent | b975bb69043c8857bbfb5c152e6e277beadf5853 (diff) | |
download | RWA.Support.DesktopApp-acf033cbb15641a79a093c301efa3fd478237c2a.tar.gz RWA.Support.DesktopApp-acf033cbb15641a79a093c301efa3fd478237c2a.tar.bz2 RWA.Support.DesktopApp-acf033cbb15641a79a093c301efa3fd478237c2a.zip |
If there are no hosts available: display it in the sidebar menu.
-rw-r--r-- | src/main_qmladaptor.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main_qmladaptor.cpp b/src/main_qmladaptor.cpp index 845da0a..419f794 100644 --- a/src/main_qmladaptor.cpp +++ b/src/main_qmladaptor.cpp @@ -151,7 +151,20 @@ void MainQMLAdaptor::get_web_app_hosts_response(QJsonDocument *doc) { if (!atLeastOneHostAvailable) { main_content_replace("scenes/Scene_no_server_available.qml"); - //addRWAHost(new RWAHost("-","Kein Server verfügbar!","-")); + // Find item via 'objectName' + QObject *sidebar_drawer = _engine->rootObjects().takeFirst()->findChild<QObject*>("sidebar_drawer"); + if (sidebar_drawer) { + sidebar_drawer->setProperty("rwaHostIsSelected", false); + } else { + qWarning() << "Unable to find 'sidebar_drawer' Item!"; + } + } + QObject *server_chooser = _engine->rootObjects().takeFirst()->findChild<QObject*>("server_chooser"); + if (server_chooser) { + server_chooser->setProperty("displayText", atLeastOneHostAvailable ? server_chooser->property("currentText") : tr("No RWA host available!")); + server_chooser->setProperty("enabled", atLeastOneHostAvailable); + } else { + qWarning() << "Unable to find 'server_chooser' Item!"; } } |