From be9f87144301b4b8bb0a7524be34cd8c8cf6e6e6 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 5 Jan 2017 21:15:33 +0000 Subject: [PATCH] Disable game operations while no game is detected --- src/gui/html/js/dom.js | 8 ++++++++ src/gui/html/js/events.js | 3 +++ src/gui/html/js/initialise.js | 1 + 3 files changed, 12 insertions(+) diff --git a/src/gui/html/js/dom.js b/src/gui/html/js/dom.js index 5ebe7a42..bc3895d2 100644 --- a/src/gui/html/js/dom.js +++ b/src/gui/html/js/dom.js @@ -253,5 +253,13 @@ static setUIState(state) { document.body.setAttribute('data-state', state); } + + static enableGameOperations(enable) { + document.getElementById('sortButton').disabled = !enable; + document.getElementById('updateMasterlistButton').disabled = !enable; + document.getElementById('wipeUserlistButton').disabled = !enable; + document.getElementById('copyLoadOrderButton').disabled = !enable; + document.getElementById('refreshContentButton').disabled = !enable; + } }; })); diff --git a/src/gui/html/js/events.js b/src/gui/html/js/events.js index 1b9afe07..903d38a6 100644 --- a/src/gui/html/js/events.js +++ b/src/gui/html/js/events.js @@ -315,6 +315,9 @@ function onCloseSettingsDialog(evt) { loot.query('closeSettings', settings).then(JSON.parse).then((installedGames) => { loot.installedGames = installedGames; loot.DOM.updateEnabledGames(installedGames); + if (installedGames.length > 0) { + loot.DOM.enableGameOperations(true); + } }).catch(loot.handlePromiseError) .then(() => { loot.settings = settings; diff --git a/src/gui/html/js/initialise.js b/src/gui/html/js/initialise.js index e3fcebf8..df7ff4cb 100644 --- a/src/gui/html/js/initialise.js +++ b/src/gui/html/js/initialise.js @@ -151,6 +151,7 @@ function handleInitErrors(error) { dom.listInitErrors(getErrorMessages(error.message)); Dialog.closeProgress(); + dom.enableGameOperations(false); dom.openDialog('settingsDialog'); }