Merge lp://qastaging/~d6g/do-plugins/rtm-1.5 into lp://qastaging/do-plugins

Proposed by Peng Deng
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~d6g/do-plugins/rtm-1.5
Merge into: lp://qastaging/do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~d6g/do-plugins/rtm-1.5
Reviewer Review Type Date Requested Status
Chris S. Needs Fixing
Review via email: mp+7335@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Peng Deng (d6g) wrote :

- Refactored internal data structure
- Improved API (fixed long list truncation, added request interval control)
- New item sources for tags and locations
- Expandable task item
- Configurable overdue task notification interval
- Documentation

Revision history for this message
Peng Deng (d6g) wrote :

Just posted more detailed informations of the new features and improvements on my blog: http://pengdeng.com/blog/2009/06/11/remember-the-milk-plugin-for-gnome-do-updates/

626. By Peng Deng

Add a missing space in a string

627. By Peng Deng

Reformat all RtmNet code to comply the Mono standard
Bump version to 2.0 since there are a lof of changes

Revision history for this message
Chris S. (cszikszoy) wrote :

A few comments (All line numbers referenced are review diff line numbers):

* class variables should use camel casing, check line 1182 of the merge diff, you have variables named "list_lock" and "overdue_timer". These should be named "listLock", and "overdueTimer".
* line 1262 you can leave off Do.Platform from "Do.Platform.Services.Environment.OpenUrl(rtm.Auth...", and also add the space before the opening (
* 1439-1443 are you missing { } brackets for that "if (note_list.Any ())" ?
* 1459-1461 - same as above
* 1467, I think it's customary to log errors in a catch statement like this: Log<>.Error ("some message {0}", e.Message); \n Log<>.Debut (e.Stacktrace); fix that anywhere else that I missed.
* 1475 should that be commented?
* 1481 { } around the foreach code block
* 1494-1496 { } around code block
* 1511 fix the formatting. I know MD formats like this by default, but I think we use only one tab indent for multiline statements
* 1528-1539 { } around if code block
* 1563-1566 { } around code blocks
* 1601 & 1611 fix tab formatting
* 1709 1803 1807 1829 1843 1859 1936 1940 1951 1955 1970 1984 2015.... and lots of other places, just check through and fix it all - same as above
* 2056 2109 2128 2141 space before (
* 2330 2419 Do.Platform isn't necessary
* 2608 the spacing here looks off. I think there are 4 spaces there instead of a tab
* 2623 It might be beneficial to allow this action to support multiple items, so users could add tag(s) to multiple tasks
* 2756 2827 2893 2988 3098 3538 3947 4538 4652 4743 4878 4985 same as above
* 3259 use Catalog.GetString ()
* 3613 remove "[RememberTheMilk]" from the debug message, Log<T> prints "[T] <message>".
* 5250 That ";" shouldn't be there, should it?
* 5415-5426 use camel casing
* 5546 use String.format to combine those strings, string concatenation can get costly

That about does it.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'RememberTheMilk/Makefile.am'
2--- RememberTheMilk/Makefile.am 2009-03-18 14:24:24 +0000
3+++ RememberTheMilk/Makefile.am 2009-05-23 20:46:21 +0000
4@@ -7,21 +7,37 @@
5 gtk-gui/generated.cs \
6 src/Configuration.cs \
7 src/RTM.cs \
8+ src/RTMAddTags.cs \
9 src/RTMCompleteTask.cs \
10+ src/RTMDeleteList.cs \
11+ src/RTMDeleteNote.cs \
12+ src/RTMDeleteTags.cs \
13 src/RTMDeleteTask.cs \
14 src/RTMListItem.cs \
15 src/RTMListItemSource.cs \
16+ src/RTMLocationItem.cs \
17+ src/RTMLocationItemSource.cs \
18 src/RTMMoveTask.cs \
19+ src/RTMNewList.cs \
20+ src/RTMNewNote.cs \
21 src/RTMNewTask.cs \
22 src/RTMPostponeTask.cs \
23 src/RTMPreferences.cs \
24 src/RTMPriorityItem.cs \
25+ src/RTMRenameList.cs \
26 src/RTMRenameTask.cs \
27 src/RTMSetDue.cs \
28+ src/RTMSetEstimate.cs \
29 src/RTMSetUrl.cs \
30+ src/RTMSetLocation.cs \
31 src/RTMSetPriority.cs \
32 src/RTMSetRecurrence.cs \
33+ src/RTMTagItem.cs \
34+ src/RTMTagItemSource.cs \
35+ src/RTMTaskAttributeItem.cs \
36+ src/RTMNoteItem.cs \
37 src/RTMTaskItem.cs \
38+ src/RTMTaskItemSource.cs \
39 src/RTMUncompleteTask.cs \
40 src/RtmNet/ApiKeyRequiredException.cs \
41 src/RtmNet/Auth.cs \
42@@ -33,6 +49,7 @@
43 src/RtmNet/Groups.cs \
44 src/RtmNet/GroupSearchResults.cs \
45 src/RtmNet/List.cs \
46+ src/RtmNet/Location.cs \
47 src/RtmNet/Methods.cs \
48 src/RtmNet/Note.cs \
49 src/RtmNet/Response.cs \
50@@ -49,7 +66,11 @@
51
52 RESOURCES = \
53 Resources/RTM.addin.xml \
54+ Resources/icons/note-add.png \
55+ Resources/icons/note-delete.png \
56 Resources/icons/rtm.png \
57+ Resources/icons/tag-add.png \
58+ Resources/icons/tag-delete.png \
59 Resources/icons/task-add.png \
60 Resources/icons/task-complete.png \
61 Resources/icons/task-delete.png \
62@@ -72,7 +93,8 @@
63 Resources/icons/task-rename.png \
64 Resources/icons/task-repeat.png \
65 Resources/icons/task-setdue.png \
66- Resources/icons/task-seturl.png
67+ Resources/icons/task-seturl.png \
68+ Resources/icons/task-tag.png
69
70 REFERENCES = \
71 System \
72
73=== modified file 'RememberTheMilk/RTM.mdp'
74--- RememberTheMilk/RTM.mdp 2009-03-29 17:55:48 +0000
75+++ RememberTheMilk/RTM.mdp 2009-06-01 23:28:44 +0000
76@@ -1,4 +1,4 @@
77-<Project name="RememberTheMilk" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="2.0" ctype="DotNetProject">
78+<Project name="RememberTheMilk" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject">
79 <Configurations active="Debug">
80 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
81 <Output directory="bin/Debug" assembly="RTM" />
82@@ -20,16 +20,23 @@
83 <File name="src" subtype="Directory" buildaction="Compile" />
84 <File name="src/RTMCompleteTask.cs" subtype="Code" buildaction="Compile" />
85 <File name="src/RTM.cs" subtype="Code" buildaction="Compile" />
86+ <File name="src/RTMDeleteList.cs" subtype="Code" buildaction="Compile" />
87 <File name="src/RTMDeleteTask.cs" subtype="Code" buildaction="Compile" />
88 <File name="src/RTMListItem.cs" subtype="Code" buildaction="Compile" />
89 <File name="src/RTMListItemSource.cs" subtype="Code" buildaction="Compile" />
90 <File name="src/RTMMoveTask.cs" subtype="Code" buildaction="Compile" />
91+ <File name="src/RTMNewList.cs" subtype="Code" buildaction="Compile" />
92 <File name="src/RTMNewTask.cs" subtype="Code" buildaction="Compile" />
93 <File name="src/RTMPriorityItem.cs" subtype="Code" buildaction="Compile" />
94+ <File name="src/RTMRenameList.cs" subtype="Code" buildaction="Compile" />
95 <File name="src/RTMRenameTask.cs" subtype="Code" buildaction="Compile" />
96 <File name="src/RTMSetDue.cs" subtype="Code" buildaction="Compile" />
97+ <File name="src/RTMSetEstimate.cs" subtype="Code" buildaction="Compile" />
98 <File name="src/RTMSetPriority.cs" subtype="Code" buildaction="Compile" />
99+ <File name="src/RTMSetUrl.cs" subtype="Code" buildaction="Compile" />
100+ <File name="src/RTMTaskAttributeItem.cs" subtype="Code" buildaction="Compile" />
101 <File name="src/RTMTaskItem.cs" subtype="Code" buildaction="Compile" />
102+ <File name="src/RTMTaskItemSource.cs" subtype="Code" buildaction="Compile" />
103 <File name="src/RtmNet" subtype="Directory" buildaction="Compile" />
104 <File name="src/RtmNet/ApiKeyRequiredException.cs" subtype="Code" buildaction="Compile" />
105 <File name="src/RtmNet/Auth.cs" subtype="Code" buildaction="Compile" />
106@@ -86,7 +93,22 @@
107 <File name="Resources/icons/task-repeat.png" subtype="Code" buildaction="EmbedAsResource" />
108 <File name="Resources/icons/task-setdue.png" subtype="Code" buildaction="EmbedAsResource" />
109 <File name="Resources/icons/task-seturl.png" subtype="Code" buildaction="EmbedAsResource" />
110- <File name="src/RTMSetUrl.cs" subtype="Code" buildaction="Compile" />
111+ <File name="src/RTMNoteItem.cs" subtype="Code" buildaction="Compile" />
112+ <File name="src/RTMNewNote.cs" subtype="Code" buildaction="Compile" />
113+ <File name="Resources/icons/note-add.png" subtype="Code" buildaction="Nothing" />
114+ <File name="Resources/icons/note-delete.png" subtype="Code" buildaction="Nothing" />
115+ <File name="src/RtmNet/Location.cs" subtype="Code" buildaction="Compile" />
116+ <File name="src/RTMLocationItem.cs" subtype="Code" buildaction="Compile" />
117+ <File name="src/RTMSetLocation.cs" subtype="Code" buildaction="Compile" />
118+ <File name="Resources/icons/task-tag.png" subtype="Code" buildaction="Nothing" />
119+ <File name="src/RTMTagItem.cs" subtype="Code" buildaction="Compile" />
120+ <File name="src/RTMAddTags.cs" subtype="Code" buildaction="Compile" />
121+ <File name="src/RTMTagItemSource.cs" subtype="Code" buildaction="Compile" />
122+ <File name="src/RTMLocationItemSource.cs" subtype="Code" buildaction="Compile" />
123+ <File name="Resources/icons/tag-add.png" subtype="Code" buildaction="Nothing" />
124+ <File name="Resources/icons/tag-delete.png" subtype="Code" buildaction="Nothing" />
125+ <File name="src/RTMDeleteTags.cs" subtype="Code" buildaction="Compile" />
126+ <File name="src/RTMDeleteNote.cs" subtype="Code" buildaction="Compile" />
127 </Contents>
128 <References>
129 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
130@@ -96,8 +118,9 @@
131 <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
132 <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
133 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
134- <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null" />
135- <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null" />
136- <ProjectReference type="Gac" localcopy="True" refto="Do.Platform.Linux, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null" />
137+ <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
138+ <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
139+ <ProjectReference type="Gac" localcopy="True" refto="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral" />
140+ <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
141 </References>
142 </Project>
143\ No newline at end of file
144
145=== modified file 'RememberTheMilk/Resources/RTM.addin.xml'
146--- RememberTheMilk/Resources/RTM.addin.xml 2009-04-22 03:29:31 +0000
147+++ RememberTheMilk/Resources/RTM.addin.xml 2009-05-23 20:46:21 +0000
148@@ -1,10 +1,10 @@
149 <Addin
150 id="RememberTheMilk"
151 namespace= "Do"
152- version="1.0"
153+ version="1.5"
154 name="Remember The Milk"
155 description="Manage tasks with Remember The Milk."
156- author="Peng Deng"
157+ author="Peng Deng, Jonathan Davies"
158 category="Community"
159 defaultEnabled="false"
160 >
161@@ -20,18 +20,30 @@
162 <!-- Extensions included in this assembly -->
163 <Extension path="/Do/ItemSource">
164 <ItemSource type="RememberTheMilk.RTMListItemSource" />
165+ <ItemSource type="RememberTheMilk.RTMLocationItemSource" />
166+ <ItemSource type="RememberTheMilk.RTMTaskItemSource" />
167+ <ItemSource type="RememberTheMilk.RTMTagItemSource" />
168 </Extension>
169
170 <Extension path="/Do/Action">
171+ <Action type="RememberTheMilk.RTMAddTags" />
172+ <Action type="RememberTheMilk.RTMNewList" />
173+ <Action type="RememberTheMilk.RTMNewNote" />
174 <Action type="RememberTheMilk.RTMNewTask" />
175- <Action type="RememberTheMilk.RTMDeleteTask" />
176+ <Action type="RememberTheMilk.RTMDeleteList" />
177+ <Action type="RememberTheMilk.RTMDeleteNote" />
178+ <Action type="RememberTheMilk.RTMDeleteTags" />
179+ <Action type="RememberTheMilk.RTMDeleteTask" />
180 <Action type="RememberTheMilk.RTMCompleteTask" />
181 <Action type="RememberTheMilk.RTMSetPriority" />
182 <Action type="RememberTheMilk.RTMSetDue" />
183 <Action type="RememberTheMilk.RTMSetUrl" />
184+ <Action type="RememberTheMilk.RTMRenameList" />
185 <Action type="RememberTheMilk.RTMMoveTask" />
186 <Action type="RememberTheMilk.RTMRenameTask" />
187 <Action type="RememberTheMilk.RTMPostponeTask" />
188+ <Action type="RememberTheMilk.RTMSetEstimate" />
189+ <Action type="RememberTheMilk.RTMSetLocation" />
190 <Action type="RememberTheMilk.RTMSetRecurrence" />
191 <Action type="RememberTheMilk.RTMUncompleteTask" />
192 </Extension>
193
194=== added file 'RememberTheMilk/Resources/icons/note-add.png'
195Binary files RememberTheMilk/Resources/icons/note-add.png 1970-01-01 00:00:00 +0000 and RememberTheMilk/Resources/icons/note-add.png 2009-03-21 02:15:13 +0000 differ
196=== added file 'RememberTheMilk/Resources/icons/note-delete.png'
197Binary files RememberTheMilk/Resources/icons/note-delete.png 1970-01-01 00:00:00 +0000 and RememberTheMilk/Resources/icons/note-delete.png 2009-03-21 02:15:13 +0000 differ
198=== added file 'RememberTheMilk/Resources/icons/tag-add.png'
199Binary files RememberTheMilk/Resources/icons/tag-add.png 1970-01-01 00:00:00 +0000 and RememberTheMilk/Resources/icons/tag-add.png 2009-05-23 17:42:27 +0000 differ
200=== added file 'RememberTheMilk/Resources/icons/tag-delete.png'
201Binary files RememberTheMilk/Resources/icons/tag-delete.png 1970-01-01 00:00:00 +0000 and RememberTheMilk/Resources/icons/tag-delete.png 2009-05-23 17:42:27 +0000 differ
202=== added file 'RememberTheMilk/Resources/icons/task-tag.png'
203Binary files RememberTheMilk/Resources/icons/task-tag.png 1970-01-01 00:00:00 +0000 and RememberTheMilk/Resources/icons/task-tag.png 2009-05-23 10:53:00 +0000 differ
204=== modified file 'RememberTheMilk/gtk-gui/RememberTheMilk.Configuration.cs'
205--- RememberTheMilk/gtk-gui/RememberTheMilk.Configuration.cs 2009-02-01 14:58:00 +0000
206+++ RememberTheMilk/gtk-gui/RememberTheMilk.Configuration.cs 2009-06-09 18:28:21 +0000
207@@ -1,7 +1,7 @@
208 // ------------------------------------------------------------------------------
209 // <autogenerated>
210 // This code was generated by a tool.
211-// Mono Runtime Version: 2.0.50727.42
212+//
213 //
214 // Changes to this file may cause incorrect behavior and will be lost if
215 // the code is regenerated.
216@@ -41,8 +41,14 @@
217
218 private Gtk.VBox vbox3;
219
220+ private Gtk.Table table1;
221+
222+ private Gtk.Label minute_lbl;
223+
224 private Gtk.CheckButton overdue_chkbtn;
225
226+ private Gtk.SpinButton overdue_interval_spinbtn;
227+
228 private Gtk.CheckButton confirm_chkbtn;
229
230 private Gtk.CheckButton returnnew_chkbtn;
231@@ -172,6 +178,7 @@
232 w17.Fill = false;
233 // Container child vbox1.Gtk.Box+BoxChild
234 this.notification_frm = new Gtk.Frame();
235+ this.notification_frm.Sensitive = false;
236 this.notification_frm.Name = "notification_frm";
237 this.notification_frm.ShadowType = ((Gtk.ShadowType)(0));
238 this.notification_frm.BorderWidth = ((uint)(2));
239@@ -185,17 +192,51 @@
240 this.vbox3.Spacing = 6;
241 this.vbox3.BorderWidth = ((uint)(5));
242 // Container child vbox3.Gtk.Box+BoxChild
243+ this.table1 = new Gtk.Table(((uint)(1)), ((uint)(3)), false);
244+ this.table1.Name = "table1";
245+ this.table1.RowSpacing = ((uint)(6));
246+ this.table1.ColumnSpacing = ((uint)(6));
247+ // Container child table1.Gtk.Table+TableChild
248+ this.minute_lbl = new Gtk.Label();
249+ this.minute_lbl.Name = "minute_lbl";
250+ this.minute_lbl.LabelProp = Mono.Unix.Catalog.GetString("minute(s)");
251+ this.table1.Add(this.minute_lbl);
252+ Gtk.Table.TableChild w18 = ((Gtk.Table.TableChild)(this.table1[this.minute_lbl]));
253+ w18.LeftAttach = ((uint)(2));
254+ w18.RightAttach = ((uint)(3));
255+ w18.XOptions = ((Gtk.AttachOptions)(4));
256+ w18.YOptions = ((Gtk.AttachOptions)(4));
257+ // Container child table1.Gtk.Table+TableChild
258 this.overdue_chkbtn = new Gtk.CheckButton();
259 this.overdue_chkbtn.CanFocus = true;
260 this.overdue_chkbtn.Name = "overdue_chkbtn";
261- this.overdue_chkbtn.Label = Mono.Unix.Catalog.GetString("Show notification for overdue task(s)");
262+ this.overdue_chkbtn.Label = Mono.Unix.Catalog.GetString("Notify overdue task(s) every");
263 this.overdue_chkbtn.DrawIndicator = true;
264 this.overdue_chkbtn.UseUnderline = true;
265- this.vbox3.Add(this.overdue_chkbtn);
266- Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.vbox3[this.overdue_chkbtn]));
267- w18.Position = 0;
268- w18.Expand = false;
269- w18.Fill = false;
270+ this.table1.Add(this.overdue_chkbtn);
271+ Gtk.Table.TableChild w19 = ((Gtk.Table.TableChild)(this.table1[this.overdue_chkbtn]));
272+ w19.XOptions = ((Gtk.AttachOptions)(6));
273+ w19.YOptions = ((Gtk.AttachOptions)(4));
274+ // Container child table1.Gtk.Table+TableChild
275+ this.overdue_interval_spinbtn = new Gtk.SpinButton(1, 9999, 1);
276+ this.overdue_interval_spinbtn.CanFocus = true;
277+ this.overdue_interval_spinbtn.Name = "overdue_interval_spinbtn";
278+ this.overdue_interval_spinbtn.Adjustment.PageIncrement = 10;
279+ this.overdue_interval_spinbtn.ClimbRate = 1;
280+ this.overdue_interval_spinbtn.Numeric = true;
281+ this.overdue_interval_spinbtn.Value = 1;
282+ this.table1.Add(this.overdue_interval_spinbtn);
283+ Gtk.Table.TableChild w20 = ((Gtk.Table.TableChild)(this.table1[this.overdue_interval_spinbtn]));
284+ w20.LeftAttach = ((uint)(1));
285+ w20.RightAttach = ((uint)(2));
286+ w20.XPadding = ((uint)(5));
287+ w20.XOptions = ((Gtk.AttachOptions)(6));
288+ w20.YOptions = ((Gtk.AttachOptions)(4));
289+ this.vbox3.Add(this.table1);
290+ Gtk.Box.BoxChild w21 = ((Gtk.Box.BoxChild)(this.vbox3[this.table1]));
291+ w21.Position = 0;
292+ w21.Expand = false;
293+ w21.Fill = false;
294 // Container child vbox3.Gtk.Box+BoxChild
295 this.confirm_chkbtn = new Gtk.CheckButton();
296 this.confirm_chkbtn.CanFocus = true;
297@@ -204,10 +245,10 @@
298 this.confirm_chkbtn.DrawIndicator = true;
299 this.confirm_chkbtn.UseUnderline = true;
300 this.vbox3.Add(this.confirm_chkbtn);
301- Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.vbox3[this.confirm_chkbtn]));
302- w19.Position = 1;
303- w19.Expand = false;
304- w19.Fill = false;
305+ Gtk.Box.BoxChild w22 = ((Gtk.Box.BoxChild)(this.vbox3[this.confirm_chkbtn]));
306+ w22.Position = 1;
307+ w22.Expand = false;
308+ w22.Fill = false;
309 // Container child vbox3.Gtk.Box+BoxChild
310 this.returnnew_chkbtn = new Gtk.CheckButton();
311 this.returnnew_chkbtn.CanFocus = true;
312@@ -216,10 +257,10 @@
313 this.returnnew_chkbtn.DrawIndicator = true;
314 this.returnnew_chkbtn.UseUnderline = true;
315 this.vbox3.Add(this.returnnew_chkbtn);
316- Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.vbox3[this.returnnew_chkbtn]));
317- w20.Position = 2;
318- w20.Expand = false;
319- w20.Fill = false;
320+ Gtk.Box.BoxChild w23 = ((Gtk.Box.BoxChild)(this.vbox3[this.returnnew_chkbtn]));
321+ w23.Position = 2;
322+ w23.Expand = false;
323+ w23.Fill = false;
324 this.GtkAlignment2.Add(this.vbox3);
325 this.notification_frm.Add(this.GtkAlignment2);
326 this.GtkLabel5 = new Gtk.Label();
327@@ -228,12 +269,13 @@
328 this.GtkLabel5.UseMarkup = true;
329 this.notification_frm.LabelWidget = this.GtkLabel5;
330 this.vbox1.Add(this.notification_frm);
331- Gtk.Box.BoxChild w23 = ((Gtk.Box.BoxChild)(this.vbox1[this.notification_frm]));
332- w23.Position = 1;
333- w23.Expand = false;
334- w23.Fill = false;
335+ Gtk.Box.BoxChild w26 = ((Gtk.Box.BoxChild)(this.vbox1[this.notification_frm]));
336+ w26.Position = 1;
337+ w26.Expand = false;
338+ w26.Fill = false;
339 // Container child vbox1.Gtk.Box+BoxChild
340 this.filter_frm = new Gtk.Frame();
341+ this.filter_frm.Sensitive = false;
342 this.filter_frm.Name = "filter_frm";
343 this.filter_frm.ShadowType = ((Gtk.ShadowType)(0));
344 this.filter_frm.BorderWidth = ((uint)(2));
345@@ -253,20 +295,20 @@
346 this.filter_entry.IsEditable = true;
347 this.filter_entry.InvisibleChar = '●';
348 this.vbox4.Add(this.filter_entry);
349- Gtk.Box.BoxChild w24 = ((Gtk.Box.BoxChild)(this.vbox4[this.filter_entry]));
350- w24.Position = 0;
351- w24.Expand = false;
352- w24.Fill = false;
353+ Gtk.Box.BoxChild w27 = ((Gtk.Box.BoxChild)(this.vbox4[this.filter_entry]));
354+ w27.Position = 0;
355+ w27.Expand = false;
356+ w27.Fill = false;
357 // Container child vbox4.Gtk.Box+BoxChild
358 this.filter_desc_lbl = new Gtk.Label();
359 this.filter_desc_lbl.Name = "filter_desc_lbl";
360 this.filter_desc_lbl.LabelProp = Mono.Unix.Catalog.GetString("You can enter some advanced search operators here to limit the tasks Do indexes. E.g. \"priority:1 AND status:incomplete\" will force Do to only index all incomplete tasks with high priority.");
361 this.filter_desc_lbl.Wrap = true;
362 this.vbox4.Add(this.filter_desc_lbl);
363- Gtk.Box.BoxChild w25 = ((Gtk.Box.BoxChild)(this.vbox4[this.filter_desc_lbl]));
364- w25.Position = 1;
365- w25.Expand = false;
366- w25.Fill = false;
367+ Gtk.Box.BoxChild w28 = ((Gtk.Box.BoxChild)(this.vbox4[this.filter_desc_lbl]));
368+ w28.Position = 1;
369+ w28.Expand = false;
370+ w28.Fill = false;
371 // Container child vbox4.Gtk.Box+BoxChild
372 this.info_hbox = new Gtk.HBox();
373 this.info_hbox.Name = "info_hbox";
374@@ -276,20 +318,20 @@
375 this.fixed3.Name = "fixed3";
376 this.fixed3.HasWindow = false;
377 this.info_hbox.Add(this.fixed3);
378- Gtk.Box.BoxChild w26 = ((Gtk.Box.BoxChild)(this.info_hbox[this.fixed3]));
379- w26.Position = 0;
380+ Gtk.Box.BoxChild w29 = ((Gtk.Box.BoxChild)(this.info_hbox[this.fixed3]));
381+ w29.Position = 0;
382 // Container child info_hbox.Gtk.Box+BoxChild
383 this.fixed4 = new Gtk.Fixed();
384 this.fixed4.Name = "fixed4";
385 this.fixed4.HasWindow = false;
386 this.info_hbox.Add(this.fixed4);
387- Gtk.Box.BoxChild w27 = ((Gtk.Box.BoxChild)(this.info_hbox[this.fixed4]));
388- w27.Position = 2;
389+ Gtk.Box.BoxChild w30 = ((Gtk.Box.BoxChild)(this.info_hbox[this.fixed4]));
390+ w30.Position = 2;
391 this.vbox4.Add(this.info_hbox);
392- Gtk.Box.BoxChild w28 = ((Gtk.Box.BoxChild)(this.vbox4[this.info_hbox]));
393- w28.Position = 2;
394- w28.Expand = false;
395- w28.Fill = false;
396+ Gtk.Box.BoxChild w31 = ((Gtk.Box.BoxChild)(this.vbox4[this.info_hbox]));
397+ w31.Position = 2;
398+ w31.Expand = false;
399+ w31.Fill = false;
400 this.GtkAlignment3.Add(this.vbox4);
401 this.filter_frm.Add(this.GtkAlignment3);
402 this.GtkLabel6 = new Gtk.Label();
403@@ -298,18 +340,17 @@
404 this.GtkLabel6.UseMarkup = true;
405 this.filter_frm.LabelWidget = this.GtkLabel6;
406 this.vbox1.Add(this.filter_frm);
407- Gtk.Box.BoxChild w31 = ((Gtk.Box.BoxChild)(this.vbox1[this.filter_frm]));
408- w31.Position = 2;
409- w31.Expand = false;
410- w31.Fill = false;
411+ Gtk.Box.BoxChild w34 = ((Gtk.Box.BoxChild)(this.vbox1[this.filter_frm]));
412+ w34.Position = 2;
413+ w34.Expand = false;
414+ w34.Fill = false;
415 this.Add(this.vbox1);
416 if ((this.Child != null)) {
417 this.Child.ShowAll();
418 }
419- this.notification_frm.Hide();
420- this.filter_frm.Hide();
421 this.Show();
422 this.auth_btn.Clicked += new System.EventHandler(this.OnAuthBtnClicked);
423+ this.overdue_interval_spinbtn.ValueChanged += new System.EventHandler(this.OnOverdueIntervalChanged);
424 this.overdue_chkbtn.Clicked += new System.EventHandler(this.OnOverdueChkbtnClicked);
425 this.confirm_chkbtn.Clicked += new System.EventHandler(this.OnConfirmChkbtnClicked);
426 this.returnnew_chkbtn.Clicked += new System.EventHandler(this.OnReturnNewChkBtnClicked);
427
428=== modified file 'RememberTheMilk/gtk-gui/generated.cs'
429--- RememberTheMilk/gtk-gui/generated.cs 2008-12-30 23:10:34 +0000
430+++ RememberTheMilk/gtk-gui/generated.cs 2009-05-31 23:40:43 +0000
431@@ -1,7 +1,7 @@
432 // ------------------------------------------------------------------------------
433 // <autogenerated>
434 // This code was generated by a tool.
435-// Mono Runtime Version: 2.0.50727.42
436+//
437 //
438 // Changes to this file may cause incorrect behavior and will be lost if
439 // the code is regenerated.
440
441=== modified file 'RememberTheMilk/gtk-gui/gui.stetic'
442--- RememberTheMilk/gtk-gui/gui.stetic 2009-03-09 10:15:27 +0000
443+++ RememberTheMilk/gtk-gui/gui.stetic 2009-05-31 23:40:43 +0000
444@@ -2,9 +2,13 @@
445 <stetic-interface>
446 <configuration>
447 <images-root-path>..</images-root-path>
448- <target-gtk-version>2.12.1</target-gtk-version>
449+ <target-gtk-version>2.12</target-gtk-version>
450 </configuration>
451- <widget class="Gtk.Bin" id="RememberTheMilk.Configuration" design-size="407 390">
452+ <import>
453+ <widget-library name="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral" />
454+ <widget-library name="../bin/Debug/RTM.dll" internal="true" />
455+ </import>
456+ <widget class="Gtk.Bin" id="RememberTheMilk.Configuration" design-size="476 435">
457 <property name="MemberName" />
458 <child>
459 <widget class="Gtk.VBox" id="vbox1">
460@@ -125,7 +129,7 @@
461 <child>
462 <widget class="Gtk.Frame" id="notification_frm">
463 <property name="MemberName" />
464- <property name="Visible">False</property>
465+ <property name="Sensitive">False</property>
466 <property name="ShadowType">None</property>
467 <property name="BorderWidth">2</property>
468 <child>
469@@ -140,14 +144,80 @@
470 <property name="Spacing">6</property>
471 <property name="BorderWidth">5</property>
472 <child>
473- <widget class="Gtk.CheckButton" id="overdue_chkbtn">
474+ <widget class="Gtk.Table" id="table1">
475 <property name="MemberName" />
476- <property name="CanFocus">True</property>
477- <property name="Label" translatable="yes">Show notification for overdue task(s)</property>
478- <property name="DrawIndicator">True</property>
479- <property name="HasLabel">True</property>
480- <property name="UseUnderline">True</property>
481- <signal name="Clicked" handler="OnOverdueChkbtnClicked" />
482+ <property name="NColumns">3</property>
483+ <property name="RowSpacing">6</property>
484+ <property name="ColumnSpacing">6</property>
485+ <child>
486+ <widget class="Gtk.Label" id="minute_lbl">
487+ <property name="MemberName" />
488+ <property name="LabelProp" translatable="yes">minute(s)</property>
489+ </widget>
490+ <packing>
491+ <property name="LeftAttach">2</property>
492+ <property name="RightAttach">3</property>
493+ <property name="AutoSize">True</property>
494+ <property name="XOptions">Fill</property>
495+ <property name="YOptions">Fill</property>
496+ <property name="XExpand">False</property>
497+ <property name="XFill">True</property>
498+ <property name="XShrink">False</property>
499+ <property name="YExpand">False</property>
500+ <property name="YFill">True</property>
501+ <property name="YShrink">False</property>
502+ </packing>
503+ </child>
504+ <child>
505+ <widget class="Gtk.CheckButton" id="overdue_chkbtn">
506+ <property name="MemberName" />
507+ <property name="CanFocus">True</property>
508+ <property name="Label" translatable="yes">Notify overdue task(s) every</property>
509+ <property name="DrawIndicator">True</property>
510+ <property name="HasLabel">True</property>
511+ <property name="UseUnderline">True</property>
512+ <signal name="Clicked" handler="OnOverdueChkbtnClicked" />
513+ </widget>
514+ <packing>
515+ <property name="AutoSize">False</property>
516+ <property name="XOptions">Shrink, Fill</property>
517+ <property name="YOptions">Fill</property>
518+ <property name="XExpand">False</property>
519+ <property name="XFill">True</property>
520+ <property name="XShrink">True</property>
521+ <property name="YExpand">False</property>
522+ <property name="YFill">True</property>
523+ <property name="YShrink">False</property>
524+ </packing>
525+ </child>
526+ <child>
527+ <widget class="Gtk.SpinButton" id="overdue_interval_spinbtn">
528+ <property name="MemberName" />
529+ <property name="CanFocus">True</property>
530+ <property name="Lower">1</property>
531+ <property name="Upper">9999</property>
532+ <property name="PageIncrement">10</property>
533+ <property name="StepIncrement">1</property>
534+ <property name="ClimbRate">1</property>
535+ <property name="Numeric">True</property>
536+ <property name="Value">1</property>
537+ <signal name="ValueChanged" handler="OnOverdueIntervalChanged" />
538+ </widget>
539+ <packing>
540+ <property name="LeftAttach">1</property>
541+ <property name="RightAttach">2</property>
542+ <property name="XPadding">5</property>
543+ <property name="AutoSize">False</property>
544+ <property name="XOptions">Shrink, Fill</property>
545+ <property name="YOptions">Fill</property>
546+ <property name="XExpand">False</property>
547+ <property name="XFill">True</property>
548+ <property name="XShrink">True</property>
549+ <property name="YExpand">False</property>
550+ <property name="YFill">True</property>
551+ <property name="YShrink">False</property>
552+ </packing>
553+ </child>
554 </widget>
555 <packing>
556 <property name="Position">0</property>
557@@ -215,7 +285,7 @@
558 <child>
559 <widget class="Gtk.Frame" id="filter_frm">
560 <property name="MemberName" />
561- <property name="Visible">False</property>
562+ <property name="Sensitive">False</property>
563 <property name="ShadowType">None</property>
564 <property name="BorderWidth">2</property>
565 <child>
566
567=== modified file 'RememberTheMilk/src/Configuration.cs'
568--- RememberTheMilk/src/Configuration.cs 2009-01-29 16:58:01 +0000
569+++ RememberTheMilk/src/Configuration.cs 2009-06-03 23:38:02 +0000
570@@ -1,21 +1,20 @@
571-/* Configuration.cs
572- *
573- * GNOME Do is the legal property of its developers. Please refer to the
574- * COPYRIGHT file distributed with this source distribution.
575- *
576- * This program is free software: you can redistribute it and/or modify
577- * it under the terms of the GNU General Public License as published by
578- * the Free Software Foundation, either version 3 of the License, or
579- * (at your option) any later version.
580- *
581- * This program is distributed in the hope that it will be useful,
582- * but WITHOUT ANY WARRANTY; without even the implied warranty of
583- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
584- * GNU General Public License for more details.
585- *
586- * You should have received a copy of the GNU General Public License
587- * along with this program. If not, see <http://www.gnu.org/licenses/>.
588- */
589+// Configuration.cs
590+//
591+// Copyright (C) 2009 GNOME Do
592+//
593+// This program is free software: you can redistribute it and/or modify
594+// it under the terms of the GNU General Public License as published by
595+// the Free Software Foundation, either version 3 of the License, or
596+// (at your option) any later version.
597+//
598+// This program is distributed in the hope that it will be useful,
599+// but WITHOUT ANY WARRANTY; without even the implied warranty of
600+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
601+// GNU General Public License for more details.
602+//
603+// You should have received a copy of the GNU General Public License
604+// along with this program. If not, see <http://www.gnu.org/licenses/>.
605+//
606
607 using System;
608 using Mono.Unix;
609@@ -24,15 +23,20 @@
610
611 using Gtk;
612
613-
614 namespace RememberTheMilk
615 {
616+ /// <summary>
617+ /// (Partial) class for the preference dialog
618+ /// </summary>
619 public partial class Configuration : Gtk.Bin
620 {
621- //private static IPreferences prefs;
622 private LinkButton rtm_ref_btn;
623 private string frob;
624
625+ /// <summary>
626+ /// Constructor. Creates a new link button point to the help page for filter
627+ /// Initialize the UI.
628+ /// </summary>
629 public Configuration ()
630 {
631 this.Build();
632@@ -43,7 +47,7 @@
633 wInt.Position = 1;
634 rtm_ref_btn.Clicked += OnRtmRefBtnClicked;
635
636- if (!System.String.IsNullOrEmpty (RTM.Preferences.Token)) {
637+ if (!System.String.IsNullOrEmpty (RTMPreferences.Token)) {
638 SetStateComplete ();
639 }
640 }
641@@ -51,32 +55,71 @@
642 static Configuration ()
643 {
644 }
645-
646+
647+ /// <summary>
648+ /// Called when the user checks to receive notification after each action
649+ /// </summary>
650+ /// <param name="sender">
651+ /// Ignored
652+ /// </param>
653+ /// <param name="e">
654+ /// Ignored
655+ /// </param>
656 protected virtual void OnConfirmChkbtnClicked (object sender, System.EventArgs e)
657 {
658- RTM.Preferences.ActionNotification = confirm_chkbtn.Active;
659+ RTMPreferences.ActionNotification = confirm_chkbtn.Active;
660 }
661-
662+
663+ /// <summary>
664+ /// Called when the user checkr the "Notfiy overdue tasks option"
665+ /// </summary>
666+ /// <param name="sender">
667+ /// Ignored
668+ /// </param>
669+ /// <param name="e">
670+ /// Ignored
671+ /// </param>
672 protected virtual void OnOverdueChkbtnClicked (object sender, System.EventArgs e)
673 {
674- RTM.Preferences.OverdueNotification = overdue_chkbtn.Active;
675+ RTMPreferences.OverdueNotification = overdue_chkbtn.Active;
676+ overdue_interval_spinbtn.Sensitive = overdue_chkbtn.Active;
677+ overdue_interval_spinbtn.Value = RTMPreferences.OverdueInterval;
678+
679 }
680
681+ /// <summary>
682+ /// Called when the user checks the "Return the newly created task" option.
683+ /// </summary>
684+ /// <param name="sender">
685+ /// Ignored
686+ /// </param>
687+ /// <param name="e">
688+ /// Ignored
689+ /// </param>
690 protected virtual void OnReturnNewChkBtnClicked (object sender, System.EventArgs e)
691 {
692- RTM.Preferences.ReturnNewTask = returnnew_chkbtn.Active;
693+ RTMPreferences.ReturnNewTask = returnnew_chkbtn.Active;
694 }
695
696+ /// <summary>
697+ /// Called when the "Authorize" button is clicked. Initializes the authentication.
698+ /// </summary>
699+ /// <param name="sender">
700+ /// Ignored
701+ /// </param>
702+ /// <param name="e">
703+ /// Ignored
704+ /// </param>
705 protected virtual void OnAuthBtnClicked (object sender, System.EventArgs e)
706 {
707 frob = RTM.AuthInit ();
708 authinfo_lbl.Text = Catalog.GetString ("A webpage from Remember The Milk should be opened"
709 + " in your web browser now. Please follow the instructions there and come back to complete"
710 + " the authrozation by clicking the button below.");
711- RTM.Preferences.Token = "";
712- RTM.Preferences.Username = "";
713- //notification_frm.Visible = false;
714- //filter_frm.Visible = false;
715+ RTMPreferences.Token = "";
716+ RTMPreferences.Username = "";
717+ notification_frm.Sensitive = false;
718+ filter_frm.Sensitive = false;
719 Widget image = auth_btn.Image;
720 auth_btn.Label = Catalog.GetString ("Complete authorization");
721 auth_btn.Image = image;
722@@ -84,13 +127,22 @@
723 auth_btn.Clicked += new EventHandler (OnCompleteBtnClicked);
724 }
725
726+ /// <summary>
727+ /// Called when user returns from the authentication webpage and clicks the "Complete" button.
728+ /// </summary>
729+ /// <param name="sender">
730+ /// Ignored
731+ /// </param>
732+ /// <param name="e">
733+ /// Ignored
734+ /// </param>
735 protected virtual void OnCompleteBtnClicked (object sender, EventArgs e)
736 {
737 Auth auth;
738 auth = RTM.AuthComplete (frob);
739 if (auth != null ) {
740- RTM.Preferences.Token = auth.Token;
741- RTM.Preferences.Username = auth.User.Username;
742+ RTMPreferences.Token = auth.Token;
743+ RTMPreferences.Username = auth.User.Username;
744 auth_btn.Clicked -= new EventHandler (OnCompleteBtnClicked);
745 auth_btn.Clicked += new EventHandler (OnAuthBtnClicked);
746 SetStateComplete ();
747@@ -102,27 +154,64 @@
748 }
749 }
750
751+ /// <summary>
752+ /// Initialize the state of various UI components.
753+ /// </summary>
754 private void SetStateComplete ()
755 {
756 authinfo_lbl.Text = String.Format (Catalog.GetString ("Thank you {0}, "
757- + "RTM plugin is now authorized to operate on your account."), RTM.Preferences.Username);
758+ + "RTM plugin is now authorized to operate on your account."), RTMPreferences.Username);
759 auth_btn.Label = "Sign in as a different user";
760- notification_frm.Visible = true;
761- filter_frm.Visible = true;
762- confirm_chkbtn.Active = RTM.Preferences.ActionNotification;
763- overdue_chkbtn.Active = RTM.Preferences.OverdueNotification;
764- returnnew_chkbtn.Active = RTM.Preferences.ReturnNewTask;
765- filter_entry.Text = RTM.Preferences.Filter;
766+ notification_frm.Sensitive = true;
767+ filter_frm.Sensitive = true;
768+ confirm_chkbtn.Active = RTMPreferences.ActionNotification;
769+ overdue_chkbtn.Active = RTMPreferences.OverdueNotification;
770+ overdue_interval_spinbtn.Sensitive = overdue_chkbtn.Active;
771+ overdue_interval_spinbtn.Value = RTMPreferences.OverdueInterval;
772+ returnnew_chkbtn.Active = RTMPreferences.ReturnNewTask;
773+ filter_entry.Text = RTMPreferences.Filter;
774 }
775-
776+
777+ /// <summary>
778+ /// Called when the Filter entry is changed by user.
779+ /// </summary>
780+ /// <param name="sender">
781+ /// Ignored
782+ /// </param>
783+ /// <param name="e">
784+ /// Ignored
785+ /// </param>
786 protected virtual void OnFilterEntryChanged (object sender, System.EventArgs e)
787 {
788- RTM.Preferences.Filter = filter_entry.Text;
789+ RTMPreferences.Filter = filter_entry.Text;
790 }
791-
792+
793+ /// <summary>
794+ /// Called when the link button to RTM reference page is clicked by user.
795+ /// </summary>
796+ /// <param name="sender">
797+ /// Ignored
798+ /// </param>
799+ /// <param name="e">
800+ /// Ignored
801+ /// </param>
802 protected virtual void OnRtmRefBtnClicked (object sender, EventArgs e)
803 {
804 Do.Platform.Services.Environment.OpenUrl("http://www.rememberthemilk.com/help/answers/search/advanced.rtm");
805 }
806+
807+ /// <summary>
808+ /// Called when user changes the interval spin button.
809+ /// </summary>
810+ /// <param name="sender">
811+ /// Ignored
812+ /// </param>
813+ /// <param name="e">
814+ /// Ignored
815+ /// </param>
816+ protected virtual void OnOverdueIntervalChanged (object sender, System.EventArgs e)
817+ {
818+ RTMPreferences.OverdueInterval = overdue_interval_spinbtn.Value;
819+ }
820 }
821 }
822
823=== modified file 'RememberTheMilk/src/RTM.cs'
824--- RememberTheMilk/src/RTM.cs 2009-03-18 18:45:13 +0000
825+++ RememberTheMilk/src/RTM.cs 2009-06-09 18:28:21 +0000
826@@ -1,550 +1,1206 @@
827-/* RTM.cs
828- *
829- * GNOME Do is the legal property of its developers. Please refer to the
830- * COPYRIGHT file distributed with this
831- * source distribution.
832- *
833- * This program is free software: you can redistribute it and/or modify
834- * it under the terms of the GNU General Public License as published by
835- * the Free Software Foundation, either version 3 of the License, or
836- * (at your option) any later version.
837- *
838- * This program is distributed in the hope that it will be useful,
839- * but WITHOUT ANY WARRANTY; without even the implied warranty of
840- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
841- * GNU General Public License for more details.
842- *
843- * You should have received a copy of the GNU General Public License
844- * along with this program. If not, see <http://www.gnu.org/licenses/>.
845- */
846+// RTM.cs
847+//
848+// Copyright (C) 2009 GNOME Do
849+//
850+// This program is free software: you can redistribute it and/or modify
851+// it under the terms of the GNU General Public License as published by
852+// the Free Software Foundation, either version 3 of the License, or
853+// (at your option) any later version.
854+//
855+// This program is distributed in the hope that it will be useful,
856+// but WITHOUT ANY WARRANTY; without even the implied warranty of
857+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
858+// GNU General Public License for more details.
859+//
860+// You should have received a copy of the GNU General Public License
861+// along with this program. If not, see <http://www.gnu.org/licenses/>.
862+//
863
864 using System;
865+using System.Linq;
866 using System.Collections.Generic;
867 using System.Text.RegularExpressions;
868+using System.Threading;
869 using Mono.Unix;
870 using RtmNet;
871
872-
873+using Do.Platform;
874 using Do.Universe;
875
876-
877 namespace RememberTheMilk
878 {
879- public static class RTM
880- {
881- private static Rtm rtm;
882- private static Dictionary<string,List<Item>> tasks;
883- private static Dictionary<string,Item> lists;
884- private static object lists_lock;
885- private static object lists_lock_at;
886- private static object dict_lock;
887- private static string timeline;
888- private static DateTime last_sync;
889- private static string username;
890- private static string filter;
891-
892- private const string ApiKey = "ee32c06f2d45baf935a2c046323457d8";
893- private const string SharedSecret = "1b835b123a903938";
894-
895- static RTM ()
896- {
897- rtm = new Rtm (ApiKey, SharedSecret);
898- tasks = new Dictionary<string,List<Item>> ();
899- lists = new Dictionary<string,Item> ();
900- lists_lock = new object ();
901- lists_lock_at = new object ();
902- dict_lock = new object ();
903- last_sync = DateTime.MinValue;
904- Preferences = new RTMPreferences ();
905- filter = Preferences.Filter;
906-
907- if (!String.IsNullOrEmpty (Preferences.Token)) {
908- Auth auth;
909- try {
910- auth = rtm.AuthCheckToken (Preferences.Token);
911- } catch (RtmException e) {
912- Console.Error.WriteLine ("Token verification failed: " + e.Message);
913- return;
914- }
915-
916- rtm.AuthToken = auth.Token;
917- timeline = rtm.TimelineCreate ();
918- username = auth.User.Username;
919- }
920- }
921-
922- public static RTMPreferences Preferences { get; private set; }
923-
924- public static bool IsAuthenticated {
925- get { return (rtm.IsAuthenticated && !String.IsNullOrEmpty (rtm.AuthToken)); }
926- }
927-
928- public static string AuthInit ()
929- {
930- string frob;
931- try {
932- frob = rtm.AuthGetFrob ();
933- } catch (RtmException e) {
934- Console.Error.WriteLine ("Fail to initialize authentication: " + e.Message);
935- return "";
936- }
937- Do.Platform.Services.Environment.OpenUrl(rtm.AuthCalcUrl (frob, AuthLevel.Delete));
938- return frob;
939- }
940-
941- public static Auth AuthComplete (string frob)
942- {
943- Auth auth;
944- try {
945- auth = rtm.AuthGetToken (frob);
946- } catch (RtmException e) {
947- Console.Error.WriteLine ("Fails to complete authentication: " + e.Message);
948- return null;
949- }
950- rtm.AuthToken = auth.Token;
951- timeline = rtm.TimelineCreate ();
952- return auth;
953- }
954-
955- public static List<Item> Lists {
956- get {
957- List<Item> lists2 = new List<Item> ();
958- lists2.Clear ();
959- lists2.Add (new RTMListItem ("All Tasks", "All Tasks"));
960-
961- lock (dict_lock)
962- foreach (KeyValuePair<string,Item> kvp in lists)
963- lists2.Add (kvp.Value);
964-
965- return lists2;
966- }
967- }
968-
969- public static void UpdateLists ()
970- {
971- if (!IsAuthenticated)
972- return;
973-
974- Lists rtmLists;
975- try {
976- rtmLists = rtm.ListsGetList ();
977- } catch (RtmException e) {
978- Console.Error.WriteLine (e.Message);
979- rtmLists = null;
980- return;
981- }
982-
983- lists.Clear ();
984- foreach (List rtmList in rtmLists.listCollection)
985- if (rtmList.Deleted == 0 && rtmList.Smart == 0)
986- lists [rtmList.ID] = new RTMListItem (rtmList.ID, rtmList.Name);
987- }
988-
989- public static List<Item> TasksForList (string listId)
990- {
991- return tasks [listId];
992- }
993-
994- public static string ListNameForList (string listId)
995- {
996- return lists [listId].Name;
997- }
998-
999- public static void UpdateTasks ()
1000- {
1001-
1002- if (!IsAuthenticated)
1003- return;
1004-
1005- Tasks rtmTasks;
1006-
1007- // if settings have changed, reset the synchronization state;
1008- if (filter != Preferences.Filter || username != Preferences.Username)
1009- last_sync = DateTime.MinValue;
1010-
1011- if (last_sync == DateTime.MinValue) {
1012- tasks.Clear ();
1013- tasks ["All Tasks"] = new List<Item> ();
1014- }
1015-
1016- filter = Preferences.Filter;
1017- if (String.IsNullOrEmpty (filter))
1018- filter = "status:incomplete";
1019- else if (!filter.Contains ("status:"))
1020- filter = "status:incomplete OR (" + filter + ")";
1021-
1022- try {
1023- // If first time sync, get full list of incompleted tasks
1024- // otherwise, only do incremental sync.
1025- if (last_sync == DateTime.MinValue)
1026- rtmTasks = rtm.TasksGetList (null, null, filter);
1027- else
1028- rtmTasks = rtm.TasksGetList (null, last_sync.ToUniversalTime ().ToString ("u"), filter);
1029- } catch (RtmException e) {
1030- rtmTasks = null;
1031- last_sync = DateTime.MinValue;
1032- Console.Error.WriteLine (e.Message);
1033- return;
1034- }
1035-
1036- foreach (List rtmList in rtmTasks.ListCollection) {
1037- if (!tasks.ContainsKey (rtmList.ID))
1038- tasks [rtmList.ID] = new List<Item> ();
1039-
1040- if (rtmList.DeletedTaskSeries != null)
1041- foreach (TaskSeries rtmTaskSeries in rtmList.DeletedTaskSeries.TaskSeriesCollection)
1042- foreach (Task rtmTask in rtmTaskSeries.TaskCollection)
1043- UniverseRemoveTask (rtmTask.TaskID, rtmList.ID);
1044-
1045- if (rtmList.TaskSeriesCollection != null) {
1046- foreach (TaskSeries rtmTaskSeries in rtmList.TaskSeriesCollection) {
1047- foreach (Task rtmTask in rtmTaskSeries.TaskCollection) {
1048- // delete one recurrent task will cause other deleted instances
1049- // appear in the taskseries tag, so here we need to check again.
1050- if (rtmTask.Deleted == DateTime.MinValue) {
1051- tasks [rtmList.ID].Add (new RTMTaskItem (rtmList.ID,
1052- rtmTaskSeries.TaskSeriesID,
1053- rtmTask.TaskID,
1054- rtmTaskSeries.Name,
1055- rtmTask.Due,
1056- rtmTask.Completed,
1057- rtmTask.TaskURL,
1058- rtmTask.Priority,
1059- rtmTask.HasDueTime));
1060- tasks ["All Tasks"].Add (new RTMTaskItem (rtmList.ID,
1061- rtmTaskSeries.TaskSeriesID,
1062- rtmTask.TaskID,
1063- rtmTaskSeries.Name,
1064- rtmTask.Due,
1065- rtmTask.Completed,
1066- rtmTask.TaskURL,
1067- rtmTask.Priority,
1068- rtmTask.HasDueTime));
1069- }
1070- }
1071- }
1072- }
1073- }
1074-
1075- last_sync = DateTime.Now;
1076-
1077- if (Preferences.OverdueNotification)
1078- NotifyOverDueItems ();
1079- }
1080-
1081- /// <summary>
1082- /// Remove task identified by taskId from list identified by listId
1083- /// and from 'All Tasks' list
1084- /// </summary>
1085- /// <param name="taskId">
1086- /// A <see cref="System.String"/>, to identify the task to remove
1087- /// </param>
1088- /// <param name="listId">
1089- /// A <see cref="System.String"/>, to identify the list from which to remove
1090- /// the task
1091- /// </param>
1092- private static void UniverseRemoveTask (string taskId, string listId)
1093- {
1094- lock (lists_lock) {
1095- foreach (RTMTaskItem task in tasks [listId].ToArray ())
1096- if (task.Id == taskId)
1097- tasks [listId].Remove (task);
1098- }
1099-
1100- lock (lists_lock_at) {
1101- foreach (RTMTaskItem task in tasks ["All Tasks"].ToArray ())
1102- if (task.Id == taskId)
1103- tasks ["All Tasks"].Remove (task);
1104- }
1105- }
1106-
1107- /// <summary>
1108- /// Check if there is overdue task in All Tasks list,
1109- /// when user chooses to be notified, display the information.
1110- /// </summary>
1111- private static void NotifyOverDueItems ()
1112- {
1113- List<string> overdue_tasks;
1114- overdue_tasks = new List<string> ();
1115- lock (lists_lock_at) {
1116- foreach (RTMTaskItem task in tasks ["All Tasks"].ToArray ())
1117- if ((task.Completed == DateTime.MinValue) && (task.Due > DateTime.MinValue) &&
1118- ((task.Due < DateTime.Now && task.HasDueTime == 1) || task.Due.Date < DateTime.Today))
1119- overdue_tasks.Add (task.Name);
1120- }
1121-
1122- int len = overdue_tasks.ToArray ().Length;
1123- if (len > 0) {
1124- string title;
1125- title = String.Format (Catalog.GetPluralString ("{0} Task Overdue",
1126- "{0} Tasks Overdue", len), len);
1127-// if (len > 1)
1128-// title = Catalog.GetString (String.Format ("{0} Tasks overdue", len));
1129-// else
1130-// title = Catalog.GetString ("1 Task Overdue");
1131-
1132- string body = "";
1133- foreach (string name in overdue_tasks) // TODO: missing lock
1134- body += ("- " + name +"\n");
1135-
1136- Do.Platform.Services.Notifications.Notify(new Do.Platform.Notification( title, body, "task-overdue.png@" + typeof(RTMTaskItem).Assembly.FullName ) );
1137- }
1138- }
1139-
1140- /// <summary>
1141- /// A wrapper function to complete several common tasks for most action methods:
1142- /// 1. display notification if user choose to
1143- /// 2. clear modified task from its list and 'All Tasks' list
1144- /// 3. update tasks
1145- /// </summary>
1146- /// <param name="title">
1147- /// A <see cref="System.String"/> for the title of the notification message.
1148- /// </param>
1149- /// <param name="body">
1150- /// A <see cref="System.String"/> for the content of the notification message.
1151- /// </param>
1152- /// <param name="taskId">
1153- /// A <see cref="System.String"/>, if exist, will be passed to <see cref="UniverseRemoveTask"/>
1154- /// </param>
1155- /// <param name="listId">
1156- /// A <see cref="System.String"/>, if exist, will be passed to <see cref="UniverseRemoveTask"/>
1157- /// </param>
1158- private static void ActionRoutine (string title, string body, string taskId, string listId)
1159- {
1160- if (Preferences.ActionNotification) {
1161- Do.Platform.Services.Notifications.Notify( new Do.Platform.Notification( title, body,
1162- "rtm.png@" + typeof(RTMTaskItem).Assembly.FullName ) );
1163- }
1164- if (taskId != null && listId != null)
1165- UniverseRemoveTask (taskId, listId);
1166- UpdateTasks ();
1167- }
1168-
1169- public static RTMTaskItem NewTask (string listId, string taskData)
1170- {
1171- List rtmList;
1172- bool parse = true;
1173- string priority = "N";
1174-
1175+ /// <summary>
1176+ /// Contrller class to handle all RTM operations.
1177+ /// </summary>
1178+ public class RTM
1179+ {
1180+ #region [ Private Variable, Constant ]
1181+
1182+ static Rtm rtm;
1183+ static List<Item> tasks;
1184+ static List<Item> lists;
1185+ static List<Item> tags;
1186+ static List<Item> locations;
1187+ static List<Item> priorities;
1188+ static List<Item> notes;
1189+ static object list_lock;
1190+ static object task_lock;
1191+ static object location_lock;
1192+ static object note_lock;
1193+ static string timeline;
1194+ static DateTime last_sync;
1195+ static string username;
1196+ static string filter;
1197+ static uint overdue_timer;
1198+
1199+ static string RTMIconPath = "rtm.png@" + typeof (RTMListItemSource).Assembly.FullName;
1200+
1201+ const string ApiKey = "ee32c06f2d45baf935a2c046323457d8";
1202+ const string SharedSecret = "1b835b123a903938";
1203+
1204+ #endregion [ Private Properties, Constant ]
1205+
1206+ RTM ()
1207+ {
1208+ }
1209+
1210+ static RTM ()
1211+ {
1212+ rtm = new Rtm (ApiKey, SharedSecret);
1213+ tasks = new List<Item> ();
1214+ lists = new List<Item> ();
1215+ tags = new List<Item> ();
1216+ locations = new List<Item> ();
1217+ priorities = new List<Item> ();
1218+ notes = new List<Item> ();
1219+ list_lock = new object ();
1220+ task_lock = new object ();
1221+ location_lock = new object ();
1222+ note_lock = new object ();
1223+
1224+ ResetLastSync ();
1225+ ResetFilter ();
1226+
1227+ RTMPreferences.AccountChanged += HandleAccountChanged;
1228+ RTMPreferences.FilterChanged += HandleFilterChanged;
1229+ RTMPreferences.OverdueIntervalChanged += HandleOverdueIntervalChanged;
1230+ RTMPreferences.OverdueNotificationChanged += HandleOverdueNotificationChanged;
1231+
1232+ Services.Core.UniverseInitialized += HandleInitialized;
1233+
1234+ TryConnect ();
1235+ }
1236+
1237+ #region [ Authentication ]
1238+
1239+ //// <value>
1240+ /// If we are authorized to communicate with RTM server.
1241+ /// </value>
1242+ public static bool IsAuthenticated {
1243+ get { return (rtm.IsAuthenticated && !String.IsNullOrEmpty (rtm.AuthToken)); }
1244+ }
1245+
1246+ /// <summary>
1247+ /// Initialize the authorization, open a URL where the user can agree
1248+ /// the operation this plugin will perform on his/her RTM account.
1249+ /// </summary>
1250+ /// <returns>
1251+ /// A <see cref="System.String"/> indicating the frob value.
1252+ /// </returns>
1253+ public static string AuthInit ()
1254+ {
1255+ string frob;
1256+ try {
1257+ frob = rtm.AuthGetFrob ();
1258+ } catch (RtmException e) {
1259+ Log<RTM>.Error (Catalog.GetString ("Failed to initialize authentication."), e.Message);
1260+ return "";
1261+ }
1262+ Do.Platform.Services.Environment.OpenUrl(rtm.AuthCalcUrl (frob, AuthLevel.Delete));
1263+ return frob;
1264+ }
1265+
1266+ /// <summary>
1267+ /// Complete the authorization, check the frob, retrieve and store the token as preference.
1268+ /// </summary>
1269+ /// <param name="frob">
1270+ /// A <see cref="System.String"/> indicating the frab value.
1271+ /// </param>
1272+ /// <returns>
1273+ /// A <see cref="Auth"/>
1274+ /// </returns>
1275+ public static Auth AuthComplete (string frob)
1276+ {
1277+ Auth auth;
1278+ try {
1279+ auth = rtm.AuthGetToken (frob);
1280+ } catch (RtmException e) {
1281+ Log<RTM>.Error (Catalog.GetString("Failed to complete authentication."), e.Message);
1282+ return null;
1283+ }
1284+ rtm.AuthToken = auth.Token;
1285+ timeline = rtm.TimelineCreate ();
1286+ return auth;
1287+ }
1288+
1289+ #endregion [ Authentication ]
1290+
1291+ #region [ Public Properties ]
1292+
1293+ // If not the initial updating of the universe, we'd like the universe manager
1294+ // to pick up the new items only after the update functions have done their jobs
1295+ // so locks are used to ensure the synchronization between threads.
1296+
1297+ /// <value>
1298+ /// All list retrieved from the RTM account plus 4 meta list
1299+ /// </value>
1300+ public static List<Item> Lists {
1301+ get {
1302+ if (last_sync == DateTime.MinValue)
1303+ return lists;
1304+ else
1305+ lock (list_lock) return lists;
1306+ }
1307+ }
1308+
1309+ /// <value>
1310+ /// All tasks retrieved from the RTM account
1311+ /// </value>
1312+ public static List<Item> Tasks {
1313+ get {
1314+ if (last_sync == DateTime.MinValue)
1315+ return tasks;
1316+ else
1317+ lock (task_lock) return tasks;
1318+ }
1319+ }
1320+
1321+ /// <value>
1322+ /// All locations retrieved from the RTM account.
1323+ /// </value>
1324+ public static List<Item> Locations {
1325+ get {
1326+ if (last_sync == DateTime.MinValue)
1327+ return locations;
1328+ else
1329+ lock (location_lock) return locations;
1330+ }
1331+ }
1332+
1333+ /// <value>
1334+ /// All tags retrieved from the RTM account.
1335+ /// </value>
1336+ public static List<Item> Tags {
1337+ get { return tags; }
1338+ }
1339+
1340+ /// <value>
1341+ /// A preset list of <see cref="RTMPriorityItem"/>
1342+ /// </value>
1343+ public static List<Item> Priorities
1344+ {
1345+ get {
1346+ return priorities;
1347+ }
1348+ }
1349+
1350+ #endregion [ Public Properties ]
1351+
1352+ #region [ Relational Search ]
1353+
1354+ /// <summary>
1355+ /// Finds all tasks in a given list indicated by the list's Id.
1356+ /// </summary>
1357+ /// <param name="listId">
1358+ /// A <see cref="System.String"/> indicating the Id of the list.
1359+ /// </param>
1360+ /// <returns>
1361+ /// A <see cref="List"/> of <see cref="Item"/> containing the found tasks.
1362+ /// </returns>
1363+ public static List<Item> TasksForList (string listId)
1364+ {
1365+ if (listId == "all")
1366+ return tasks;
1367+ else if (listId == "overdue")
1368+ return tasks.FindAll (i => IsOverdue (i as RTMTaskItem));
1369+ else if (listId == "today")
1370+ return tasks.FindAll (i => IsDueToday (i as RTMTaskItem));
1371+ else if (listId == "tomorrow")
1372+ return tasks.FindAll (i => IsDueTomorrow (i as RTMTaskItem));
1373+ else if (listId == "week")
1374+ return tasks.FindAll (i => IsDueInAWeek (i as RTMTaskItem));
1375+ else
1376+ return tasks.FindAll (i => (i as RTMTaskItem).ListId == listId);
1377+ }
1378+
1379+ /// <summary>
1380+ /// Finds all tasks that have a given tag.
1381+ /// </summary>
1382+ /// <param name="tag">
1383+ /// A <see cref="System.String"/> indicating the tag to be searched for.
1384+ /// </param>
1385+ /// <returns>
1386+ /// A <see cref="List"/> of <see cref="Item"/> containing the found tasks.
1387+ /// </returns>
1388+ public static List<Item> TasksForTag (string tag)
1389+ {
1390+ return tasks.FindAll (i => (i as RTMTaskItem).Tags.Contains (tag));
1391+ }
1392+
1393+ /// <summary>
1394+ /// Finds all tasks that are associated with a given location.
1395+ /// </summary>
1396+ /// <param name="locationId">
1397+ /// A <see cref="System.String"/> indicating the Id of the location.
1398+ /// </param>
1399+ /// <returns>
1400+ /// A <see cref="List"/> of <see cref="Item"/> containing the found tasks.
1401+ /// </returns>
1402+ public static List<Item> TasksForLocation (string locationId)
1403+ {
1404+ return tasks.FindAll (i => (i as RTMTaskItem).LocationId == locationId);
1405+ }
1406+
1407+ /// <summary>
1408+ /// Generates all <see cref="RTMTaskAttributeItem"/>s based on the available properties of a task.
1409+ /// </summary>
1410+ /// <param name="task">
1411+ /// A <see cref="RTMTaskItem"/> indicating the task.
1412+ /// </param>
1413+ /// <returns>
1414+ /// A <see cref="List"/> of <see cref="Item"/> containing the generated attributes.
1415+ /// </returns>
1416+ public static List<Item> AttributesForTask (RTMTaskItem task)
1417+ {
1418+ List<Item> attribute_list = new List<Item> ();
1419+
1420+ if (task.Due != DateTime.MinValue)
1421+ attribute_list.Add (new RTMTaskAttributeItem (task.Due.ToString ((task.HasDueTime != 0) ? "g" : "d"),
1422+ "Due Date/Time",
1423+ task.Url, "stock_calendar", task));
1424+ if (!String.IsNullOrEmpty (task.TaskUrl))
1425+ attribute_list.Add (new RTMTaskAttributeItem (task.TaskUrl, "URL",
1426+ task.TaskUrl, "text-html", task));
1427+ if (!String.IsNullOrEmpty (task.Estimate))
1428+ attribute_list.Add (new RTMTaskAttributeItem (task.Estimate, "Time Estimate",
1429+ task.Url, "stock_appointment-reminder", task));
1430+ if (!String.IsNullOrEmpty (task.LocationId))
1431+ attribute_list.Add (locations.Find (i => (i as RTMLocationItem).Id == task.LocationId));
1432+
1433+ if (!String.IsNullOrEmpty (task.Tags))
1434+ attribute_list.Add (new RTMTaskAttributeItem (task.Tags, "Tags", task.Url,
1435+ "task-tag.png@" + typeof (RTMListItemSource).Assembly.FullName,
1436+ task));
1437+
1438+ List<Item> note_list = notes.FindAll (i => (i as RTMNoteItem).TaskId == task.Id);
1439+ if (note_list.Any ())
1440+ lock (note_lock)
1441+ foreach (Item item in note_list)
1442+ attribute_list.Add (item);
1443+
1444+ return attribute_list;
1445+ }
1446+
1447+ #endregion [ Relational Search ]
1448+
1449+ #region [ Methods for Data Update ]
1450+
1451+ /// <summary>
1452+ /// Retrieves the list of task lists as <see cref="RTMListIem"/>s from RTM server.
1453+ /// Also adds 4 meta lists for easy access to overdue tasks,
1454+ /// and tasks due today/tomorrow/in a week.
1455+ /// </summary>
1456+ public static void UpdateLists ()
1457+ {
1458+ lock (list_lock) {
1459+ if (!IsAuthenticated)
1460+ if (!TryConnect ())
1461+ return;
1462+
1463+ Lists rtmLists;
1464+ try {
1465+ rtmLists = rtm.ListsGetList ();
1466+ } catch (RtmException e) {
1467+ Log<RTM>.Debug (Catalog.GetString ("An error occured when updating RTM lists: {0}"),
1468+ e.Message);
1469+ rtmLists = null;
1470+ return;
1471+ }
1472+
1473+ lists.Clear ();
1474+
1475+ //lists.Add (new RTMListItem ("all", "All Tasks", 1, 1));
1476+ lists.Add (new RTMListItem ("today", "Today", 1, 1));
1477+ lists.Add (new RTMListItem ("tomorrow", "Tomorrow", 1, 1));
1478+ lists.Add (new RTMListItem ("week", "In a Week", 1, 1));
1479+ lists.Add (new RTMListItem ("overdue", "Overdue", 1, 1));
1480+
1481+ foreach (List rtmList in rtmLists.listCollection)
1482+ if (rtmList.Deleted == 0 && rtmList.Smart == 0)
1483+ lists.Add (new RTMListItem (rtmList.ID, rtmList.Name, rtmList.Locked, rtmList.Smart));
1484+ }
1485+ Log<RTM>.Debug ("Received {0} lists.", lists.ToArray ().Length);
1486+ }
1487+
1488+ /// <summary>
1489+ /// Retrieves the list of locations as <see cref="RTMLocationItem"/>s from the RTM server.
1490+ /// </summary>
1491+ public static void UpdateLocations ()
1492+ {
1493+ lock (location_lock) {
1494+ if (!IsAuthenticated)
1495+ if (!TryConnect ())
1496+ return;
1497+
1498+ Locations rtmLocations;
1499+ try {
1500+ rtmLocations = rtm.LocationsGetList ();
1501+ } catch (RtmException e) {
1502+ Log<RTM>.Debug (Catalog.GetString ("An error happend when updating RTM locations: {0}"), e.Message);
1503+ rtmLocations = null;
1504+ return;
1505+ }
1506+
1507+ locations.Clear ();
1508+ if (rtmLocations.locationCollection.Length > 0) {
1509+ foreach (Location rtmLocation in rtmLocations.locationCollection) {
1510+ locations.Add (new RTMLocationItem (rtmLocation.ID,
1511+ rtmLocation.Name,
1512+ rtmLocation.Address,
1513+ rtmLocation.Longitude,
1514+ rtmLocation.Latitude));
1515+ }
1516+ }
1517+ }
1518+ Log<RTM>.Debug ("Received {0} locations.", locations.ToArray ().Length);
1519+ }
1520+
1521+ /// <summary>
1522+ /// Updates the list of tasks as <see cref="RTMTaskItem"/>s from the RTM server.
1523+ /// Also collects all the notes and tags during the update.
1524+ /// </summary>
1525+ public static void UpdateTasks ()
1526+ {
1527+ lock (task_lock) {
1528+ if (!IsAuthenticated)
1529+ if (!TryConnect ())
1530+ return;
1531+
1532+ Tasks rtmTasks;
1533+ Tasks rtmTasks_sync;
1534+
1535+ if (last_sync == DateTime.MinValue) {
1536+ tasks.Clear ();
1537+ tags.Clear ();
1538+ notes.Clear ();
1539+ }
1540+
1541+ try {
1542+ // If first time sync, get full list of tasks restricted by filter
1543+ // otherwise, only do incremental sync.
1544+ if (last_sync == DateTime.MinValue) {
1545+ rtmTasks = rtm.TasksGetList (null, null, filter);
1546+ rtmTasks_sync = null;
1547+ } else {
1548+ rtmTasks_sync = rtm.TasksGetList (null, last_sync.ToUniversalTime ().ToString ("u"), null);
1549+ rtmTasks = rtm.TasksGetList (null, last_sync.ToUniversalTime ().ToString ("u"), filter);
1550+ }
1551+ } catch (RtmException e) {
1552+ rtmTasks = null;
1553+ rtmTasks_sync = null;
1554+ last_sync = DateTime.MinValue;
1555+ Log<RTM>.Debug (Catalog.GetString ("An error occured when updating RTM tasks: {0}"),
1556+ e.Message);
1557+ return;
1558+ }
1559+
1560+ // if not first time sync, delete all changed tasks (using the list with nothing filtered)
1561+ if (last_sync != DateTime.MinValue) {
1562+ foreach (List rtmList in rtmTasks_sync.ListCollection) {
1563+ if (rtmList.DeletedTaskSeries != null)
1564+ foreach (TaskSeries rtmTaskSeries in rtmList.DeletedTaskSeries.TaskSeriesCollection)
1565+ foreach (Task rtmTask in rtmTaskSeries.TaskCollection)
1566+ TryRemoveTask (rtmTask.TaskID);
1567+
1568+ if (rtmList.TaskSeriesCollection.Any ()) {
1569+ foreach (TaskSeries rtmTaskSeries in rtmList.TaskSeriesCollection) {
1570+ foreach (Task rtmTask in rtmTaskSeries.TaskCollection) {
1571+ TryRemoveTask (rtmTask.TaskID);
1572+ }
1573+ }
1574+ }
1575+ }
1576+ }
1577+
1578+ // add changed tasks from the list with filter used.
1579+ foreach (List rtmList in rtmTasks.ListCollection) {
1580+ if (rtmList.TaskSeriesCollection.Any ()) {
1581+ foreach (TaskSeries rtmTaskSeries in rtmList.TaskSeriesCollection) {
1582+ foreach (Task rtmTask in rtmTaskSeries.TaskCollection) {
1583+ // delete one recurrent task will cause other deleted instances
1584+ // appear in the taskseries tag, so here we need to check again.
1585+ if (rtmTask.Deleted == DateTime.MinValue) {
1586+ // handle tags
1587+ string temp_tags = "";
1588+ if (rtmTaskSeries.Tags.TagCollection.Length > 0) {
1589+ foreach (Tag rtmTag in rtmTaskSeries.Tags.TagCollection) {
1590+ if (tags.FindIndex (i => (i as RTMTagItem).Name == rtmTag.Text) == -1)
1591+ tags.Add (new RTMTagItem (rtmTag.Text));
1592+ temp_tags += rtmTag.Text + ", ";
1593+ }
1594+ temp_tags = temp_tags.Remove (temp_tags.Length-2);
1595+ }
1596+
1597+ // handle notes
1598+ if (rtmTaskSeries.Notes.NoteCollection.Length > 0) {
1599+ foreach (Note rtmNote in rtmTaskSeries.Notes.NoteCollection)
1600+ notes.Add (new RTMNoteItem (rtmNote.Title, rtmNote.Text, rtmNote.ID,
1601+ "http://www.rememberthemil.com/print/"
1602+ + username + "/"
1603+ + rtmList.ID + "/"
1604+ + rtmTask.TaskID
1605+ + "/notes/",
1606+ rtmTask.TaskID));
1607+ }
1608+
1609+ // add new task
1610+ RTMTaskItem new_task = new RTMTaskItem (rtmList.ID,
1611+ rtmTaskSeries.TaskSeriesID,
1612+ rtmTask.TaskID,
1613+ rtmTaskSeries.Name,
1614+ rtmTask.Due,
1615+ rtmTask.Completed,
1616+ rtmTaskSeries.TaskURL,
1617+ rtmTask.Priority,
1618+ rtmTask.HasDueTime,
1619+ rtmTask.Estimate,
1620+ rtmTaskSeries.LocationID,
1621+ temp_tags);
1622+ tasks.Add (new_task);
1623+ }
1624+ }
1625+ }
1626+ }
1627+ }
1628+ last_sync = DateTime.Now;
1629+ }
1630+
1631+ Log<RTM>.Debug ("Received {0} tasks.", tasks.ToArray ().Length);
1632+ Log<RTM>.Debug ("Received {0} notes.", notes.ToArray ().Length);
1633+ Log<RTM>.Debug ("Received {0} tags.", tags.ToArray ().Length);
1634+ }
1635+
1636+ /// <summary>
1637+ /// Manully generates a list containing all the <see cref="RTMPrioirtyItem"/>s.
1638+ /// </summary>
1639+ static void UpdatePriorities ()
1640+ {
1641+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("High"),
1642+ Catalog.GetString ("High Priority")));
1643+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("Medium"),
1644+ Catalog.GetString ("Medium Priority")));
1645+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("Low"),
1646+ Catalog.GetString ("Low Priority")));
1647+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("None"),
1648+ Catalog.GetString ("No Priority")));
1649+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("Up"),
1650+ Catalog.GetString ("Increase the priority")));
1651+ priorities.Add (new RTMPriorityItem (Catalog.GetString ("Down"),
1652+ Catalog.GetString ("Decrease the priority")));
1653+ }
1654+
1655+ #endregion [ Methods for Data Update ]
1656+
1657+ #region [ Task Actions ]
1658+
1659+ public static RTMTaskItem NewTask (string listId, string taskData)
1660+ {
1661+ List rtmList;
1662+ bool parse = true;
1663+ string priority = "N";
1664+
1665 // Task string starting with "@" won't be parsed for date/time information
1666 if (taskData.StartsWith ("@")) {
1667- taskData = taskData.Remove (0, 1).Trim ();
1668- parse = false;
1669- }
1670-
1671+ taskData = taskData.Remove (0, 1).Trim ();
1672+ parse = false;
1673+ }
1674+
1675 // Task string starting with "![123]" contains priority information
1676 if (Regex.IsMatch (taskData, @"^![123]\s")) {
1677- priority = taskData.Substring (1,1);
1678- taskData = taskData.Remove (0, 3);
1679- }
1680-
1681- try {
1682- rtmList = rtm.TasksAdd (timeline, taskData, listId, parse);
1683- } catch (RtmException e) {
1684- Console.Error.WriteLine (e.Message);
1685- return null;
1686- }
1687-
1688-
1689- if (priority != "N") {
1690- try {
1691- rtm.TasksSetPriority (timeline, rtmList.ID,
1692+ priority = taskData.Substring (1,1);
1693+ taskData = taskData.Remove (0, 3);
1694+ }
1695+
1696+ try {
1697+ rtmList = rtm.TasksAdd (timeline, taskData, listId, parse);
1698+ } catch (RtmException e) {
1699+ Log<RTM>.Debug (e.Message);
1700+ return null;
1701+ }
1702+
1703+
1704+ if (priority != "N") {
1705+ try {
1706+ rtm.TasksSetPriority (timeline, rtmList.ID,
1707 rtmList.TaskSeriesCollection[0].TaskSeriesID,
1708- rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskID,
1709+ rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskID,
1710 priority);
1711- } catch (RtmException e) {
1712- Console.Error.WriteLine (e.Message);
1713- }
1714- }
1715-
1716- UpdateTasks ();
1717- return new RTMTaskItem (rtmList.ID, rtmList.TaskSeriesCollection[0].TaskSeriesID,
1718- rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskID,
1719- rtmList.TaskSeriesCollection[0].Name,
1720- rtmList.TaskSeriesCollection[0].TaskCollection[0].Due,
1721- rtmList.TaskSeriesCollection[0].TaskCollection[0].Completed,
1722- rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskURL,
1723- priority,
1724- rtmList.TaskSeriesCollection[0].TaskCollection[0].HasDueTime);
1725- }
1726-
1727- public static void DeleteTask (string listId, string taskSeriesId, string taskId)
1728- {
1729- try {
1730- rtm.TasksDelete (timeline, listId, taskSeriesId, taskId);
1731- } catch (RtmException e) {
1732- Console.Error.WriteLine (e.Message);
1733- return;
1734- }
1735-
1736- ActionRoutine (Catalog.GetString ("Task Deleted"),
1737- Catalog.GetString ("The selected task has been successfully deleted"
1738- +" from your Remember The Milk task list"),
1739- null, null);
1740- }
1741-
1742- public static void CompleteTask (string listId, string taskSeriesId, string taskId)
1743- {
1744- try {
1745- rtm.TasksComplete (timeline, listId, taskSeriesId, taskId);
1746- } catch (RtmException e) {
1747- Console.Error.WriteLine (e.Message);
1748- return;
1749- }
1750-
1751- ActionRoutine (Catalog.GetString ("Task Completed"),
1752- Catalog.GetString ("The selected task in your Remember The Milk"
1753- +" task list has been marked as completed."),
1754- taskId, listId);
1755- }
1756-
1757- public static List<Item> GeneratePriorities ()
1758- {
1759- List<Item> priorities = new List<Item> ();
1760- priorities.Add (new RTMPriorityItem (Catalog.GetString ("High"),
1761- Catalog.GetString ("High Priority")));
1762- priorities.Add (new RTMPriorityItem (Catalog.GetString ("Medium"),
1763- Catalog.GetString ("Medium Priority")));
1764- priorities.Add (new RTMPriorityItem (Catalog.GetString ("Low"),
1765- Catalog.GetString ("Low Priority")));
1766- priorities.Add (new RTMPriorityItem (Catalog.GetString ("None"),
1767- Catalog.GetString ("No Priority")));
1768- priorities.Add (new RTMPriorityItem (Catalog.GetString ("Up"),
1769- Catalog.GetString ("Increase the priority")));
1770- priorities.Add (new RTMPriorityItem (Catalog.GetString ("Down"),
1771- Catalog.GetString ("Decrease the priority")));
1772- return priorities;
1773- }
1774-
1775- public static void SetTaskPriority (string listId, string taskSeriesId, string taskId, string priority)
1776- {
1777- try {
1778- if (priority == "up" || priority == "down")
1779- rtm.TasksMovePriority (timeline, listId, taskSeriesId, taskId, priority);
1780- else
1781- rtm.TasksSetPriority (timeline, listId, taskSeriesId, taskId, priority);
1782- } catch (RtmException e) {
1783- Console.Error.WriteLine (e.Message);
1784- return;
1785- }
1786-
1787- ActionRoutine (Catalog.GetString ("Priority Changed"),
1788- Catalog.GetString ("The priority of the selected task in your"
1789- +" Remember The Milk task list has been changed."),
1790- taskId, listId);
1791- }
1792-
1793- public static void SetDueDateTime (string listId, string taskSeriesId, string taskId, string due)
1794- {
1795- try {
1796- if (String.IsNullOrEmpty (due))
1797+ } catch (RtmException e) {
1798+ Log<RTM>.Debug (e.Message);
1799+ }
1800+ }
1801+
1802+ FinalizeAction (Catalog.GetString ("New Task Created"),
1803+ Catalog.GetString ("The task has been successully added to your"
1804+ + "Remember The milk task list."));
1805+
1806+ return new RTMTaskItem (rtmList.ID, rtmList.TaskSeriesCollection[0].TaskSeriesID,
1807+ rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskID,
1808+ rtmList.TaskSeriesCollection[0].Name,
1809+ rtmList.TaskSeriesCollection[0].TaskCollection[0].Due,
1810+ rtmList.TaskSeriesCollection[0].TaskCollection[0].Completed,
1811+ rtmList.TaskSeriesCollection[0].TaskURL,
1812+ priority,
1813+ rtmList.TaskSeriesCollection[0].TaskCollection[0].HasDueTime,
1814+ rtmList.TaskSeriesCollection[0].TaskCollection[0].Estimate,
1815+ rtmList.TaskSeriesCollection[0].LocationID, "");
1816+ }
1817+
1818+ public static void DeleteTask (string listId, string taskSeriesId, string taskId)
1819+ {
1820+ try {
1821+ rtm.TasksDelete (timeline, listId, taskSeriesId, taskId);
1822+ } catch (RtmException e) {
1823+ Log<RTM>.Debug (e.Message);
1824+ return;
1825+ }
1826+
1827+ FinalizeAction (Catalog.GetString ("Task Deleted"),
1828+ Catalog.GetString ("The selected task has been successfully deleted"
1829+ +" from your Remember The Milk task list"));
1830+ }
1831+
1832+ public static void CompleteTask (string listId, string taskSeriesId, string taskId)
1833+ {
1834+ try {
1835+ rtm.TasksComplete (timeline, listId, taskSeriesId, taskId);
1836+ } catch (RtmException e) {
1837+ Log<RTM>.Debug (e.Message);
1838+ return;
1839+ }
1840+
1841+ FinalizeAction (Catalog.GetString ("Task Completed"),
1842+ Catalog.GetString ("The selected task in your Remember The Milk"
1843+ +" task list has been marked as completed."));
1844+ }
1845+
1846+ public static void SetTaskPriority (string listId, string taskSeriesId, string taskId, string priority)
1847+ {
1848+ try {
1849+ if (priority == "up" || priority == "down")
1850+ rtm.TasksMovePriority (timeline, listId, taskSeriesId, taskId, priority);
1851+ else
1852+ rtm.TasksSetPriority (timeline, listId, taskSeriesId, taskId, priority);
1853+ } catch (RtmException e) {
1854+ Log<RTM>.Debug (e.Message);
1855+ return;
1856+ }
1857+
1858+ FinalizeAction (Catalog.GetString ("Priority Changed"),
1859+ Catalog.GetString ("The priority of the selected task in your"
1860+ +" Remember The Milk task list has been changed."));
1861+ }
1862+
1863+ public static void SetDueDateTime (string listId, string taskSeriesId, string taskId, string due)
1864+ {
1865+ try {
1866+ if (String.IsNullOrEmpty (due))
1867 rtm.TasksSetDueDate (timeline, listId, taskSeriesId, taskId);
1868 else
1869 rtm.TasksSetDueDateParse (timeline, listId, taskSeriesId, taskId, due);
1870- } catch (RtmException e) {
1871- Console.Error.WriteLine (e.Message);
1872- return;
1873- }
1874-
1875- ActionRoutine (Catalog.GetString ("Due Date/Time Changed"),
1876- Catalog.GetString ("The due date/time of the selected task in your "
1877- +"Remember The Milk task list has been changed."),
1878- taskId, listId);
1879- }
1880-
1881- public static void MoveTask (string fromListId, string toListId, string taskSeriesId, string taskId)
1882- {
1883- try {
1884- rtm.TasksMoveTo (timeline, fromListId, toListId, taskSeriesId, taskId);
1885- } catch (RtmException e) {
1886- Console.Error.WriteLine (e.Message);
1887- return;
1888- }
1889-
1890- ActionRoutine (Catalog.GetString ("Task Moved"),
1891- Catalog.GetString (String.Format ("The selected task has been moved from"
1892- + " Remember The Milk list \"{0}\" to list \"{1}\".",
1893- lists [fromListId].Name, lists [toListId].Name)),
1894- taskId, fromListId);
1895- }
1896-
1897- public static void RenameTask (string listId, string taskSeriesId, string taskId, string newName)
1898- {
1899- try {
1900- rtm.TasksSetName (timeline, listId, taskSeriesId, taskId, newName);
1901- } catch (RtmException e) {
1902- Console.Error.WriteLine (e.Message);
1903- return;
1904- }
1905-
1906- ActionRoutine (Catalog.GetString ("Task Renamed"),
1907- Catalog.GetString (String.Format ("The selected task has"
1908- + " been renamed to \"{0}\".", newName)),
1909- taskId, listId);
1910- }
1911-
1912- public static void PostponeTask (string listId, string taskSeriesId, string taskId)
1913- {
1914- try {
1915- rtm.TasksPostpone (timeline, listId, taskSeriesId, taskId);
1916- } catch (RtmException e) {
1917- Console.Error.WriteLine (e.Message);
1918- return;
1919- }
1920-
1921- ActionRoutine (Catalog.GetString ("Task Postponed"),
1922- Catalog.GetString ("The selected task in your Remember The Milk task"
1923- + " list has been postponed"),
1924- taskId, listId);
1925- }
1926-
1927- public static void SetRecurrence (string listId, string taskSeriesId, string taskId, string repeat)
1928- {
1929+ } catch (RtmException e) {
1930+ Log<RTM>.Debug (e.Message);
1931+ return;
1932+ }
1933+
1934+ if (String.IsNullOrEmpty (due))
1935+ FinalizeAction (Catalog.GetString ("Due Date/Time Unset"),
1936+ Catalog.GetString ("The due date/time of the selected task in your "
1937+ +"Remember The Milk task list has been unset."));
1938+ else
1939+ FinalizeAction (Catalog.GetString ("Due Date/Time Changed"),
1940+ Catalog.GetString ("The due date/time of the selected task in your "
1941+ +"Remember The Milk task list has been changed."));
1942+ }
1943+
1944+ public static void MoveTask (string fromListId, string toListId, string taskSeriesId, string taskId)
1945+ {
1946+ try {
1947+ rtm.TasksMoveTo (timeline, fromListId, toListId, taskSeriesId, taskId);
1948+ } catch (RtmException e) {
1949+ Log<RTM>.Debug (e.Message);
1950+ return;
1951+ }
1952+
1953+ FinalizeAction (Catalog.GetString ("Task Moved"),
1954+ Catalog.GetString (String.Format ("The selected task has been moved from"
1955+ + " Remember The Milk list \"{0}\" to list \"{1}\".",
1956+ lists.Find (i => (i as RTMListItem).Id == fromListId).Name,
1957+ lists.Find (i => (i as RTMListItem).Id == toListId).Name)));
1958+ }
1959+
1960+ public static void RenameTask (string listId, string taskSeriesId, string taskId, string newName)
1961+ {
1962+ try {
1963+ rtm.TasksSetName (timeline, listId, taskSeriesId, taskId, newName);
1964+ } catch (RtmException e) {
1965+ Log<RTM>.Debug (e.Message);
1966+ return;
1967+ }
1968+
1969+ FinalizeAction (Catalog.GetString ("Task Renamed"),
1970+ Catalog.GetString (String.Format ("The selected task has"
1971+ + " been renamed to \"{0}\".", newName)));
1972+ }
1973+
1974+ public static void PostponeTask (string listId, string taskSeriesId, string taskId)
1975+ {
1976+ try {
1977+ rtm.TasksPostpone (timeline, listId, taskSeriesId, taskId);
1978+ } catch (RtmException e) {
1979+ Log<RTM>.Debug (e.Message);
1980+ return;
1981+ }
1982+
1983+ FinalizeAction (Catalog.GetString ("Task Postponed"),
1984+ Catalog.GetString ("The selected task in your Remember The Milk task"
1985+ + " list has been postponed"));
1986+ }
1987+
1988+ public static void SetRecurrence (string listId, string taskSeriesId, string taskId, string repeat)
1989+ {
1990 try {
1991 rtm.TasksSetRecurrence (timeline, listId, taskSeriesId, taskId, repeat);
1992- } catch (RtmException e) {
1993- Console.Error.WriteLine (e.Message);
1994- return;
1995- }
1996-
1997- ActionRoutine (Catalog.GetString ("Recurrence Pattern Changed"),
1998- Catalog.GetString ("The recurrence pattern of the selected task in your"
1999- + " Remember The Milk task list has been changed."),
2000- taskId, listId);
2001- }
2002-
2003- public static void SetURL(string listId, string taskSeriesId, string taskId, string url)
2004- {
2005- try {
2006- rtm.TasksSetUrl(timeline, listId, taskSeriesId, taskId, url);
2007- } catch (RtmException e) {
2008- Console.Error.WriteLine (e.Message);
2009+ } catch (RtmException e) {
2010+ Log<RTM>.Debug (e.Message);
2011 return;
2012 }
2013+
2014+ FinalizeAction (Catalog.GetString ("Recurrence Pattern Changed"),
2015+ Catalog.GetString ("The recurrence pattern of the selected task in your"
2016+ + " Remember The Milk task list has been changed."));
2017+ }
2018
2019+ public static void SetURL(string listId, string taskSeriesId, string taskId, string url)
2020+ {
2021+ try {
2022+ rtm.TasksSetUrl(timeline, listId, taskSeriesId, taskId, url);
2023+ } catch (RtmException e) {
2024+ Log<RTM>.Debug (e.Message);
2025+ return;
2026+ }
2027+
2028 if (!string.IsNullOrEmpty(url)) {
2029- ActionRoutine (Catalog.GetString ("Task URL Set"),
2030- Catalog.GetString ("The selected task has been assigned a URL."),
2031- taskId, listId);
2032- } else {
2033- ActionRoutine (Catalog.GetString ("Task URL Reset"),
2034- Catalog.GetString ("The URL for the selected task has been reset."),
2035- taskId, listId);
2036- }
2037- }
2038+ FinalizeAction (Catalog.GetString ("Task URL Set"),
2039+ Catalog.GetString ("The selected task has been assigned a URL."));
2040+ } else {
2041+ FinalizeAction (Catalog.GetString ("Task URL Reset"),
2042+ Catalog.GetString ("The URL for the selected task has been reset."));
2043+ }
2044+ }
2045+
2046+ public static void SetEstimateTime (string listId, string taskSeriesId, string taskId, string estimateTime)
2047+ {
2048+ try {
2049+ rtm.TasksSetEstimateTime(timeline, listId, taskSeriesId,
2050+ taskId, estimateTime);
2051+ } catch (RtmException e) {
2052+ Log<RTM>.Debug (e.Message);
2053+ return;
2054+ }
2055+
2056+ if (String.IsNullOrEmpty(estimateTime))
2057+ FinalizeAction (Catalog.GetString ("Task Estimated Time Unset"),
2058+ Catalog.GetString ("The estimated time for the selected task has been unset."));
2059+ else
2060+ FinalizeAction (Catalog.GetString ("Task Estimated Time Set"),
2061+ Catalog.GetString ("The selected task has been assigned an estimated time."));
2062+ }
2063+
2064+ public static void SetLocation (string listId, string taskSeriesId, string taskId, string locationId)
2065+ {
2066+ try {
2067+ rtm.TasksSetLocation (timeline, listId, taskSeriesId, taskId, locationId);
2068+ } catch (RtmException e) {
2069+ Log<RTM>.Debug (e.Message);
2070+ return;
2071+ }
2072+
2073+ if (string.IsNullOrEmpty (locationId)) {
2074+ FinalizeAction (Catalog.GetString ("Location Reset"),
2075+ Catalog.GetString ("The location of the selected task has been cleared."));
2076+ } else {
2077+ FinalizeAction (Catalog.GetString ("Location changed"),
2078+ Catalog.GetString ("The location of the selected task has been successfully changed."));
2079+ }
2080+
2081+ }
2082
2083 public static void UncompleteTask (string listId, string taskSeriesId, string taskId)
2084 {
2085 try {
2086 rtm.TasksUncomplete (timeline, listId, taskSeriesId, taskId);
2087 } catch (RtmException e) {
2088- Console.Error.WriteLine (e.Message);
2089- return;
2090- }
2091-
2092- ActionRoutine (Catalog.GetString ("Task Uncompleted"),
2093- Catalog.GetString ("The selected task has been marked as \"incomplete\"."),
2094- taskId, listId);
2095- }
2096- }
2097+ Log<RTM>.Debug (e.Message);
2098+ return;
2099+ }
2100+
2101+ FinalizeAction (Catalog.GetString ("Task Uncompleted"),
2102+ Catalog.GetString ("The selected task has been marked as \"incomplete\"."));
2103+ }
2104+
2105+ #endregion [ Task Actions ]
2106+
2107+ #region [ List Actions ]
2108+
2109+ public static void NewList(string newListName)
2110+ {
2111+ if (IsProtectedList (newListName)) {
2112+ Services.Notifications.Notify ("Invalid List Name", "The provided new list name is reserved.",
2113+ RTMIconPath);
2114+ return;
2115+ }
2116+
2117+ try {
2118+ rtm.ListsNew(timeline, newListName);
2119+ } catch (RtmException e) {
2120+ Log<RTM>.Debug (e.Message);
2121+ return;
2122+ }
2123+
2124+ FinalizeAction (Catalog.GetString ("New List Created"),
2125+ Catalog.GetString (String.Format ("A new task list named \"{0}\" has been created.", newListName)));
2126+ }
2127+
2128+ public static void DeleteList(string listId)
2129+ {
2130+ try {
2131+ rtm.ListsDelete(timeline, listId);
2132+ } catch (RtmException e) {
2133+ Log<RTM>.Debug (e.Message);
2134+ return;
2135+ }
2136+
2137+ FinalizeAction (Catalog.GetString("List Deleted"),
2138+ Catalog.GetString("The selected task list has been deleted."));
2139+ }
2140+
2141+ public static void RenameList(string listId, string newListName)
2142+ {
2143+ if (IsProtectedList (newListName)) {
2144+ Services.Notifications.Notify ("Invalid List Name", "The provided new list name is reserved.",
2145+ RTMIconPath);
2146+ return;
2147+ }
2148+
2149+ try {
2150+ rtm.ListsRename(timeline, listId, newListName);
2151+ } catch (RtmException e) {
2152+ Log<RTM>.Debug (e.Message);
2153+ return;
2154+ }
2155+ FinalizeAction (Catalog.GetString("Task List Renamed"),
2156+ Catalog.GetString(String.Format ("The selected task"
2157+ + " list has been renamed to \"{0}\".", newListName)));
2158+ }
2159+
2160+ #endregion [ List Actions ]
2161+
2162+ #region [ Note Actions ]
2163+
2164+ public static void NewNote (string listId, string taskSeriesId, string taskId, string note)
2165+ {
2166+ string[] parts = null;
2167+ string note_title;
2168+ string note_body;
2169+ bool has_separator = (0 < note.IndexOf ("|") && note.IndexOf ("|") < note.Length);
2170+ bool has_newline = (0 < note.IndexOf ("\n") && note.IndexOf ("\n") < note.Length);
2171+ bool newline_first = note.IndexOf ("\n") < note.IndexOf ("|");
2172+
2173+
2174+ if ((has_newline && has_separator && newline_first) || (has_newline && !has_separator)) {
2175+ parts = note.Split(new char[] {'\n'}, 2);
2176+ } else if (has_separator) {
2177+ parts = note.Split(new char[] {'|'}, 2);
2178+ }
2179+
2180+ if (string.IsNullOrEmpty (note) || ((has_separator || has_newline) && parts != null && parts.Length < 2)) {
2181+ Log<RTM>.Debug ("Entered text cannot be used as a note.");
2182+ return;
2183+ } else {
2184+ note_title = (has_separator || has_newline) ? parts[0].Trim () : "Untitled Note";
2185+ note_body = (has_separator || has_newline) ? parts[1].Trim () : note;
2186+ }
2187+
2188+ try {
2189+ rtm.NotesAdd (timeline, listId, taskSeriesId, taskId, note_title, note_body);
2190+ } catch (RtmException e) {
2191+ Log<RTM>.Debug (e.Message);
2192+ return;
2193+ }
2194+
2195+ FinalizeAction (Catalog.GetString ("Note Added"),
2196+ Catalog.GetString ("A note has been added to the selected task"));
2197+ }
2198+
2199+ public static void DeleteNote (string noteId)
2200+ {
2201+ try {
2202+ rtm.NotesDelete (timeline, noteId);
2203+ } catch (RtmException e) {
2204+ Log<RTM>.Debug (e.Message);
2205+ return;
2206+ }
2207+
2208+ lock (note_lock)
2209+ notes.Remove (notes.Find (i => (i as RTMNoteItem).Id == noteId));
2210+
2211+ FinalizeAction (Catalog.GetString ("Note Deleted"),
2212+ Catalog.GetString ("The selected note has been deleted from the selected task"));
2213+ }
2214+
2215+ #endregion [ Note Actions ]
2216+
2217+ #region [ Tag Actions ]
2218+
2219+ public static void AddTags (string listId, string taskSeriesId, string taskId, string tags)
2220+ {
2221+ if (String.IsNullOrEmpty (tags)) {
2222+ Log<RTM>.Debug ("Tags to add is empty or null string.");
2223+ } else {
2224+ try {
2225+ rtm.TasksAddTags (timeline, listId, taskSeriesId, taskId, tags);
2226+ } catch (RtmException e) {
2227+ Log<RTM>.Debug (e.Message);
2228+ return;
2229+ }
2230+
2231+ FinalizeAction (Catalog.GetString ("Tags Added"),
2232+ Catalog.GetString ("New tags have been successfully added to the selected task."));
2233+ }
2234+ }
2235+
2236+ public static void DeleteTags (string listId, string taskSeriesId, string taskId, string tags)
2237+ {
2238+ if (String.IsNullOrEmpty (tags)) {
2239+ Log<RTM>.Debug ("[RememberTheMilk] Tags to delete is empty or null string.");
2240+ } else {
2241+ try {
2242+ rtm.TasksRemoveTags (timeline, listId, taskSeriesId, taskId, tags);
2243+ } catch (RtmException e) {
2244+ Log<RTM>.Debug (e.Message);
2245+ return;
2246+ }
2247+
2248+ FinalizeAction (Catalog.GetString ("Tags Deleted"),
2249+ Catalog.GetString ("Selected tags have been successfully removed from the selected task."));
2250+ }
2251+ }
2252+
2253+ #endregion [ Tag Actions ]
2254+
2255+ #region [ Utilities ]
2256+
2257+ /// <summary>
2258+ /// Initializes the connection to RTM server.
2259+ /// Verify the stored token with RTM server and if valid also creates the timeline.
2260+ /// </summary>
2261+ /// <returns>
2262+ /// A <see cref="System.Boolean"/>, true if the connection is successfully established,
2263+ /// false if there is a problem during verfication or timeline creation.
2264+ /// </returns>
2265+ static bool TryConnect ()
2266+ {
2267+ if (!String.IsNullOrEmpty (RTMPreferences.Token)) {
2268+ Auth auth;
2269+ try {
2270+ auth = rtm.AuthCheckToken (RTMPreferences.Token);
2271+ } catch (RtmException e) {
2272+ Log<RTM>.Error (Catalog.GetString ("Token verification failed."), e.Message);
2273+ return false;
2274+ }
2275+
2276+ rtm.AuthToken = auth.Token;
2277+ username = auth.User.Username;
2278+
2279+ try {
2280+ timeline = rtm.TimelineCreate ();
2281+ } catch (RtmException e) {
2282+ Log<RTM>.Error (Catalog.GetString ("Remember The Milk timeline creation failed."), e.Message);
2283+ return false;
2284+ }
2285+
2286+ return true;
2287+ } else {
2288+ Log<RTM>.Error (Catalog.GetString ("Not authorized to use a Remember The Milk account."));
2289+ return false;
2290+ }
2291+ }
2292+
2293+ /// <summary>
2294+ /// Try to remove a <see cref="RTMTaskItem"/> from the task list.
2295+ /// All <see cref="RTMNoteItem"/>s related to the task are also removed from the note list.
2296+ /// </summary>
2297+ /// <param name="taskId">
2298+ /// A <see cref="System.String"/> indicating the Id of the task to be removed.
2299+ /// </param>
2300+ static void TryRemoveTask (string taskId)
2301+ {
2302+ lock (task_lock)
2303+ tasks.RemoveAll (i => (i as RTMTaskItem).Id == taskId);
2304+ lock (note_lock)
2305+ notes.RemoveAll (i => (i as RTMNoteItem).TaskId == taskId);
2306+ }
2307+
2308+ /// <summary>
2309+ /// Show a notification if there is any overdue task.
2310+ /// </summary>
2311+ static void NotifyOverdueTasks ()
2312+ {
2313+ List<Item> overdue_tasks;
2314+ object list_lock = new object ();
2315+ overdue_tasks = new List<Item> ();
2316+ lock (task_lock)
2317+ overdue_tasks = tasks.FindAll (i => IsOverdue (i as RTMTaskItem));
2318+
2319+ int len = overdue_tasks.ToArray ().Length;
2320+ if (len > 0) {
2321+ string title;
2322+ title = String.Format (Catalog.GetPluralString ("{0} Task Overdue",
2323+ "{0} Tasks Overdue", len), len);
2324+
2325+ string body = "";
2326+ lock (list_lock) {
2327+ foreach (Item item in overdue_tasks)
2328+ body += ("- " + (item as RTMTaskItem).Name +"\n");
2329+ }
2330+ Do.Platform.Services.Notifications.Notify (new Do.Platform.Notification( title, body, "task-overdue.png@" + typeof(RTMTaskItem).Assembly.FullName));
2331+ }
2332+ }
2333+
2334+ /// <summary>
2335+ /// Check if a task is overdue.
2336+ /// </summary>
2337+ /// <param name="item">
2338+ /// A <see cref="RTMTaskItem"/> indicating the task to be checked.
2339+ /// </param>
2340+ /// <returns>
2341+ /// Ignored
2342+ /// </returns>
2343+ static bool IsOverdue (RTMTaskItem item)
2344+ {
2345+ return (item.Completed == DateTime.MinValue &&
2346+ item.Due > DateTime.MinValue &&
2347+ ((item.HasDueTime == 1 && item.Due < DateTime.Now) ||
2348+ item.Due.Date < DateTime.Today));
2349+ }
2350+
2351+ /// <summary>
2352+ /// Check if a task is due today
2353+ /// </summary>
2354+ /// <param name="item">
2355+ /// A <see cref="RTMTaskItem"/> indicating the task to be checked
2356+ /// </param>
2357+ /// <returns>
2358+ /// Ignored
2359+ /// </returns>
2360+ static bool IsDueToday (RTMTaskItem item)
2361+ {
2362+ return (item.Completed == DateTime.MinValue &&
2363+ item.Due.Date == DateTime.Today);
2364+ }
2365+
2366+ /// <summary>
2367+ /// Check if a task is due tomorrow
2368+ /// </summary>
2369+ /// <param name="item">
2370+ /// A <see cref="RTMTaskItem"/> indicating the task to be checked
2371+ /// </param>
2372+ /// <returns>
2373+ /// Ignored
2374+ /// </returns>
2375+ static bool IsDueTomorrow (RTMTaskItem item)
2376+ {
2377+ return (item.Completed == DateTime.MinValue &&
2378+ item.Due.Date == DateTime.Today.AddDays (1.0));
2379+ }
2380+
2381+ /// <summary>
2382+ /// Check if a task is due in next 7 days.
2383+ /// </summary>
2384+ /// <param name="item">
2385+ /// A <see cref="RTMTaskItem"/> indicating the task to be checked.
2386+ /// </param>
2387+ /// <returns>
2388+ /// Ignored
2389+ /// </returns>
2390+ static bool IsDueInAWeek (RTMTaskItem item)
2391+ {
2392+ return (item.Completed == DateTime.MinValue &&
2393+ item.Due != DateTime.MinValue &&
2394+ item.Due.Date <= DateTime.Today.AddDays (6.0));
2395+ }
2396+
2397+ /// <summary>
2398+ /// Check if the give list name is protected from assigning to other list.
2399+ /// </summary>
2400+ /// <param name="listName">
2401+ /// A <see cref="System.String"/> indicating the list name to be checked .
2402+ /// </param>
2403+ /// <returns>
2404+ /// Ignored
2405+ /// </returns>
2406+ static bool IsProtectedList (string listName)
2407+ {
2408+ Item item = lists.Find (i => (i as RTMListItem).Name == listName);
2409+ if (item != null)
2410+ return (item as RTMListItem).Locked;
2411+
2412+ return false;
2413+ }
2414+
2415+ static void FinalizeAction (string title, string body,
2416+ bool updateTasks, bool updateLists, bool updateLocations)
2417+ {
2418+ if (RTMPreferences.ActionNotification) {
2419+ Do.Platform.Services.Notifications.Notify (new Do.Platform.Notification (title, body, RTMIconPath));
2420+ }
2421+
2422+ if (updateLists)
2423+ UpdateLists ();
2424+ if (updateTasks)
2425+ UpdateTasks ();
2426+ if (updateLocations)
2427+ UpdateLocations ();
2428+ }
2429+
2430+ static void FinalizeAction (string title, string body)
2431+ {
2432+ FinalizeAction (title, body, false, false, false);
2433+ }
2434+
2435+ /// <summary>
2436+ /// Reset the timer for notifying overdue task.
2437+ /// </summary>
2438+ static void ResetOverdueTimer ()
2439+ {
2440+ if (overdue_timer != 0)
2441+ GLib.Source.Remove (overdue_timer);
2442+ if (RTMPreferences.OverdueNotification)
2443+ overdue_timer = GLib.Timeout.Add ((uint) RTMPreferences.OverdueInterval * 60 * 1000,
2444+ () => { NotifyOverdueTasks (); return true; });
2445+ }
2446+
2447+ /// <summary>
2448+ /// Reset the <see cref="filter"/> to the current preference setting,
2449+ /// make sure we have 'status' defined in the string.
2450+ /// </summary>
2451+ static void ResetFilter ()
2452+ {
2453+ filter = RTMPreferences.Filter;
2454+
2455+ if (String.IsNullOrEmpty (filter))
2456+ filter = "status:incomplete";
2457+ else if (!filter.Contains ("status:"))
2458+ filter = "status:incomplete OR (" + filter + ")";
2459+ }
2460+
2461+ /// <summary>
2462+ /// Reset the last synchronization timestamp.
2463+ /// </summary>
2464+ static void ResetLastSync ()
2465+ {
2466+ last_sync = DateTime.MinValue;
2467+ }
2468+
2469+ #endregion [ Utilities ]
2470+
2471+ #region [ Event Handlers ]
2472+
2473+ /// <summary>
2474+ /// Handles when RTM account is changed
2475+ /// </summary>
2476+ /// <param name="sender">
2477+ /// Ignored
2478+ /// </param>
2479+ /// <param name="e">
2480+ /// Ignored
2481+ /// </param>
2482+ static void HandleAccountChanged (object sender, EventArgs e)
2483+ {
2484+ ResetLastSync ();
2485+ }
2486+
2487+ /// <summary>
2488+ /// Handles when Filter preference is changed.
2489+ /// </summary>
2490+ /// <param name="sender">
2491+ /// Ignored
2492+ /// </param>
2493+ /// <param name="e">
2494+ /// Ignored
2495+ /// </param>
2496+ static void HandleFilterChanged (object sender, EventArgs e)
2497+ {
2498+ ResetLastSync ();
2499+ ResetFilter ();
2500+ }
2501+
2502+ /// <summary>
2503+ /// Handles when overdue notification interval preference is changed.
2504+ /// </summary>
2505+ /// <param name="sender">
2506+ /// Ignored
2507+ /// </param>
2508+ /// <param name="e">
2509+ /// Ignored
2510+ /// </param>
2511+ static void HandleOverdueIntervalChanged (object sender, EventArgs e)
2512+ {
2513+ ResetOverdueTimer ();
2514+ }
2515+
2516+ /// <summary>
2517+ /// Handles when show overdue notification preference is changed.
2518+ /// </summary>
2519+ /// <param name="sender">
2520+ /// Ignored
2521+ /// </param>
2522+ /// <param name="e">
2523+ /// Ignored
2524+ /// </param>
2525+ static void HandleOverdueNotificationChanged (object sender, EventArgs e)
2526+ {
2527+ ResetOverdueTimer ();
2528+ }
2529+
2530+ /// <summary>
2531+ /// Handles when the <see cref="UniverseManger"/> is initialized.
2532+ /// </summary>
2533+ /// <param name="sender">
2534+ /// Ignored
2535+ /// </param>
2536+ /// <param name="e">
2537+ /// Ignored
2538+ /// </param>
2539+ static void HandleInitialized (object sender, EventArgs e)
2540+ {
2541+ Services.Core.UniverseInitialized -= HandleInitialized;
2542+ UpdatePriorities ();
2543+ ResetOverdueTimer ();
2544+ }
2545+
2546+ #endregion
2547+
2548+ }
2549 }
2550
2551=== added file 'RememberTheMilk/src/RTMAddTags.cs'
2552--- RememberTheMilk/src/RTMAddTags.cs 1970-01-01 00:00:00 +0000
2553+++ RememberTheMilk/src/RTMAddTags.cs 2009-06-03 23:38:02 +0000
2554@@ -0,0 +1,106 @@
2555+// RTMAddTags.cs
2556+//
2557+// Copyright (C) 2009 GNOME Do
2558+//
2559+// This program is free software: you can redistribute it and/or modify
2560+// it under the terms of the GNU General Public License as published by
2561+// the Free Software Foundation, either version 3 of the License, or
2562+// (at your option) any later version.
2563+//
2564+// This program is distributed in the hope that it will be useful,
2565+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2566+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2567+// GNU General Public License for more details.
2568+//
2569+// You should have received a copy of the GNU General Public License
2570+// along with this program. If not, see <http://www.gnu.org/licenses/>.
2571+//
2572+
2573+using System;
2574+using System.Linq;
2575+using System.Collections.Generic;
2576+using Mono.Unix;
2577+
2578+using Do.Universe;
2579+using Do.Platform;
2580+
2581+namespace RememberTheMilk
2582+{
2583+ /// <summary>
2584+ /// Class to provide the "Add Tag(s)" action
2585+ /// </summary>
2586+ public class RTMAddTags : Act
2587+ {
2588+ public override string Name {
2589+ get { return Catalog.GetString ("Add Tag(s)"); }
2590+ }
2591+
2592+ public override string Description {
2593+ get { return Catalog.GetString ("Add one or more tags to a task."); }
2594+ }
2595+
2596+ public override string Icon {
2597+ get { return "tag-add.png@" + GetType ().Assembly.FullName; }
2598+ }
2599+
2600+ public override IEnumerable<Type> SupportedItemTypes {
2601+ get {
2602+ yield return typeof (RTMTaskItem);
2603+ yield return typeof (RTMTaskAttributeItem);
2604+ }
2605+ }
2606+
2607+ public override IEnumerable<Type> SupportedModifierItemTypes {
2608+ get {
2609+ yield return typeof (ITextItem);
2610+ yield return typeof (RTMTagItem);
2611+ }
2612+ }
2613+
2614+ public override bool SupportsItem (Item item) {
2615+ if (item is RTMTaskItem)
2616+ return true;
2617+ else if (item is RTMTaskAttributeItem)
2618+ return (item as RTMTaskAttributeItem).Description == "Tags";
2619+ else
2620+ return false;
2621+ }
2622+
2623+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2624+ {
2625+ RTMTaskItem task = null;
2626+ List<string> temp_tags = new List<string> ();
2627+ string s = null;
2628+
2629+ if (items.Any()) {
2630+ if (items.First () is RTMTaskItem)
2631+ task = (items.First () as RTMTaskItem);
2632+ else if (items.First () is RTMTaskAttributeItem)
2633+ task = (items.First () as RTMTaskAttributeItem).Parent;
2634+ }
2635+
2636+ if (modifierItems.Any () && task != null) {
2637+ foreach (Item item in modifierItems) {
2638+ s = GetText (item);
2639+ if (!String.IsNullOrEmpty(s))
2640+ temp_tags.Add (s);
2641+ }
2642+
2643+ Services.Application.RunOnThread (() => {
2644+ RTM.AddTags ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
2645+ (items.First () as RTMTaskItem).Id, String.Join (",", temp_tags.ToArray ()));
2646+ });
2647+ }
2648+ yield break;
2649+ }
2650+
2651+ protected string GetText (Item item)
2652+ {
2653+ if (item is ITextItem)
2654+ return (item as ITextItem).Text;
2655+ if (item is RTMTagItem)
2656+ return (item as RTMTagItem).Name;
2657+ throw new Exception ("Inappropriate Item type.");
2658+ }
2659+ }
2660+}
2661\ No newline at end of file
2662
2663=== modified file 'RememberTheMilk/src/RTMCompleteTask.cs'
2664--- RememberTheMilk/src/RTMCompleteTask.cs 2009-02-01 14:58:00 +0000
2665+++ RememberTheMilk/src/RTMCompleteTask.cs 2009-06-03 23:38:02 +0000
2666@@ -1,21 +1,20 @@
2667-/* RTMCompleteTask.cs
2668- *
2669- * GNOME Do is the legal property of its developers. Please refer to the
2670- * COPYRIGHT file distributed with this source distribution.
2671- *
2672- * This program is free software: you can redistribute it and/or modify
2673- * it under the terms of the GNU General Public License as published by
2674- * the Free Software Foundation, either version 3 of the License, or
2675- * (at your option) any later version.
2676- *
2677- * This program is distributed in the hope that it will be useful,
2678- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2679- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2680- * GNU General Public License for more details.
2681- *
2682- * You should have received a copy of the GNU General Public License
2683- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2684- */
2685+// RTMCompleteTask.cs
2686+//
2687+// Copyright (C) 2009 GNOME Do
2688+//
2689+// This program is free software: you can redistribute it and/or modify
2690+// it under the terms of the GNU General Public License as published by
2691+// the Free Software Foundation, either version 3 of the License, or
2692+// (at your option) any later version.
2693+//
2694+// This program is distributed in the hope that it will be useful,
2695+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2696+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2697+// GNU General Public License for more details.
2698+//
2699+// You should have received a copy of the GNU General Public License
2700+// along with this program. If not, see <http://www.gnu.org/licenses/>.
2701+//
2702
2703 using System;
2704 using System.Linq;
2705@@ -27,42 +26,39 @@
2706
2707 namespace RememberTheMilk
2708 {
2709-
2710-
2711+ /// <summary>
2712+ /// Class to provide the "Complete Task" action.
2713+ /// </summary>
2714 public class RTMCompleteTask : Act
2715 {
2716 public override string Name {
2717 get { return Catalog.GetString ("Complete"); }
2718- }
2719-
2720+ }
2721+
2722 public override string Description {
2723- get { return Catalog.GetString ("Complete a selected task"); }
2724- }
2725-
2726+ get { return Catalog.GetString ("Complete a task"); }
2727+ }
2728+
2729 public override string Icon {
2730 get { return "task-complete.png@" + GetType ().Assembly.FullName; }
2731 }
2732
2733 public override IEnumerable<Type> SupportedItemTypes {
2734- get {
2735- return new Type[] {
2736- typeof (RTMTaskItem),
2737- };
2738- }
2739- }
2740-
2741- public override bool SupportsItem (Item item)
2742- {
2743- return (item as RTMTaskItem).Completed == DateTime.MinValue;
2744- }
2745-
2746- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2747- {
2748+ get { yield return typeof (RTMTaskItem); }
2749+ }
2750+
2751+ public override bool SupportsItem (Item item)
2752+ {
2753+ return (item as RTMTaskItem).Completed == DateTime.MinValue;
2754+ }
2755+
2756+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2757+ {
2758 Services.Application.RunOnThread (() => {
2759 RTM.CompleteTask ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
2760 (items.First () as RTMTaskItem).Id);
2761 });
2762- yield break;
2763- }
2764+ yield break;
2765+ }
2766 }
2767 }
2768
2769=== added file 'RememberTheMilk/src/RTMDeleteList.cs'
2770--- RememberTheMilk/src/RTMDeleteList.cs 1970-01-01 00:00:00 +0000
2771+++ RememberTheMilk/src/RTMDeleteList.cs 2009-06-03 23:38:02 +0000
2772@@ -0,0 +1,66 @@
2773+// RTMDeleteList.cs
2774+//
2775+// Copyright (C) 2009 GNOME Do
2776+//
2777+// This program is free software: you can redistribute it and/or modify
2778+// it under the terms of the GNU General Public License as published by
2779+// the Free Software Foundation, either version 3 of the License, or
2780+// (at your option) any later version.
2781+//
2782+// This program is distributed in the hope that it will be useful,
2783+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2784+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2785+// GNU General Public License for more details.
2786+//
2787+// You should have received a copy of the GNU General Public License
2788+// along with this program. If not, see <http://www.gnu.org/licenses/>.
2789+//
2790+
2791+using System;
2792+using System.Linq;
2793+using System.Collections.Generic;
2794+using Mono.Unix;
2795+
2796+using Do.Universe;
2797+using Do.Platform;
2798+
2799+namespace RememberTheMilk
2800+{
2801+ /// <summary>
2802+ /// Class to provide the "Delete List" action.
2803+ /// </summary>
2804+ public class RTMDeleteList : Act
2805+ {
2806+ public override string Name {
2807+ get { return Catalog.GetString ("Delete List"); }
2808+ }
2809+
2810+ public override string Description {
2811+ get { return Catalog.GetString ("Delete a task list from Remember The Milk"); }
2812+ }
2813+
2814+ public override string Icon {
2815+ get { return "task-delete.png@" + GetType ().Assembly.FullName; }
2816+ }
2817+
2818+ public override IEnumerable<Type> SupportedItemTypes {
2819+ get { yield return typeof (RTMListItem); }
2820+ }
2821+
2822+ public override bool SupportsItem (Item item)
2823+ {
2824+ return !(item as RTMListItem).Locked;
2825+ }
2826+
2827+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2828+ {
2829+ string listname = (items.First () as RTMListItem).Id;
2830+
2831+ Services.Application.RunOnThread (() => {
2832+ RTM.DeleteList (listname);
2833+ });
2834+
2835+ yield break;
2836+ }
2837+ }
2838+}
2839
2840=== added file 'RememberTheMilk/src/RTMDeleteNote.cs'
2841--- RememberTheMilk/src/RTMDeleteNote.cs 1970-01-01 00:00:00 +0000
2842+++ RememberTheMilk/src/RTMDeleteNote.cs 2009-06-03 23:38:02 +0000
2843@@ -0,0 +1,60 @@
2844+// RTMDeleteNote.cs
2845+//
2846+// Copyright (C) 2009 GNOME Do
2847+//
2848+// This program is free software: you can redistribute it and/or modify
2849+// it under the terms of the GNU General Public License as published by
2850+// the Free Software Foundation, either version 3 of the License, or
2851+// (at your option) any later version.
2852+//
2853+// This program is distributed in the hope that it will be useful,
2854+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2855+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2856+// GNU General Public License for more details.
2857+//
2858+// You should have received a copy of the GNU General Public License
2859+// along with this program. If not, see <http://www.gnu.org/licenses/>.
2860+//
2861+
2862+using System;
2863+using System.Linq;
2864+using System.Collections.Generic;
2865+using Mono.Unix;
2866+
2867+using Do.Universe;
2868+using Do.Platform;
2869+
2870+namespace RememberTheMilk
2871+{
2872+ /// <summary>
2873+ /// Class to provide the "Delete Note" action.
2874+ /// </summary>
2875+ public class RTMDeleteNote : Act
2876+ {
2877+ public override string Name {
2878+ get { return Catalog.GetString ("Delete Note"); }
2879+ }
2880+
2881+ public override string Description {
2882+ get { return Catalog.GetString ("Detele the a note from a task."); }
2883+ }
2884+
2885+ public override string Icon {
2886+ get { return "note-delete.png@" + GetType ().Assembly.FullName; }
2887+ }
2888+
2889+ public override IEnumerable<Type> SupportedItemTypes {
2890+ get { yield return typeof (RTMNoteItem); }
2891+ }
2892+
2893+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2894+ {
2895+ if (items.Any())
2896+ Services.Application.RunOnThread (() => {
2897+ RTM.DeleteNote ((items.First () as RTMNoteItem).Id);
2898+ });
2899+
2900+ yield break;
2901+ }
2902+ }
2903+}
2904
2905=== added file 'RememberTheMilk/src/RTMDeleteTags.cs'
2906--- RememberTheMilk/src/RTMDeleteTags.cs 1970-01-01 00:00:00 +0000
2907+++ RememberTheMilk/src/RTMDeleteTags.cs 2009-06-03 23:38:02 +0000
2908@@ -0,0 +1,104 @@
2909+// RTMDeleteTags.cs
2910+//
2911+// Copyright (C) 2009 GNOME Do
2912+//
2913+// This program is free software: you can redistribute it and/or modify
2914+// it under the terms of the GNU General Public License as published by
2915+// the Free Software Foundation, either version 3 of the License, or
2916+// (at your option) any later version.
2917+//
2918+// This program is distributed in the hope that it will be useful,
2919+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2920+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2921+// GNU General Public License for more details.
2922+//
2923+// You should have received a copy of the GNU General Public License
2924+// along with this program. If not, see <http://www.gnu.org/licenses/>.
2925+//
2926+
2927+using System;
2928+using System.Linq;
2929+using System.Collections.Generic;
2930+using Mono.Unix;
2931+
2932+using Do.Universe;
2933+using Do.Platform;
2934+
2935+namespace RememberTheMilk
2936+{
2937+ /// <summary>
2938+ /// Class to provide the "Delete Tags" action.
2939+ /// </summary>
2940+ public class RTMDeleteTags : Act
2941+ {
2942+ public override string Name {
2943+ get { return Catalog.GetString ("Delete Tag(s)"); }
2944+ }
2945+
2946+ public override string Description {
2947+ get { return Catalog.GetString ("Detele one or more tags from a task."); }
2948+ }
2949+
2950+ public override string Icon {
2951+ get { return "tag-delete.png@" + GetType ().Assembly.FullName; }
2952+ }
2953+
2954+ public override IEnumerable<Type> SupportedItemTypes {
2955+ get {
2956+ yield return typeof (RTMTaskItem);
2957+ yield return typeof (RTMTaskAttributeItem);
2958+ }
2959+ }
2960+
2961+ public override IEnumerable<Type> SupportedModifierItemTypes {
2962+ get { yield return typeof (RTMTagItem); }
2963+ }
2964+
2965+ public override bool SupportsItem (Item item) {
2966+ if (item is RTMTaskItem)
2967+ return !String.IsNullOrEmpty ((item as RTMTaskItem).Tags);
2968+ else if (item is RTMTaskAttributeItem)
2969+ return (item as RTMTaskAttributeItem).Description == "Tags";
2970+ else
2971+ return false;
2972+ }
2973+
2974+ public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
2975+ {
2976+ string tagline = String.Empty;
2977+
2978+ if (item.First () is RTMTaskItem)
2979+ tagline = (item.First () as RTMTaskItem).Tags;
2980+ else if (item.First () is RTMTaskAttributeItem)
2981+ tagline = (item.First () as RTMTaskAttributeItem).Name;
2982+
2983+ List<string> tags = new List<string> (tagline.Split (new string[] {", "}, StringSplitOptions.None));
2984+
2985+ return tags.FindIndex (i => i == (modItem as RTMTagItem).Name) != -1;
2986+ }
2987+
2988+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
2989+ {
2990+ RTMTaskItem task = null;
2991+ List<string> temp_tags = new List<string> ();
2992+
2993+ if (items.Any()) {
2994+ if (items.First () is RTMTaskItem)
2995+ task = (items.First () as RTMTaskItem);
2996+ else if (items.First () is RTMTaskAttributeItem)
2997+ task = (items.First () as RTMTaskAttributeItem).Parent;
2998+ }
2999+
3000+ if (modifierItems.Any () && task != null) {
3001+ foreach (Item item in modifierItems)
3002+ temp_tags.Add ((item as RTMTagItem).Name);
3003+
3004+ Services.Application.RunOnThread (() => {
3005+ RTM.DeleteTags (task.ListId, task.TaskSeriesId,
3006+ task.Id, String.Join (",", temp_tags.ToArray ()));
3007+ });
3008+ }
3009+ yield break;
3010+ }
3011+ }
3012+}
3013
3014=== modified file 'RememberTheMilk/src/RTMDeleteTask.cs'
3015--- RememberTheMilk/src/RTMDeleteTask.cs 2009-02-01 14:58:00 +0000
3016+++ RememberTheMilk/src/RTMDeleteTask.cs 2009-06-03 23:38:02 +0000
3017@@ -1,21 +1,20 @@
3018-/* RTMDeleteTask.cs
3019- *
3020- * GNOME Do is the legal property of its developers. Please refer to the
3021- * COPYRIGHT file distributed with this source distribution.
3022- *
3023- * This program is free software: you can redistribute it and/or modify
3024- * it under the terms of the GNU General Public License as published by
3025- * the Free Software Foundation, either version 3 of the License, or
3026- * (at your option) any later version.
3027- *
3028- * This program is distributed in the hope that it will be useful,
3029- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3030- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3031- * GNU General Public License for more details.
3032- *
3033- * You should have received a copy of the GNU General Public License
3034- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3035- */
3036+// RTMDeleteTask.cs
3037+//
3038+// Copyright (C) 2009 GNOME Do
3039+//
3040+// This program is free software: you can redistribute it and/or modify
3041+// it under the terms of the GNU General Public License as published by
3042+// the Free Software Foundation, either version 3 of the License, or
3043+// (at your option) any later version.
3044+//
3045+// This program is distributed in the hope that it will be useful,
3046+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3047+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3048+// GNU General Public License for more details.
3049+//
3050+// You should have received a copy of the GNU General Public License
3051+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3052+//
3053
3054 using System;
3055 using System.Linq;
3056@@ -27,18 +26,19 @@
3057
3058 namespace RememberTheMilk
3059 {
3060-
3061-
3062+ /// <summary>
3063+ /// Class to provide the "Delete Task" action.
3064+ /// </summary>
3065 public class RTMDeleteTask : Act
3066 {
3067 public override string Name {
3068 get { return Catalog.GetString ("Delete"); }
3069 }
3070-
3071+
3072 public override string Description {
3073- get { return Catalog.GetString ("Delete a selected task from Remember The Milk"); }
3074- }
3075-
3076+ get { return Catalog.GetString ("Delete a task from Remember The Milk"); }
3077+ }
3078+
3079 public override string Icon {
3080 get { return "task-delete.png@" + GetType ().Assembly.FullName; }
3081 }
3082@@ -51,18 +51,18 @@
3083 }
3084 }
3085
3086- public override bool SupportsItem (Item item)
3087- {
3088- return true;
3089- }
3090-
3091- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3092- {
3093+ public override bool SupportsItem (Item item)
3094+ {
3095+ return true;
3096+ }
3097+
3098+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3099+ {
3100 Services.Application.RunOnThread (() => {
3101 RTM.DeleteTask ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
3102 (items.First () as RTMTaskItem).Id);
3103 });
3104- yield break;
3105- }
3106+ yield break;
3107+ }
3108 }
3109 }
3110
3111=== modified file 'RememberTheMilk/src/RTMListItem.cs'
3112--- RememberTheMilk/src/RTMListItem.cs 2009-01-08 08:11:01 +0000
3113+++ RememberTheMilk/src/RTMListItem.cs 2009-06-03 23:38:02 +0000
3114@@ -1,38 +1,43 @@
3115-/* RTMListItem.cs
3116- *
3117- * GNOME Do is the legal property of its developers. Please refer to the
3118- * COPYRIGHT file distributed with this source distribution.
3119- *
3120- * This program is free software: you can redistribute it and/or modify
3121- * it under the terms of the GNU General Public License as published by
3122- * the Free Software Foundation, either version 3 of the License, or
3123- * (at your option) any later version.
3124- *
3125- * This program is distributed in the hope that it will be useful,
3126- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3127- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3128- * GNU General Public License for more details.
3129- *
3130- * You should have received a copy of the GNU General Public License
3131- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3132- */
3133+// RTMListItem.cs
3134+//
3135+// Copyright (C) 2009 GNOME Do
3136+//
3137+// This program is free software: you can redistribute it and/or modify
3138+// it under the terms of the GNU General Public License as published by
3139+// the Free Software Foundation, either version 3 of the License, or
3140+// (at your option) any later version.
3141+//
3142+// This program is distributed in the hope that it will be useful,
3143+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3144+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3145+// GNU General Public License for more details.
3146+//
3147+// You should have received a copy of the GNU General Public License
3148+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3149+//
3150
3151 using System;
3152
3153-
3154 using Do.Universe;
3155
3156 namespace RememberTheMilk
3157-{
3158+{
3159+ /// <summary>
3160+ /// Item class for the the Remember The Milk list
3161+ /// </summary>
3162 public class RTMListItem : Item, IUrlItem
3163 {
3164- private string list_id;
3165- private string name;
3166-
3167- public RTMListItem (string listId, string name)
3168+ string list_id;
3169+ string name;
3170+ int locked;
3171+ int smart;
3172+
3173+ public RTMListItem (string listId, string name, int locked, int smart)
3174 {
3175 this.list_id = listId;
3176 this.name = name;
3177+ this.locked = locked;
3178+ this.smart = smart;
3179 }
3180
3181 public override string Name {
3182@@ -59,10 +64,18 @@
3183 public string Url {
3184 get {
3185 if (list_id == "All Tasks")
3186- return "http://www.rememberthemilk.com/home/" + RTM.Preferences.Username;
3187+ return "http://www.rememberthemilk.com/home/" + RTMPreferences.Username;
3188 else
3189- return "http://www.rememberthemilk.com/home/" + RTM.Preferences.Username + "/" + list_id;
3190+ return "http://www.rememberthemilk.com/home/" + RTMPreferences.Username + "/" + list_id;
3191 }
3192 }
3193+
3194+ public bool Locked {
3195+ get { return (locked == 1) ? true : false; }
3196+ }
3197+
3198+ public bool Smart {
3199+ get { return (smart == 1) ? true : false; }
3200+ }
3201 }
3202 }
3203
3204=== modified file 'RememberTheMilk/src/RTMListItemSource.cs'
3205--- RememberTheMilk/src/RTMListItemSource.cs 2009-01-08 03:33:27 +0000
3206+++ RememberTheMilk/src/RTMListItemSource.cs 2009-06-03 23:38:02 +0000
3207@@ -1,21 +1,20 @@
3208-/* RTMListItemSource.cs
3209- *
3210- * GNOME Do is the legal property of its developers. Please refer to the
3211- * COPYRIGHT file distributed with this source distribution.
3212- *
3213- * This program is free software: you can redistribute it and/or modify
3214- * it under the terms of the GNU General Public License as published by
3215- * the Free Software Foundation, either version 3 of the License, or
3216- * (at your option) any later version.
3217- *
3218- * This program is distributed in the hope that it will be useful,
3219- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3220- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3221- * GNU General Public License for more details.
3222- *
3223- * You should have received a copy of the GNU General Public License
3224- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3225- */
3226+// RTMListItemSource.cs
3227+//
3228+// Copyright (C) 2009 GNOME Do
3229+//
3230+// This program is free software: you can redistribute it and/or modify
3231+// it under the terms of the GNU General Public License as published by
3232+// the Free Software Foundation, either version 3 of the License, or
3233+// (at your option) any later version.
3234+//
3235+// This program is distributed in the hope that it will be useful,
3236+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3237+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3238+// GNU General Public License for more details.
3239+//
3240+// You should have received a copy of the GNU General Public License
3241+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3242+//
3243
3244 using System;
3245 using System.Collections.Generic;
3246@@ -25,11 +24,14 @@
3247 using Do.Universe;
3248
3249 namespace RememberTheMilk
3250-{
3251+{
3252+ /// <summary>
3253+ /// ItemSource class for the Remember The Milk lists
3254+ /// </summary>
3255 public class RTMListItemSource : ItemSource, IConfigurable
3256 {
3257 public override string Name {
3258- get { return "Remember The Milk Task Lists"; }
3259+ get { return "Remember The Milk Lists"; }
3260 }
3261
3262 public override string Description {
3263@@ -42,11 +44,7 @@
3264
3265 public override IEnumerable<Type> SupportedItemTypes
3266 {
3267- get {
3268- return new Type[] {
3269- typeof (RTMListItem),
3270- };
3271- }
3272+ get { yield return typeof (RTMListItem); }
3273 }
3274
3275 public override IEnumerable<Item> Items
3276@@ -64,10 +62,6 @@
3277 Thread updateLists = new Thread (new ThreadStart (RTM.UpdateLists));
3278 updateLists.IsBackground = true;
3279 updateLists.Start ();
3280-
3281- Thread updateTasks = new Thread (new ThreadStart (RTM.UpdateTasks));
3282- updateTasks.IsBackground = true;
3283- updateTasks.Start ();
3284 }
3285
3286 public Gtk.Bin GetConfiguration ()
3287
3288=== added file 'RememberTheMilk/src/RTMLocationItem.cs'
3289--- RememberTheMilk/src/RTMLocationItem.cs 1970-01-01 00:00:00 +0000
3290+++ RememberTheMilk/src/RTMLocationItem.cs 2009-06-03 23:38:02 +0000
3291@@ -0,0 +1,55 @@
3292+// RTMLocationItem.cs
3293+//
3294+// Copyright (C) 2009 GNOME Do
3295+//
3296+// This program is free software: you can redistribute it and/or modify
3297+// it under the terms of the GNU General Public License as published by
3298+// the Free Software Foundation, either version 3 of the License, or
3299+// (at your option) any later version.
3300+//
3301+// This program is distributed in the hope that it will be useful,
3302+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3303+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3304+// GNU General Public License for more details.
3305+//
3306+// You should have received a copy of the GNU General Public License
3307+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3308+//
3309+
3310+using System;
3311+
3312+using Do.Universe;
3313+using Do.Platform;
3314+
3315+namespace RememberTheMilk
3316+{
3317+ /// <summary>
3318+ /// Item class for the Remember The Milk location
3319+ /// </summary>
3320+ public class RTMLocationItem : RTMTaskAttributeItem
3321+ {
3322+ string id;
3323+ string longitude;
3324+ string latitude;
3325+
3326+ public RTMLocationItem (string id, string name, string address, string longitude, string latitude)
3327+ : base (name, address, "http://maps.google.com/maps?q="+latitude+","+longitude, "stock_internet", null)
3328+ {
3329+ this.id = id;
3330+ this.latitude = latitude;
3331+ this.longitude = longitude;
3332+ }
3333+
3334+ public string Longitude {
3335+ get { return longitude; }
3336+ }
3337+
3338+ public string Latitude {
3339+ get { return latitude; }
3340+ }
3341+
3342+ public string Id {
3343+ get { return id;}
3344+ }
3345+ }
3346+}
3347
3348=== added file 'RememberTheMilk/src/RTMLocationItemSource.cs'
3349--- RememberTheMilk/src/RTMLocationItemSource.cs 1970-01-01 00:00:00 +0000
3350+++ RememberTheMilk/src/RTMLocationItemSource.cs 2009-06-03 23:38:02 +0000
3351@@ -0,0 +1,68 @@
3352+// RTMLocationItemSource.cs
3353+//
3354+// Copyright (C) 2009 GNOME Do
3355+//
3356+// This program is free software: you can redistribute it and/or modify
3357+// it under the terms of the GNU General Public License as published by
3358+// the Free Software Foundation, either version 3 of the License, or
3359+// (at your option) any later version.
3360+//
3361+// This program is distributed in the hope that it will be useful,
3362+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3363+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3364+// GNU General Public License for more details.
3365+//
3366+// You should have received a copy of the GNU General Public License
3367+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3368+//
3369+
3370+using System;
3371+using System.Collections.Generic;
3372+using System.Threading;
3373+using Mono.Unix;
3374+
3375+using Do.Universe;
3376+using Do.Platform;
3377+
3378+namespace RememberTheMilk
3379+{
3380+ /// <summary>
3381+ /// ItemSource class for the Remember The Milk locations
3382+ /// </summary>
3383+ public class RTMLocationItemSource : ItemSource
3384+ {
3385+ public override string Name {
3386+ get { return Catalog.GetString ("Remember The Milk Locations"); }
3387+ }
3388+
3389+ public override string Description {
3390+ get { return Catalog.GetString ("Locations associated with your Remember The Milk tasks."); }
3391+ }
3392+
3393+ public override string Icon {
3394+ get { return "rtm.png@" + GetType ().Assembly.FullName; }
3395+ }
3396+
3397+ public override IEnumerable<Type> SupportedItemTypes
3398+ {
3399+ get { yield return typeof (RTMLocationItem); }
3400+ }
3401+
3402+ public override IEnumerable<Item> Items
3403+ {
3404+ get { return RTM.Locations; }
3405+ }
3406+
3407+ public override IEnumerable<Item> ChildrenOfItem (Item parent)
3408+ {
3409+ return RTM.TasksForLocation ((parent as RTMLocationItem).Id);
3410+ }
3411+
3412+ public override void UpdateItems ()
3413+ {
3414+ Thread updateLocations = new Thread (new ThreadStart (RTM.UpdateLocations));
3415+ updateLocations.IsBackground = true;
3416+ updateLocations.Start ();
3417+ }
3418+ }
3419+}
3420
3421=== modified file 'RememberTheMilk/src/RTMMoveTask.cs'
3422--- RememberTheMilk/src/RTMMoveTask.cs 2009-02-01 14:58:00 +0000
3423+++ RememberTheMilk/src/RTMMoveTask.cs 2009-06-03 23:38:02 +0000
3424@@ -1,21 +1,20 @@
3425-/* RTMMoveTask.cs
3426- *
3427- * GNOME Do is the legal property of its developers. Please refer to the
3428- * COPYRIGHT file distributed with this source distribution.
3429- *
3430- * This program is free software: you can redistribute it and/or modify
3431- * it under the terms of the GNU General Public License as published by
3432- * the Free Software Foundation, either version 3 of the License, or
3433- * (at your option) any later version.
3434- *
3435- * This program is distributed in the hope that it will be useful,
3436- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3437- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3438- * GNU General Public License for more details.
3439- *
3440- * You should have received a copy of the GNU General Public License
3441- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3442- */
3443+// RTMMoveTask.cs
3444+//
3445+// Copyright (C) 2009 GNOME Do
3446+//
3447+// This program is free software: you can redistribute it and/or modify
3448+// it under the terms of the GNU General Public License as published by
3449+// the Free Software Foundation, either version 3 of the License, or
3450+// (at your option) any later version.
3451+//
3452+// This program is distributed in the hope that it will be useful,
3453+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3454+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3455+// GNU General Public License for more details.
3456+//
3457+// You should have received a copy of the GNU General Public License
3458+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3459+//
3460
3461 using System;
3462 using System.Linq;
3463@@ -27,62 +26,50 @@
3464
3465 namespace RememberTheMilk
3466 {
3467-
3468-
3469+ /// <summary>
3470+ /// Class for the "Move Task" action.
3471+ /// </summary>
3472 public class RTMMoveTask : Act
3473 {
3474 public override string Name {
3475- get { return Catalog.GetString ("Move to..."); }
3476+ get { return Catalog.GetString ("Move to ..."); }
3477 }
3478
3479 public override string Description {
3480- get { return Catalog.GetString ("Move a seleted task from one list to another"); }
3481- }
3482+ get { return Catalog.GetString ("Move the seleted task to another list"); }
3483+ }
3484
3485 public override string Icon {
3486 get { return "forward"; }
3487 }
3488
3489 public override IEnumerable<Type> SupportedItemTypes {
3490- get {
3491- return new Type[] {
3492- typeof (RTMTaskItem),
3493- };
3494- }
3495+ get { yield return typeof (RTMTaskItem); }
3496 }
3497
3498 public override IEnumerable<Type> SupportedModifierItemTypes {
3499- get {
3500- return new Type[] {
3501- typeof (RTMListItem),
3502- };
3503- }
3504- }
3505-
3506- public override bool ModifierItemsOptional {
3507- get { return false; }
3508- }
3509-
3510- public override bool SupportsItem (Item item)
3511- {
3512- return true;
3513- }
3514-
3515- public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
3516- {
3517+ get { yield return typeof (RTMListItem); }
3518+ }
3519+
3520+ public override bool ModifierItemsOptional {
3521+ get { return false; }
3522+ }
3523+
3524+ public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
3525+ {
3526 if (modItem is RTMListItem)
3527- return !(modItem as RTMListItem).Name.Equals ("All Tasks");
3528+ return !(modItem as RTMListItem).Smart;
3529
3530- return true;
3531- }
3532-
3533- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3534- {
3535+ return true;
3536+ }
3537+
3538+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3539+ {
3540 Services.Application.RunOnThread (() => {
3541 RTM.MoveTask ((items.First () as RTMTaskItem).ListId, (modifierItems.First () as RTMListItem).Id,
3542 (items.First () as RTMTaskItem).TaskSeriesId, (items.First () as RTMTaskItem).Id);
3543 });
3544- yield break;
3545- }
3546+ yield break;
3547+ }
3548 }
3549 }
3550
3551=== added file 'RememberTheMilk/src/RTMNewList.cs'
3552--- RememberTheMilk/src/RTMNewList.cs 1970-01-01 00:00:00 +0000
3553+++ RememberTheMilk/src/RTMNewList.cs 2009-06-09 18:28:21 +0000
3554@@ -0,0 +1,70 @@
3555+// RTMNewList.cs
3556+//
3557+// Copyright (C) 2009 GNOME Do
3558+//
3559+// This program is free software: you can redistribute it and/or modify
3560+// it under the terms of the GNU General Public License as published by
3561+// the Free Software Foundation, either version 3 of the License, or
3562+// (at your option) any later version.
3563+//
3564+// This program is distributed in the hope that it will be useful,
3565+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3566+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3567+// GNU General Public License for more details.
3568+//
3569+// You should have received a copy of the GNU General Public License
3570+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3571+//
3572+
3573+using System;
3574+using System.Linq;
3575+using System.Collections.Generic;
3576+using Mono.Unix;
3577+
3578+using Do.Universe;
3579+using Do.Platform;
3580+
3581+namespace RememberTheMilk
3582+{
3583+ /// <summary>
3584+ /// Class for the "New List" action.
3585+ /// </summary>
3586+ public class RTMNewList : Act
3587+ {
3588+ public override string Name {
3589+ get { return Catalog.GetString ("New List"); }
3590+ }
3591+
3592+ public override string Description {
3593+ get { return Catalog.GetString ("Create a new task list."); }
3594+ }
3595+
3596+ public override string Icon {
3597+ get { return "task-add.png@" + GetType ().Assembly.FullName; }
3598+ }
3599+
3600+ public override IEnumerable<Type> SupportedItemTypes {
3601+ get { yield return typeof (ITextItem); }
3602+ }
3603+
3604+ public override bool SupportsItem (Item item) {
3605+ return true;
3606+ }
3607+
3608+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3609+ {
3610+ if (items.Any ()) {
3611+ string newListName = (items.First () as ITextItem).Text;
3612+ if (String.IsNullOrEmpty (newListName)) {
3613+ Log<RTM>.Debug ("[RememberTheMilk] No list name provided for RTMNewList action");
3614+ yield break;
3615+ } else {
3616+ Services.Application.RunOnThread (() => {
3617+ RTM.NewList (newListName);
3618+ });
3619+ }
3620+ }
3621+ yield break;
3622+ }
3623+ }
3624+}
3625
3626=== added file 'RememberTheMilk/src/RTMNewNote.cs'
3627--- RememberTheMilk/src/RTMNewNote.cs 1970-01-01 00:00:00 +0000
3628+++ RememberTheMilk/src/RTMNewNote.cs 2009-06-03 23:38:02 +0000
3629@@ -0,0 +1,75 @@
3630+// RTMNewNote.cs
3631+//
3632+// Copyright (C) 2009 GNOME Do
3633+//
3634+// This program is free software: you can redistribute it and/or modify
3635+// it under the terms of the GNU General Public License as published by
3636+// the Free Software Foundation, either version 3 of the License, or
3637+// (at your option) any later version.
3638+//
3639+// This program is distributed in the hope that it will be useful,
3640+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3641+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3642+// GNU General Public License for more details.
3643+//
3644+// You should have received a copy of the GNU General Public License
3645+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3646+//
3647+
3648+using System;
3649+using System.Linq;
3650+using System.Collections.Generic;
3651+using System.Text.RegularExpressions;
3652+using Mono.Unix;
3653+
3654+using Do.Universe;
3655+using Do.Platform;
3656+
3657+namespace RememberTheMilk
3658+{
3659+ /// <summary>
3660+ /// Class for the "New Note" action
3661+ /// </summary>
3662+ public class RTMNewNote : Act
3663+ {
3664+ public override string Name {
3665+ get { return Catalog.GetString ("New Note"); }
3666+ }
3667+
3668+ public override string Description {
3669+ get { return Catalog.GetString ("Add a new note to a task."); }
3670+ }
3671+
3672+ public override string Icon {
3673+ get { return "note-add.png@" + GetType ().Assembly.FullName; }
3674+ }
3675+
3676+ public override IEnumerable<Type> SupportedItemTypes {
3677+ get { yield return typeof (RTMTaskItem); }
3678+ }
3679+
3680+ public override IEnumerable<Type> SupportedModifierItemTypes {
3681+ get { yield return typeof (ITextItem); }
3682+ }
3683+
3684+ public override bool ModifierItemsOptional {
3685+ get { return false; }
3686+ }
3687+
3688+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3689+ {
3690+ string note = String.Empty;
3691+
3692+ if (modifierItems.FirstOrDefault() != null) {
3693+ note = ((modifierItems.FirstOrDefault() as ITextItem).Text);
3694+ }
3695+
3696+ Services.Application.RunOnThread (() => {
3697+ RTM.NewNote ((items.First () as RTMTaskItem).ListId,
3698+ (items.First () as RTMTaskItem).TaskSeriesId,
3699+ (items.First () as RTMTaskItem).Id, note);
3700+ });
3701+ yield break;
3702+ }
3703+ }
3704+}
3705\ No newline at end of file
3706
3707=== modified file 'RememberTheMilk/src/RTMNewTask.cs'
3708--- RememberTheMilk/src/RTMNewTask.cs 2009-04-11 21:18:05 +0000
3709+++ RememberTheMilk/src/RTMNewTask.cs 2009-06-03 23:38:02 +0000
3710@@ -1,21 +1,20 @@
3711-/* RTMNewTask.cs
3712- *
3713- * GNOME Do is the legal property of its developers. Please refer to the
3714- * COPYRIGHT file distributed with this source distribution.
3715- *
3716- * This program is free software: you can redistribute it and/or modify
3717- * it under the terms of the GNU General Public License as published by
3718- * the Free Software Foundation, either version 3 of the License, or
3719- * (at your option) any later version.
3720- *
3721- * This program is distributed in the hope that it will be useful,
3722- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3723- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3724- * GNU General Public License for more details.
3725- *
3726- * You should have received a copy of the GNU General Public License
3727- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3728- */
3729+// RTMNewTask.cs
3730+//
3731+// Copyright (C) 2009 GNOME Do
3732+//
3733+// This program is free software: you can redistribute it and/or modify
3734+// it under the terms of the GNU General Public License as published by
3735+// the Free Software Foundation, either version 3 of the License, or
3736+// (at your option) any later version.
3737+//
3738+// This program is distributed in the hope that it will be useful,
3739+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3740+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3741+// GNU General Public License for more details.
3742+//
3743+// You should have received a copy of the GNU General Public License
3744+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3745+//
3746
3747 using System;
3748 using System.Linq;
3749@@ -27,6 +26,9 @@
3750
3751 namespace RememberTheMilk
3752 {
3753+ /// <summary>
3754+ /// Class for the "New Task" action.
3755+ /// </summary>
3756 public class RTMNewTask : Act
3757 {
3758 public override string Name {
3759@@ -42,43 +44,30 @@
3760 }
3761
3762 public override IEnumerable<Type> SupportedItemTypes {
3763- get {
3764- return new Type[] {
3765- typeof (ITextItem),
3766- };
3767- }
3768+ get { yield return typeof (ITextItem); }
3769 }
3770
3771 public override IEnumerable<Type> SupportedModifierItemTypes {
3772- get {
3773- return new Type[] {
3774- typeof (RTMListItem),
3775- };
3776- }
3777+ get { yield return typeof (RTMListItem); }
3778 }
3779
3780 public override bool ModifierItemsOptional {
3781 get {return true; }
3782 }
3783-
3784- public override bool SupportsItem (Item item)
3785- {
3786- return true;
3787- }
3788-
3789+
3790 public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
3791 {
3792 if (modItem is RTMListItem)
3793- return !(modItem as RTMListItem).Name.Equals ("All Tasks");
3794-
3795+ return !(modItem as RTMListItem).Smart;
3796+
3797 return true;
3798 }
3799-
3800+
3801 public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3802 {
3803 string listId = String.Empty;
3804 string taskData = (items.First () as ITextItem).Text;
3805-
3806+
3807 if (string.IsNullOrEmpty(taskData)) {
3808 Services.Notifications.Notify ("Remember The Milk", "No title provided for new task.");
3809 yield break;
3810@@ -86,8 +75,8 @@
3811
3812 if (modifierItems.FirstOrDefault () != null)
3813 listId = (modifierItems.FirstOrDefault () as RTMListItem).Id;
3814-
3815- if (RTM.Preferences.ReturnNewTask)
3816+
3817+ if (RTMPreferences.ReturnNewTask)
3818 yield return RTM.NewTask (listId, taskData);
3819 else {
3820 Services.Application.RunOnThread (() => {
3821
3822=== added file 'RememberTheMilk/src/RTMNoteItem.cs'
3823--- RememberTheMilk/src/RTMNoteItem.cs 1970-01-01 00:00:00 +0000
3824+++ RememberTheMilk/src/RTMNoteItem.cs 2009-06-03 23:38:02 +0000
3825@@ -0,0 +1,49 @@
3826+// RTMNoteItem.cs
3827+//
3828+// Copyright (C) 2009 GNOME Do
3829+//
3830+// This program is free software: you can redistribute it and/or modify
3831+// it under the terms of the GNU General Public License as published by
3832+// the Free Software Foundation, either version 3 of the License, or
3833+// (at your option) any later version.
3834+//
3835+// This program is distributed in the hope that it will be useful,
3836+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3837+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3838+// GNU General Public License for more details.
3839+//
3840+// You should have received a copy of the GNU General Public License
3841+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3842+//
3843+
3844+using System;
3845+
3846+using Do.Universe;
3847+using Do.Platform;
3848+
3849+namespace RememberTheMilk
3850+{
3851+ /// <summary>
3852+ /// Item class for the Remember The Milk Note, derived from <see cref="RTMTaskAttributeItem"/>.
3853+ /// </summary>
3854+ public class RTMNoteItem : RTMTaskAttributeItem
3855+ {
3856+ string note_id;
3857+ string task_id;
3858+
3859+ public RTMNoteItem (string title, string text, string noteId, string url, string task_id)
3860+ : base (title, text, url, "gnome-sticky-notes-applet", null)
3861+ {
3862+ this.note_id = noteId;
3863+ this.task_id = task_id;
3864+ }
3865+
3866+ public string Id {
3867+ get { return note_id; }
3868+ }
3869+
3870+ public string TaskId {
3871+ get { return task_id; }
3872+ }
3873+ }
3874+}
3875
3876=== modified file 'RememberTheMilk/src/RTMPostponeTask.cs'
3877--- RememberTheMilk/src/RTMPostponeTask.cs 2009-02-01 14:58:00 +0000
3878+++ RememberTheMilk/src/RTMPostponeTask.cs 2009-06-03 23:38:02 +0000
3879@@ -1,21 +1,20 @@
3880-/* RTMPostponeTask.cs
3881- *
3882- * GNOME Do is the legal property of its developers. Please refer to the
3883- * COPYRIGHT file distributed with this source distribution.
3884- *
3885- * This program is free software: you can redistribute it and/or modify
3886- * it under the terms of the GNU General Public License as published by
3887- * the Free Software Foundation, either version 3 of the License, or
3888- * (at your option) any later version.
3889- *
3890- * This program is distributed in the hope that it will be useful,
3891- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3892- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3893- * GNU General Public License for more details.
3894- *
3895- * You should have received a copy of the GNU General Public License
3896- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3897- */
3898+// RTMPostponeTask.cs
3899+//
3900+// Copyright (C) 2009 GNOME Do
3901+//
3902+// This program is free software: you can redistribute it and/or modify
3903+// it under the terms of the GNU General Public License as published by
3904+// the Free Software Foundation, either version 3 of the License, or
3905+// (at your option) any later version.
3906+//
3907+// This program is distributed in the hope that it will be useful,
3908+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3909+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3910+// GNU General Public License for more details.
3911+//
3912+// You should have received a copy of the GNU General Public License
3913+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3914+//
3915
3916 using System;
3917 using System.Linq;
3918@@ -27,6 +26,9 @@
3919
3920 namespace RememberTheMilk
3921 {
3922+ /// <summary>
3923+ /// Class for the "Postpone" action
3924+ /// </summary>
3925 public class RTMPostponeTask : Act
3926 {
3927 public override string Name {
3928@@ -42,25 +44,16 @@
3929 }
3930
3931 public override IEnumerable<Type> SupportedItemTypes {
3932- get {
3933- return new Type[] {
3934- typeof (RTMTaskItem),
3935- };
3936- }
3937+ get { yield return typeof (RTMTaskItem); }
3938 }
3939
3940- public override bool SupportsItem (Item item)
3941- {
3942- return true;
3943- }
3944-
3945- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3946- {
3947+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
3948+ {
3949 Services.Application.RunOnThread (() => {
3950 RTM.PostponeTask ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
3951 (items.First () as RTMTaskItem).Id);
3952 });
3953- yield break;
3954- }
3955+ yield break;
3956+ }
3957 }
3958 }
3959
3960=== modified file 'RememberTheMilk/src/RTMPreferences.cs'
3961--- RememberTheMilk/src/RTMPreferences.cs 2009-01-29 16:58:01 +0000
3962+++ RememberTheMilk/src/RTMPreferences.cs 2009-06-01 23:28:44 +0000
3963@@ -1,69 +1,150 @@
3964-/* RTMPreferences.cs
3965- *
3966- * GNOME Do is the legal property of its developers. Please refer to the
3967- * COPYRIGHT file distributed with this source distribution.
3968- *
3969- * This program is free software: you can redistribute it and/or modify
3970- * it under the terms of the GNU General Public License as published by
3971- * the Free Software Foundation, either version 3 of the License, or
3972- * (at your option) any later version.
3973- *
3974- * This program is distributed in the hope that it will be useful,
3975- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3976- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3977- * GNU General Public License for more details.
3978- *
3979- * You should have received a copy of the GNU General Public License
3980- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3981- */
3982+// RTMPreferences.cs
3983+//
3984+// Copyright (C) 2009 GNOME Do
3985+//
3986+// This program is free software: you can redistribute it and/or modify
3987+// it under the terms of the GNU General Public License as published by
3988+// the Free Software Foundation, either version 3 of the License, or
3989+// (at your option) any later version.
3990+//
3991+// This program is distributed in the hope that it will be useful,
3992+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3993+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3994+// GNU General Public License for more details.
3995+//
3996+// You should have received a copy of the GNU General Public License
3997+// along with this program. If not, see <http://www.gnu.org/licenses/>.
3998+//
3999
4000 using System;
4001+
4002 using Do.Platform;
4003
4004 namespace RememberTheMilk
4005-{
4006- public class RTMPreferences
4007+{
4008+ /// <summary>
4009+ /// All the Remember The Milk related preferences.
4010+ /// </summary>
4011+ internal class RTMPreferences
4012 {
4013 const string TokenKey = "Token";
4014 const string UsernameKey = "Username";
4015 const string FilterKey = "Filter";
4016 const string OverdueNotificationKey = "OverdueNotification";
4017+ const string OverdueIntervalKey = "OverdueInterval";
4018 const string ActionNotificationKey = "ActionNotification";
4019 const string ReturnNewTaskKey = "ReturnNewTask";
4020
4021- IPreferences prefs;
4022-
4023- public RTMPreferences()
4024+ static IPreferences prefs = Services.Preferences.Get <RTMPreferences> ();
4025+
4026+ /// <value>
4027+ /// Indicates the RTM account has been changed.
4028+ /// </value>
4029+ public static event EventHandler AccountChanged;
4030+
4031+ /// <value>
4032+ /// Called when account has been changed.
4033+ /// </value>
4034+ public static void OnAccountChanged ()
4035 {
4036- prefs = Services.Preferences.Get <RTMPreferences> ();
4037+ if (AccountChanged != null)
4038+ AccountChanged (null, EventArgs.Empty);
4039 }
4040
4041- public string Token {
4042+ /// <value>
4043+ /// The current authenticated token
4044+ /// </value>
4045+ public static string Token {
4046 get { return prefs.GetSecure (TokenKey, ""); }
4047 set { prefs.SetSecure (TokenKey, value); }
4048 }
4049-
4050- public string Username {
4051+
4052+ /// <value>
4053+ /// The username of the currently used RTM account
4054+ /// </value>
4055+ public static string Username {
4056 get { return prefs.Get(UsernameKey, ""); }
4057- set { prefs.Set(UsernameKey, value); }
4058- }
4059-
4060- public string Filter {
4061+ set { prefs.Set(UsernameKey, value); OnAccountChanged ();}
4062+ }
4063+
4064+ /// <value>
4065+ /// Indicates the filter preference has been changed.
4066+ /// </value>
4067+ public static event EventHandler FilterChanged;
4068+
4069+ /// <value>
4070+ /// Called when the filter preference has been changed.
4071+ /// </value>
4072+ public static void OnFilterChanged ()
4073+ {
4074+ if (FilterChanged != null)
4075+ FilterChanged (null, EventArgs.Empty);
4076+ }
4077+
4078+ /// <value>
4079+ /// The current filter used when retrieving task lists
4080+ /// </value>
4081+ public static string Filter {
4082 get { return prefs.Get<string> (FilterKey, "status:incomplete"); }
4083- set { prefs.Set<string> (FilterKey, value); }
4084- }
4085-
4086- public bool OverdueNotification {
4087+ set { prefs.Set<string> (FilterKey, value); OnFilterChanged (); }
4088+ }
4089+
4090+ /// <value>
4091+ /// Indicates the interval to notify of overdue tasks have been changed.
4092+ /// </value>
4093+ public static event EventHandler OverdueIntervalChanged;
4094+
4095+ /// <value>
4096+ /// Called when the overdue task notifcation interval has been changed.
4097+ /// </value>
4098+ public static void OnOverdueIntervalChanged ()
4099+ {
4100+ if (OverdueIntervalChanged != null)
4101+ OverdueIntervalChanged (null, EventArgs.Empty);
4102+ }
4103+
4104+ /// <value>
4105+ /// The interval to display the notification of overdue tasks
4106+ /// </value>
4107+ public static double OverdueInterval {
4108+ get { return prefs.Get<double> (OverdueIntervalKey, 15); }
4109+ set { prefs.Set<double> (OverdueIntervalKey, value); OnOverdueIntervalChanged (); }
4110+ }
4111+
4112+ /// <value>
4113+ /// Indicates the show overdue task notification preference has been changed.
4114+ /// </value>
4115+ public static event EventHandler OverdueNotificationChanged;
4116+
4117+ /// <value>
4118+ /// Called when the show overdue task notification preference has been changed.
4119+ /// </value>
4120+ public static void OnOverdueNotificationChanged ()
4121+ {
4122+ if (OverdueNotificationChanged != null)
4123+ OverdueNotificationChanged (null, EventArgs.Empty);
4124+ }
4125+
4126+ /// <value>
4127+ /// If to show a notification when there is any overdue task.
4128+ /// </value>
4129+ public static bool OverdueNotification {
4130 get { return prefs.Get<bool> (OverdueNotificationKey, true); }
4131- set { prefs.Set<bool> (OverdueNotificationKey, value); }
4132+ set { prefs.Set<bool> (OverdueNotificationKey, value); OnOverdueNotificationChanged (); }
4133 }
4134
4135- public bool ActionNotification {
4136+ /// <value>
4137+ /// If to show a notification when an action is finshed.
4138+ /// </value>
4139+ public static bool ActionNotification {
4140 get { return prefs.Get<bool> (ActionNotificationKey, true); }
4141 set { prefs.Set<bool> (ActionNotificationKey, value); }
4142 }
4143
4144- public bool ReturnNewTask {
4145+ /// <value>
4146+ /// If to return the new task item right after it is created.
4147+ /// </value>
4148+ public static bool ReturnNewTask {
4149 get { return prefs.Get<bool> (ReturnNewTaskKey, true); }
4150 set { prefs.Set<bool> (ReturnNewTaskKey, value); }
4151 }
4152
4153=== modified file 'RememberTheMilk/src/RTMPriorityItem.cs'
4154--- RememberTheMilk/src/RTMPriorityItem.cs 2008-12-30 23:10:34 +0000
4155+++ RememberTheMilk/src/RTMPriorityItem.cs 2009-06-03 23:38:02 +0000
4156@@ -1,28 +1,28 @@
4157-/* RTMPriorityItem.cs
4158- *
4159- * GNOME Do is the legal property of its developers. Please refer to the
4160- * COPYRIGHT file distributed with this source distribution.
4161- *
4162- * This program is free software: you can redistribute it and/or modify
4163- * it under the terms of the GNU General Public License as published by
4164- * the Free Software Foundation, either version 3 of the License, or
4165- * (at your option) any later version.
4166- *
4167- * This program is distributed in the hope that it will be useful,
4168- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4169- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4170- * GNU General Public License for more details.
4171- *
4172- * You should have received a copy of the GNU General Public License
4173- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4174- */
4175-
4176-
4177+// RTMPriorityItem.cs
4178+//
4179+// Copyright (C) 2009 GNOME Do
4180+//
4181+// This program is free software: you can redistribute it and/or modify
4182+// it under the terms of the GNU General Public License as published by
4183+// the Free Software Foundation, either version 3 of the License, or
4184+// (at your option) any later version.
4185+//
4186+// This program is distributed in the hope that it will be useful,
4187+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4188+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4189+// GNU General Public License for more details.
4190+//
4191+// You should have received a copy of the GNU General Public License
4192+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4193+//
4194
4195 using Do.Universe;
4196-
4197+
4198 namespace RememberTheMilk
4199 {
4200+ /// <summary>
4201+ /// Item class for the Remember The Milk priorities
4202+ /// </summary>
4203 public class RTMPriorityItem : Item
4204 {
4205 private string name;
4206@@ -69,6 +69,5 @@
4207 return "N";
4208 }
4209 }
4210-
4211 }
4212 }
4213
4214=== added file 'RememberTheMilk/src/RTMRenameList.cs'
4215--- RememberTheMilk/src/RTMRenameList.cs 1970-01-01 00:00:00 +0000
4216+++ RememberTheMilk/src/RTMRenameList.cs 2009-06-09 18:28:21 +0000
4217@@ -0,0 +1,79 @@
4218+// RTMRenameList.cs
4219+//
4220+// Copyright (C) 2009 GNOME Do
4221+//
4222+// This program is free software: you can redistribute it and/or modify
4223+// it under the terms of the GNU General Public License as published by
4224+// the Free Software Foundation, either version 3 of the License, or
4225+// (at your option) any later version.
4226+//
4227+// This program is distributed in the hope that it will be useful,
4228+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4229+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4230+// GNU General Public License for more details.
4231+//
4232+// You should have received a copy of the GNU General Public License
4233+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4234+//
4235+
4236+using System;
4237+using System.Linq;
4238+using System.Collections.Generic;
4239+using Mono.Unix;
4240+
4241+using Do.Universe;
4242+using Do.Platform;
4243+
4244+namespace RememberTheMilk
4245+{
4246+ /// <summary>
4247+ /// Class for the "Rename List to ..." action
4248+ /// </summary>
4249+ public class RTMRenameList : Act
4250+ {
4251+ public override string Name {
4252+ get { return Catalog.GetString ("Rename List to ..."); }
4253+ }
4254+
4255+ public override string Description {
4256+ get { return Catalog.GetString ("Give a list a new name."); }
4257+ }
4258+
4259+ public override string Icon {
4260+ get { return "task-rename.png@" + GetType ().Assembly.FullName; }
4261+ }
4262+
4263+ public override IEnumerable<Type> SupportedItemTypes {
4264+ get { yield return typeof (RTMListItem); }
4265+ }
4266+
4267+ public override IEnumerable<Type> SupportedModifierItemTypes {
4268+ get { yield return typeof (ITextItem); }
4269+ }
4270+
4271+ public override bool ModifierItemsOptional {
4272+ get { return false; }
4273+ }
4274+
4275+ public override bool SupportsItem (Item item) {
4276+ return !(item as RTMListItem).Locked;
4277+ }
4278+
4279+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4280+ {
4281+ if (modifierItems.Any ()) {
4282+ string newListName = (modifierItems.First () as ITextItem).Text;
4283+ if (String.IsNullOrEmpty (newListName)) {
4284+ Log<RTM>.Debug ("[RememberTheMilk] No list name provided for RTMRenameList action");
4285+ yield break;
4286+ }
4287+
4288+ Services.Application.RunOnThread (() => {
4289+ RTM.RenameList ((items.First () as RTMListItem).Id, newListName);
4290+ });
4291+ }
4292+
4293+ yield break;
4294+ }
4295+ }
4296+}
4297
4298=== modified file 'RememberTheMilk/src/RTMRenameTask.cs'
4299--- RememberTheMilk/src/RTMRenameTask.cs 2009-02-01 14:58:00 +0000
4300+++ RememberTheMilk/src/RTMRenameTask.cs 2009-06-03 23:38:02 +0000
4301@@ -1,21 +1,20 @@
4302-/* RTMRename.cs
4303- *
4304- * GNOME Do is the legal property of its developers. Please refer to the
4305- * COPYRIGHT file distributed with this source distribution.
4306- *
4307- * This program is free software: you can redistribute it and/or modify
4308- * it under the terms of the GNU General Public License as published by
4309- * the Free Software Foundation, either version 3 of the License, or
4310- * (at your option) any later version.
4311- *
4312- * This program is distributed in the hope that it will be useful,
4313- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4314- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4315- * GNU General Public License for more details.
4316- *
4317- * You should have received a copy of the GNU General Public License
4318- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4319- */
4320+// RTMRenameTask.cs
4321+//
4322+// Copyright (C) 2009 GNOME Do
4323+//
4324+// This program is free software: you can redistribute it and/or modify
4325+// it under the terms of the GNU General Public License as published by
4326+// the Free Software Foundation, either version 3 of the License, or
4327+// (at your option) any later version.
4328+//
4329+// This program is distributed in the hope that it will be useful,
4330+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4331+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4332+// GNU General Public License for more details.
4333+//
4334+// You should have received a copy of the GNU General Public License
4335+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4336+//
4337
4338 using System;
4339 using System.Linq;
4340@@ -27,57 +26,42 @@
4341
4342 namespace RememberTheMilk
4343 {
4344+ /// <summary>
4345+ /// Class for the "Rename Task to ..." action
4346+ /// </summary>
4347 public class RTMRenameTask : Act
4348 {
4349 public override string Name {
4350- get { return Catalog.GetString ("Rename to..."); }
4351+ get { return Catalog.GetString ("Rename Task to ..."); }
4352 }
4353
4354 public override string Description {
4355 get { return Catalog.GetString ("Give the seleted task a new name"); }
4356- }
4357+ }
4358
4359 public override string Icon {
4360 get { return "task-rename.png@" + GetType ().Assembly.FullName; }
4361 }
4362
4363 public override IEnumerable<Type> SupportedItemTypes {
4364- get {
4365- return new Type[] {
4366- typeof (RTMTaskItem),
4367- };
4368- }
4369+ get { yield return typeof (RTMTaskItem); }
4370 }
4371
4372 public override IEnumerable<Type> SupportedModifierItemTypes {
4373- get {
4374- return new Type[] {
4375- typeof (ITextItem),
4376- };
4377- }
4378- }
4379-
4380- public override bool ModifierItemsOptional {
4381- get { return false; }
4382- }
4383-
4384- public override bool SupportsItem (Item item)
4385- {
4386- return true;
4387- }
4388-
4389- public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
4390- {
4391- return true;
4392- }
4393-
4394- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4395- {
4396+ get { yield return typeof (ITextItem); }
4397+ }
4398+
4399+ public override bool ModifierItemsOptional {
4400+ get { return false; }
4401+ }
4402+
4403+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4404+ {
4405 Services.Application.RunOnThread (() => {
4406 RTM.RenameTask ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
4407 (items.First () as RTMTaskItem).Id, (modifierItems.First () as ITextItem).Text);
4408 });
4409 yield break;
4410- }
4411+ }
4412 }
4413 }
4414\ No newline at end of file
4415
4416=== modified file 'RememberTheMilk/src/RTMSetDue.cs'
4417--- RememberTheMilk/src/RTMSetDue.cs 2009-03-18 14:06:36 +0000
4418+++ RememberTheMilk/src/RTMSetDue.cs 2009-06-03 23:38:02 +0000
4419@@ -1,21 +1,20 @@
4420-/* RTMSetDue.cs
4421- *
4422- * GNOME Do is the legal property of its developers. Please refer to the
4423- * COPYRIGHT file distributed with this source distribution.
4424- *
4425- * This program is free software: you can redistribute it and/or modify
4426- * it under the terms of the GNU General Public License as published by
4427- * the Free Software Foundation, either version 3 of the License, or
4428- * (at your option) any later version.
4429- *
4430- * This program is distributed in the hope that it will be useful,
4431- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4432- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4433- * GNU General Public License for more details.
4434- *
4435- * You should have received a copy of the GNU General Public License
4436- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4437- */
4438+// RTMSetDue.cs
4439+//
4440+// Copyright (C) 2009 GNOME Do
4441+//
4442+// This program is free software: you can redistribute it and/or modify
4443+// it under the terms of the GNU General Public License as published by
4444+// the Free Software Foundation, either version 3 of the License, or
4445+// (at your option) any later version.
4446+//
4447+// This program is distributed in the hope that it will be useful,
4448+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4449+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4450+// GNU General Public License for more details.
4451+//
4452+// You should have received a copy of the GNU General Public License
4453+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4454+//
4455
4456 using System;
4457 using System.Linq;
4458@@ -27,6 +26,9 @@
4459
4460 namespace RememberTheMilk
4461 {
4462+ /// <summary>
4463+ /// Class for the "Set Due Date/Time" action
4464+ /// </summary>
4465 public class RTMSetDue : Act
4466 {
4467 public override string Name {
4468@@ -34,8 +36,8 @@
4469 }
4470
4471 public override string Description {
4472- get { return Catalog.GetString ("Set the due date/time of a task"); }
4473- }
4474+ get { return Catalog.GetString ("Set or change the due date/time of a task"); }
4475+ }
4476
4477 public override string Icon {
4478 get { return "task-setdue.png@" + GetType ().Assembly.FullName; }
4479@@ -43,41 +45,52 @@
4480
4481 public override IEnumerable<Type> SupportedItemTypes {
4482 get {
4483- return new Type[] {
4484- typeof (RTMTaskItem),
4485- };
4486+ yield return typeof (RTMTaskItem);
4487+ yield return typeof (RTMTaskAttributeItem);
4488 }
4489 }
4490
4491 public override IEnumerable<Type> SupportedModifierItemTypes {
4492- get {
4493- return new Type[] {
4494- typeof (ITextItem),
4495- };
4496- }
4497- }
4498-
4499- public override bool ModifierItemsOptional {
4500- get { return false; }
4501- }
4502-
4503- public override bool SupportsItem (Item item)
4504- {
4505- return true;
4506- }
4507-
4508- public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
4509- {
4510- return true;
4511- }
4512-
4513- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4514- {
4515- Services.Application.RunOnThread (() => {
4516- RTM.SetDueDateTime ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
4517- (items.First () as RTMTaskItem).Id, (modifierItems.FirstOrDefault () as ITextItem).Text);
4518- });
4519+ get {
4520+ yield return typeof (ITextItem);
4521+ }
4522+ }
4523+
4524+ public override bool ModifierItemsOptional {
4525+ get { return true; }
4526+ }
4527+
4528+ public override bool SupportsItem (Item item)
4529+ {
4530+ if (item is RTMTaskItem)
4531+ return true;
4532+ else if (item is RTMTaskAttributeItem)
4533+ return (item as RTMTaskAttributeItem).Description == "Due Date/Time";
4534+ else
4535+ return false;
4536+ }
4537+
4538+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4539+ {
4540+ RTMTaskItem task = null;
4541+ string due = String.Empty;
4542+
4543+ if (items.Any ()) {
4544+ if (items.First () is RTMTaskItem)
4545+ task = (items.First () as RTMTaskItem);
4546+ else if (items.First () is RTMTaskAttributeItem)
4547+ task = (items.First () as RTMTaskAttributeItem).Parent;
4548+ }
4549+
4550+ if (modifierItems.Any ())
4551+ due = (modifierItems.First () as ITextItem).Text;
4552+
4553+ if (task != null)
4554+ Services.Application.RunOnThread (() => {
4555+ RTM.SetDueDateTime (task.ListId, task.TaskSeriesId, task.Id, due);
4556+ });
4557+
4558 yield break;
4559- }
4560+ }
4561 }
4562 }
4563
4564=== added file 'RememberTheMilk/src/RTMSetEstimate.cs'
4565--- RememberTheMilk/src/RTMSetEstimate.cs 1970-01-01 00:00:00 +0000
4566+++ RememberTheMilk/src/RTMSetEstimate.cs 2009-06-03 23:38:02 +0000
4567@@ -0,0 +1,117 @@
4568+// RTMSetEstimate.cs
4569+//
4570+// Copyright (C) 2009 GNOME Do
4571+//
4572+// This program is free software: you can redistribute it and/or modify
4573+// it under the terms of the GNU General Public License as published by
4574+// the Free Software Foundation, either version 3 of the License, or
4575+// (at your option) any later version.
4576+//
4577+// This program is distributed in the hope that it will be useful,
4578+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4579+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4580+// GNU General Public License for more details.
4581+//
4582+// You should have received a copy of the GNU General Public License
4583+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4584+//
4585+
4586+
4587+using System;
4588+using System.Linq;
4589+using System.Collections.Generic;
4590+using Mono.Unix;
4591+
4592+using Do.Universe;
4593+using Do.Platform;
4594+
4595+namespace RememberTheMilk
4596+{
4597+ /// <summary>
4598+ /// Class for the "Set Estimated Time" action.
4599+ /// </summary>
4600+ public class RTMSetEstimate : Act
4601+ {
4602+ public override string Name {
4603+ get { return Catalog.GetString ("Set Estimated Time"); }
4604+ }
4605+
4606+ public override string Description {
4607+ get { return Catalog.GetString ("Set or reset the estimated time for a task"); }
4608+ }
4609+
4610+ public override string Icon {
4611+ get { return "task-setdue.png@" + GetType ().Assembly.FullName; }
4612+ }
4613+
4614+ public bool CheckValidTime(string timeEntered) {
4615+ // RTM API supports units of days, hours and minutes
4616+ string[] times = {
4617+ "min", "mins", "minute", "minutes",
4618+ "h", "hr", "hrs", "hour", "hours",
4619+ "d", "day", "days"
4620+ };
4621+
4622+ return times.Any (t => timeEntered.EndsWith (t));
4623+ }
4624+
4625+ public override IEnumerable<Type> SupportedItemTypes {
4626+ get {
4627+ yield return typeof (RTMTaskItem);
4628+ yield return typeof (RTMTaskAttributeItem);
4629+ }
4630+ }
4631+
4632+ public override IEnumerable<Type> SupportedModifierItemTypes {
4633+ get {
4634+ yield return typeof (ITextItem);
4635+ }
4636+ }
4637+
4638+ public override bool ModifierItemsOptional {
4639+ get { return false; }
4640+ }
4641+
4642+ public override bool SupportsItem (Item item)
4643+ {
4644+ if (item is RTMTaskItem)
4645+ return true;
4646+ else if (item is RTMTaskAttributeItem)
4647+ return (item as RTMTaskAttributeItem).Description == "Time Estimate";
4648+ else
4649+ return false;
4650+ }
4651+
4652+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4653+ {
4654+ RTMTaskItem task = null;
4655+ string est = String.Empty;
4656+
4657+ if (items.Any ()) {
4658+ if (items.First () is RTMTaskItem)
4659+ task = (items.First () as RTMTaskItem);
4660+ else if (items.First () is RTMTaskAttributeItem)
4661+ task = (items.First () as RTMTaskAttributeItem).Parent;
4662+ }
4663+
4664+ if (modifierItems.Any ())
4665+ est = ((modifierItems.First () as ITextItem).Text);
4666+
4667+ if (!string.IsNullOrEmpty(est)) {
4668+ if (!CheckValidTime(est)) {
4669+ Services.Notifications.Notify ("Invalid Time format",
4670+ "The estimated time entered cannot be understood.",
4671+ "rtm.png@" + GetType ().Assembly.FullName);
4672+ yield break;
4673+ }
4674+ }
4675+
4676+ if (task != null)
4677+ Services.Application.RunOnThread (() => {
4678+ RTM.SetEstimateTime (task.ListId, task.TaskSeriesId, task.Id, est);
4679+ });
4680+
4681+ yield break;
4682+ }
4683+ }
4684+}
4685
4686=== added file 'RememberTheMilk/src/RTMSetLocation.cs'
4687--- RememberTheMilk/src/RTMSetLocation.cs 1970-01-01 00:00:00 +0000
4688+++ RememberTheMilk/src/RTMSetLocation.cs 2009-06-03 23:38:02 +0000
4689@@ -0,0 +1,68 @@
4690+// RTMSetLocation.cs
4691+//
4692+// Copyright (C) 2009 GNOME Do
4693+//
4694+// This program is free software: you can redistribute it and/or modify
4695+// it under the terms of the GNU General Public License as published by
4696+// the Free Software Foundation, either version 3 of the License, or
4697+// (at your option) any later version.
4698+//
4699+// This program is distributed in the hope that it will be useful,
4700+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4701+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4702+// GNU General Public License for more details.
4703+//
4704+// You should have received a copy of the GNU General Public License
4705+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4706+//
4707+
4708+using System;
4709+using System.Linq;
4710+using System.Collections.Generic;
4711+using Mono.Unix;
4712+
4713+using Do.Universe;
4714+using Do.Platform;
4715+
4716+namespace RememberTheMilk
4717+{
4718+ /// <summary>
4719+ /// Class for the "Set Location" action
4720+ /// </summary>
4721+ public class RTMSetLocation : Act
4722+ {
4723+ public override string Name {
4724+ get { return Catalog.GetString ("Set Location"); }
4725+ }
4726+
4727+ public override string Description {
4728+ get { return Catalog.GetString ("Set or change the location of a task"); }
4729+ }
4730+
4731+ public override string Icon {
4732+ get { return "task-seturl.png@" + GetType ().Assembly.FullName; }
4733+ }
4734+
4735+ public override IEnumerable<Type> SupportedItemTypes {
4736+ get { yield return typeof (RTMTaskItem); }
4737+ }
4738+
4739+ public override IEnumerable<Type> SupportedModifierItemTypes {
4740+ get { yield return typeof (RTMLocationItem); }
4741+ }
4742+
4743+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4744+ {
4745+ string locationId = String.Empty;
4746+
4747+ if (modifierItems.Any ())
4748+ locationId = (modifierItems.First () as RTMLocationItem).Id;
4749+
4750+ Services.Application.RunOnThread (() => {
4751+ RTM.SetLocation ( (items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
4752+ (items.First () as RTMTaskItem).Id, locationId);
4753+ });
4754+ yield break;
4755+ }
4756+ }
4757+}
4758\ No newline at end of file
4759
4760=== modified file 'RememberTheMilk/src/RTMSetPriority.cs'
4761--- RememberTheMilk/src/RTMSetPriority.cs 2009-02-01 14:58:00 +0000
4762+++ RememberTheMilk/src/RTMSetPriority.cs 2009-06-03 23:38:02 +0000
4763@@ -1,21 +1,20 @@
4764-/* RTMSetPriority.cs
4765- *
4766- * GNOME Do is the legal property of its developers. Please refer to the
4767- * COPYRIGHT file distributed with this source distribution.
4768- *
4769- * This program is free software: you can redistribute it and/or modify
4770- * it under the terms of the GNU General Public License as published by
4771- * the Free Software Foundation, either version 3 of the License, or
4772- * (at your option) any later version.
4773- *
4774- * This program is distributed in the hope that it will be useful,
4775- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4776- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4777- * GNU General Public License for more details.
4778- *
4779- * You should have received a copy of the GNU General Public License
4780- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4781- */
4782+// RTMSetPriority.cs
4783+//
4784+// Copyright (C) 2009 GNOME Do
4785+//
4786+// This program is free software: you can redistribute it and/or modify
4787+// it under the terms of the GNU General Public License as published by
4788+// the Free Software Foundation, either version 3 of the License, or
4789+// (at your option) any later version.
4790+//
4791+// This program is distributed in the hope that it will be useful,
4792+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4793+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4794+// GNU General Public License for more details.
4795+//
4796+// You should have received a copy of the GNU General Public License
4797+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4798+//
4799
4800 using System;
4801 using System.Linq;
4802@@ -27,8 +26,9 @@
4803
4804 namespace RememberTheMilk
4805 {
4806-
4807-
4808+ /// <summary>
4809+ /// Class for the "Set Prioirty" action
4810+ /// </summary>
4811 public class RTMSetPriority : Act
4812 {
4813 public override string Name {
4814@@ -36,50 +36,32 @@
4815 }
4816
4817 public override string Description {
4818- get { return Catalog.GetString ("Set the priority of a task"); }
4819- }
4820-
4821+ get { return Catalog.GetString ("Set or change the priority of a task"); }
4822+ }
4823+
4824 public override string Icon {
4825 get { return "task-priority.png@" + GetType ().Assembly.FullName; }
4826 }
4827
4828 public override IEnumerable<Type> SupportedItemTypes {
4829- get {
4830- return new Type[] {
4831- typeof (RTMTaskItem),
4832- };
4833- }
4834+ get { yield return typeof (RTMTaskItem); }
4835 }
4836
4837 public override IEnumerable<Type> SupportedModifierItemTypes {
4838- get {
4839- return new Type[] {
4840- typeof (RTMPriorityItem),
4841- };
4842- }
4843- }
4844-
4845- public override bool ModifierItemsOptional {
4846- get { return false; }
4847- }
4848-
4849- public override bool SupportsItem (Item item)
4850- {
4851- return true;
4852- }
4853-
4854- public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
4855- {
4856- return true;
4857- }
4858-
4859- public override IEnumerable<Item> DynamicModifierItemsForItem (Item item)
4860- {
4861- return RTM.GeneratePriorities ().ToArray ();
4862- }
4863-
4864- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4865- {
4866+ get { yield return typeof (RTMPriorityItem); }
4867+ }
4868+
4869+ public override bool ModifierItemsOptional {
4870+ get { return false; }
4871+ }
4872+
4873+ public override IEnumerable<Item> DynamicModifierItemsForItem (Item item)
4874+ {
4875+ return RTM.Priorities;
4876+ }
4877+
4878+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4879+ {
4880 Services.Application.RunOnThread (() => {
4881 RTM.SetTaskPriority ( (items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
4882 (items.First () as RTMTaskItem).Id, (modifierItems.First () as RTMPriorityItem).Priority);
4883
4884=== modified file 'RememberTheMilk/src/RTMSetRecurrence.cs'
4885--- RememberTheMilk/src/RTMSetRecurrence.cs 2009-02-01 14:58:00 +0000
4886+++ RememberTheMilk/src/RTMSetRecurrence.cs 2009-06-03 23:38:02 +0000
4887@@ -1,21 +1,20 @@
4888-/* RTMSetRecurrence.cs
4889- *
4890- * GNOME Do is the legal property of its developers. Please refer to the
4891- * COPYRIGHT file distributed with this source distribution.
4892- *
4893- * This program is free software: you can redistribute it and/or modify
4894- * it under the terms of the GNU General Public License as published by
4895- * the Free Software Foundation, either version 3 of the License, or
4896- * (at your option) any later version.
4897- *
4898- * This program is distributed in the hope that it will be useful,
4899- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4900- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4901- * GNU General Public License for more details.
4902- *
4903- * You should have received a copy of the GNU General Public License
4904- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4905- */
4906+// RTMSetRecurrence.cs
4907+//
4908+// Copyright (C) 2009 GNOME Do
4909+//
4910+// This program is free software: you can redistribute it and/or modify
4911+// it under the terms of the GNU General Public License as published by
4912+// the Free Software Foundation, either version 3 of the License, or
4913+// (at your option) any later version.
4914+//
4915+// This program is distributed in the hope that it will be useful,
4916+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4917+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4918+// GNU General Public License for more details.
4919+//
4920+// You should have received a copy of the GNU General Public License
4921+// along with this program. If not, see <http://www.gnu.org/licenses/>.
4922+//
4923
4924 using System;
4925 using System.Linq;
4926@@ -27,6 +26,9 @@
4927
4928 namespace RememberTheMilk
4929 {
4930+ /// <summary>
4931+ /// Class for the "Set Recurrence" action
4932+ /// </summary>
4933 public class RTMSetRecurrence : Act
4934 {
4935 public override string Name {
4936@@ -34,50 +36,28 @@
4937 }
4938
4939 public override string Description {
4940- get { return Catalog.GetString ("Sets a recurrence pattern for a task."); }
4941- }
4942+ get { return Catalog.GetString ("Set a recurrence pattern for a task."); }
4943+ }
4944
4945 public override string Icon {
4946 get { return "task-repeat.png@" + GetType ().Assembly.FullName; }
4947 }
4948
4949 public override IEnumerable<Type> SupportedItemTypes {
4950- get {
4951- return new Type[] {
4952- typeof (RTMTaskItem),
4953- };
4954- }
4955+ get { yield return typeof (RTMTaskItem); }
4956 }
4957
4958 public override IEnumerable<Type> SupportedModifierItemTypes {
4959- get {
4960- return new Type[] {
4961- typeof (ITextItem),
4962- };
4963- }
4964- }
4965-
4966- public override bool ModifierItemsOptional {
4967- get { return true; }
4968- }
4969-
4970- public override bool SupportsItem (Item item)
4971- {
4972- return true;
4973- }
4974-
4975- public override bool SupportsModifierItemForItems (IEnumerable<Item> item, Item modItem)
4976- {
4977- return true;
4978- }
4979-
4980- public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4981- {
4982+ get { yield return typeof (ITextItem); }
4983+ }
4984+
4985+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
4986+ {
4987 Services.Application.RunOnThread (() => {
4988 RTM.SetRecurrence ((items.First () as RTMTaskItem).ListId, (items.First () as RTMTaskItem).TaskSeriesId,
4989 (items.First () as RTMTaskItem).Id, (modifierItems.FirstOrDefault () as ITextItem).Text);
4990 });
4991 yield break;
4992- }
4993+ }
4994 }
4995 }
4996\ No newline at end of file
4997
4998=== modified file 'RememberTheMilk/src/RTMSetUrl.cs'
4999--- RememberTheMilk/src/RTMSetUrl.cs 2009-03-18 18:45:13 +0000
5000+++ RememberTheMilk/src/RTMSetUrl.cs 2009-06-03 23:38:02 +0000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches