[osx] allow opening files from the event log
This commit is contained in:
parent
ea85c3a8ea
commit
dc83498767
|
@ -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;
|
||||||
|
|
||||||
|
@ -135,5 +136,20 @@ 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,10 +294,13 @@ namespace SparkleShare {
|
||||||
event_entry += "<dt>Edited</dt>";
|
event_entry += "<dt>Edited</dt>";
|
||||||
|
|
||||||
foreach (string file_path in change_set.Edited) {
|
foreach (string file_path in change_set.Edited) {
|
||||||
|
|
||||||
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
|
if (File.Exists (absolute_file_path)) {
|
||||||
|
|
||||||
if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) {
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
event_entry += "<dd><a href='#'>" + file_path + "</a></dd>";
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -315,11 +318,13 @@ 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 (absolute_file_path)) {
|
||||||
|
|
||||||
if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) {
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
event_entry += "<dd><a href='#'>" + file_path + "</a></dd>";
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
event_entry += "<dd>" + file_path + "</dd>";
|
event_entry += "<dd>" + file_path + "</dd>";
|
||||||
|
@ -336,10 +341,13 @@ 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 {
|
||||||
|
|
||||||
event_entry += "<dd>" + file_path + "</dd>";
|
event_entry += "<dd>" + file_path + "</dd>";
|
||||||
|
|
Loading…
Reference in a new issue