summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccessxml.cpp4
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 55f268b..c0d8dfc 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -1,49 +1,50 @@
1#include <errno.h> 1#include <errno.h>
2#include <fcntl.h> 2#include <fcntl.h>
3 3
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include <sys/stat.h> 5#include <sys/stat.h>
6#include <sys/types.h> 6#include <sys/types.h>
7 7
8#include <unistd.h> 8#include <unistd.h>
9 9
10 10
11#include <qfile.h> 11#include <qfile.h>
12#include <qvector.h> 12#include <qvector.h>
13 13
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/stringutil.h> 15#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 16#include <qpe/timeconversion.h>
17 17
18#include "orecur.h"
18#include "otodoaccessxml.h" 19#include "otodoaccessxml.h"
19 20
20namespace { 21namespace {
21 // FROM TT again 22 // FROM TT again
22char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) 23char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
23{ 24{
24 char needleChar; 25 char needleChar;
25 char haystackChar; 26 char haystackChar;
26 if (!needle || !haystack || !hLen || !nLen) 27 if (!needle || !haystack || !hLen || !nLen)
27 return 0; 28 return 0;
28 29
29 const char* hsearch = haystack; 30 const char* hsearch = haystack;
30 31
31 if ((needleChar = *needle++) != 0) { 32 if ((needleChar = *needle++) != 0) {
32 nLen--; //(to make up for needle++) 33 nLen--; //(to make up for needle++)
33 do { 34 do {
34 do { 35 do {
35 if ((haystackChar = *hsearch++) == 0) 36 if ((haystackChar = *hsearch++) == 0)
36 return (0); 37 return (0);
37 if (hsearch >= haystack + hLen) 38 if (hsearch >= haystack + hLen)
38 return (0); 39 return (0);
39 } while (haystackChar != needleChar); 40 } while (haystackChar != needleChar);
40 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 41 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
41 hsearch--; 42 hsearch--;
42 } 43 }
43 return ((char *)hsearch); 44 return ((char *)hsearch);
44} 45}
45} 46}
46 47
47 48
48OTodoAccessXML::OTodoAccessXML( const QString& appName, 49OTodoAccessXML::OTodoAccessXML( const QString& appName,
49 const QString& fileName ) 50 const QString& fileName )
@@ -405,65 +406,66 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
405 406
406 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 407 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
407 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 408 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
408 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 409 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
409 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 410 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
410 411
411 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 412 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
412 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 413 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
413 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 414 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
414 415
415 if ( ev.hasDueDate() ) { 416 if ( ev.hasDueDate() ) {
416 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; 417 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" ";
417 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; 418 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
418 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; 419 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
419 } 420 }
420// qWarning( "Uid %d", ev.uid() ); 421// qWarning( "Uid %d", ev.uid() );
421 str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; 422 str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
422 423
423// append the extra options 424// append the extra options
424 /* FIXME Qtopia::Record this is currently not 425 /* FIXME Qtopia::Record this is currently not
425 * possible you can set custom fields 426 * possible you can set custom fields
426 * but don' iterate over the list 427 * but don' iterate over the list
427 * I may do #define private protected 428 * I may do #define private protected
428 * for this case - cough --zecke 429 * for this case - cough --zecke
429 */ 430 */
430 /* 431 /*
431 QMap<QString, QString> extras = ev.extras(); 432 QMap<QString, QString> extras = ev.extras();
432 QMap<QString, QString>::Iterator extIt; 433 QMap<QString, QString>::Iterator extIt;
433 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 434 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
434 str += extIt.key() + "=\"" + extIt.data() + "\" "; 435 str += extIt.key() + "=\"" + extIt.data() + "\" ";
435 */ 436 */
436 // cross refernce 437 // cross refernce
437 438 if ( ev.hasRecurrence() )
439 str += ev.recurrence().toString();
438 440
439 return str; 441 return str;
440} 442}
441QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 443QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
442 return Qtopia::Record::idsToString( ints ); 444 return Qtopia::Record::idsToString( ints );
443} 445}
444 446
445/* internal class for sorting 447/* internal class for sorting
446 * 448 *
447 * Inspired by todoxmlio.cpp from TT 449 * Inspired by todoxmlio.cpp from TT
448 */ 450 */
449 451
450struct OTodoXMLContainer { 452struct OTodoXMLContainer {
451 OTodo todo; 453 OTodo todo;
452}; 454};
453 455
454namespace { 456namespace {
455 inline QString string( const OTodo& todo) { 457 inline QString string( const OTodo& todo) {
456 return todo.summary().isEmpty() ? 458 return todo.summary().isEmpty() ?
457 todo.description().left(20 ) : 459 todo.description().left(20 ) :
458 todo.summary(); 460 todo.summary();
459 } 461 }
460 inline int completed( const OTodo& todo1, const OTodo& todo2) { 462 inline int completed( const OTodo& todo1, const OTodo& todo2) {
461 int ret = 0; 463 int ret = 0;
462 if ( todo1.isCompleted() ) ret++; 464 if ( todo1.isCompleted() ) ret++;
463 if ( todo2.isCompleted() ) ret--; 465 if ( todo2.isCompleted() ) ret--;
464 return ret; 466 return ret;
465 } 467 }
466 inline int priority( const OTodo& t1, const OTodo& t2) { 468 inline int priority( const OTodo& t1, const OTodo& t2) {
467 return ( t1.priority() - t2.priority() ); 469 return ( t1.priority() - t2.priority() );
468 } 470 }
469 inline int description( const OTodo& t1, const OTodo& t2) { 471 inline int description( const OTodo& t1, const OTodo& t2) {
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 55f268b..c0d8dfc 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -1,49 +1,50 @@
1#include <errno.h> 1#include <errno.h>
2#include <fcntl.h> 2#include <fcntl.h>
3 3
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include <sys/stat.h> 5#include <sys/stat.h>
6#include <sys/types.h> 6#include <sys/types.h>
7 7
8#include <unistd.h> 8#include <unistd.h>
9 9
10 10
11#include <qfile.h> 11#include <qfile.h>
12#include <qvector.h> 12#include <qvector.h>
13 13
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/stringutil.h> 15#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 16#include <qpe/timeconversion.h>
17 17
18#include "orecur.h"
18#include "otodoaccessxml.h" 19#include "otodoaccessxml.h"
19 20
20namespace { 21namespace {
21 // FROM TT again 22 // FROM TT again
22char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) 23char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
23{ 24{
24 char needleChar; 25 char needleChar;
25 char haystackChar; 26 char haystackChar;
26 if (!needle || !haystack || !hLen || !nLen) 27 if (!needle || !haystack || !hLen || !nLen)
27 return 0; 28 return 0;
28 29
29 const char* hsearch = haystack; 30 const char* hsearch = haystack;
30 31
31 if ((needleChar = *needle++) != 0) { 32 if ((needleChar = *needle++) != 0) {
32 nLen--; //(to make up for needle++) 33 nLen--; //(to make up for needle++)
33 do { 34 do {
34 do { 35 do {
35 if ((haystackChar = *hsearch++) == 0) 36 if ((haystackChar = *hsearch++) == 0)
36 return (0); 37 return (0);
37 if (hsearch >= haystack + hLen) 38 if (hsearch >= haystack + hLen)
38 return (0); 39 return (0);
39 } while (haystackChar != needleChar); 40 } while (haystackChar != needleChar);
40 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 41 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
41 hsearch--; 42 hsearch--;
42 } 43 }
43 return ((char *)hsearch); 44 return ((char *)hsearch);
44} 45}
45} 46}
46 47
47 48
48OTodoAccessXML::OTodoAccessXML( const QString& appName, 49OTodoAccessXML::OTodoAccessXML( const QString& appName,
49 const QString& fileName ) 50 const QString& fileName )
@@ -405,65 +406,66 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
405 406
406 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 407 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
407 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 408 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
408 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 409 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
409 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 410 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
410 411
411 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 412 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
412 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 413 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
413 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 414 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
414 415
415 if ( ev.hasDueDate() ) { 416 if ( ev.hasDueDate() ) {
416 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; 417 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" ";
417 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; 418 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
418 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; 419 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
419 } 420 }
420// qWarning( "Uid %d", ev.uid() ); 421// qWarning( "Uid %d", ev.uid() );
421 str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; 422 str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
422 423
423// append the extra options 424// append the extra options
424 /* FIXME Qtopia::Record this is currently not 425 /* FIXME Qtopia::Record this is currently not
425 * possible you can set custom fields 426 * possible you can set custom fields
426 * but don' iterate over the list 427 * but don' iterate over the list
427 * I may do #define private protected 428 * I may do #define private protected
428 * for this case - cough --zecke 429 * for this case - cough --zecke
429 */ 430 */
430 /* 431 /*
431 QMap<QString, QString> extras = ev.extras(); 432 QMap<QString, QString> extras = ev.extras();
432 QMap<QString, QString>::Iterator extIt; 433 QMap<QString, QString>::Iterator extIt;
433 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 434 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
434 str += extIt.key() + "=\"" + extIt.data() + "\" "; 435 str += extIt.key() + "=\"" + extIt.data() + "\" ";
435 */ 436 */
436 // cross refernce 437 // cross refernce
437 438 if ( ev.hasRecurrence() )
439 str += ev.recurrence().toString();
438 440
439 return str; 441 return str;
440} 442}
441QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 443QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
442 return Qtopia::Record::idsToString( ints ); 444 return Qtopia::Record::idsToString( ints );
443} 445}
444 446
445/* internal class for sorting 447/* internal class for sorting
446 * 448 *
447 * Inspired by todoxmlio.cpp from TT 449 * Inspired by todoxmlio.cpp from TT
448 */ 450 */
449 451
450struct OTodoXMLContainer { 452struct OTodoXMLContainer {
451 OTodo todo; 453 OTodo todo;
452}; 454};
453 455
454namespace { 456namespace {
455 inline QString string( const OTodo& todo) { 457 inline QString string( const OTodo& todo) {
456 return todo.summary().isEmpty() ? 458 return todo.summary().isEmpty() ?
457 todo.description().left(20 ) : 459 todo.description().left(20 ) :
458 todo.summary(); 460 todo.summary();
459 } 461 }
460 inline int completed( const OTodo& todo1, const OTodo& todo2) { 462 inline int completed( const OTodo& todo1, const OTodo& todo2) {
461 int ret = 0; 463 int ret = 0;
462 if ( todo1.isCompleted() ) ret++; 464 if ( todo1.isCompleted() ) ret++;
463 if ( todo2.isCompleted() ) ret--; 465 if ( todo2.isCompleted() ) ret--;
464 return ret; 466 return ret;
465 } 467 }
466 inline int priority( const OTodo& t1, const OTodo& t2) { 468 inline int priority( const OTodo& t1, const OTodo& t2) {
467 return ( t1.priority() - t2.priority() ); 469 return ( t1.priority() - t2.priority() );
468 } 470 }
469 inline int description( const OTodo& t1, const OTodo& t2) { 471 inline int description( const OTodo& t1, const OTodo& t2) {