mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Implemented "Clear All User Metadata" feature.
This commit is contained in:
@@ -306,7 +306,16 @@ function redatePlugins(evt) {
|
||||
//showMessageBox('info', 'Redate Plugins', 'Plugins were successfully redated.');
|
||||
}
|
||||
function clearAllMetadata(evt) {
|
||||
showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?');
|
||||
showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?', function(result){
|
||||
if (result) {
|
||||
loot.query('clearAllMetadata').then(function(result){
|
||||
/* Need to also empty the UI-side user metadata. */
|
||||
loot.game.plugins.forEach(function(plugin){
|
||||
plugin.userlist = undefined;
|
||||
});
|
||||
}).catch(processCefError);
|
||||
}
|
||||
});
|
||||
}
|
||||
function handlePluginDrop(evt) {
|
||||
evt.stopPropagation();
|
||||
|
||||
@@ -116,6 +116,11 @@ namespace loot {
|
||||
uout.close();
|
||||
}
|
||||
|
||||
void MetadataList::clear() {
|
||||
plugins.clear();
|
||||
messages.clear();
|
||||
}
|
||||
|
||||
bool MetadataList::operator == (const MetadataList& rhs) const {
|
||||
if (this->plugins.size() != rhs.plugins.size() || this->messages.size() != rhs.messages.size()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Metadata edited for some plugin, new and old userlists differ in size.";
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace loot {
|
||||
public:
|
||||
void Load(const boost::filesystem::path& filepath);
|
||||
void Save(const boost::filesystem::path& filepath);
|
||||
void clear();
|
||||
|
||||
bool operator == (const MetadataList& rhs) const; //Compares content.
|
||||
|
||||
|
||||
@@ -130,6 +130,11 @@ namespace loot {
|
||||
callback->Success("");
|
||||
return true;
|
||||
}
|
||||
else if (request == "clearAllMetadata") {
|
||||
g_app_state.CurrentGame().userlist.clear();
|
||||
callback->Success("");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// May be a request with arguments.
|
||||
YAML::Node req;
|
||||
|
||||
Reference in New Issue
Block a user