[tomboy] Add CreateNamedNoteWithUri method to RemoteControl (bug #580525)



commit 9d334d7309b7e78cf28e9da4b6f0a7119e33644d
Author: Matt Jones <mattjones workhorsy org>
Date:   Sun Nov 15 15:17:24 2009 -0800

    Add CreateNamedNoteWithUri method to RemoteControl (bug #580525)

 Tomboy/IRemoteControl.cs       |    1 +
 Tomboy/RemoteControl.cs        |   29 +++++++++++++++++++++++++++++
 Tomboy/RemoteControlWrapper.cs |    5 +++++
 3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/Tomboy/IRemoteControl.cs b/Tomboy/IRemoteControl.cs
index 6e9d307..adf4de1 100644
--- a/Tomboy/IRemoteControl.cs
+++ b/Tomboy/IRemoteControl.cs
@@ -6,6 +6,7 @@ namespace Tomboy
 	{
 		bool AddTagToNote (string uri, string tag_name);
 		string CreateNamedNote (string linked_title);
+		string CreateNamedNoteWithUri (string linked_title, string uri);
 		string CreateNote ();
 		bool DeleteNote (string uri);
 		bool DisplayNote (string uri);
diff --git a/Tomboy/RemoteControl.cs b/Tomboy/RemoteControl.cs
index 8e408ee..13c9048 100644
--- a/Tomboy/RemoteControl.cs
+++ b/Tomboy/RemoteControl.cs
@@ -120,6 +120,35 @@ namespace Tomboy
 			}
 		}
 
+		public string CreateNamedNoteWithUri (string linked_title, string uri)
+		{
+			Note note;
+			string guid;
+			try {
+				guid = uri.Replace ("note://tomboy/", "");
+			} catch {
+				return string.Empty;
+			}
+
+			if (String.IsNullOrEmpty (guid))
+				return string.Empty;
+
+			note = note_manager.Find (linked_title);
+			if (note != null)
+				return string.Empty;
+
+			note = note_manager.FindByUri (uri);
+			if (note != null)
+				return string.Empty;
+
+			try {
+				note = note_manager.CreateWithGuid (linked_title, guid);
+				return note.Uri;
+			} catch {
+				return string.Empty;
+			}
+		}
+
 		public bool DeleteNote (string uri)
 		{
 			Note note;
diff --git a/Tomboy/RemoteControlWrapper.cs b/Tomboy/RemoteControlWrapper.cs
index 298bd46..5e5a782 100644
--- a/Tomboy/RemoteControlWrapper.cs
+++ b/Tomboy/RemoteControlWrapper.cs
@@ -33,6 +33,11 @@ namespace Tomboy
 			throw new NotImplementedException ();
 		}
 
+		public string CreateNamedNoteWithUri (string linked_title, string uri)
+		{
+			throw new NotImplementedException ();
+		}
+
 		public string CreateNote ()
 		{
 			throw new NotImplementedException ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]