[osx] allow opening files from the event log
This commit is contained in:
parent
dd3dd0246e
commit
7719df2b06
|
@ -115,6 +115,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
WebView = new WebView (frame, "", "");
|
WebView = new WebView (frame, "", "");
|
||||||
WebView.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
WebView.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
||||||
|
WebView.PolicyDelegate = new SparkleWebPolicyDelegate ();
|
||||||
|
|
||||||
return WebView;
|
return WebView;
|
||||||
|
|
||||||
|
@ -136,4 +137,19 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class SparkleWebPolicyDelegate : WebPolicyDelegate {
|
||||||
|
|
||||||
|
public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info,
|
||||||
|
NSUrlRequest request, WebFrame frame, NSObject decision_token) {
|
||||||
|
|
||||||
|
string file_path = request.Url.ToString ();
|
||||||
|
file_path = file_path.Replace ("%20", "\\ ");
|
||||||
|
|
||||||
|
NSWorkspace.SharedWorkspace.OpenFile (file_path);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,9 +295,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
foreach (string file_path in change_set.Edited) {
|
foreach (string file_path in change_set.Edited) {
|
||||||
|
|
||||||
if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) {
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
event_entry += "<dd><a href='#'>" + file_path + "</a></dd>";
|
if (File.Exists (absolute_file_path)) {
|
||||||
|
|
||||||
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -315,10 +318,12 @@ namespace SparkleShare {
|
||||||
event_entry += "<dt>Added</dt>";
|
event_entry += "<dt>Added</dt>";
|
||||||
|
|
||||||
foreach (string file_path in change_set.Added) {
|
foreach (string file_path in change_set.Added) {
|
||||||
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) {
|
if (File.Exists (absolute_file_path)) {
|
||||||
|
|
||||||
event_entry += "<dd><a href='#'>" + file_path + "</a></dd>";
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -336,9 +341,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
foreach (string file_path in change_set.Deleted) {
|
foreach (string file_path in change_set.Deleted) {
|
||||||
|
|
||||||
if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) {
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
event_entry += "<dd><a href='#'>" + file_path + "</a></dd>";
|
if (File.Exists (absolute_file_path)) {
|
||||||
|
|
||||||
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue