aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-07-08 16:44:35 +0200
committerDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-07-08 16:44:35 +0200
commitacf033cbb15641a79a093c301efa3fd478237c2a (patch)
treec5fff9bbbaa6a5ffcca1306c9fcfee700b3268dd
parentb975bb69043c8857bbfb5c152e6e277beadf5853 (diff)
downloadRWA.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.cpp15
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!";
}
}