mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Some small fixes for bugs which showed up while using the current version. In this case there was an issue with the ExportInfomation passing, an export to Outlook wasn't reported as done causing the destination picker to show again after the export.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2060 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
518fa607b1
commit
4be78dddd4
4 changed files with 19 additions and 16 deletions
|
@ -218,14 +218,16 @@ namespace Greenshot.Destinations {
|
|||
foreach (string inspectorCaption in inspectorCaptions.Keys) {
|
||||
destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption]));
|
||||
}
|
||||
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
}
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
}
|
||||
} else {
|
||||
OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC);
|
||||
exportInformation.ExportMade = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ProcessExport(exportInformation, surface);
|
||||
return exportInformation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,9 @@ namespace Greenshot.Destinations {
|
|||
/// <param name="captureDetails">Details for the surface</param>
|
||||
/// <param name="destinations">The list of destinations to show</param>
|
||||
/// <returns></returns>
|
||||
public static void ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable<IDestination> destinations) {
|
||||
public static ExportInformation ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable<IDestination> destinations) {
|
||||
// Generate an empty ExportInformation object, for when nothing was selected.
|
||||
ExportInformation exportInformation = new ExportInformation(DESIGNATION, Language.GetString(LangKey.settings_destination_picker));
|
||||
ContextMenuStrip menu = new ContextMenuStrip();
|
||||
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
|
||||
LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason);
|
||||
|
@ -102,7 +104,7 @@ namespace Greenshot.Destinations {
|
|||
menu.Hide();
|
||||
|
||||
// Export
|
||||
ExportInformation exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails);
|
||||
exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails);
|
||||
if (exportInformation != null && exportInformation.ExportMade) {
|
||||
LOG.InfoFormat("Export to {0} success, closing menu", exportInformation.DestinationDescription);
|
||||
// close menu if the destination wasn't the editor
|
||||
|
@ -138,6 +140,7 @@ namespace Greenshot.Destinations {
|
|||
menu.Items.Add(closeItem);
|
||||
|
||||
ShowMenuAtCursor(menu);
|
||||
return exportInformation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -180,7 +183,6 @@ namespace Greenshot.Destinations {
|
|||
/// <param name="captureDetails">Details of the capture</param>
|
||||
/// <returns>true if export was made</returns>
|
||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
||||
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
|
||||
List<IDestination> destinations = new List<IDestination>();
|
||||
foreach(IDestination destination in DestinationHelper.GetAllDestinations()) {
|
||||
if ("Picker".Equals(destination.Designation)) {
|
||||
|
@ -192,10 +194,8 @@ namespace Greenshot.Destinations {
|
|||
destinations.Add(destination);
|
||||
}
|
||||
|
||||
ShowPickerMenu(true, surface, captureDetails, destinations);
|
||||
exportInformation.ExportMade = true;
|
||||
// No Processing! :)
|
||||
return exportInformation;
|
||||
// No Processing, this is done in the selected destination (if anything was selected)
|
||||
return ShowPickerMenu(true, surface, captureDetails, destinations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,11 +133,10 @@ namespace Greenshot.Destinations {
|
|||
foreach (string presentation in presentations) {
|
||||
destinations.Add(new PowerpointDestination(presentation));
|
||||
}
|
||||
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
exportInformation.ExportMade = true;
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
}
|
||||
}
|
||||
if (!exportInformation.ExportMade) {
|
||||
} else if (!exportInformation.ExportMade) {
|
||||
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
|
||||
exportInformation.ExportMade = true;
|
||||
}
|
||||
|
|
|
@ -142,13 +142,15 @@ namespace Greenshot.Destinations {
|
|||
foreach (string document in documents) {
|
||||
destinations.Add(new WordDestination(document));
|
||||
}
|
||||
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
}
|
||||
}
|
||||
try {
|
||||
WordExporter.InsertIntoNewDocument(tmpFile);
|
||||
exportInformation.ExportMade = true;
|
||||
} catch(Exception) {
|
||||
// Retry once, just in case
|
||||
try {
|
||||
WordExporter.InsertIntoNewDocument(tmpFile);
|
||||
exportInformation.ExportMade = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue