Fix wrong user intention (clipboard or save) detection on edit for.

This commit is contained in:
Alberto Aldegheri 2022-08-05 12:06:56 +02:00
commit 73f5bbb012
2 changed files with 11 additions and 4 deletions

View file

@ -935,7 +935,8 @@ namespace Greenshot.Editor.Forms
// Make sure the editor is visible
WindowDetails.ToForeground(Handle);
bool saveToClipboard = _surface.CaptureDetails.CaptureMode == CaptureMode.Clipboard;
// If the user choose the clipboard as destination, just keep it also on close
bool saveToClipboard = _surface.CaptureDetails.CaptureDestinations.SingleOrDefault()?.Designation == nameof(WellKnownDestinations.Clipboard);
MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel;
// Dissallow "CANCEL" if the application needs to shutdown
@ -958,7 +959,6 @@ namespace Greenshot.Editor.Forms
if (result.Equals(DialogResult.Yes))
{
// If the user choose the clipboard as destination, just keep it also on close
if (saveToClipboard)
{
BtnClipboardClick(sender, e);

View file

@ -20,6 +20,7 @@
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Greenshot.Base;
@ -83,10 +84,16 @@ namespace Greenshot.Destinations
{
Log.Info(Designation + " Notification Clicked!");
var surface = new Surface((Image)e.Image.Clone()) { CaptureDetails = new CaptureDetails { CaptureMode = CaptureMode.Clipboard } };
var captureDetails = new CaptureDetails
{
CaptureMode = CaptureMode.Clipboard,
CaptureDestinations = new List<IDestination> { DestinationHelper.GetDestination(Designation) }
};
var surface = new Surface((Image)e.Image.Clone()) { CaptureDetails = captureDetails };
DestinationHelper.GetDestination(EditorDestination.DESIGNATION)
.ExportCapture(true, surface, new CaptureDetails { CaptureMode = CaptureMode.Clipboard });
.ExportCapture(true, surface, captureDetails);
}
}
}