From 20d4fb693f85e155a14da6b14120561160ff17eb Mon Sep 17 00:00:00 2001 From: RKrom Date: Wed, 21 Mar 2012 15:17:27 +0000 Subject: [PATCH] See feature request #3488317: When taking an IE capture, now the URL is added to the meta data. This makes it possible to include the URL in the pattern. Although one should wonder how this would look after making it "filename safe"... but there is a use when printing. I also added the following info: URL_SCHEME, URL_HOSTNAME, URL_PORT, URL_PATH, URL_QUERY, URL_USER. These last fields might make more sense to use. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1720 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Helpers/IECaptureHelper.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Greenshot/Helpers/IECaptureHelper.cs b/Greenshot/Helpers/IECaptureHelper.cs index 30f49abe5..851c80cee 100644 --- a/Greenshot/Helpers/IECaptureHelper.cs +++ b/Greenshot/Helpers/IECaptureHelper.cs @@ -295,13 +295,37 @@ namespace Greenshot.Helpers { capture.Image = returnBitmap; // Store the location of the window capture.Location = documentContainer.ContentWindow.Location; - // Store the title of the Page + + // Store the title of the page if (documentContainer.Name != null) { capture.CaptureDetails.Title = documentContainer.Name; } else { capture.CaptureDetails.Title = activeWindow.Text; } - + + // Store the URL of the page + if (documentContainer.Url != null) { + Uri uri = new Uri(documentContainer.Url); + capture.CaptureDetails.AddMetaData("URL", uri.OriginalString); + // As the URL can hardly be used in a filename, the following can be used + if (!string.IsNullOrEmpty(uri.Scheme)) { + capture.CaptureDetails.AddMetaData("URL_SCHEME", uri.Scheme); + } + if (!string.IsNullOrEmpty(uri.DnsSafeHost)) { + capture.CaptureDetails.AddMetaData("URL_HOSTNAME", uri.DnsSafeHost); + } + if (!string.IsNullOrEmpty(uri.AbsolutePath)) { + capture.CaptureDetails.AddMetaData("URL_PATH", uri.AbsolutePath); + } + if (!string.IsNullOrEmpty(uri.Query)) { + capture.CaptureDetails.AddMetaData("URL_QUERY", uri.Query); + } + if (!string.IsNullOrEmpty(uri.UserInfo)) { + capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo); + } + capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString()); + } + // Only move the mouse to correct for the capture offset capture.MoveMouseLocation(-documentContainer.ViewportRectangle.X, -documentContainer.ViewportRectangle.Y); // Used to be: capture.MoveMouseLocation(-(capture.Location.X + documentContainer.CaptureOffset.X), -(capture.Location.Y + documentContainer.CaptureOffset.Y));