feat(PluginManager): add DeleteConfiguration() and UI

This commit is contained in:
goat 2021-07-16 22:57:41 +02:00
parent 68142da426
commit 9759ac6d11
No known key found for this signature in database
GPG key ID: F18F057873895461
3 changed files with 66 additions and 1 deletions

View file

@ -692,6 +692,25 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Unindent();
}
if (ImGui.BeginPopupContextItem("InstalledItemContextMenu"))
{
if (ImGui.Selectable(Locs.PluginContext_DeletePluginConfig))
{
Log.Debug($"Deleting config for {plugin.Manifest.InternalName}");
Task.Run(() => this.dalamud.PluginManager.DeleteConfiguration(plugin))
.ContinueWith(task =>
{
// There is no need to set as Complete for an individual plugin installation
this.installStatus = OperationStatus.Idle;
this.DisplayErrorContinuation(task, Locs.ErrorModal_DeleteConfigFail(plugin.Name));
});
}
ImGui.EndPopup();
}
}
private void DrawPluginControlButton(LocalPlugin plugin)
@ -1125,6 +1144,8 @@ namespace Dalamud.Interface.Internal.Windows
public static string PluginContext_HidePlugin => Loc.Localize("InstallerHidePlugin", "Hide from installer");
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Delete configuration data & reload");
#endregion
#region Plugin body
@ -1199,6 +1220,8 @@ namespace Dalamud.Interface.Internal.Windows
public static string ErrorModal_SingleUpdateFail(string name) => Loc.Localize("InstallerSingleUpdateFail", "Failed to update plugin {0}.").Format(name);
public static string ErrorModal_DeleteConfigFail(string name) => Loc.Localize("InstallerDeleteConfigFail", "Failed to reset the plugin {0}.\n\nThe plugin may not support this action. You can try deleting the configuration manually while the game is shut down - please see the FAQ.").Format(name);
public static string ErrorModal_EnableFail(string name) => Loc.Localize("InstallerEnableFail", "Failed to enable plugin {0}.").Format(name);
public static string ErrorModal_DisableFail(string name) => Loc.Localize("InstallerDisableFail", "Failed to disable plugin {0}.").Format(name);