Implementing save changes before closing dialog for the image editor as requested on issue 6725

This commit is contained in:
gregorygregio 2024-01-03 16:16:13 -03:00
parent 52a71c8b8d
commit 894394715b
4 changed files with 27 additions and 2 deletions

View file

@ -605,8 +605,15 @@ internal bool ShowExitConfirmation()
if (IsImageModified)
{
Pause();
result = MessageBox.Show(this, Resources.RegionCaptureForm_ShowExitConfirmation_Text, Resources.RegionCaptureForm_ShowExitConfirmation_ShareXImageEditor,
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
DialogResult dialogResult = MessageBox.Show(this, Resources.RegionCaptureForm_SaveChangesBeforeClosingEditor, Resources.RegionCaptureForm_ShowExitConfirmation_ShareXImageEditor,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dialogResult == DialogResult.Yes)
{
OnSaveImageRequested();
}
result = dialogResult != DialogResult.Cancel;
Resume();
}

View file

@ -1356,6 +1356,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to There are unsaved changes.
///Would you like to save the changes before closing the editor.
/// </summary>
internal static string RegionCaptureForm_SaveChangesBeforeClosingEditor {
get {
return ResourceManager.GetString("RegionCaptureForm_SaveChangesBeforeClosingEditor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ShareX - Image editor.
/// </summary>

View file

@ -487,4 +487,8 @@ Você gostaria de fechar o editor de imagens?</value>
<data name="ShapeManager_CreateToolbar_ZoomToFitOnOpen" xml:space="preserve">
<value>Zoom para caber em aberto</value>
</data>
<data name="RegionCaptureForm_SaveChangesBeforeClosingEditor" xml:space="preserve">
<value>Existem alterações não salvas.
Deseja salvar as alterações antes de fechar o editor?</value>
</data>
</root>

View file

@ -823,4 +823,8 @@ Would you like to close image editor?</value>
<data name="ImageURL" xml:space="preserve">
<value>Image URL</value>
</data>
<data name="RegionCaptureForm_SaveChangesBeforeClosingEditor" xml:space="preserve">
<value>There are unsaved changes.
Would you like to save the changes before closing the editor</value>
</data>
</root>