diff --git a/SparkleShare/Windows/SparkleNote.xaml b/SparkleShare/Windows/SparkleNote.xaml
new file mode 100644
index 00000000..22f2b24b
--- /dev/null
+++ b/SparkleShare/Windows/SparkleNote.xaml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SparkleShare/Windows/SparkleNote.xaml.cs b/SparkleShare/Windows/SparkleNote.xaml.cs
new file mode 100644
index 00000000..a0ba4cc0
--- /dev/null
+++ b/SparkleShare/Windows/SparkleNote.xaml.cs
@@ -0,0 +1,123 @@
+// SparkleShare, a collaboration and sharing tool.
+// Copyright (C) 2010 Hylke Bons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Windows;
+using System.Windows.Forms.Integration;
+using System.Windows.Media;
+
+using SparkleLib;
+
+namespace SparkleShare {
+
+ public partial class SparkleNote : Window {
+
+ public SparkleNoteController Controller = new SparkleNoteController ();
+
+ private readonly string default_text = "Anything to add?";
+
+ public SparkleNote()
+ {
+ InitializeComponent();
+
+ Background = new SolidColorBrush(Color.FromRgb(240, 240, 240));
+ AllowsTransparency = false;
+ Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");
+ WindowStartupLocation = WindowStartupLocation.CenterScreen;
+
+ Closing += this.OnClosing;
+
+ Controller.ShowWindowEvent += delegate {
+ Dispatcher.BeginInvoke((Action)(() => {
+ Show();
+ Activate();
+ CreateNote();
+ BringIntoView();
+ }));
+ };
+
+ Controller.HideWindowEvent += delegate {
+ Dispatcher.BeginInvoke ((Action) (() => {
+ Hide ();
+ this.balloon_text_field.Clear();
+ }));
+ };
+
+ this.cancel_button.Click += delegate {
+ Dispatcher.BeginInvoke ((Action) (() => {
+ Controller.CancelClicked ();
+ }));
+ };
+
+ this.sync_button.Click += delegate {
+ Dispatcher.BeginInvoke ((Action) (() => {
+ string note = this.balloon_text_field.Text;
+
+ if (note.Equals (default_text, StringComparison.InvariantCultureIgnoreCase)) {
+ note = String.Empty;
+ }
+
+ Controller.SyncClicked (note);
+ }));
+ };
+
+ this.balloon_text_field.GotFocus += OnTextBoxGotFocus;
+ this.balloon_text_field.LostFocus += OnTextBoxLostFocus;
+
+ CreateNote();
+ }
+
+ private void CreateNote()
+ {
+ ImageSource avatar = SparkleUIHelpers.GetImageSource("user-icon-default");
+
+ if (File.Exists (Controller.AvatarFilePath)) {
+ avatar = SparkleUIHelpers.GetImage (Controller.AvatarFilePath);
+ }
+
+ this.user_image.ImageSource = avatar;
+ this.Title = Controller.CurrentProject ?? "Add Note";
+ this.user_name_text_block.Text = Program.Controller.CurrentUser.Name;
+ this.user_email_text_field.Text = Program.Controller.CurrentUser.Email;
+ this.balloon_text_field.Text = default_text;
+
+ ElementHost.EnableModelessKeyboardInterop (this);
+ }
+
+ private void OnClosing (object sender, CancelEventArgs cancel_event_args)
+ {
+ Controller.WindowClosed ();
+ cancel_event_args.Cancel = true;
+ }
+
+ private void OnTextBoxGotFocus (object sender, RoutedEventArgs e)
+ {
+ if (this.balloon_text_field.Text.Equals (default_text, StringComparison.InvariantCultureIgnoreCase)) {
+ this.balloon_text_field.Text = string.Empty;
+ }
+ }
+
+ private void OnTextBoxLostFocus (object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrEmpty (this.balloon_text_field.Text)) {
+ this.balloon_text_field.Text = default_text;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj
index 8b258d3d..b4370640 100644
--- a/SparkleShare/Windows/SparkleShare.csproj
+++ b/SparkleShare/Windows/SparkleShare.csproj
@@ -79,6 +79,9 @@
SparkleInvite.cs
+
+ SparkleNoteController.cs
+
SparklePlugin.cs
@@ -89,6 +92,9 @@
SparkleEventLogWindow.xaml
+
+ SparkleNote.xaml
+
@@ -260,6 +266,9 @@
+
+ Pixmaps\text-balloon.png
+
@@ -267,6 +276,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs
index a6854f9b..a4a77adb 100644
--- a/SparkleShare/Windows/SparkleStatusIcon.cs
+++ b/SparkleShare/Windows/SparkleStatusIcon.cs
@@ -229,6 +229,20 @@ namespace SparkleShare {
subfolder_item.Items.Add(state_menu_items[i]);
subfolder_item.Items.Add(new Separator());
+ SparkleMenuItem open_item = new SparkleMenuItem {
+ Header = "Open folder",
+ Icon = new Image
+ {
+ Source = SparkleUIHelpers.GetImageSource("folder"),
+ Width = 16,
+ Height = 16
+ }
+ };
+
+ open_item.Click += new RoutedEventHandler(Controller.OpenFolderDelegate(project.Name));
+ subfolder_item.Items.Add(open_item);
+ subfolder_item.Items.Add(new Separator());
+
if(project.IsPaused) {
SparkleMenuItem resume_item;
diff --git a/SparkleShare/Windows/SparkleUI.cs b/SparkleShare/Windows/SparkleUI.cs
index 9781500e..31f5ebb1 100644
--- a/SparkleShare/Windows/SparkleUI.cs
+++ b/SparkleShare/Windows/SparkleUI.cs
@@ -30,6 +30,7 @@ namespace SparkleShare {
public SparkleBubbles Bubbles;
public SparkleStatusIcon StatusIcon;
public SparkleAbout About;
+ public SparkleNote Note;
static SparkleUI ()
{
@@ -43,12 +44,13 @@ namespace SparkleShare {
// FIXME: The second time windows are shown, the windows
// don't have the smooth ease in animation, but appear abruptly.
// The ease out animation always seems to work
- Setup = new SparkleSetup ();
- EventLog = new SparkleEventLogWindow();
- About = new SparkleAbout ();
- Bubbles = new SparkleBubbles ();
- StatusIcon = new SparkleStatusIcon ();
-
+ Setup = new SparkleSetup ();
+ EventLog = new SparkleEventLogWindow();
+ About = new SparkleAbout ();
+ Bubbles = new SparkleBubbles ();
+ StatusIcon = new SparkleStatusIcon ();
+ Note = new SparkleNote ();
+
Program.Controller.UIHasLoaded ();
}
diff --git a/SparkleShare/Windows/SparkleUIHelpers.cs b/SparkleShare/Windows/SparkleUIHelpers.cs
index 2a662202..ff289c80 100644
--- a/SparkleShare/Windows/SparkleUIHelpers.cs
+++ b/SparkleShare/Windows/SparkleUIHelpers.cs
@@ -47,7 +47,17 @@ namespace SparkleShare {
Stream image_stream = assembly.GetManifestResourceStream("SparkleShare.Pixmaps." + name + "." + type);
return BitmapFrame.Create(image_stream);
}
-
+
+ public static ImageSource GetImage(string absolutePath)
+ {
+ BitmapImage image = new BitmapImage();
+ image.BeginInit();
+ image.UriSource = new Uri(absolutePath, UriKind.Absolute);
+ image.CacheOption = BitmapCacheOption.OnDemand;
+ image.EndInit();
+
+ return image;
+ }
public static Drawing.Bitmap GetBitmap (string name)
{