Merge lp://qastaging/~cszikszoy/do-plugins/remind-me into lp://qastaging/do-plugins
- remind-me
- Merge into trunk
Proposed by
Chris S.
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~cszikszoy/do-plugins/remind-me |
Merge into: | lp://qastaging/do-plugins |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://qastaging/~cszikszoy/do-plugins/remind-me |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Smith (community) | Approve | ||
Review via email: mp+6590@code.qastaging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'DoPlugins.mds' |
2 | --- DoPlugins.mds 2009-03-29 17:55:48 +0000 |
3 | +++ DoPlugins.mds 2009-05-05 19:29:20 +0000 |
4 | @@ -1,4 +1,5 @@ |
5 | -<Combine fileversion="2.0" outputpath="build/bin/" name="DoPlugins" releaseversion="0.4.9.9"> |
6 | +<Combine name="DoPlugins" fileversion="2.0" outputpath="build/bin/" releaseversion="0.4.9.9"> |
7 | + <Policies /> |
8 | <Configurations active="Debug"> |
9 | <Configuration name="Debug" ctype="CombineConfiguration"> |
10 | <Entry build="True" name="Rhythmbox" configuration="Debug" /> |
11 | @@ -71,6 +72,7 @@ |
12 | <Entry build="True" name="Tracker" configuration="Debug" /> |
13 | <Entry build="True" name="YouTube" configuration="Debug" /> |
14 | <Entry build="True" name="Emesene" configuration="Debug" /> |
15 | + <Entry build="True" name="RemindMe" configuration="Debug" /> |
16 | </Configuration> |
17 | <Configuration name="Release" ctype="CombineConfiguration"> |
18 | <Entry build="True" name="Rhythmbox" configuration="Release" /> |
19 | @@ -143,6 +145,7 @@ |
20 | <Entry build="True" name="Tracker" configuration="Release" /> |
21 | <Entry build="True" name="YouTube" configuration="Release" /> |
22 | <Entry build="True" name="Emesene" configuration="Release" /> |
23 | + <Entry build="True" name="RemindMe" configuration="Release" /> |
24 | </Configuration> |
25 | </Configurations> |
26 | <StartMode startupentry="Rhythmbox" single="True"> |
27 | @@ -216,6 +219,7 @@ |
28 | <Execute type="None" entry="Tracker" /> |
29 | <Execute type="None" entry="YouTube" /> |
30 | <Execute type="None" entry="Emesene" /> |
31 | + <Execute type="None" entry="RemindMe" /> |
32 | </StartMode> |
33 | <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" /> |
34 | <Entries> |
35 | @@ -289,5 +293,6 @@ |
36 | <Entry filename="Tracker/Tracker.mdp" /> |
37 | <Entry filename="YouTube/YouTube.mdp" /> |
38 | <Entry filename="Emesene/Emesene.mdp" /> |
39 | + <Entry filename="RemindMe/RemindMe.mdp" /> |
40 | </Entries> |
41 | </Combine> |
42 | \ No newline at end of file |
43 | |
44 | === modified file 'Flickr/gtk-gui/objects.xml' |
45 | --- Flickr/gtk-gui/objects.xml 2009-04-23 21:37:32 +0000 |
46 | +++ Flickr/gtk-gui/objects.xml 2009-05-05 19:29:20 +0000 |
47 | @@ -1,2 +1,6 @@ |
48 | <objects attr-sync="on"> |
49 | + <object type="Flickr.UploadConfig" palette-category="Flickr" allow-children="false" base-type="Gtk.Bin"> |
50 | + <itemgroups /> |
51 | + <signals /> |
52 | + </object> |
53 | </objects> |
54 | \ No newline at end of file |
55 | |
56 | === modified file 'Flickr/src/UploadDialog.cs' |
57 | --- Flickr/src/UploadDialog.cs 2009-04-24 00:44:55 +0000 |
58 | +++ Flickr/src/UploadDialog.cs 2009-05-05 19:29:20 +0000 |
59 | @@ -3,7 +3,6 @@ |
60 | |
61 | using Gtk; |
62 | using Gdk; |
63 | -using GLib; |
64 | |
65 | using Do.Platform; |
66 | |
67 | |
68 | === modified file 'Makefile.am' |
69 | --- Makefile.am 2009-03-31 22:19:30 +0000 |
70 | +++ Makefile.am 2009-05-05 19:29:20 +0000 |
71 | @@ -47,6 +47,7 @@ |
72 | Putty \ |
73 | Quote \ |
74 | RememberTheMilk \ |
75 | + RemindMe \ |
76 | RequestTracker \ |
77 | Rhythmbox \ |
78 | Riptide \ |
79 | |
80 | === added directory 'RemindMe' |
81 | === added file 'RemindMe/Makefile.am' |
82 | --- RemindMe/Makefile.am 1970-01-01 00:00:00 +0000 |
83 | +++ RemindMe/Makefile.am 2009-05-05 19:29:20 +0000 |
84 | @@ -0,0 +1,21 @@ |
85 | +include $(top_srcdir)/build.rules.mk |
86 | + |
87 | +ASSEMBLY=RemindMe |
88 | + |
89 | +FILES = \ |
90 | + src/Reminder.cs \ |
91 | + src/RemindMe.cs \ |
92 | + src/SnoozeableReminder.cs \ |
93 | + src/StringExtensions.cs |
94 | + |
95 | +RESOURCES = \ |
96 | + Resources/RemindMe.addin.xml |
97 | + |
98 | +REFERENCES = \ |
99 | + Mono.Posix \ |
100 | + System \ |
101 | + System.Core \ |
102 | + $(GTK_SHARP_20_LIBS) \ |
103 | + $(DO_PLATFORM_LIBS) \ |
104 | + $(DO_PLATFORM_LINUX_LIBS) \ |
105 | + $(DO_UNIVERSE_LIBS) |
106 | |
107 | === added file 'RemindMe/RemindMe.mdp' |
108 | --- RemindMe/RemindMe.mdp 1970-01-01 00:00:00 +0000 |
109 | +++ RemindMe/RemindMe.mdp 2009-05-05 19:29:20 +0000 |
110 | @@ -0,0 +1,34 @@ |
111 | +<Project name="RemindMe" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject"> |
112 | + <Configurations active="Debug"> |
113 | + <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
114 | + <Output directory="bin/Debug" assembly="RemindMe" /> |
115 | + <Build debugmode="True" target="Library" /> |
116 | + <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" /> |
117 | + <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
118 | + </Configuration> |
119 | + <Configuration name="Release" ctype="DotNetProjectConfiguration"> |
120 | + <Output directory="bin/Release" assembly="RemindMe" /> |
121 | + <Build debugmode="False" target="Library" /> |
122 | + <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" /> |
123 | + <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
124 | + </Configuration> |
125 | + </Configurations> |
126 | + <Contents> |
127 | + <File name="src" subtype="Directory" buildaction="Compile" /> |
128 | + <File name="src/RemindMe.cs" subtype="Code" buildaction="Compile" /> |
129 | + <File name="Resources" subtype="Directory" buildaction="Compile" /> |
130 | + <File name="Resources/RemindMe.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> |
131 | + <File name="src/StringExtensions.cs" subtype="Code" buildaction="Compile" /> |
132 | + <File name="src/SnoozeableReminder.cs" subtype="Code" buildaction="Compile" /> |
133 | + <File name="src/Reminder.cs" subtype="Code" buildaction="Compile" /> |
134 | + </Contents> |
135 | + <References> |
136 | + <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
137 | + <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
138 | + <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" /> |
139 | + <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.Linux.dll" /> |
140 | + <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" /> |
141 | + <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
142 | + <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
143 | + </References> |
144 | +</Project> |
145 | \ No newline at end of file |
146 | |
147 | === added directory 'RemindMe/Resources' |
148 | === added file 'RemindMe/Resources/RemindMe.addin.xml' |
149 | --- RemindMe/Resources/RemindMe.addin.xml 1970-01-01 00:00:00 +0000 |
150 | +++ RemindMe/Resources/RemindMe.addin.xml 2009-05-05 19:29:20 +0000 |
151 | @@ -0,0 +1,25 @@ |
152 | +<Addin |
153 | + id="RemindMe" |
154 | + namespace= "Do" |
155 | + version="1.0" |
156 | + name="Remind Me" |
157 | + description="Make small reminders." |
158 | + author="Chris Szikszoy" |
159 | + category="Community" |
160 | + defaultEnabled="false" |
161 | +> |
162 | + |
163 | + <Runtime> |
164 | + <Import assembly="RemindMe.dll"/> |
165 | + </Runtime> |
166 | + |
167 | + <Dependencies> |
168 | + <Addin id="Universe" version="1.0" /> |
169 | + </Dependencies> |
170 | + |
171 | + <!-- Extensions included in this assembly --> |
172 | + <Extension path="/Do/Action"> |
173 | + |
174 | + <Action type="RemindMe.RemindMe" /> |
175 | + </Extension> |
176 | +</Addin> |
177 | |
178 | === added directory 'RemindMe/src' |
179 | === added file 'RemindMe/src/RemindMe.cs' |
180 | --- RemindMe/src/RemindMe.cs 1970-01-01 00:00:00 +0000 |
181 | +++ RemindMe/src/RemindMe.cs 2009-05-05 19:29:20 +0000 |
182 | @@ -0,0 +1,237 @@ |
183 | +// RemindMe.cs |
184 | +// |
185 | +// GNOME Do is the legal property of its developers. |
186 | +// Please refer to the COPYRIGHT file distributed with this |
187 | +// source distribution. |
188 | +// |
189 | +// This program is free software: you can redistribute it and/or modify |
190 | +// it under the terms of the GNU General Public License as published by |
191 | +// the Free Software Foundation, either version 3 of the License, or |
192 | +// (at your option) any later version. |
193 | +// |
194 | +// This program is distributed in the hope that it will be useful, |
195 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
196 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
197 | +// GNU General Public License for more details. |
198 | +// |
199 | +// You should have received a copy of the GNU General Public License |
200 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
201 | +// |
202 | + |
203 | +using System; |
204 | +using System.Linq; |
205 | +using System.Collections.Generic; |
206 | +using Mono.Unix; |
207 | + |
208 | +using GLib; |
209 | + |
210 | +using Do.Universe; |
211 | +using Do.Platform; |
212 | + |
213 | +namespace RemindMe |
214 | +{ |
215 | + |
216 | + public class RemindMe : Act |
217 | + { |
218 | + |
219 | + readonly string remindMessageHourMin; |
220 | + readonly string remindMessageMin; |
221 | + readonly string [] timeKeyWords; |
222 | + |
223 | + class AllowSnoozeItem : Item |
224 | + { |
225 | + |
226 | + public override string Name { |
227 | + get { return Catalog.GetString ("Allow Snooze"); } |
228 | + } |
229 | + |
230 | + public override string Description { |
231 | + get { return Catalog.GetString ("Allows this reminder to be snoozed."); } |
232 | + } |
233 | + |
234 | + public override string Icon { |
235 | + get { return ""; } |
236 | + } |
237 | + } |
238 | + |
239 | + class NoSnoozeItem : Item |
240 | + { |
241 | + |
242 | + public override string Name { |
243 | + get { return Catalog.GetString ("No Snooze Allowed"); } |
244 | + } |
245 | + |
246 | + public override string Description { |
247 | + get { return Catalog.GetString ("This reminder cannot be snoozed."); } |
248 | + } |
249 | + |
250 | + public override string Icon { |
251 | + get { return ""; } |
252 | + } |
253 | + } |
254 | + |
255 | + public RemindMe () |
256 | + { |
257 | + remindMessageHourMin = Catalog.GetString ("You will be reminded in {0} hours, {0} minutes."); |
258 | + remindMessageMin = Catalog.GetString ("You will be reminded in {0} minutes"); |
259 | + timeKeyWords = new string[] {Catalog.GetString ("in"), Catalog.GetString ("at")}; |
260 | + } |
261 | + |
262 | + public override string Name { |
263 | + get { return Catalog.GetString ("Remind Me"); } |
264 | + } |
265 | + |
266 | + public override string Description { |
267 | + get { return Catalog.GetString ("Simple Reminders"); } |
268 | + } |
269 | + |
270 | + public override string Icon { |
271 | + get { return ""; } |
272 | + } |
273 | + |
274 | + public override IEnumerable<Type> SupportedItemTypes { |
275 | + get { |
276 | + yield return typeof (ITextItem); |
277 | + } |
278 | + } |
279 | + |
280 | + public override bool SupportsItem (Item item) { |
281 | + return true; |
282 | + } |
283 | + |
284 | + public override IEnumerable<Type> SupportedModifierItemTypes |
285 | + { |
286 | + get { |
287 | + yield return typeof (AllowSnoozeItem); |
288 | + yield return typeof (NoSnoozeItem); |
289 | + } |
290 | + } |
291 | + |
292 | + public override IEnumerable<Item> DynamicModifierItemsForItem (Item item) |
293 | + { |
294 | + yield return new AllowSnoozeItem (); |
295 | + yield return new NoSnoozeItem (); |
296 | + } |
297 | + |
298 | + public override bool ModifierItemsOptional |
299 | + { |
300 | + get { return true; } |
301 | + } |
302 | + |
303 | + public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) |
304 | + { |
305 | + string message, matchedWord; |
306 | + TimeSpan timeout; |
307 | + message = (items.First () as ITextItem).Text; |
308 | + |
309 | + //bad time string, bail |
310 | + if (!message.ContainsAny (timeKeyWords)) |
311 | + yield break; |
312 | + |
313 | + timeout = ParseTimeString (message.Substring (message.LastIndexOfAny (timeKeyWords, out matchedWord) + matchedWord.Length)); |
314 | + message = message.Substring (0, message.LastIndexOfAny (timeKeyWords)).Trim (); |
315 | + |
316 | + if (timeout.TotalMilliseconds == 0) |
317 | + yield break; |
318 | + |
319 | + MaybeShowMessage (timeout); |
320 | + |
321 | + Notification reminder; |
322 | + |
323 | + if (modItems.Any ()) |
324 | + { |
325 | + if (modItems.First () is AllowSnoozeItem) |
326 | + reminder = new SnoozeableReminder (message, timeout); |
327 | + else |
328 | + reminder = new Reminder (message, timeout); |
329 | + } |
330 | + else |
331 | + reminder = new Reminder (message, timeout); |
332 | + |
333 | + GLib.Timeout.Add ((uint) |
334 | +timeout.TotalMilliseconds, () => { |
335 | + Services.Notifications.Notify (reminder); |
336 | + return false; |
337 | + }); |
338 | + yield break; |
339 | + } |
340 | + |
341 | + TimeSpan ParseTimeString (string timeStr) |
342 | + { |
343 | + DateTime t; |
344 | + TimeSpan notificationTimeout = new TimeSpan (0,0,0); |
345 | + |
346 | + //this will catch strings like 10:00 PM or 14:12 |
347 | + if (TryConvert (timeStr, out t)) { |
348 | + notificationTimeout = t-DateTime.Now; |
349 | + return notificationTimeout; |
350 | + } |
351 | + //this will catch strings like 2m2s or 2 h 2 m |
352 | + else /*if (timeStr.ContainsAny (new [] {"h", "m", "s"}))*/ { |
353 | + int hours, minutes, seconds; |
354 | + hours = minutes = seconds = 0; |
355 | + |
356 | + timeStr = timeStr.Replace (" ", null); |
357 | + //I'm not quite sure how to make these translateable... |
358 | + //There could be a case where the first letter for two time units are the same, |
359 | + //for example, german Stunde = hour, Sekund = second. |
360 | + foreach (string match in timeStr.Matches (new [] {"h", "m", "s"})) { |
361 | + try { |
362 | + switch (match) { |
363 | + case "h": |
364 | + hours = GetTimeUnit (timeStr, "h", out timeStr); |
365 | + break; |
366 | + case "m": |
367 | + minutes = GetTimeUnit (timeStr, "m", out timeStr); |
368 | + break; |
369 | + case "s": |
370 | + seconds = GetTimeUnit (timeStr, "s", out timeStr); |
371 | + break; |
372 | + } |
373 | + } |
374 | + //bad time string |
375 | + catch (Exception e) { |
376 | + return new TimeSpan (); |
377 | + } |
378 | + } |
379 | + notificationTimeout = notificationTimeout.Add ( |
380 | + new TimeSpan (hours, minutes, seconds)); |
381 | + return notificationTimeout; |
382 | + } |
383 | + } |
384 | + |
385 | + bool TryConvert (string timeString, out DateTime time) |
386 | + { |
387 | + try { |
388 | + time = Convert.ToDateTime (timeString); |
389 | + } |
390 | + catch { |
391 | + time = default (DateTime); |
392 | + return false; |
393 | + } |
394 | + return true; |
395 | + } |
396 | + |
397 | + void MaybeShowMessage (TimeSpan timeout) |
398 | + { |
399 | + if (timeout.TotalMinutes < 2) |
400 | + return; |
401 | + else if (timeout.TotalMinutes < 60) { |
402 | + Services.Notifications.Notify ("RemindMe", |
403 | + string.Format (remindMessageMin, timeout.Minutes)); |
404 | + } |
405 | + else { |
406 | + Services.Notifications.Notify ("RemindMe", |
407 | + string.Format (remindMessageHourMin, timeout.Hours, timeout.Minutes)); |
408 | + } |
409 | + return; |
410 | + } |
411 | + |
412 | + int GetTimeUnit (string input, string match, out string remainingString) |
413 | + { |
414 | + int val = int.Parse (input.Substring (0, input.IndexOf (match))); |
415 | + remainingString = input.Substring (input.IndexOf (match)+1); |
416 | + return val; |
417 | + } |
418 | + } |
419 | +} |
420 | |
421 | === added file 'RemindMe/src/Reminder.cs' |
422 | --- RemindMe/src/Reminder.cs 1970-01-01 00:00:00 +0000 |
423 | +++ RemindMe/src/Reminder.cs 2009-05-05 19:29:20 +0000 |
424 | @@ -0,0 +1,41 @@ |
425 | +// Reminder.cs |
426 | +// |
427 | +// GNOME Do is the legal property of its developers. |
428 | +// Please refer to the COPYRIGHT file distributed with this |
429 | +// source distribution. |
430 | +// |
431 | +// This program is free software: you can redistribute it and/or modify |
432 | +// it under the terms of the GNU General Public License as published by |
433 | +// the Free Software Foundation, either version 3 of the License, or |
434 | +// (at your option) any later version. |
435 | +// |
436 | +// This program is distributed in the hope that it will be useful, |
437 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
438 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
439 | +// GNU General Public License for more details. |
440 | +// |
441 | +// You should have received a copy of the GNU General Public License |
442 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
443 | +// |
444 | + |
445 | +using System; |
446 | + |
447 | +using GLib; |
448 | + |
449 | +using Do.Platform; |
450 | +namespace RemindMe |
451 | +{ |
452 | + |
453 | + |
454 | + public class Reminder : Notification |
455 | + { |
456 | + |
457 | + public Reminder(string message, TimeSpan timeout) : base ("RemindMe", message, "") |
458 | + { |
459 | + base.Body = message; |
460 | + this.ReminderDelay = timeout; |
461 | + } |
462 | + |
463 | + TimeSpan ReminderDelay { get; set; } |
464 | + } |
465 | +} |
466 | \ No newline at end of file |
467 | |
468 | === added file 'RemindMe/src/SnoozeableReminder.cs' |
469 | --- RemindMe/src/SnoozeableReminder.cs 1970-01-01 00:00:00 +0000 |
470 | +++ RemindMe/src/SnoozeableReminder.cs 2009-05-05 19:29:20 +0000 |
471 | @@ -0,0 +1,62 @@ |
472 | +// SnoozeableReminder.cs |
473 | +// |
474 | +// GNOME Do is the legal property of its developers. |
475 | +// Please refer to the COPYRIGHT file distributed with this |
476 | +// source distribution. |
477 | +// |
478 | +// This program is free software: you can redistribute it and/or modify |
479 | +// it under the terms of the GNU General Public License as published by |
480 | +// the Free Software Foundation, either version 3 of the License, or |
481 | +// (at your option) any later version. |
482 | +// |
483 | +// This program is distributed in the hope that it will be useful, |
484 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
485 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
486 | +// GNU General Public License for more details. |
487 | +// |
488 | +// You should have received a copy of the GNU General Public License |
489 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
490 | +// |
491 | + |
492 | +using System; |
493 | + |
494 | +using GLib; |
495 | + |
496 | +using Do.Platform; |
497 | +namespace RemindMe |
498 | +{ |
499 | + |
500 | + |
501 | + public class SnoozeableReminder : ActionableNotification |
502 | + { |
503 | + |
504 | + public SnoozeableReminder(string message, TimeSpan timeout) : base ("RemindMe", message, "", "Snooze") |
505 | + { |
506 | + base.Body = message; |
507 | + this.ReminderDelay = timeout; |
508 | + } |
509 | + |
510 | + TimeSpan ReminderDelay { get; set; } |
511 | + |
512 | + TimeSpan SnoozeTime { |
513 | + get |
514 | + { |
515 | + //the snooze time is the lesser of (TotalReminderSeconds / 4) and 180 (3 minutes |
516 | + //ie, for all reminders > 12 minutes, the snooze time is still 3 minutes. |
517 | + //however, we still set the floor for a snooze time to be 30 seconds |
518 | + int snoozeTime = (int) Math.Max (Math.Min (ReminderDelay.TotalSeconds / 4, 180), 30); |
519 | + return new TimeSpan (0,0,snoozeTime); |
520 | + } |
521 | + } |
522 | + |
523 | + public override void PerformAction () |
524 | + { |
525 | + GLib.Timeout.Add ((uint) |
526 | +this.SnoozeTime.TotalMilliseconds, () => { |
527 | + Services.Notifications.Notify (new SnoozeableReminder (this.Body, this.SnoozeTime)); |
528 | + return false; |
529 | + }); |
530 | + } |
531 | + |
532 | + } |
533 | +} |
534 | |
535 | === added file 'RemindMe/src/StringExtensions.cs' |
536 | --- RemindMe/src/StringExtensions.cs 1970-01-01 00:00:00 +0000 |
537 | +++ RemindMe/src/StringExtensions.cs 2009-05-05 19:29:20 +0000 |
538 | @@ -0,0 +1,72 @@ |
539 | +// StringExtensions.cs |
540 | +// |
541 | +// GNOME Do is the legal property of its developers. |
542 | +// Please refer to the COPYRIGHT file distributed with this |
543 | +// source distribution. |
544 | +// |
545 | +// This program is free software: you can redistribute it and/or modify |
546 | +// it under the terms of the GNU General Public License as published by |
547 | +// the Free Software Foundation, either version 3 of the License, or |
548 | +// (at your option) any later version. |
549 | +// |
550 | +// This program is distributed in the hope that it will be useful, |
551 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
552 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
553 | +// GNU General Public License for more details. |
554 | +// |
555 | +// You should have received a copy of the GNU General Public License |
556 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
557 | +// |
558 | + |
559 | +using System; |
560 | +using System.Linq; |
561 | +using System.Collections.Generic; |
562 | + |
563 | +namespace RemindMe |
564 | +{ |
565 | + |
566 | + public static class StringExtensions |
567 | + { |
568 | + |
569 | + //let's get cute and make playing with these strings more fun |
570 | + public static bool ContainsAny (this string str, IEnumerable<string> items) |
571 | + { |
572 | + foreach (string item in items) { |
573 | + if (str.Contains (item)) |
574 | + return true; |
575 | + } |
576 | + return false; |
577 | + } |
578 | + |
579 | + public static IEnumerable<string> Matches (this string str, IEnumerable<string> items) |
580 | + { |
581 | + foreach (string item in items) { |
582 | + if (str.Contains (item)) |
583 | + yield return item; |
584 | + } |
585 | + yield break; |
586 | + } |
587 | + |
588 | + public static int LastIndexOfAny (this string str, IEnumerable<string> items, out string match) |
589 | + { |
590 | + int index = -1; |
591 | + match = ""; |
592 | + |
593 | + foreach (string item in items) { |
594 | + if (str.Contains (item)) { |
595 | + if (str.LastIndexOf (item) > index) { |
596 | + index = str.LastIndexOf (item); |
597 | + match = item; |
598 | + } |
599 | + } |
600 | + } |
601 | + return index; |
602 | + } |
603 | + |
604 | + public static int LastIndexOfAny (this string str, IEnumerable<string> items) |
605 | + { |
606 | + string match; |
607 | + return str.LastIndexOfAny (items, out match); |
608 | + } |
609 | + } |
610 | +} |
611 | |
612 | === modified file 'configure.ac' |
613 | --- configure.ac 2009-03-20 23:05:29 +0000 |
614 | +++ configure.ac 2009-05-05 19:29:20 +0000 |
615 | @@ -164,6 +164,7 @@ |
616 | Putty/Makefile |
617 | Quote/Makefile |
618 | RememberTheMilk/Makefile |
619 | +RemindMe/Makefile |
620 | Rhythmbox/Makefile |
621 | Riptide/Makefile |
622 | RSS/Makefile |
Mono coding guidelines states to use string [] not string[] in RemindMe ctor
properties have opening brace on same line, not on a new line
"message = (items.First () as ITextItem).Text;" may crash, please convert with as ITextItem first, then null check, then use it.
in Perform
if () {
}
else
foo ();
is not ok, please add brackets and inline the else to be } else {
You forgot to inline elses in several other places, please fix these
MaybeShowMessage () has inconsistent usage of brackets, please fix
some unary operators need spaces 1 + 1 instead of 1+1
Reminder ctor needs a space before (, this error pops up on other ctor's
ReminderDelay declaration should be before ctor
SnoozeableReminder has awkward indentation on PerformAction ()
watch spacing on parameters also (x, y, z) not (x,y,z)
Fix the icons missing and the above issues and +1 approved