From c67ebf19d45c8371c93d86587608e4b4ff44cd4a Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Wed, 26 Aug 2020 11:01:40 -0400 Subject: [PATCH] Fix AutoOpen IfDevice matching, again * Fix case where only exclusions are entered (eg, !COMPUTER1, !COMPUTER2) which should allow opening the database on every other computer name. --- src/gui/DatabaseWidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index d5ac7eb3e..5cfe26e03 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -2061,7 +2061,7 @@ void DatabaseWidget::processAutoOpen() // negated using '!' auto ifDevice = entry->attribute("IfDevice"); if (!ifDevice.isEmpty()) { - bool loadDb = true; + bool loadDb = false; auto hostName = QHostInfo::localHostName(); for (auto& device : ifDevice.split(",")) { device = device.trimmed(); @@ -2070,12 +2070,13 @@ void DatabaseWidget::processAutoOpen() // Machine name matched an exclusion, don't load this database loadDb = false; break; + } else { + // Not matching an exclusion allows loading on all machines + loadDb = true; } } else if (device.compare(hostName, Qt::CaseInsensitive) == 0) { + // Explicitly named for loading loadDb = true; - } else { - // Don't load the database if there are devices not starting with '!' - loadDb = false; } } if (!loadDb) {