Status: | Merged |
---|---|
Merged at revision: | 684 |
Proposed branch: | lp:~ilja-smoli/do/gtg |
Merge into: | lp:~tomaz-muraus/do/gtg |
Diff against target: |
560 lines (+171/-247) 10 files modified
GTG/GTG.mdp (+39/-0) GTG/Makefile.am (+4/-1) GTG/Resources/GTG.addin.xml (+2/-2) GTG/Resources/GTG.addin.xml.in (+32/-0) GTG/src/CreateAction.cs (+5/-3) GTG/src/GTGAction.cs (+0/-186) GTG/src/GTGDBus.cs (+82/-52) GTG/src/GTGTask.cs (+3/-2) GTG/src/GTGTaskItemSource.cs (+2/-1) configure.ac (+2/-0) |
To merge this branch: | bzr merge lp:~ilja-smoli/do/gtg |
Related bugs: |
This proposal supersedes a proposal from 2010-10-03.
Commit message
Description of the change
-- Fixed plugin crash gnome-do
-- Adjusted a bit GTG Dbus contract
-- Tags are added to the body of task
Now active tasks are working
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 | === added file 'GTG/GTG.mdp' | |||
2 | --- GTG/GTG.mdp 1970-01-01 00:00:00 +0000 | |||
3 | +++ GTG/GTG.mdp 2010-10-13 08:39:47 +0000 | |||
4 | @@ -0,0 +1,39 @@ | |||
5 | 1 | <Project name="GTG" fileversion="2.0" newfilesearch="OnLoadAutoInsert" DefaultNamespace="GTG" language="C#" targetFramework="3.5" ctype="DotNetProject"> | ||
6 | 2 | <Deployment.LinuxDeployData /> | ||
7 | 3 | <Configurations active="Debug"> | ||
8 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> | ||
9 | 5 | <Output directory="bin/Debug" assembly="GTG" /> | ||
10 | 6 | <Build debugmode="True" target="Library" /> | ||
11 | 7 | <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" /> | ||
12 | 8 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
13 | 9 | </Configuration> | ||
14 | 10 | <Configuration name="Release" ctype="DotNetProjectConfiguration"> | ||
15 | 11 | <Output directory="bin/Release" assembly="GTG" /> | ||
16 | 12 | <Build debugmode="False" target="Library" /> | ||
17 | 13 | <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" /> | ||
18 | 14 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
19 | 15 | </Configuration> | ||
20 | 16 | </Configurations> | ||
21 | 17 | <Contents> | ||
22 | 18 | <File subtype="Directory" buildaction="Compile" name="src" /> | ||
23 | 19 | <File subtype="Directory" buildaction="Compile" name="Resources" /> | ||
24 | 20 | <File subtype="Code" buildaction="Compile" name="src/CompleteAction.cs" /> | ||
25 | 21 | <File subtype="Code" buildaction="Compile" name="src/CreateAction.cs" /> | ||
26 | 22 | <File subtype="Code" buildaction="Compile" name="src/DeleteTask.cs" /> | ||
27 | 23 | <File subtype="Code" buildaction="Compile" name="src/GTGDBus.cs" /> | ||
28 | 24 | <File subtype="Code" buildaction="Compile" name="src/GTGTask.cs" /> | ||
29 | 25 | <File subtype="Code" buildaction="Compile" name="src/GTGTaskItemSource.cs" /> | ||
30 | 26 | <File subtype="Code" buildaction="Compile" name="src/OpenAction.cs" /> | ||
31 | 27 | <File subtype="Code" buildaction="Nothing" name="Resources/GTG.addin.xml" /> | ||
32 | 28 | </Contents> | ||
33 | 29 | <References> | ||
34 | 30 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> | ||
35 | 31 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
36 | 32 | <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
37 | 33 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> | ||
38 | 34 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | ||
39 | 35 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | ||
40 | 36 | <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" /> | ||
41 | 37 | <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus.GLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" /> | ||
42 | 38 | </References> | ||
43 | 39 | </Project> | ||
44 | 0 | \ No newline at end of file | 40 | \ No newline at end of file |
45 | 1 | 41 | ||
46 | === modified file 'GTG/Makefile.am' | |||
47 | --- GTG/Makefile.am 2010-03-27 12:22:00 +0000 | |||
48 | +++ GTG/Makefile.am 2010-10-13 08:39:47 +0000 | |||
49 | @@ -3,7 +3,10 @@ | |||
50 | 3 | ASSEMBLY=GTG | 3 | ASSEMBLY=GTG |
51 | 4 | 4 | ||
52 | 5 | FILES = \ | 5 | FILES = \ |
54 | 6 | src/GTGAction.cs \ | 6 | src/CompleteAction.cs \ |
55 | 7 | src/CreateAction.cs \ | ||
56 | 8 | src/DeleteTask.cs \ | ||
57 | 9 | src/OpenAction.cs \ | ||
58 | 7 | src/GTGTask.cs \ | 10 | src/GTGTask.cs \ |
59 | 8 | src/GTGTaskItemSource.cs \ | 11 | src/GTGTaskItemSource.cs \ |
60 | 9 | src/GTGDBus.cs | 12 | src/GTGDBus.cs |
61 | 10 | 13 | ||
62 | === modified file 'GTG/Resources/GTG.addin.xml' | |||
63 | --- GTG/Resources/GTG.addin.xml 2010-05-01 10:59:54 +0000 | |||
64 | +++ GTG/Resources/GTG.addin.xml 2010-10-13 08:39:47 +0000 | |||
65 | @@ -13,7 +13,7 @@ | |||
66 | 13 | <Import assembly="GTG.dll"/> | 13 | <Import assembly="GTG.dll"/> |
67 | 14 | </Runtime> | 14 | </Runtime> |
68 | 15 | 15 | ||
70 | 16 | <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" /> | 16 | <Localizer type="Gettext" catalog="gnome-do-plugins" location="/usr/local/share/locale" /> |
71 | 17 | 17 | ||
72 | 18 | <Dependencies> | 18 | <Dependencies> |
73 | 19 | <Addin id="Universe" version="1.0" /> | 19 | <Addin id="Universe" version="1.0" /> |
74 | @@ -29,4 +29,4 @@ | |||
75 | 29 | <Action type="GTG.CompleteTask" /> | 29 | <Action type="GTG.CompleteTask" /> |
76 | 30 | <Action type="GTG.DeleteTask" /> | 30 | <Action type="GTG.DeleteTask" /> |
77 | 31 | </Extension> | 31 | </Extension> |
78 | 32 | </Addin> | ||
79 | 33 | \ No newline at end of file | 32 | \ No newline at end of file |
80 | 33 | </Addin> | ||
81 | 34 | 34 | ||
82 | === added file 'GTG/Resources/GTG.addin.xml.in' | |||
83 | --- GTG/Resources/GTG.addin.xml.in 1970-01-01 00:00:00 +0000 | |||
84 | +++ GTG/Resources/GTG.addin.xml.in 2010-10-13 08:39:47 +0000 | |||
85 | @@ -0,0 +1,32 @@ | |||
86 | 1 | <Addin | ||
87 | 2 | id="GTG" | ||
88 | 3 | namespace="Do" | ||
89 | 4 | version="1.1" | ||
90 | 5 | name="Getting Things Gnome" | ||
91 | 6 | description="Create a new and edit, complete or delete an existing GTG task." | ||
92 | 7 | author="Tomaž Muraus" | ||
93 | 8 | category="Community" | ||
94 | 9 | defaultEnabled="false" | ||
95 | 10 | url="http://do.davebsd.com/wiki/GTG_Plugin" | ||
96 | 11 | > | ||
97 | 12 | <Runtime> | ||
98 | 13 | <Import assembly="GTG.dll"/> | ||
99 | 14 | </Runtime> | ||
100 | 15 | |||
101 | 16 | <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" /> | ||
102 | 17 | |||
103 | 18 | <Dependencies> | ||
104 | 19 | <Addin id="Universe" version="1.0" /> | ||
105 | 20 | </Dependencies> | ||
106 | 21 | |||
107 | 22 | <!-- Sources --> | ||
108 | 23 | <Extension path="/Do/ItemSource"> | ||
109 | 24 | <ItemSource type="GTG.GTGTaskItemSource" /> | ||
110 | 25 | </Extension> | ||
111 | 26 | <Extension path="/Do/Action"> | ||
112 | 27 | <Action type="GTG.CreateTask" /> | ||
113 | 28 | <Action type="GTG.OpenTask" /> | ||
114 | 29 | <Action type="GTG.CompleteTask" /> | ||
115 | 30 | <Action type="GTG.DeleteTask" /> | ||
116 | 31 | </Extension> | ||
117 | 32 | </Addin> | ||
118 | 0 | \ No newline at end of file | 33 | \ No newline at end of file |
119 | 1 | 34 | ||
120 | === modified file 'GTG/src/CreateAction.cs' | |||
121 | --- GTG/src/CreateAction.cs 2010-05-01 10:59:54 +0000 | |||
122 | +++ GTG/src/CreateAction.cs 2010-10-13 08:39:47 +0000 | |||
123 | @@ -53,7 +53,7 @@ | |||
124 | 53 | 53 | ||
125 | 54 | public override string Description | 54 | public override string Description |
126 | 55 | { | 55 | { |
128 | 56 | get { return AddinManager.CurrentLocalizer.GetString ("Creata a new task in Getting Things Gnome!"); } | 56 | get { return AddinManager.CurrentLocalizer.GetString ("Create a new task in Getting Things Gnome!"); } |
129 | 57 | } | 57 | } |
130 | 58 | 58 | ||
131 | 59 | public override string Icon | 59 | public override string Icon |
132 | @@ -153,9 +153,11 @@ | |||
133 | 153 | } | 153 | } |
134 | 154 | 154 | ||
135 | 155 | task.Title = itemText; | 155 | task.Title = itemText; |
137 | 156 | gtg.CreateTask(task); | 156 | var tid = gtg.CreateTask(task); |
138 | 157 | if(tid.ContainsKey("id")){ | ||
139 | 158 | gtg.OpenTaskEditor(tid["id"].ToString()); | ||
140 | 159 | } | ||
141 | 157 | gtgItemSource.UpdateItems(); | 160 | gtgItemSource.UpdateItems(); |
142 | 158 | |||
143 | 159 | return null; | 161 | return null; |
144 | 160 | } | 162 | } |
145 | 161 | 163 | ||
146 | 162 | 164 | ||
147 | === removed file 'GTG/src/GTGAction.cs' | |||
148 | --- GTG/src/GTGAction.cs 2010-05-01 10:59:54 +0000 | |||
149 | +++ GTG/src/GTGAction.cs 1970-01-01 00:00:00 +0000 | |||
150 | @@ -1,186 +0,0 @@ | |||
151 | 1 | // GTGAction.cs | ||
152 | 2 | // | ||
153 | 3 | // GNOME Do is the legal property of its developers, whose names are too | ||
154 | 4 | // numerous to list here. Please refer to the COPYRIGHT file distributed with | ||
155 | 5 | // this source distribution. | ||
156 | 6 | // | ||
157 | 7 | // This program is free software: you can redistribute it and/or modify | ||
158 | 8 | // it under the terms of the GNU General Public License as published by | ||
159 | 9 | // the Free Software Foundation, either version 3 of the License, or | ||
160 | 10 | // (at your option) any later version. | ||
161 | 11 | // | ||
162 | 12 | // This program is distributed in the hope that it will be useful, | ||
163 | 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
164 | 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
165 | 15 | // GNU General Public License for more details. | ||
166 | 16 | // | ||
167 | 17 | // You should have received a copy of the GNU General Public License | ||
168 | 18 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
169 | 19 | |||
170 | 20 | using System; | ||
171 | 21 | using System.Linq; | ||
172 | 22 | using System.Collections; | ||
173 | 23 | using System.Collections.Generic; | ||
174 | 24 | using System.Text.RegularExpressions; | ||
175 | 25 | |||
176 | 26 | using Do.Universe; | ||
177 | 27 | using Do.Platform; | ||
178 | 28 | |||
179 | 29 | using Mono.Addins; | ||
180 | 30 | |||
181 | 31 | using GTG.DBus; | ||
182 | 32 | |||
183 | 33 | namespace GTG | ||
184 | 34 | { | ||
185 | 35 | public class CreateTask : Act | ||
186 | 36 | { | ||
187 | 37 | static Regex regExpDate = new Regex(@"(?<type>(starts?|ends?|due)):\s? | ||
188 | 38 | ((?<date_full>(?<day>0[1-9]|[12][0-9]|3[01])[- /.](?<month>0[1-9]|1[012])[- /.](?<year>20\d\d)) | ||
189 | 39 | |(?<date_days>\+(?<days>\d+)\s?days?) | ||
190 | 40 | |(?<date_tommorow>tom{1,2}or{1,2}ow) | ||
191 | 41 | |(?<date_today>today))", | ||
192 | 42 | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase | RegexOptions.Compiled); | ||
193 | 43 | static Regex regExpTags = new Regex(@"@(?<tag>[A-Za-z0-9_]+)"); | ||
194 | 44 | |||
195 | 45 | public CreateTask() | ||
196 | 46 | { | ||
197 | 47 | } | ||
198 | 48 | |||
199 | 49 | public override string Name | ||
200 | 50 | { | ||
201 | 51 | get { return AddinManager.CurrentLocalizer.GetString ("Create a GTG task"); } | ||
202 | 52 | } | ||
203 | 53 | |||
204 | 54 | public override string Description | ||
205 | 55 | { | ||
206 | 56 | get { return AddinManager.CurrentLocalizer.GetString ("Creata a new task in Getting Things Gnome!"); } | ||
207 | 57 | } | ||
208 | 58 | |||
209 | 59 | public override string Icon | ||
210 | 60 | { | ||
211 | 61 | get { return "gtg"; } | ||
212 | 62 | } | ||
213 | 63 | |||
214 | 64 | public override IEnumerable<Type> SupportedItemTypes | ||
215 | 65 | { | ||
216 | 66 | get | ||
217 | 67 | { | ||
218 | 68 | yield return typeof(ITextItem); | ||
219 | 69 | yield return typeof(GTGTask); | ||
220 | 70 | } | ||
221 | 71 | } | ||
222 | 72 | |||
223 | 73 | public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) | ||
224 | 74 | { | ||
225 | 75 | if (items.First() is ITextItem) | ||
226 | 76 | { | ||
227 | 77 | TextItemPerform(items.First() as ITextItem); | ||
228 | 78 | } | ||
229 | 79 | else | ||
230 | 80 | { | ||
231 | 81 | TaskItemPerform(items.First() as GTGTask); | ||
232 | 82 | } | ||
233 | 83 | |||
234 | 84 | return null; | ||
235 | 85 | } | ||
236 | 86 | |||
237 | 87 | protected Item[] TaskItemPerform(GTGTask task) | ||
238 | 88 | { | ||
239 | 89 | GTGDBus gtg = new GTGDBus(); | ||
240 | 90 | |||
241 | 91 | gtg.OpenTaskEditor(task.TaskId); | ||
242 | 92 | |||
243 | 93 | return null; | ||
244 | 94 | } | ||
245 | 95 | |||
246 | 96 | protected Item[] TextItemPerform (ITextItem item) | ||
247 | 97 | { | ||
248 | 98 | GTGTaskItemSource gtgItemSource = new GTGTaskItemSource(); | ||
249 | 99 | string itemText = item.Text; | ||
250 | 100 | |||
251 | 101 | if (itemText.Length == 0) | ||
252 | 102 | { | ||
253 | 103 | return null; | ||
254 | 104 | } | ||
255 | 105 | |||
256 | 106 | GTGDBus gtg = new GTGDBus(); | ||
257 | 107 | GTGTask task = new GTGTask(); | ||
258 | 108 | |||
259 | 109 | MatchCollection matchesDate = regExpDate.Matches(itemText); | ||
260 | 110 | MatchCollection matchesTags = regExpTags.Matches(itemText); | ||
261 | 111 | |||
262 | 112 | if (matchesDate.Count > 0) | ||
263 | 113 | { | ||
264 | 114 | DateTime dateStart = DateTime.MinValue; | ||
265 | 115 | DateTime dateDue = DateTime.MinValue; | ||
266 | 116 | itemText = regExpDate.Replace(itemText, ""); | ||
267 | 117 | |||
268 | 118 | // Task start and/or due date is located in the text | ||
269 | 119 | foreach (Match match in matchesDate) | ||
270 | 120 | { | ||
271 | 121 | string type = match.Groups["type"].Value; | ||
272 | 122 | |||
273 | 123 | if (type.IndexOf("start") != -1) | ||
274 | 124 | { | ||
275 | 125 | // Start date | ||
276 | 126 | dateStart = getDateFromMatch(match); | ||
277 | 127 | } | ||
278 | 128 | else | ||
279 | 129 | { | ||
280 | 130 | // Due/end data | ||
281 | 131 | dateDue = getDateFromMatch(match); | ||
282 | 132 | } | ||
283 | 133 | } | ||
284 | 134 | |||
285 | 135 | if (dateStart != DateTime.MinValue) | ||
286 | 136 | { | ||
287 | 137 | task.StartDate = dateStart; | ||
288 | 138 | } | ||
289 | 139 | |||
290 | 140 | if (dateDue != DateTime.MinValue) | ||
291 | 141 | { | ||
292 | 142 | task.DueDate = dateDue; | ||
293 | 143 | } | ||
294 | 144 | } | ||
295 | 145 | |||
296 | 146 | if (matchesTags.Count > 0) | ||
297 | 147 | { | ||
298 | 148 | itemText = regExpTags.Replace(itemText, ""); | ||
299 | 149 | foreach (Match match in matchesTags) | ||
300 | 150 | { | ||
301 | 151 | task.Tags.Add("@" + match.Groups["tag"].Value); | ||
302 | 152 | } | ||
303 | 153 | } | ||
304 | 154 | |||
305 | 155 | task.Title = itemText; | ||
306 | 156 | gtg.CreateTask(task); | ||
307 | 157 | gtgItemSource.UpdateItems(); | ||
308 | 158 | |||
309 | 159 | return null; | ||
310 | 160 | } | ||
311 | 161 | |||
312 | 162 | protected DateTime getDateFromMatch(Match match) | ||
313 | 163 | { | ||
314 | 164 | DateTime date; | ||
315 | 165 | |||
316 | 166 | if (match.Groups["date_full"].Success) | ||
317 | 167 | { | ||
318 | 168 | date = new DateTime(int.Parse(match.Groups["year"].Value), int.Parse(match.Groups["month"].Value), int.Parse(match.Groups["day"].Value)); | ||
319 | 169 | } | ||
320 | 170 | else if (match.Groups["date_days"].Success) | ||
321 | 171 | { | ||
322 | 172 | date = DateTime.Today.AddDays(int.Parse(match.Groups["days"].Value)); | ||
323 | 173 | } | ||
324 | 174 | else if (match.Groups["date_tommorow"].Success) | ||
325 | 175 | { | ||
326 | 176 | date = DateTime.Today.AddDays(1); | ||
327 | 177 | } | ||
328 | 178 | else | ||
329 | 179 | { | ||
330 | 180 | date = DateTime.Today; | ||
331 | 181 | } | ||
332 | 182 | |||
333 | 183 | return date; | ||
334 | 184 | } | ||
335 | 185 | } | ||
336 | 186 | } | ||
337 | 187 | \ No newline at end of file | 0 | \ No newline at end of file |
338 | 188 | 1 | ||
339 | === modified file 'GTG/src/GTGDBus.cs' | |||
340 | --- GTG/src/GTGDBus.cs 2010-05-01 10:59:54 +0000 | |||
341 | +++ GTG/src/GTGDBus.cs 2010-10-13 08:39:47 +0000 | |||
342 | @@ -20,7 +20,7 @@ | |||
343 | 20 | using System; | 20 | using System; |
344 | 21 | using System.Collections; | 21 | using System.Collections; |
345 | 22 | using System.Collections.Generic; | 22 | using System.Collections.Generic; |
347 | 23 | 23 | using System.Linq; | |
348 | 24 | using NDesk.DBus; | 24 | using NDesk.DBus; |
349 | 25 | 25 | ||
350 | 26 | using Do.Platform; | 26 | using Do.Platform; |
351 | @@ -33,13 +33,17 @@ | |||
352 | 33 | { | 33 | { |
353 | 34 | // There is a bug in ndesk-dbus package which comes with Ubuntu (9.10) | 34 | // There is a bug in ndesk-dbus package which comes with Ubuntu (9.10) |
354 | 35 | // Package from https://edge.launchpad.net/~docky-core/+archive/ppa PPA works fine | 35 | // Package from https://edge.launchpad.net/~docky-core/+archive/ppa PPA works fine |
355 | 36 | //This call cause System.Exception: Read non-zero byte at position 4 while expecting padding | ||
356 | 36 | IDictionary<string, object>[] get_tasks(); | 37 | IDictionary<string, object>[] get_tasks(); |
357 | 37 | IDictionary<string, object> get_task(string taskId); | 38 | IDictionary<string, object> get_task(string taskId); |
363 | 38 | 39 | string[] get_task_ids(string ids); | |
364 | 39 | string open_task_editor(string taskId); | 40 | |
365 | 40 | string new_task(string status, string title, string dueDate, string startDate, string doneDate, string[] tags, string text, string subTasks); | 41 | void open_task_editor(string taskId); |
366 | 41 | string modify_task(string taskId, Hashtable taskData); | 42 | IDictionary<string, object> new_task(string status, string title, string dueDate, string startDate, string doneDate, string[] tags, string text, string subTasks); |
367 | 42 | string delete_task(string taskId); | 43 | void modify_task(string taskId, IDictionary<string, object> taskData); |
368 | 44 | void delete_task(string taskId); | ||
369 | 45 | void show_task_browser(); | ||
370 | 46 | |||
371 | 43 | } | 47 | } |
372 | 44 | 48 | ||
373 | 45 | public class GTGDBus | 49 | public class GTGDBus |
374 | @@ -50,7 +54,7 @@ | |||
375 | 50 | 54 | ||
376 | 51 | public GTGDBus() | 55 | public GTGDBus() |
377 | 52 | { | 56 | { |
379 | 53 | GTG = FindInstance(); | 57 | //GTG = FindInstance(); |
380 | 54 | try | 58 | try |
381 | 55 | { | 59 | { |
382 | 56 | GTG = FindInstance(); | 60 | GTG = FindInstance(); |
383 | @@ -73,61 +77,87 @@ | |||
384 | 73 | 77 | ||
385 | 74 | public IDictionary<string, object>[] GetActiveTasks() | 78 | public IDictionary<string, object>[] GetActiveTasks() |
386 | 75 | { | 79 | { |
388 | 76 | return GTG.get_tasks(); | 80 | var tids = GTG.get_task_ids("Active"); |
389 | 81 | return tids.Select(tid => GetTask(tid)).ToArray(); | ||
390 | 82 | |||
391 | 77 | } | 83 | } |
392 | 78 | 84 | ||
393 | 79 | public IDictionary<string, object> GetTask(string taskId) | 85 | public IDictionary<string, object> GetTask(string taskId) |
394 | 80 | { | 86 | { |
395 | 87 | Log.Debug("Get GTG task "+taskId); | ||
396 | 81 | return GTG.get_task(taskId); | 88 | return GTG.get_task(taskId); |
397 | 82 | } | 89 | } |
398 | 83 | 90 | ||
400 | 84 | public string CreateTask(GTGTask task) | 91 | public IDictionary<string, object> CreateTask(GTGTask task) |
401 | 85 | { | 92 | { |
402 | 86 | try | 93 | try |
403 | 87 | { | 94 | { |
405 | 88 | return GTG.new_task(task.StatusString, task.Title, task.DueDateString, task.StartDateString, | 95 | Log.Debug("Creating GTG task "+task.Title); |
406 | 96 | //We want add tags also to the body of task as classic | ||
407 | 97 | task.Text = String.Join(", ",task.TagsArray) + task.Text +"\n"; | ||
408 | 98 | var returnedTask = GTG.new_task(task.StatusString, task.Title, task.DueDateString, task.StartDateString, | ||
409 | 89 | task.DoneDateString, task.TagsArray, task.Text, task.SubTasksString); | 99 | task.DoneDateString, task.TagsArray, task.Text, task.SubTasksString); |
452 | 90 | } | 100 | Log.Debug("GTG task created with id "+returnedTask["id"]); |
453 | 91 | catch (Exception) | 101 | return returnedTask; |
454 | 92 | { | 102 | } |
455 | 93 | return ""; | 103 | catch (Exception) |
456 | 94 | } | 104 | { |
457 | 95 | } | 105 | return null; |
458 | 96 | 106 | } | |
459 | 97 | public string OpenTaskEditor(string taskId) | 107 | } |
460 | 98 | { | 108 | |
461 | 99 | try | 109 | public void OpenTaskEditor(string taskId) |
462 | 100 | { | 110 | { |
463 | 101 | return GTG.open_task_editor(taskId); | 111 | try |
464 | 102 | } | 112 | { |
465 | 103 | catch (Exception) | 113 | Log.Debug("Opening GTG task editor "+taskId); |
466 | 104 | { | 114 | GTG.open_task_editor(taskId); |
467 | 105 | return ""; | 115 | } |
468 | 106 | } | 116 | catch (Exception) |
469 | 107 | } | 117 | { |
470 | 108 | 118 | ||
471 | 109 | public string CompleteTask(GTGTask task) | 119 | } |
472 | 110 | { | 120 | } |
473 | 111 | try | 121 | |
474 | 112 | { | 122 | public void CompleteTask(GTGTask task) |
475 | 113 | return GTG.modify_task(task.TaskId, task.GetTaskData()); | 123 | { |
476 | 114 | } | 124 | try |
477 | 115 | catch (Exception) | 125 | { |
478 | 116 | { | 126 | Log.Debug("Modifying GTG task "+task.Title); |
479 | 117 | return ""; | 127 | GTG.modify_task(task.TaskId, task.GetTaskData()); |
480 | 118 | } | 128 | } |
481 | 119 | } | 129 | catch (Exception) |
482 | 120 | 130 | { | |
483 | 121 | public string DeleteTask(string taskId) | 131 | |
484 | 122 | { | 132 | } |
485 | 123 | try | 133 | } |
486 | 124 | { | 134 | |
487 | 125 | return GTG.delete_task(taskId); | 135 | public void DeleteTask(string taskId) |
488 | 126 | } | 136 | { |
489 | 127 | catch (Exception) | 137 | try |
490 | 128 | { | 138 | { |
491 | 129 | return ""; | 139 | Log.Debug("Delete GTG task "+taskId); |
492 | 130 | } | 140 | GTG.delete_task(taskId); |
493 | 131 | } | 141 | } |
494 | 142 | catch (Exception) | ||
495 | 143 | { | ||
496 | 144 | |||
497 | 145 | } | ||
498 | 146 | } | ||
499 | 147 | |||
500 | 148 | public void ShowTaskBrowser() | ||
501 | 149 | { | ||
502 | 150 | try | ||
503 | 151 | { | ||
504 | 152 | Log.Debug("Showing GTG task browser"); | ||
505 | 153 | GTG.show_task_browser(); | ||
506 | 154 | } | ||
507 | 155 | catch (Exception) | ||
508 | 156 | { | ||
509 | 157 | |||
510 | 158 | } | ||
511 | 159 | } | ||
512 | 160 | |||
513 | 161 | |||
514 | 132 | } | 162 | } |
515 | 133 | } | 163 | } |
516 | 134 | \ No newline at end of file | 164 | \ No newline at end of file |
517 | 135 | 165 | ||
518 | === modified file 'GTG/src/GTGTask.cs' | |||
519 | --- GTG/src/GTGTask.cs 2010-05-01 10:59:54 +0000 | |||
520 | +++ GTG/src/GTGTask.cs 2010-10-13 08:39:47 +0000 | |||
521 | @@ -169,9 +169,10 @@ | |||
522 | 169 | get { return ""; } | 169 | get { return ""; } |
523 | 170 | } | 170 | } |
524 | 171 | 171 | ||
526 | 172 | public Hashtable GetTaskData() | 172 | public IDictionary<string, object> GetTaskData() |
527 | 173 | { | 173 | { |
529 | 174 | Hashtable taskData = new Hashtable(); | 174 | //Hashtable taskData = new Hashtable(); |
530 | 175 | var taskData = new Dictionary<string, object>(); | ||
531 | 175 | 176 | ||
532 | 176 | taskData.Add("status", this.StatusString); | 177 | taskData.Add("status", this.StatusString); |
533 | 177 | taskData.Add("title", this.Title); | 178 | taskData.Add("title", this.Title); |
534 | 178 | 179 | ||
535 | === modified file 'GTG/src/GTGTaskItemSource.cs' | |||
536 | --- GTG/src/GTGTaskItemSource.cs 2010-05-01 10:59:54 +0000 | |||
537 | +++ GTG/src/GTGTaskItemSource.cs 2010-10-13 08:39:47 +0000 | |||
538 | @@ -66,7 +66,8 @@ | |||
539 | 66 | public override void UpdateItems() | 66 | public override void UpdateItems() |
540 | 67 | { | 67 | { |
541 | 68 | items.Clear(); | 68 | items.Clear(); |
543 | 69 | 69 | ||
544 | 70 | |||
545 | 70 | foreach (IDictionary<string, object> item in gtg.GetActiveTasks()) | 71 | foreach (IDictionary<string, object> item in gtg.GetActiveTasks()) |
546 | 71 | { | 72 | { |
547 | 72 | items.Add(new GTGTask((string)item["id"], (string)item["title"])); | 73 | items.Add(new GTGTask((string)item["id"], (string)item["title"])); |
548 | 73 | 74 | ||
549 | === modified file 'configure.ac' | |||
550 | --- configure.ac 2010-03-08 02:43:56 +0000 | |||
551 | +++ configure.ac 2010-10-13 08:39:47 +0000 | |||
552 | @@ -313,6 +313,8 @@ | |||
553 | 313 | GoogleMaps/Resources/GoogleMaps.addin.xml | 313 | GoogleMaps/Resources/GoogleMaps.addin.xml |
554 | 314 | GoogleSearch/Makefile | 314 | GoogleSearch/Makefile |
555 | 315 | GoogleSearch/Resources/GoogleSearch.addin.xml | 315 | GoogleSearch/Resources/GoogleSearch.addin.xml |
556 | 316 | GTG/Makefile | ||
557 | 317 | GTG/Resources/GTG.addin.xml | ||
558 | 316 | ImageShack/Makefile | 318 | ImageShack/Makefile |
559 | 317 | ImageShack/Resources/ImageShack.addin.xml | 319 | ImageShack/Resources/ImageShack.addin.xml |
560 | 318 | JIRA/Makefile | 320 | JIRA/Makefile |