summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TodoItem.cpp44
-rw-r--r--core/pim/today/TodoItem.h40
-rw-r--r--core/pim/today/changelog5
-rw-r--r--core/pim/today/minidom.c446
-rw-r--r--core/pim/today/minidom.h57
-rw-r--r--core/pim/today/opie-today.control2
6 files changed, 6 insertions, 588 deletions
diff --git a/core/pim/today/TodoItem.cpp b/core/pim/today/TodoItem.cpp
deleted file mode 100644
index 5654687..0000000
--- a/core/pim/today/TodoItem.cpp
+++ b/dev/null
@@ -1,44 +0,0 @@
1/*
2 * TodoItem.h
3 *
4 * ---------------------
5 *
6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de
9 *
10 */
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19
20
21#include "TodoItem.h"
22
23TodoItem::TodoItem(const char *description, int completed, int priority)
24{
25 m_description = description;
26 m_completed = completed;
27 m_priority = priority;
28}
29
30QString TodoItem::getDescription()
31{
32 return m_description;
33}
34
35bool TodoItem::getCompleted()
36{
37 return (m_completed == 1);
38}
39
40int TodoItem::getPriority()
41{
42 return m_priority;
43}
44
diff --git a/core/pim/today/TodoItem.h b/core/pim/today/TodoItem.h
deleted file mode 100644
index abdb215..0000000
--- a/core/pim/today/TodoItem.h
+++ b/dev/null
@@ -1,40 +0,0 @@
1/*
2 * TodoItem.h
3 *
4 * ---------------------
5 *
6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de
9 *
10 */
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19
20
21#ifndef TODO_ITEM_H
22#define TODO_ITEM_H
23
24#include <qstring.h>
25
26class TodoItem
27{
28 public:
29 TodoItem(const char *description, int completed, int priority);
30 QString getDescription();
31 bool getCompleted();
32 int getPriority();
33 private:
34 QString m_description;
35 int m_priority;
36 int m_completed;
37};
38
39#endif
40
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index 8ccff3c..c5d20ce 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,2 +1,7 @@
10.3.1
2
3
4* bugfixes in calendar part, now location and note are working again.
5
10.3.0 60.3.0
2 7
diff --git a/core/pim/today/minidom.c b/core/pim/today/minidom.c
deleted file mode 100644
index 4155f48..0000000
--- a/core/pim/today/minidom.c
+++ b/dev/null
@@ -1,446 +0,0 @@
1/*
2 * The GGZ Gaming Zone Metaserver Project
3 * Copyright (C) 2001 Josef Spillner, dr_maux@users.sourceforge.net
4 * Published under GNU GPL conditions.
5 */
6
7#include <stdio.h>
8#include <string.h>
9#include <stdlib.h>
10#include "minidom.h"
11
12/* Remove all line breaks, spaces, tabs, and check/remove XML header */
13char *minidom_cleanstream(const char *stream)
14{
15 static char *cs = NULL;
16 unsigned int i, j;
17 int inside;
18 int spaceprotect;
19 int spacesonly;
20
21 if(!stream) return NULL;
22 if(cs)
23 {
24 free(cs);
25 cs = NULL;
26 }
27 cs = (char*)malloc(strlen(stream) + 1);
28
29 j = 0;
30 inside = 0;
31 spaceprotect = 0;
32 spacesonly = 0;
33 for(i = 0; i < strlen(stream); i++)
34 {
35 if(stream[i] == '\t') continue;
36 if(stream[i] == '\n')
37 {
38 if(inside)
39 {
40 cs[j] = ' ';
41 j++;
42 }
43 continue;
44 }
45 if((!inside) && (!spaceprotect) && (stream[i] == ' ')) continue;
46 if((stream[i] != ' ') && (stream[i] != '<') && (spacesonly)) spacesonly = 0;
47 if(stream[i] == '<')
48 {
49 if(spacesonly) j = spacesonly;
50 spacesonly = 0;
51 inside = 1;
52 if(stream[i + 1] == '?') inside = 2;
53 spaceprotect = 0;
54 if(stream[i + 1] == '/') spaceprotect = -1;
55 }
56 if(inside != 2)
57 {
58 cs[j] = stream[i];
59 j++;
60 }
61 if(stream[i] == '>')
62 {
63 inside = 0;
64 spaceprotect++; /* 1 on opening tag, 0 on closing tag */
65 if(stream[i - 1] == '/') spaceprotect = 0;
66 spacesonly = j;
67 }
68 }
69 cs[j] = 0;
70
71 /*printf("DEBUG: cleanstream: return %s\n", cs);*/
72 return cs;
73}
74
75/* Return position of c or -1 if not found */
76int strpos(const char *s, char c)
77{
78 unsigned int i;
79
80 if(!s) return -1;
81 for(i = 0; i < strlen(s); i++)
82 if(s[i] == c) return i;
83 return -1;
84}
85
86/* Add a complete tag to an element, return the new child */
87ELE *minidom_makechild(ELE *parent, char *tag)
88{
89 char *token;
90 int i, j, k, l, len, size, count;
91 ELE *ele;
92 ATT *att;
93 int pos;
94
95 if(!tag) return parent;
96
97 ele = (ELE*)malloc(sizeof(ELE));
98 ele->parent = parent;
99 ele->name = NULL;
100 ele->value = NULL;
101 ele->at = NULL;
102 ele->el = NULL;
103 ele->elnum = 0;
104 ele->atnum = 0;
105
106 if(parent)
107 {
108 parent->elnum++;
109 parent->el = (ELE**)realloc(parent->el, (parent->elnum + 1) * sizeof(ELE*));
110 parent->el[parent->elnum - 1] = ele;
111 parent->el[parent->elnum] = NULL;
112 }
113
114 /*printf("TAG: %s\n", tag);*/
115 i = 0;
116 k = 0;
117 l = 0;
118 count = 0;
119 token = strdup(tag);
120 len = strlen(tag);
121 for(j = 0; j < len; j++)
122 {
123 if(tag[j] == '\"') k++;
124 if(tag[j] == '\'') k++;
125 if(tag[j] == '=') l++;
126 if(((tag[j] == ' ') && ((k == 2) || (l == 0))) || (j == len - 1))
127 {
128 size = j - i;
129 if(j == len - 1) size++;
130 strncpy(token, tag + i, size);
131 token[size] = 0;
132 /*printf("ATTRIBUTE: %s\n", token);*/
133 if(count == 0)
134 {
135 /* name */
136 /*printf(" ** %s\n", token);*/
137 ele->name = (char*)malloc(strlen(token) + 1);
138 strcpy(ele->name, token);
139 }
140 else
141 {
142 att = (ATT*)malloc(sizeof(ATT));
143 pos = strpos(token, '=');
144 if(pos == -1)
145 {
146 att->name = strdup(token);
147 att->value = NULL;
148 }
149 else
150 {
151 att->name = (char*)malloc(pos + 1);
152 att->value = (char*)malloc(strlen(token) - pos + 1);
153 memcpy(att->name, token, pos);
154 memcpy(att->value, token + pos + 1 + 1, strlen(token) - pos - 1 - 2); /* exclude "" marks */
155 att->name[pos] = 0;
156 att->value[strlen(token) - pos - 1 - 2] = 0;
157 }
158 ele->atnum++;
159 ele->at = (ATT**)realloc(ele->at, (ele->atnum + 1) * sizeof(ATT*));
160 ele->at[ele->atnum - 1] = att;
161 ele->at[ele->atnum] = NULL;
162 }
163 i = j + 1;
164 k = 0;
165 l = 0;
166 count++;
167 }
168 }
169 free(token);
170
171 return ele;
172}
173
174/* Parses a stream to add its contents to a DOM */
175DOM *minidom_parse(const char *stream)
176{
177 DOM *dom;
178 char *cs;
179 unsigned int i;
180 int mark, lastmark;
181 char *token;
182 int error = 0;
183 ELE *ele, *cp; /* root node and current pointer */
184 int endtag;
185
186 if(!stream) return NULL;
187 cs = minidom_cleanstream(stream);
188
189 dom = (DOM*)malloc(sizeof(DOM));
190 dom->processed = 0;
191 dom->valid = 0;
192 dom->el = NULL;
193
194 /*ele = (ELE*)malloc(sizeof(ELE));*/ /* memory loss! */
195 /*ele->parent = NULL;
196 ele->name = NULL;
197 ele->value = NULL;
198 ele->el = NULL;
199 ele->at = NULL;
200 ele->elnum = 0;*/
201 ele = NULL;
202 cp = NULL;
203 token = NULL;
204 mark = -1;
205 error = 0;
206 lastmark = 0;
207 endtag = 0;
208 for(i = 0; i < strlen(cs); i++)
209 {
210 if(cs[i] == '<')
211 {
212 if(mark == -1) mark = i + 1;
213 else error = 1;
214 if((int)i != lastmark)
215 {
216 if(token) free(token);
217 token = (char*)malloc(i - lastmark + 1);
218 memcpy(token, cs + lastmark, i - lastmark);
219 token[i - lastmark] = 0;
220 /*printf(" --> content: %s\n", token);*/
221 cp->value = (char*)malloc(strlen(token) + 1);
222 strcpy(cp->value, token);
223 }
224 }
225 if(cs[i] == '>')
226 {
227 if(mark != -1)
228 {
229 if(token) free(token);
230 token = (char*)malloc(i - mark + 1);
231 memcpy(token, cs + mark, i - mark);
232 token[i - mark] = 0;
233 /*printf("--> token: %s\n", token);*/
234 if((token[0] == '/') && (cp)) cp = cp->parent;
235 else
236 {
237 if(token[i - mark - 1] == '/')
238 {
239 token[i - mark - 1] = 0;
240 /*cp = cp->parent;*/
241 endtag = 1;
242 }
243 /*printf("INSERT AT: %i\n", cp);*/
244 cp = minidom_makechild(cp, token);
245 if((cp) && (!ele)) ele = cp;
246 /*if(cp) cp = cp->parent;*/ /* QUICK HACK?! */
247 if(endtag)
248 {
249 if(cp) cp = cp->parent;
250 endtag = 0;
251 }
252 }
253 mark = -1;
254 lastmark = i + 1;
255 }
256 else error = 1;
257 }
258 }
259
260 dom->valid = !error;
261 dom->processed = 1;
262 dom->el = ele;
263
264 return dom;
265}
266
267/* Loads an XML file and return the DOM */
268DOM *minidom_load(const char *file)
269{
270 DOM *dom;
271 FILE *f;
272 char buf[1024];
273 char *buffer;
274
275 f = fopen(file, "r");
276 if(!f) return NULL;
277
278 buffer = (char*)malloc(1);
279 strcpy(buffer, "");
280 while(fgets(buf, sizeof(buf), f))
281 {
282 if(strlen(buf) > 0)
283 {
284 /*printf("Got: %s\n", buf);*/
285 buffer = (char*)realloc(buffer, strlen(buffer) + strlen(buf) + 1);
286 /*buf[strlen(buf) - 1] = 0;*/
287 /*printf("Add: %s", buf);*/
288 strcat(buffer, buf);
289 }
290 }
291 fclose(f);
292
293 /*printf("DEBUG: ready!\n");
294 printf("DEBUG: load: parse %s\n", buffer);*/
295 dom = minidom_parse(buffer);
296 free(buffer);
297
298 return dom;
299}
300
301 void minidom_internal_dump(ELE *ele); /* forward decl */
302
303/* Dump out the DOM in XML format */
304/* FIXME: return a char* and print this if dump is needed */
305void minidom_dump(DOM *dom)
306{
307 if(!dom) return;
308 if(!dom->processed)
309 {
310 printf("ERROR: DOM is incomplete!\n");
311 return;
312 }
313 if(!dom->valid)
314 {
315 printf("ERROR: DOM is invalid!\n");
316 return;
317 }
318 if(!dom->el)
319 {
320 printf("ERROR: DOM is empty!\n");/* is this really an error? */
321 return;
322 }
323 minidom_internal_dump(dom->el);
324}
325
326void minidom_internal_dump(ELE *ele)
327{
328 int i;
329 static int indent = 0;
330 static int start = 0;
331
332 if(!ele) return;
333 if(!start)
334 {
335 start = 1;
336 printf("<?xml version=\"1.0\"?>\n");
337 }
338 indent++;
339 for(i = 0; i < (indent - 1) * 2; i++)
340 printf(" ");
341 printf("<%s", ele->name);
342
343 i = 0;
344 while((ele->at) && (ele->at[i]))
345 {
346 if(ele->at[i]->value)
347 printf(" %s=\"%s\"", ele->at[i]->name, ele->at[i]->value);
348 else
349 printf(" %s", ele->at[i]->name);
350 i++;
351 }
352
353 if((!ele->value) && (!ele->el)) printf("/");
354 printf(">\n");
355 if(ele->value)
356 {
357 for(i = 0; i < (indent - 1) * 2; i++)
358 printf(" ");
359 printf(" %s\n", ele->value);
360 }
361
362 i = 0;
363 while((ele->el) && (ele->el[i]))
364 {
365 minidom_internal_dump(ele->el[i]);
366 i++;
367 }
368
369 if((ele->value) || (ele->el))
370 {
371 for(i = 0; i < (indent -1) * 2; i++)
372 printf(" ");
373 printf("</%s>\n", ele->name);
374 }
375 indent--;
376}
377
378/* Clean up after all operations */
379void minidom_free(DOM *dom)
380{
381 if(!dom) return;
382 free(dom);
383 dom = NULL;
384}
385
386/* Query a list of elements */
387ELE **MD_querylist(ELE *parent, const char *name)
388{
389 static ELE **elelist = NULL;
390 int i, j;
391
392 if(!parent) return NULL;
393 /*if(elelist)
394 {
395 i = 0;
396 while(elelist[i])
397 {
398 free(elelist[i]);
399 i++;
400 }
401 free(elelist);
402 elelist = NULL;
403 }*/ /* MEMORY HOLE !*/
404
405 i = 0;
406 j = 1;
407 while((parent->el) && (parent->el[i]))
408 {
409 if(!strcmp(parent->el[i]->name, name))
410 {
411 elelist = (ELE**)malloc((j + 1) * sizeof(ELE*));
412 elelist[j - 1] = parent->el[i];
413 elelist[j] = NULL;
414 j++;
415 }
416 i++;
417 }
418
419 return elelist;
420}
421
422/* Query a single element */
423ELE *MD_query(ELE *parent, const char *name)
424{
425 ELE **elelist;
426
427 elelist = MD_querylist(parent, name);
428 if((elelist) && (elelist[0])) return elelist[0];
429 return NULL;
430}
431
432/* Get an attribute's value */
433char *MD_att(ELE *element, const char *name)
434{
435 int i;
436
437 if((!element) || (!element->at)) return NULL;
438 i = 0;
439 while((element->at[i]))
440 {
441 if(!strcmp(element->at[i]->name, name)) return element->at[i]->value;
442 i++;
443 }
444 return NULL;
445}
446
diff --git a/core/pim/today/minidom.h b/core/pim/today/minidom.h
deleted file mode 100644
index caa4d4a..0000000
--- a/core/pim/today/minidom.h
+++ b/dev/null
@@ -1,57 +0,0 @@
1/*
2 * The GGZ Gaming Zone Metaserver Project
3 * Copyright (C) 2001 Josef Spillner, dr_maux@users.sourceforge.net
4 * Published under GNU GPL conditions.
5 */
6
7#ifndef MINIDOM_H
8#define MINIDOM_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14struct att_t
15{
16 char *name; /* name of the attribute */
17 char *value; /* value of the attribute */
18};
19
20struct ele_t
21{
22 struct ele_t *parent;/* pointer to the parent */
23 struct ele_t **el; /* list of child elements */
24 struct att_t **at; /* list of attributes */
25 char *name; /* tag identifier */
26 char *value; /* value inside the tag*/
27 int elnum; /* number of child elements [redundant] */
28 int atnum; /* number of attribute pairs [redundant] */
29};
30
31struct dom_t
32{
33 struct ele_t *el; /* the root node (may be NULL) */
34 int valid; /* validity of the DOM */
35 int processed; /* indicates whether you can work with it */
36};
37
38 typedef struct dom_t DOM;/* Domain Object Model */
39 typedef struct ele_t ELE;/* Elements */
40 typedef struct att_t ATT;/* Attributes */
41
42DOM *minidom_load(const char *file);
43DOM *minidom_parse(const char *stream);
44void minidom_dump(DOM *dom);
45void minidom_free(DOM *dom);
46
47ELE *MD_query(ELE *parent, const char *name);
48ELE **MD_querylist(ELE *parent, const char *name);
49
50char *MD_att(ELE *element, const char *name);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control
index 9d8444e..ce2d6b9 100644
--- a/core/pim/today/opie-today.control
+++ b/core/pim/today/opie-today.control
@@ -1,3 +1,3 @@
1Files: bin/today apps/Applications/today.desktop pics/today 1Files: bin/today apps/Applications/today.desktop pics/today/*
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications