windows eventlog: implement clicking on files/dirs to open them
This commit is contained in:
parent
1568067c04
commit
03639bbb01
|
@ -1203,7 +1203,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (crumb))
|
if (string.IsNullOrEmpty (crumb))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string crumb_path = Path.Combine (new_path_root, crumb);
|
string crumb_path = Path.Combine (new_path_root, crumb);
|
||||||
|
|
||||||
if (Directory.Exists (crumb_path)) {
|
if (Directory.Exists (crumb_path)) {
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace SparkleShare {
|
||||||
if (UpdateContentEvent != null)
|
if (UpdateContentEvent != null)
|
||||||
UpdateContentEvent (HTML);
|
UpdateContentEvent (HTML);
|
||||||
};
|
};
|
||||||
|
|
||||||
Program.Controller.OnIdle += delegate {
|
Program.Controller.OnIdle += delegate {
|
||||||
if (UpdateContentEvent != null)
|
if (UpdateContentEvent != null)
|
||||||
UpdateContentEvent (HTML);
|
UpdateContentEvent (HTML);
|
||||||
|
@ -198,7 +198,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void LinkClicked (string url)
|
public void LinkClicked (string url)
|
||||||
{
|
{
|
||||||
if (url.StartsWith (Path.VolumeSeparatorChar.ToString ())) {
|
if (url.StartsWith (Path.VolumeSeparatorChar.ToString ()) ||
|
||||||
|
url.Substring (1, 1).Equals (":")) {
|
||||||
|
|
||||||
Program.Controller.OpenFile (url);
|
Program.Controller.OpenFile (url);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Permissions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Navigation;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
@ -89,9 +89,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
this.web_browser = new WebBrowser () {
|
this.web_browser = new WebBrowser () {
|
||||||
Width = Width - 7,
|
Width = Width - 7,
|
||||||
Height = Height - 36 - 12
|
Height = Height - 36 - 12,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();;
|
||||||
|
|
||||||
// Disable annoying IE clicking sound
|
// Disable annoying IE clicking sound
|
||||||
CoInternetSetFeatureEnabled (21, 0x00000002, true);
|
CoInternetSetFeatureEnabled (21, 0x00000002, true);
|
||||||
|
|
||||||
|
@ -100,7 +103,7 @@ namespace SparkleShare {
|
||||||
Content = this.canvas;
|
Content = this.canvas;
|
||||||
|
|
||||||
this.canvas.Children.Add (size_label);
|
this.canvas.Children.Add (size_label);
|
||||||
Canvas.SetLeft (size_label, 22);
|
Canvas.SetLeft (size_label, 24);
|
||||||
Canvas.SetTop (size_label, 4);
|
Canvas.SetTop (size_label, 4);
|
||||||
|
|
||||||
this.canvas.Children.Add (this.size_label_value);
|
this.canvas.Children.Add (this.size_label_value);
|
||||||
|
@ -211,7 +214,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.canvas.Children.Add (combo_box);
|
this.canvas.Children.Add (combo_box);
|
||||||
Canvas.SetLeft (this.combo_box, Width - 18 - this.combo_box.Width);
|
Canvas.SetLeft (this.combo_box, Width - 24 - this.combo_box.Width);
|
||||||
Canvas.SetTop (this.combo_box, 6);
|
Canvas.SetTop (this.combo_box, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +224,9 @@ namespace SparkleShare {
|
||||||
Thread thread = new Thread (new ThreadStart (delegate {
|
Thread thread = new Thread (new ThreadStart (delegate {
|
||||||
if (html == null)
|
if (html == null)
|
||||||
html = Controller.HTML;
|
html = Controller.HTML;
|
||||||
|
|
||||||
|
|
||||||
|
html = html.Replace ("<a href=", "<a class='windows' href=");
|
||||||
|
|
||||||
html = html.Replace ("<!-- $body-font-family -->", "sans-serif");
|
html = html.Replace ("<!-- $body-font-family -->", "sans-serif");
|
||||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||||
|
@ -249,21 +255,13 @@ namespace SparkleShare {
|
||||||
//html = html.Replace ("<!-- $document-moved-background-image -->",
|
//html = html.Replace ("<!-- $document-moved-background-image -->",
|
||||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||||
//"Pixmaps", "document-moved-12.png"));
|
//"Pixmaps", "document-moved-12.png"));
|
||||||
|
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
//if (this.progress_indicator.Superview == ContentView) TODO: spinner
|
//if (this.progress_indicator.Superview == ContentView) TODO: spinner
|
||||||
// this.progress_indicator.RemoveFromSuperview ();
|
// this.progress_indicator.RemoveFromSuperview ();
|
||||||
|
|
||||||
this.web_browser.LoadCompleted += delegate(object sender, NavigationEventArgs e) {
|
|
||||||
this.web_browser.Navigating += delegate(object sender2, NavigatingCancelEventArgs e2) {
|
|
||||||
MessageBox.Show (e2.Uri.ToString ());
|
|
||||||
e2.Cancel = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
this.web_browser.NavigateToString (html);
|
this.web_browser.NavigateToString (html);
|
||||||
|
|
||||||
//MessageBox.Show (html);
|
|
||||||
if (!this.canvas.Children.Contains (this.web_browser)) {
|
if (!this.canvas.Children.Contains (this.web_browser)) {
|
||||||
this.canvas.Children.Add (this.web_browser);
|
this.canvas.Children.Add (this.web_browser);
|
||||||
Canvas.SetLeft (this.web_browser, 0);
|
Canvas.SetLeft (this.web_browser, 0);
|
||||||
|
@ -286,7 +284,18 @@ namespace SparkleShare {
|
||||||
[DllImport ("urlmon.dll")]
|
[DllImport ("urlmon.dll")]
|
||||||
[PreserveSig]
|
[PreserveSig]
|
||||||
[return:MarshalAs (UnmanagedType.Error)]
|
[return:MarshalAs (UnmanagedType.Error)]
|
||||||
static extern int CoInternetSetFeatureEnabled (int feature,
|
static extern int CoInternetSetFeatureEnabled (
|
||||||
[MarshalAs (UnmanagedType.U4)] int flags, bool enable);
|
int feature, [MarshalAs (UnmanagedType.U4)] int flags, bool enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
|
||||||
|
[ComVisible(true)]
|
||||||
|
public class SparkleScriptingObject {
|
||||||
|
|
||||||
|
public void LinkClicked (string url)
|
||||||
|
{
|
||||||
|
SparkleUI.EventLog.Controller.LinkClicked (url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,12 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$('dl dd:nth-child(-n+10)').css('display', 'block');
|
$('dl dd:nth-child(-n+10)').css('display', 'block');
|
||||||
|
$('.day-entry-content .event-entry:last-child').css('border', 'none');
|
||||||
|
|
||||||
|
$('dd a.windows').click(function () {
|
||||||
|
window.external.LinkClicked($(this).attr("href"));
|
||||||
|
});
|
||||||
|
|
||||||
// Update the Today and Yesterday labels after midnight
|
// Update the Today and Yesterday labels after midnight
|
||||||
var midnight_interval = setInterval (function(){
|
var midnight_interval = setInterval (function(){
|
||||||
|
@ -130,14 +134,11 @@
|
||||||
margin-bottom: 36px;
|
margin-bottom: 36px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-entry-content .event-entry:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: <!-- $a-color -->;
|
color: <!-- $a-color -->;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
|
@ -179,7 +180,7 @@
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
float:right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,11 +188,11 @@
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
padding-bottom: 24px;
|
padding-bottom: 24px;
|
||||||
border-bottom: 1px #ddd solid;
|
border-bottom: 1px #ddd solid;
|
||||||
width: 99%;
|
width: 100%;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
padding-left: 72px;
|
padding-left: 72px;
|
||||||
padding-right: 12px;
|
padding-right: 24px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: 12px top;
|
background-position: 12px top;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -231,6 +232,7 @@
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd {
|
dd {
|
||||||
|
|
Loading…
Reference in a new issue