Fix "You have not sorted..." reappearing

The "You have not sorted..." message was reappearing after sorting your
load order when no changes were necessary, then switching to another
game then back again, because the cancelSort query was reinstating the
message.

A new discardUnappliedChanges query was added to ensure the change
counter is zeroed, and that used where appropriate instead of cancelSort.
This commit is contained in:
Oliver Hamlet
2016-03-05 10:04:12 +00:00
parent 7c2609f934
commit 0874e23ecd
2 changed files with 11 additions and 15 deletions
+6
View File
@@ -180,6 +180,12 @@ namespace loot {
callback->Success("");
return true;
}
else if (request == "discardUnappliedChanges") {
while (_lootState.hasUnappliedChanges())
_lootState.decrementUnappliedChangeCounter();
callback->Success("");
return true;
}
else {
// May be a request with arguments.
YAML::Node req;
+5 -15
View File
@@ -119,9 +119,9 @@ function onSortPlugins() {
existingPlugin.isEmpty = plugin.isEmpty;
}
});
/* Send cancelSort query to notify that no unapplied sorting changes are
present. Not doing so prevents LOOT's window from closing. */
loot.query('cancelSort');
/* Send discardUnappliedChanges query. Not doing so prevents LOOT's window
from closing. */
loot.query('discardUnappliedChanges');
loot.Dialog.closeProgress();
loot.Dialog.showNotification(loot.l10n.translate('Sorting made no changes to the load order.'));
return;
@@ -333,18 +333,8 @@ function handleUnappliedChangesClose(change) {
if (!result) {
return;
}
/* Cancel any sorting and close any editors. Cheat by sending a
cancelSort query for as many times as necessary. */
const queries = [];
let numQueries = 0;
if (!document.getElementById('applySortButton').hidden) {
numQueries += 1;
}
numQueries += document.body.getAttribute('data-editors');
for (let i = 0; i < numQueries; ++i) {
queries.push(loot.query('cancelSort'));
}
Promise.all(queries).then(() => {
/* Discard any unapplied changes. */
loot.query('discardUnappliedChanges').then(() => {
window.close();
}).catch(handlePromiseError);
});