[tomboy] When converting to NoteData, only GUID, Title, NoteContent, and NoteContentVersion are required Note
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Subject: [tomboy] When converting to NoteData, only GUID, Title, NoteContent, and NoteContentVersion are required Note
- Date: Tue, 19 May 2009 16:04:25 -0400 (EDT)
commit e25f6c7a37672b9ef569c4812de20918e631c17f
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Tue May 19 13:00:14 2009 -0700
When converting to NoteData, only GUID, Title, NoteContent, and NoteContentVersion are required NoteInfo fields.
---
Tomboy/Addins/WebSyncService/NoteConvert.cs | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/Tomboy/Addins/WebSyncService/NoteConvert.cs b/Tomboy/Addins/WebSyncService/NoteConvert.cs
index a5a9421..96c5797 100644
--- a/Tomboy/Addins/WebSyncService/NoteConvert.cs
+++ b/Tomboy/Addins/WebSyncService/NoteConvert.cs
@@ -73,20 +73,28 @@ namespace Tomboy.WebSync
public static NoteData ToNoteData (NoteInfo noteInfo)
{
+ // NOTE: For now, we absolutely require values for
+ // Guid, Title, NoteContent, and NoteContentVersion
NoteData noteData = new NoteData (noteInfo.Guid);
noteData.Title = noteInfo.Title;
noteData.Text =
"<note-content version=\"" + noteInfo.NoteContentVersion.ToString () + "\">" +
noteInfo.NoteContent + "</note-content>";
- noteData.ChangeDate = noteInfo.LastChangeDate.Value;
- noteData.MetadataChangeDate = noteInfo.LastMetadataChangeDate.Value;
- noteData.CreateDate = noteInfo.CreateDate.Value;
- noteData.IsOpenOnStartup = noteInfo.OpenOnStartup.Value;
+ if (noteInfo.LastChangeDate.HasValue)
+ noteData.ChangeDate = noteInfo.LastChangeDate.Value;
+ if (noteInfo.LastMetadataChangeDate.HasValue)
+ noteData.MetadataChangeDate = noteInfo.LastMetadataChangeDate.Value;
+ if (noteInfo.CreateDate.HasValue)
+ noteData.CreateDate = noteInfo.CreateDate.Value;
+ if (noteInfo.OpenOnStartup.HasValue)
+ noteData.IsOpenOnStartup = noteInfo.OpenOnStartup.Value;
// TODO: support Pinned
- foreach (string tagName in noteInfo.Tags) {
- Tag tag = TagManager.GetOrCreateTag (tagName);
- noteData.Tags [tag.NormalizedName] = tag;
+ if (noteInfo.Tags != null) {
+ foreach (string tagName in noteInfo.Tags) {
+ Tag tag = TagManager.GetOrCreateTag (tagName);
+ noteData.Tags [tag.NormalizedName] = tag;
+ }
}
return noteData;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]