~ubuntu-branches/ubuntu/gutsy/tomboy/gutsy-updates

« back to all changes in this revision

Viewing changes to Tomboy/RemoteControl.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2007-01-08 21:12:13 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070108211213-duqllmpnxes216dv
Tags: 0.5.3-0ubuntu1
* New upstream release
* debian/patches/01_utf8-fix.patch:
  + Dropped, merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
                        note_manager = mgr;
18
18
                }
19
19
 
 
20
                //Convert System.DateTime to unix timestamp
 
21
                private static long UnixDateTime(DateTime d)
 
22
                {
 
23
                        long epoch_ticks = new DateTime (1970,1,1).Ticks;
 
24
                        //Ticks is in 100s of nanoseconds, unix time is in seconds
 
25
                        return (d.ToUniversalTime ().Ticks - epoch_ticks) / 10000000;
 
26
                }
 
27
        
20
28
                public bool DisplayNote (string uri)
21
29
                {
22
30
                        Note note;
59
67
                        try {
60
68
                                Note note = note_manager.Create ();
61
69
                                return note.Uri;
62
 
                        } catch (Exception e) {
 
70
                        } catch {
63
71
                                return  "";
64
72
                        }
65
73
                }
75
83
                        try {
76
84
                                note = note_manager.Create (linked_title);
77
85
                                return note.Uri;
78
 
                        } catch (Exception e) {
 
86
                        } catch {
79
87
                                return "";
80
88
                        }
81
89
                }
107
115
                        recent_changes.SearchText = search_text;
108
116
                        recent_changes.Present ();
109
117
                }
 
118
 
 
119
                public bool NoteExists (string uri)
 
120
                {
 
121
                        Note note = note_manager.FindByUri (uri);
 
122
                        return note != null;
 
123
                }
 
124
 
 
125
                public string[] ListAllNotes ()
 
126
                {
 
127
                        ArrayList uris = new ArrayList ();
 
128
                        foreach (Note note in note_manager.Notes) {
 
129
                                uris.Add (note.Uri);
 
130
                        }
 
131
                        return (string []) uris.ToArray (typeof (string)) ;
 
132
                }
 
133
 
 
134
                public string GetNoteContents (string uri)
 
135
                {
 
136
                        Note note;
 
137
                        note = note_manager.FindByUri (uri);
 
138
                        if (note == null)
 
139
                                return "";
 
140
                        return note.TextContent;
 
141
                }
 
142
 
 
143
                public string GetNoteTitle (string uri)
 
144
                {
 
145
                        Note note;
 
146
                        note = note_manager.FindByUri (uri);
 
147
                        if (note == null)
 
148
                                return "";
 
149
                        return note.Title;
 
150
                }
 
151
 
 
152
                public long GetNoteCreateDate (string uri)
 
153
                {
 
154
                        Note note;
 
155
                        note = note_manager.FindByUri (uri);
 
156
                        if (note == null)
 
157
                                return -1;
 
158
                        return UnixDateTime (note.CreateDate);
 
159
                }
 
160
 
 
161
                public long GetNoteChangeDate (string uri)
 
162
                {
 
163
                        Note note;
 
164
                        note = note_manager.FindByUri (uri);
 
165
                        if (note == null)
 
166
                                return -1;
 
167
                        return UnixDateTime (note.ChangeDate);
 
168
                }
 
169
 
 
170
                public string GetNoteContentsXml (string uri)
 
171
                {
 
172
                        Note note;
 
173
                        note = note_manager.FindByUri (uri);
 
174
                        if (note == null)
 
175
                                return "";
 
176
                        return note.XmlContent;
 
177
                }
 
178
 
 
179
                public bool SetNoteContents (string uri, string text_contents)
 
180
                {
 
181
                        Note note;
 
182
                        note = note_manager.FindByUri (uri);
 
183
                        if (note == null)
 
184
                                return false;
 
185
                        note.TextContent = text_contents;
 
186
                        return true;
 
187
                }
 
188
 
 
189
                public bool SetNoteContentsXml (string uri, string xml_contents)
 
190
                {
 
191
                        Note note;
 
192
                        note = note_manager.FindByUri (uri);
 
193
                        if (note == null)
 
194
                                return false;
 
195
                        note.XmlContent = xml_contents;
 
196
                        return true;
 
197
                }
110
198
        }
111
199
}