-rw-r--r-- | libopie/libopie.pro | 2 | ||||
-rw-r--r-- | libopie/pim/orecur.cpp | 121 | ||||
-rw-r--r-- | libopie/pim/orecur.h | 12 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 31 | ||||
-rw-r--r-- | libopie2/opiecore/oglobalsettings.h | 2 | ||||
-rw-r--r-- | libopie2/opiedb/opiedb.pro | 4 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 31 | ||||
-rw-r--r-- | libopie2/opiepim/core/orecur.cpp | 121 | ||||
-rw-r--r-- | libopie2/opiepim/core/orecur.h | 12 | ||||
-rw-r--r-- | mkspecs/qws/macx-generic-g++/qmake.conf | 6 |
10 files changed, 280 insertions, 62 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index bf6b78f..94434ae 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -91,25 +91,25 @@ SOURCES = ofontmenu.cc \ | |||
91 | 91 | ||
92 | TARGET = opie | 92 | TARGET = opie |
93 | INCLUDEPATH += $(OPIEDIR)/include | 93 | INCLUDEPATH += $(OPIEDIR)/include |
94 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 94 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
95 | 95 | ||
96 | LIBS += -lqpe | 96 | LIBS += -lqpe |
97 | 97 | ||
98 | # Add SQL-Support if selected by config (eilers) | 98 | # Add SQL-Support if selected by config (eilers) |
99 | CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) | 99 | CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) |
100 | contains( CONFTEST, y ){ | 100 | contains( CONFTEST, y ){ |
101 | 101 | ||
102 | DEFINES += __USE_SQL | 102 | DEFINES += __USE_SQL |
103 | LIBS += -lopiedb2 -lsqlite | 103 | LIBS += -lopiedb2 |
104 | HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h | 104 | HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h |
105 | SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp | 105 | SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | INTERFACES = otimepickerbase.ui orecurrancebase.ui | 109 | INTERFACES = otimepickerbase.ui orecurrancebase.ui |
110 | TARGET = opie | 110 | TARGET = opie |
111 | 111 | ||
112 | TRANSLATIONS = ../i18n/de/libopie.ts \ | 112 | TRANSLATIONS = ../i18n/de/libopie.ts \ |
113 | ../i18n/nl/libopie.ts \ | 113 | ../i18n/nl/libopie.ts \ |
114 | ../i18n/xx/libopie.ts \ | 114 | ../i18n/xx/libopie.ts \ |
115 | ../i18n/en/libopie.ts \ | 115 | ../i18n/en/libopie.ts \ |
diff --git a/libopie/pim/orecur.cpp b/libopie/pim/orecur.cpp index eae1fdc..8c9ad46 100644 --- a/libopie/pim/orecur.cpp +++ b/libopie/pim/orecur.cpp | |||
@@ -447,64 +447,139 @@ void ORecur::checkOrModify() { | |||
447 | d2->hasEnd = data->hasEnd; | 447 | d2->hasEnd = data->hasEnd; |
448 | d2->end = data->end; | 448 | d2->end = data->end; |
449 | d2->create = data->create; | 449 | d2->create = data->create; |
450 | d2->rep = data->rep; | 450 | d2->rep = data->rep; |
451 | d2->app = data->app; | 451 | d2->app = data->app; |
452 | d2->list = data->list; | 452 | d2->list = data->list; |
453 | d2->start = data->start; | 453 | d2->start = data->start; |
454 | data = d2; | 454 | data = d2; |
455 | } | 455 | } |
456 | } | 456 | } |
457 | QString ORecur::toString()const { | 457 | QString ORecur::toString()const { |
458 | QString buf; | 458 | QString buf; |
459 | QMap<int, QString> recMap = toMap(); | ||
459 | 460 | ||
460 | buf += " rtype=\""; | 461 | buf += " rtype=\""; |
462 | buf += recMap[ORecur::RType]; | ||
463 | buf += "\""; | ||
464 | if (data->days > 0 ) | ||
465 | buf += " rweekdays=\"" + recMap[ORecur::RWeekdays] + "\""; | ||
466 | if ( data->pos != 0 ) | ||
467 | buf += " rposition=\"" + recMap[ORecur::RPosition] + "\""; | ||
468 | |||
469 | buf += " rfreq=\"" + recMap[ORecur::RFreq] + "\""; | ||
470 | buf += " rhasenddate=\"" + recMap[ORecur::RHasEndDate]+ "\""; | ||
471 | if ( data->hasEnd ) | ||
472 | buf += " enddt=\"" | ||
473 | + recMap[ORecur::EndDate] | ||
474 | + "\""; | ||
475 | buf += " created=\"" + recMap[ORecur::Created] + "\""; | ||
476 | |||
477 | if ( data->list.isEmpty() ) return buf; | ||
478 | buf += " exceptions=\""; | ||
479 | buf += recMap[ORecur::Exceptions]; | ||
480 | buf += "\" "; | ||
481 | |||
482 | return buf; | ||
483 | } | ||
484 | |||
485 | QString ORecur::rTypeString() const | ||
486 | { | ||
487 | QString retString; | ||
461 | switch ( data->type ) { | 488 | switch ( data->type ) { |
462 | case ORecur::Daily: | 489 | case ORecur::Daily: |
463 | buf += "Daily"; | 490 | retString = "Daily"; |
464 | break; | 491 | break; |
465 | case ORecur::Weekly: | 492 | case ORecur::Weekly: |
466 | buf += "Weekly"; | 493 | retString = "Weekly"; |
467 | break; | 494 | break; |
468 | case ORecur::MonthlyDay: | 495 | case ORecur::MonthlyDay: |
469 | buf += "MonthlyDay"; | 496 | retString = "MonthlyDay"; |
470 | break; | 497 | break; |
471 | case ORecur::MonthlyDate: | 498 | case ORecur::MonthlyDate: |
472 | buf += "MonthlyDate"; | 499 | retString = "MonthlyDate"; |
473 | break; | 500 | break; |
474 | case ORecur::Yearly: | 501 | case ORecur::Yearly: |
475 | buf += "Yearly"; | 502 | retString = "Yearly"; |
476 | break; | 503 | break; |
477 | default: | 504 | default: |
478 | buf += "NoRepeat"; | 505 | retString = "NoRepeat"; |
479 | break; | 506 | break; |
507 | |||
480 | } | 508 | } |
481 | buf += "\""; | ||
482 | if (data->days > 0 ) | ||
483 | buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; | ||
484 | if ( data->pos != 0 ) | ||
485 | buf += " rposition=\"" + QString::number(data->pos ) + "\""; | ||
486 | 509 | ||
487 | buf += " rfreq=\"" + QString::number( data->freq ) + "\""; | 510 | return retString; |
488 | buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; | 511 | } |
512 | |||
513 | QMap<QString, ORecur::RepeatType> ORecur::rTypeValueConvertMap() const | ||
514 | { | ||
515 | QMap<QString, RepeatType> convertMap; | ||
516 | |||
517 | convertMap.insert( QString( "Daily" ), ORecur::Daily ); | ||
518 | convertMap.insert( QString( "Weekly" ), ORecur::Weekly ); | ||
519 | convertMap.insert( QString( "MonthlyDay" ), ORecur::MonthlyDay ); | ||
520 | convertMap.insert( QString( "MonthlyDate" ), ORecur::MonthlyDate ); | ||
521 | convertMap.insert( QString( "Yearly" ), ORecur::Yearly ); | ||
522 | convertMap.insert( QString( "NoRepeat" ), ORecur::NoRepeat ); | ||
523 | |||
524 | return convertMap; | ||
525 | } | ||
526 | |||
527 | |||
528 | QMap<int, QString> ORecur::toMap() const | ||
529 | { | ||
530 | QMap<int, QString> retMap; | ||
531 | |||
532 | retMap.insert( ORecur::RType, rTypeString() ); | ||
533 | retMap.insert( ORecur::RWeekdays, QString::number( static_cast<int>( data->days ) ) ); | ||
534 | retMap.insert( ORecur::RPosition, QString::number(data->pos ) ); | ||
535 | retMap.insert( ORecur::RFreq, QString::number( data->freq ) ); | ||
536 | retMap.insert( ORecur::RHasEndDate, QString::number( static_cast<int>( data->hasEnd ) ) ); | ||
489 | if ( data->hasEnd ) | 537 | if ( data->hasEnd ) |
490 | buf += " enddt=\"" | 538 | retMap.insert( ORecur::EndDate, QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) ); |
491 | + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) | 539 | retMap.insert( ORecur::Created, QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) ); |
492 | + "\""; | 540 | |
493 | buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; | 541 | if ( data->list.isEmpty() ) return retMap; |
494 | 542 | ||
495 | if ( data->list.isEmpty() ) return buf; | ||
496 | // save exceptions list here!! | 543 | // save exceptions list here!! |
497 | ExceptionList::ConstIterator it; | 544 | ExceptionList::ConstIterator it; |
498 | ExceptionList list = data->list; | 545 | ExceptionList list = data->list; |
499 | buf += " exceptions=\""; | 546 | QString exceptBuf; |
500 | QDate date; | 547 | QDate date; |
501 | for ( it = list.begin(); it != list.end(); ++it ) { | 548 | for ( it = list.begin(); it != list.end(); ++it ) { |
502 | date = (*it); | 549 | date = (*it); |
503 | if ( it != list.begin() ) buf += " "; | 550 | if ( it != list.begin() ) exceptBuf += " "; |
504 | 551 | ||
505 | buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); | 552 | exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); |
506 | } | 553 | } |
507 | buf += "\" "; | ||
508 | 554 | ||
509 | return buf; | 555 | retMap.insert( ORecur::Exceptions, exceptBuf ); |
556 | |||
557 | return retMap; | ||
558 | } | ||
559 | |||
560 | void ORecur::fromMap( const QMap<int, QString>& map ) | ||
561 | { | ||
562 | QMap<QString, RepeatType> repTypeMap = rTypeValueConvertMap(); | ||
563 | |||
564 | data -> type = repTypeMap[ map [ORecur::RType] ]; | ||
565 | data -> days = (char) map[ ORecur::RWeekdays ].toInt(); | ||
566 | data -> pos = map[ ORecur::RPosition ].toInt(); | ||
567 | data -> freq = map[ ORecur::RFreq ].toInt(); | ||
568 | data -> hasEnd= map[ ORecur::RHasEndDate ].toInt() ? true : false; | ||
569 | OTimeZone utc = OTimeZone::utc(); | ||
570 | if ( data -> hasEnd ){ | ||
571 | data -> end = utc.fromUTCDateTime( (time_t) map[ ORecur::EndDate ].toLong() ).date(); | ||
572 | } | ||
573 | data -> create = utc.fromUTCDateTime( (time_t) map[ ORecur::Created ].toLong() ).date(); | ||
574 | |||
575 | #if 0 | ||
576 | // FIXME: Exceptions currently not supported... | ||
577 | // Convert the list of exceptions from QString into ExceptionList | ||
578 | data -> list.clear(); | ||
579 | QString exceptStr = map[ ORecur::Exceptions ]; | ||
580 | QStringList exceptList = QStringList::split( " ", exceptStr ); | ||
581 | ... | ||
582 | #endif | ||
583 | |||
584 | |||
510 | } | 585 | } |
diff --git a/libopie/pim/orecur.h b/libopie/pim/orecur.h index b214b3f..47901b0 100644 --- a/libopie/pim/orecur.h +++ b/libopie/pim/orecur.h | |||
@@ -1,32 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | * GPL from TT | 2 | * GPL from TT |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef OPIE_RECUR_H | 5 | #ifndef OPIE_RECUR_H |
6 | #define OPIE_RECUR_H | 6 | #define OPIE_RECUR_H |
7 | 7 | ||
8 | #include <sys/types.h> | 8 | #include <sys/types.h> |
9 | 9 | ||
10 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
11 | #include <qvaluelist.h> | 11 | #include <qvaluelist.h> |
12 | 12 | #include <qmap.h> | |
13 | 13 | ||
14 | class ORecur { | 14 | class ORecur { |
15 | public: | 15 | public: |
16 | typedef QValueList<QDate> ExceptionList; | 16 | typedef QValueList<QDate> ExceptionList; |
17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, | 17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, |
18 | MonthlyDate, Yearly }; | 18 | MonthlyDate, Yearly }; |
19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, | 19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, |
20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; | 20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; |
21 | enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, | ||
22 | EndDate, Created, Exceptions }; | ||
23 | |||
21 | ORecur(); | 24 | ORecur(); |
22 | ORecur( const ORecur& ); | 25 | ORecur( const ORecur& ); |
23 | ~ORecur(); | 26 | ~ORecur(); |
24 | 27 | ||
25 | ORecur &operator=( const ORecur& ); | 28 | ORecur &operator=( const ORecur& ); |
26 | bool operator==(const ORecur& )const; | 29 | bool operator==(const ORecur& )const; |
27 | 30 | ||
28 | bool doesRecur()const; | 31 | bool doesRecur()const; |
29 | /* if it recurrs on that day */ | 32 | /* if it recurrs on that day */ |
30 | bool doesRecur( const QDate& ); | 33 | bool doesRecur( const QDate& ); |
31 | RepeatType type()const; | 34 | RepeatType type()const; |
32 | int frequency()const; | 35 | int frequency()const; |
@@ -65,27 +68,34 @@ public: | |||
65 | void setType( const RepeatType& ); | 68 | void setType( const RepeatType& ); |
66 | void setFrequency( int freq ); | 69 | void setFrequency( int freq ); |
67 | void setPosition( int pos ); | 70 | void setPosition( int pos ); |
68 | void setDays( char c); | 71 | void setDays( char c); |
69 | void setEndDate( const QDate& dt ); | 72 | void setEndDate( const QDate& dt ); |
70 | void setStart( const QDate& dt ); | 73 | void setStart( const QDate& dt ); |
71 | void setCreatedDateTime( const QDateTime& ); | 74 | void setCreatedDateTime( const QDateTime& ); |
72 | void setHasEndDate( bool b ); | 75 | void setHasEndDate( bool b ); |
73 | void setRepitition(int ); | 76 | void setRepitition(int ); |
74 | 77 | ||
75 | void setService( const QString& ser ); | 78 | void setService( const QString& ser ); |
76 | 79 | ||
80 | QMap<int, QString> toMap() const; | ||
81 | void fromMap( const QMap<int, QString>& map ); | ||
82 | |||
77 | /* almost internal */ | 83 | /* almost internal */ |
78 | QString toString()const; | 84 | QString toString()const; |
79 | private: | 85 | private: |
80 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 86 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
81 | void deref(); | 87 | void deref(); |
82 | inline void checkOrModify(); | 88 | inline void checkOrModify(); |
83 | 89 | ||
90 | /* Converts rType to String */ | ||
91 | QString rTypeString() const; | ||
92 | /* Returns a map to convert Stringname for RType to RepeatType */ | ||
93 | QMap<QString, RepeatType> rTypeValueConvertMap() const; | ||
84 | 94 | ||
85 | class Data; | 95 | class Data; |
86 | Data* data; | 96 | Data* data; |
87 | class ORecurPrivate; | 97 | class ORecurPrivate; |
88 | ORecurPrivate *d; | 98 | ORecurPrivate *d; |
89 | }; | 99 | }; |
90 | 100 | ||
91 | #endif | 101 | #endif |
diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index ebd03bb..3913661 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp | |||
@@ -114,25 +114,27 @@ namespace { | |||
114 | QDate m_start; | 114 | QDate m_start; |
115 | QDate m_end; | 115 | QDate m_end; |
116 | bool m_inc :1; | 116 | bool m_inc :1; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
120 | CreateQuery::CreateQuery() : OSQLQuery() {} | 120 | CreateQuery::CreateQuery() : OSQLQuery() {} |
121 | CreateQuery::~CreateQuery() {} | 121 | CreateQuery::~CreateQuery() {} |
122 | QString CreateQuery::query()const { | 122 | QString CreateQuery::query()const { |
123 | QString qu; | 123 | QString qu; |
124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; | 124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; |
125 | qu += "description, summary, priority, DueDate, progress , state, "; | 125 | qu += "description, summary, priority, DueDate, progress , state, "; |
126 | qu += "Recurrence, reminders, alarms, maintainer, startdate, completeddate);"; | 126 | // This is the recurrance-stuff .. Exceptions are currently not supported (see ORecur.cpp) ! (eilers) |
127 | qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; | ||
128 | qu += "reminders, alarms, maintainer, startdate, completeddate);"; | ||
127 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; | 129 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; |
128 | return qu; | 130 | return qu; |
129 | } | 131 | } |
130 | 132 | ||
131 | LoadQuery::LoadQuery() : OSQLQuery() {} | 133 | LoadQuery::LoadQuery() : OSQLQuery() {} |
132 | LoadQuery::~LoadQuery() {} | 134 | LoadQuery::~LoadQuery() {} |
133 | QString LoadQuery::query()const { | 135 | QString LoadQuery::query()const { |
134 | QString qu; | 136 | QString qu; |
135 | // We do not need "distinct" here. The primary key is always unique.. | 137 | // We do not need "distinct" here. The primary key is always unique.. |
136 | //qu += "select distinct uid from todolist"; | 138 | //qu += "select distinct uid from todolist"; |
137 | qu += "select uid from todolist"; | 139 | qu += "select uid from todolist"; |
138 | 140 | ||
@@ -165,37 +167,45 @@ namespace { | |||
165 | sMonth= sDate.month(); | 167 | sMonth= sDate.month(); |
166 | sDay = sDate.day(); | 168 | sDay = sDate.day(); |
167 | } | 169 | } |
168 | 170 | ||
169 | int eYear = 0, eMonth = 0, eDay = 0; | 171 | int eYear = 0, eMonth = 0, eDay = 0; |
170 | if( m_todo.hasCompletedDate() ){ | 172 | if( m_todo.hasCompletedDate() ){ |
171 | QDate eDate = m_todo.completedDate(); | 173 | QDate eDate = m_todo.completedDate(); |
172 | eYear = eDate.year(); | 174 | eYear = eDate.year(); |
173 | eMonth= eDate.month(); | 175 | eMonth= eDate.month(); |
174 | eDay = eDate.day(); | 176 | eDay = eDate.day(); |
175 | } | 177 | } |
176 | QString qu; | 178 | QString qu; |
179 | QMap<int, QString> recMap = m_todo.recurrence().toMap(); | ||
177 | qu = "insert into todolist VALUES(" | 180 | qu = "insert into todolist VALUES(" |
178 | + QString::number( m_todo.uid() ) + "," | 181 | + QString::number( m_todo.uid() ) + "," |
179 | + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," | 182 | + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," |
180 | + QString::number( m_todo.isCompleted() ) + "," | 183 | + QString::number( m_todo.isCompleted() ) + "," |
181 | + "'" + m_todo.description() + "'" + "," | 184 | + "'" + m_todo.description() + "'" + "," |
182 | + "'" + m_todo.summary() + "'" + "," | 185 | + "'" + m_todo.summary() + "'" + "," |
183 | + QString::number(m_todo.priority() ) + "," | 186 | + QString::number(m_todo.priority() ) + "," |
184 | + "'" + QString::number(year) + "-" | 187 | + "'" + QString::number(year) + "-" |
185 | + QString::number(month) | 188 | + QString::number(month) |
186 | + "-" + QString::number( day ) + "'" + "," | 189 | + "-" + QString::number( day ) + "'" + "," |
187 | + QString::number( m_todo.progress() ) + "," | 190 | + QString::number( m_todo.progress() ) + "," |
188 | + QString::number( m_todo.state().state() ) + "," | 191 | + QString::number( m_todo.state().state() ) + "," |
189 | + "'" + m_todo.recurrence().toString() + "'"+ ","; | 192 | + "'" + recMap[ ORecur::RType ] + "'" + "," |
193 | + "'" + recMap[ ORecur::RWeekdays ] + "'" + "," | ||
194 | + "'" + recMap[ ORecur::RPosition ] + "'" + "," | ||
195 | + "'" + recMap[ ORecur::RFreq ] + "'" + "," | ||
196 | + "'" + recMap[ ORecur::RHasEndDate ] + "'" + "," | ||
197 | + "'" + recMap[ ORecur::EndDate ] + "'" + "," | ||
198 | + "'" + recMap[ ORecur::Created ] + "'" + "," | ||
199 | + "'" + recMap[ ORecur::Exceptions ] + "'" + ","; | ||
190 | 200 | ||
191 | if ( m_todo.hasNotifiers() ) { | 201 | if ( m_todo.hasNotifiers() ) { |
192 | OPimNotifyManager manager = m_todo.notifiers(); | 202 | OPimNotifyManager manager = m_todo.notifiers(); |
193 | qu += "'" + manager.remindersToString() + "'" + "," | 203 | qu += "'" + manager.remindersToString() + "'" + "," |
194 | + "'" + manager.alarmsToString() + "'" + ","; | 204 | + "'" + manager.alarmsToString() + "'" + ","; |
195 | } | 205 | } |
196 | else{ | 206 | else{ |
197 | qu += QString( "''" ) + "," | 207 | qu += QString( "''" ) + "," |
198 | + "''" + ","; | 208 | + "''" + ","; |
199 | } | 209 | } |
200 | 210 | ||
201 | qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) | 211 | qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) |
@@ -515,24 +525,26 @@ OTodo OTodoAccessBackendSQL::todo( const OSQLResult& res) const{ | |||
515 | for ( ; it != list.end(); ++it ) { | 525 | for ( ; it != list.end(); ++it ) { |
516 | qWarning("caching"); | 526 | qWarning("caching"); |
517 | cache( todo( (*it) ) ); | 527 | cache( todo( (*it) ) ); |
518 | } | 528 | } |
519 | return to; | 529 | return to; |
520 | } | 530 | } |
521 | OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | 531 | OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { |
522 | qWarning("todo"); | 532 | qWarning("todo"); |
523 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); | 533 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); |
524 | hasDueDate = date( dueDate, item.data("DueDate") ); | 534 | hasDueDate = date( dueDate, item.data("DueDate") ); |
525 | QStringList cats = QStringList::split(";", item.data("categories") ); | 535 | QStringList cats = QStringList::split(";", item.data("categories") ); |
526 | 536 | ||
537 | qWarning("Item is completed: %d", item.data("completed").toInt() ); | ||
538 | |||
527 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), | 539 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), |
528 | cats, item.data("summary"), item.data("description"), | 540 | cats, item.data("summary"), item.data("description"), |
529 | item.data("progress").toUShort(), hasDueDate, dueDate, | 541 | item.data("progress").toUShort(), hasDueDate, dueDate, |
530 | item.data("uid").toInt() ); | 542 | item.data("uid").toInt() ); |
531 | 543 | ||
532 | bool isOk; | 544 | bool isOk; |
533 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); | 545 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); |
534 | if ( isOk ) | 546 | if ( isOk ) |
535 | to.setPriority( prioInt ); | 547 | to.setPriority( prioInt ); |
536 | 548 | ||
537 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); | 549 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); |
538 | hasStartDate = date( startDate, item.data("startdate") ); | 550 | hasStartDate = date( startDate, item.data("startdate") ); |
@@ -543,26 +555,37 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
543 | to.setStartDate( startDate ); | 555 | to.setStartDate( startDate ); |
544 | if ( hasCompletedDate ) | 556 | if ( hasCompletedDate ) |
545 | to.setCompletedDate( completedDate ); | 557 | to.setCompletedDate( completedDate ); |
546 | 558 | ||
547 | OPimNotifyManager& manager = to.notifiers(); | 559 | OPimNotifyManager& manager = to.notifiers(); |
548 | manager.alarmsFromString( item.data("alarms") ); | 560 | manager.alarmsFromString( item.data("alarms") ); |
549 | manager.remindersFromString( item.data("reminders") ); | 561 | manager.remindersFromString( item.data("reminders") ); |
550 | 562 | ||
551 | OPimState pimState; | 563 | OPimState pimState; |
552 | pimState.setState( QString( item.data("state") ).toInt() ); | 564 | pimState.setState( QString( item.data("state") ).toInt() ); |
553 | to.setState( pimState ); | 565 | to.setState( pimState ); |
554 | 566 | ||
555 | // Recurrence not supported yet | 567 | QMap<int, QString> recMap; |
556 | // to.setRecurrence( | 568 | recMap.insert( ORecur::RType , item.data("RType") ); |
569 | recMap.insert( ORecur::RWeekdays , item.data("RWeekdays") ); | ||
570 | recMap.insert( ORecur::RPosition , item.data("RPosition") ); | ||
571 | recMap.insert( ORecur::RFreq , item.data("RFreq") ); | ||
572 | recMap.insert( ORecur::RHasEndDate, item.data("RHasEndDate") ); | ||
573 | recMap.insert( ORecur::EndDate , item.data("EndDate") ); | ||
574 | recMap.insert( ORecur::Created , item.data("Created") ); | ||
575 | recMap.insert( ORecur::Exceptions , item.data("Exceptions") ); | ||
576 | |||
577 | ORecur recur; | ||
578 | recur.fromMap( recMap ); | ||
579 | to.setRecurrence( recur ); | ||
557 | 580 | ||
558 | return to; | 581 | return to; |
559 | } | 582 | } |
560 | OTodo OTodoAccessBackendSQL::todo( int uid )const { | 583 | OTodo OTodoAccessBackendSQL::todo( int uid )const { |
561 | FindQuery find( uid ); | 584 | FindQuery find( uid ); |
562 | return todo( m_driver->query(&find) ); | 585 | return todo( m_driver->query(&find) ); |
563 | } | 586 | } |
564 | /* | 587 | /* |
565 | * update the dict | 588 | * update the dict |
566 | */ | 589 | */ |
567 | void OTodoAccessBackendSQL::fillDict() { | 590 | void OTodoAccessBackendSQL::fillDict() { |
568 | /* initialize dict */ | 591 | /* initialize dict */ |
diff --git a/libopie2/opiecore/oglobalsettings.h b/libopie2/opiecore/oglobalsettings.h index d3f357e..e3ac148 100644 --- a/libopie2/opiecore/oglobalsettings.h +++ b/libopie2/opiecore/oglobalsettings.h | |||
@@ -195,25 +195,25 @@ class OGlobalSettings | |||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * This enum describes the debug mode used for by the @ref odbgstream class. | 197 | * This enum describes the debug mode used for by the @ref odbgstream class. |
198 | * See <a href="http://opie.handhelds.org/documentation/standards/opie/style/debug/debug.html"> | 198 | * See <a href="http://opie.handhelds.org/documentation/standards/opie/style/debug/debug.html"> |
199 | * the styleguide</a>. | 199 | * the styleguide</a>. |
200 | **/ | 200 | **/ |
201 | enum Debug { | 201 | enum Debug { |
202 | /** | 202 | /** |
203 | * Debug messages are ignored. | 203 | * Debug messages are ignored. |
204 | */ | 204 | */ |
205 | DebugNone=-1, | 205 | DebugNone=-1, |
206 | /** | 206 | /** |
207 | * Debug output is sent to files /var/log/***. | 207 | * Debug output is sent to files /var/log/. |
208 | */ | 208 | */ |
209 | DebugFiles=0, | 209 | DebugFiles=0, |
210 | /** | 210 | /** |
211 | * Debug output is written in a QMessageBox. | 211 | * Debug output is written in a QMessageBox. |
212 | */ | 212 | */ |
213 | DebugMsgBox=1, | 213 | DebugMsgBox=1, |
214 | /** | 214 | /** |
215 | * Debug output is sent to stderr. | 215 | * Debug output is sent to stderr. |
216 | */ | 216 | */ |
217 | DebugStdErr=2, | 217 | DebugStdErr=2, |
218 | /** | 218 | /** |
219 | * Debug output is sent to syslog. | 219 | * Debug output is sent to syslog. |
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index bf547ab..6a4e8f1 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -20,20 +20,22 @@ SOURCES = osqlbackend.cpp \ | |||
20 | osqltable.cpp \ | 20 | osqltable.cpp \ |
21 | osqlbackendmanager.cpp \ | 21 | osqlbackendmanager.cpp \ |
22 | osqlitedriver.cpp | 22 | osqlitedriver.cpp |
23 | INTERFACES = | 23 | INTERFACES = |
24 | TARGET = opiedb2 | 24 | TARGET = opiedb2 |
25 | VERSION = 1.8.1 | 25 | VERSION = 1.8.1 |
26 | INCLUDEPATH += $(OPIEDIR)/include | 26 | INCLUDEPATH += $(OPIEDIR)/include |
27 | DEPENDPATH += $(OPIEDIR)/include | 27 | DEPENDPATH += $(OPIEDIR)/include |
28 | 28 | ||
29 | MOC_DIR = moc | 29 | MOC_DIR = moc |
30 | OBJECTS_DIR = obj | 30 | OBJECTS_DIR = obj |
31 | 31 | ||
32 | LIBS += -lsqlite -lqpe | ||
33 | |||
32 | !contains( platform, x11 ) { | 34 | !contains( platform, x11 ) { |
33 | include ( $(OPIEDIR)/include.pro ) | 35 | include ( $(OPIEDIR)/include.pro ) |
34 | } | 36 | } |
35 | 37 | ||
36 | contains( platform, x11 ) { | 38 | contains( platform, x11 ) { |
37 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 39 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
38 | } | 40 | } |
39 | 41 | ||
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index ebd03bb..3913661 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -114,25 +114,27 @@ namespace { | |||
114 | QDate m_start; | 114 | QDate m_start; |
115 | QDate m_end; | 115 | QDate m_end; |
116 | bool m_inc :1; | 116 | bool m_inc :1; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
120 | CreateQuery::CreateQuery() : OSQLQuery() {} | 120 | CreateQuery::CreateQuery() : OSQLQuery() {} |
121 | CreateQuery::~CreateQuery() {} | 121 | CreateQuery::~CreateQuery() {} |
122 | QString CreateQuery::query()const { | 122 | QString CreateQuery::query()const { |
123 | QString qu; | 123 | QString qu; |
124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; | 124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; |
125 | qu += "description, summary, priority, DueDate, progress , state, "; | 125 | qu += "description, summary, priority, DueDate, progress , state, "; |
126 | qu += "Recurrence, reminders, alarms, maintainer, startdate, completeddate);"; | 126 | // This is the recurrance-stuff .. Exceptions are currently not supported (see ORecur.cpp) ! (eilers) |
127 | qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; | ||
128 | qu += "reminders, alarms, maintainer, startdate, completeddate);"; | ||
127 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; | 129 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; |
128 | return qu; | 130 | return qu; |
129 | } | 131 | } |
130 | 132 | ||
131 | LoadQuery::LoadQuery() : OSQLQuery() {} | 133 | LoadQuery::LoadQuery() : OSQLQuery() {} |
132 | LoadQuery::~LoadQuery() {} | 134 | LoadQuery::~LoadQuery() {} |
133 | QString LoadQuery::query()const { | 135 | QString LoadQuery::query()const { |
134 | QString qu; | 136 | QString qu; |
135 | // We do not need "distinct" here. The primary key is always unique.. | 137 | // We do not need "distinct" here. The primary key is always unique.. |
136 | //qu += "select distinct uid from todolist"; | 138 | //qu += "select distinct uid from todolist"; |
137 | qu += "select uid from todolist"; | 139 | qu += "select uid from todolist"; |
138 | 140 | ||
@@ -165,37 +167,45 @@ namespace { | |||
165 | sMonth= sDate.month(); | 167 | sMonth= sDate.month(); |
166 | sDay = sDate.day(); | 168 | sDay = sDate.day(); |
167 | } | 169 | } |
168 | 170 | ||
169 | int eYear = 0, eMonth = 0, eDay = 0; | 171 | int eYear = 0, eMonth = 0, eDay = 0; |
170 | if( m_todo.hasCompletedDate() ){ | 172 | if( m_todo.hasCompletedDate() ){ |
171 | QDate eDate = m_todo.completedDate(); | 173 | QDate eDate = m_todo.completedDate(); |
172 | eYear = eDate.year(); | 174 | eYear = eDate.year(); |
173 | eMonth= eDate.month(); | 175 | eMonth= eDate.month(); |
174 | eDay = eDate.day(); | 176 | eDay = eDate.day(); |
175 | } | 177 | } |
176 | QString qu; | 178 | QString qu; |
179 | QMap<int, QString> recMap = m_todo.recurrence().toMap(); | ||
177 | qu = "insert into todolist VALUES(" | 180 | qu = "insert into todolist VALUES(" |
178 | + QString::number( m_todo.uid() ) + "," | 181 | + QString::number( m_todo.uid() ) + "," |
179 | + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," | 182 | + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," |
180 | + QString::number( m_todo.isCompleted() ) + "," | 183 | + QString::number( m_todo.isCompleted() ) + "," |
181 | + "'" + m_todo.description() + "'" + "," | 184 | + "'" + m_todo.description() + "'" + "," |
182 | + "'" + m_todo.summary() + "'" + "," | 185 | + "'" + m_todo.summary() + "'" + "," |
183 | + QString::number(m_todo.priority() ) + "," | 186 | + QString::number(m_todo.priority() ) + "," |
184 | + "'" + QString::number(year) + "-" | 187 | + "'" + QString::number(year) + "-" |
185 | + QString::number(month) | 188 | + QString::number(month) |
186 | + "-" + QString::number( day ) + "'" + "," | 189 | + "-" + QString::number( day ) + "'" + "," |
187 | + QString::number( m_todo.progress() ) + "," | 190 | + QString::number( m_todo.progress() ) + "," |
188 | + QString::number( m_todo.state().state() ) + "," | 191 | + QString::number( m_todo.state().state() ) + "," |
189 | + "'" + m_todo.recurrence().toString() + "'"+ ","; | 192 | + "'" + recMap[ ORecur::RType ] + "'" + "," |
193 | + "'" + recMap[ ORecur::RWeekdays ] + "'" + "," | ||
194 | + "'" + recMap[ ORecur::RPosition ] + "'" + "," | ||
195 | + "'" + recMap[ ORecur::RFreq ] + "'" + "," | ||
196 | + "'" + recMap[ ORecur::RHasEndDate ] + "'" + "," | ||
197 | + "'" + recMap[ ORecur::EndDate ] + "'" + "," | ||
198 | + "'" + recMap[ ORecur::Created ] + "'" + "," | ||
199 | + "'" + recMap[ ORecur::Exceptions ] + "'" + ","; | ||
190 | 200 | ||
191 | if ( m_todo.hasNotifiers() ) { | 201 | if ( m_todo.hasNotifiers() ) { |
192 | OPimNotifyManager manager = m_todo.notifiers(); | 202 | OPimNotifyManager manager = m_todo.notifiers(); |
193 | qu += "'" + manager.remindersToString() + "'" + "," | 203 | qu += "'" + manager.remindersToString() + "'" + "," |
194 | + "'" + manager.alarmsToString() + "'" + ","; | 204 | + "'" + manager.alarmsToString() + "'" + ","; |
195 | } | 205 | } |
196 | else{ | 206 | else{ |
197 | qu += QString( "''" ) + "," | 207 | qu += QString( "''" ) + "," |
198 | + "''" + ","; | 208 | + "''" + ","; |
199 | } | 209 | } |
200 | 210 | ||
201 | qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) | 211 | qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) |
@@ -515,24 +525,26 @@ OTodo OTodoAccessBackendSQL::todo( const OSQLResult& res) const{ | |||
515 | for ( ; it != list.end(); ++it ) { | 525 | for ( ; it != list.end(); ++it ) { |
516 | qWarning("caching"); | 526 | qWarning("caching"); |
517 | cache( todo( (*it) ) ); | 527 | cache( todo( (*it) ) ); |
518 | } | 528 | } |
519 | return to; | 529 | return to; |
520 | } | 530 | } |
521 | OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | 531 | OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { |
522 | qWarning("todo"); | 532 | qWarning("todo"); |
523 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); | 533 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); |
524 | hasDueDate = date( dueDate, item.data("DueDate") ); | 534 | hasDueDate = date( dueDate, item.data("DueDate") ); |
525 | QStringList cats = QStringList::split(";", item.data("categories") ); | 535 | QStringList cats = QStringList::split(";", item.data("categories") ); |
526 | 536 | ||
537 | qWarning("Item is completed: %d", item.data("completed").toInt() ); | ||
538 | |||
527 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), | 539 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), |
528 | cats, item.data("summary"), item.data("description"), | 540 | cats, item.data("summary"), item.data("description"), |
529 | item.data("progress").toUShort(), hasDueDate, dueDate, | 541 | item.data("progress").toUShort(), hasDueDate, dueDate, |
530 | item.data("uid").toInt() ); | 542 | item.data("uid").toInt() ); |
531 | 543 | ||
532 | bool isOk; | 544 | bool isOk; |
533 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); | 545 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); |
534 | if ( isOk ) | 546 | if ( isOk ) |
535 | to.setPriority( prioInt ); | 547 | to.setPriority( prioInt ); |
536 | 548 | ||
537 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); | 549 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); |
538 | hasStartDate = date( startDate, item.data("startdate") ); | 550 | hasStartDate = date( startDate, item.data("startdate") ); |
@@ -543,26 +555,37 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
543 | to.setStartDate( startDate ); | 555 | to.setStartDate( startDate ); |
544 | if ( hasCompletedDate ) | 556 | if ( hasCompletedDate ) |
545 | to.setCompletedDate( completedDate ); | 557 | to.setCompletedDate( completedDate ); |
546 | 558 | ||
547 | OPimNotifyManager& manager = to.notifiers(); | 559 | OPimNotifyManager& manager = to.notifiers(); |
548 | manager.alarmsFromString( item.data("alarms") ); | 560 | manager.alarmsFromString( item.data("alarms") ); |
549 | manager.remindersFromString( item.data("reminders") ); | 561 | manager.remindersFromString( item.data("reminders") ); |
550 | 562 | ||
551 | OPimState pimState; | 563 | OPimState pimState; |
552 | pimState.setState( QString( item.data("state") ).toInt() ); | 564 | pimState.setState( QString( item.data("state") ).toInt() ); |
553 | to.setState( pimState ); | 565 | to.setState( pimState ); |
554 | 566 | ||
555 | // Recurrence not supported yet | 567 | QMap<int, QString> recMap; |
556 | // to.setRecurrence( | 568 | recMap.insert( ORecur::RType , item.data("RType") ); |
569 | recMap.insert( ORecur::RWeekdays , item.data("RWeekdays") ); | ||
570 | recMap.insert( ORecur::RPosition , item.data("RPosition") ); | ||
571 | recMap.insert( ORecur::RFreq , item.data("RFreq") ); | ||
572 | recMap.insert( ORecur::RHasEndDate, item.data("RHasEndDate") ); | ||
573 | recMap.insert( ORecur::EndDate , item.data("EndDate") ); | ||
574 | recMap.insert( ORecur::Created , item.data("Created") ); | ||
575 | recMap.insert( ORecur::Exceptions , item.data("Exceptions") ); | ||
576 | |||
577 | ORecur recur; | ||
578 | recur.fromMap( recMap ); | ||
579 | to.setRecurrence( recur ); | ||
557 | 580 | ||
558 | return to; | 581 | return to; |
559 | } | 582 | } |
560 | OTodo OTodoAccessBackendSQL::todo( int uid )const { | 583 | OTodo OTodoAccessBackendSQL::todo( int uid )const { |
561 | FindQuery find( uid ); | 584 | FindQuery find( uid ); |
562 | return todo( m_driver->query(&find) ); | 585 | return todo( m_driver->query(&find) ); |
563 | } | 586 | } |
564 | /* | 587 | /* |
565 | * update the dict | 588 | * update the dict |
566 | */ | 589 | */ |
567 | void OTodoAccessBackendSQL::fillDict() { | 590 | void OTodoAccessBackendSQL::fillDict() { |
568 | /* initialize dict */ | 591 | /* initialize dict */ |
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp index eae1fdc..8c9ad46 100644 --- a/libopie2/opiepim/core/orecur.cpp +++ b/libopie2/opiepim/core/orecur.cpp | |||
@@ -447,64 +447,139 @@ void ORecur::checkOrModify() { | |||
447 | d2->hasEnd = data->hasEnd; | 447 | d2->hasEnd = data->hasEnd; |
448 | d2->end = data->end; | 448 | d2->end = data->end; |
449 | d2->create = data->create; | 449 | d2->create = data->create; |
450 | d2->rep = data->rep; | 450 | d2->rep = data->rep; |
451 | d2->app = data->app; | 451 | d2->app = data->app; |
452 | d2->list = data->list; | 452 | d2->list = data->list; |
453 | d2->start = data->start; | 453 | d2->start = data->start; |
454 | data = d2; | 454 | data = d2; |
455 | } | 455 | } |
456 | } | 456 | } |
457 | QString ORecur::toString()const { | 457 | QString ORecur::toString()const { |
458 | QString buf; | 458 | QString buf; |
459 | QMap<int, QString> recMap = toMap(); | ||
459 | 460 | ||
460 | buf += " rtype=\""; | 461 | buf += " rtype=\""; |
462 | buf += recMap[ORecur::RType]; | ||
463 | buf += "\""; | ||
464 | if (data->days > 0 ) | ||
465 | buf += " rweekdays=\"" + recMap[ORecur::RWeekdays] + "\""; | ||
466 | if ( data->pos != 0 ) | ||
467 | buf += " rposition=\"" + recMap[ORecur::RPosition] + "\""; | ||
468 | |||
469 | buf += " rfreq=\"" + recMap[ORecur::RFreq] + "\""; | ||
470 | buf += " rhasenddate=\"" + recMap[ORecur::RHasEndDate]+ "\""; | ||
471 | if ( data->hasEnd ) | ||
472 | buf += " enddt=\"" | ||
473 | + recMap[ORecur::EndDate] | ||
474 | + "\""; | ||
475 | buf += " created=\"" + recMap[ORecur::Created] + "\""; | ||
476 | |||
477 | if ( data->list.isEmpty() ) return buf; | ||
478 | buf += " exceptions=\""; | ||
479 | buf += recMap[ORecur::Exceptions]; | ||
480 | buf += "\" "; | ||
481 | |||
482 | return buf; | ||
483 | } | ||
484 | |||
485 | QString ORecur::rTypeString() const | ||
486 | { | ||
487 | QString retString; | ||
461 | switch ( data->type ) { | 488 | switch ( data->type ) { |
462 | case ORecur::Daily: | 489 | case ORecur::Daily: |
463 | buf += "Daily"; | 490 | retString = "Daily"; |
464 | break; | 491 | break; |
465 | case ORecur::Weekly: | 492 | case ORecur::Weekly: |
466 | buf += "Weekly"; | 493 | retString = "Weekly"; |
467 | break; | 494 | break; |
468 | case ORecur::MonthlyDay: | 495 | case ORecur::MonthlyDay: |
469 | buf += "MonthlyDay"; | 496 | retString = "MonthlyDay"; |
470 | break; | 497 | break; |
471 | case ORecur::MonthlyDate: | 498 | case ORecur::MonthlyDate: |
472 | buf += "MonthlyDate"; | 499 | retString = "MonthlyDate"; |
473 | break; | 500 | break; |
474 | case ORecur::Yearly: | 501 | case ORecur::Yearly: |
475 | buf += "Yearly"; | 502 | retString = "Yearly"; |
476 | break; | 503 | break; |
477 | default: | 504 | default: |
478 | buf += "NoRepeat"; | 505 | retString = "NoRepeat"; |
479 | break; | 506 | break; |
507 | |||
480 | } | 508 | } |
481 | buf += "\""; | ||
482 | if (data->days > 0 ) | ||
483 | buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; | ||
484 | if ( data->pos != 0 ) | ||
485 | buf += " rposition=\"" + QString::number(data->pos ) + "\""; | ||
486 | 509 | ||
487 | buf += " rfreq=\"" + QString::number( data->freq ) + "\""; | 510 | return retString; |
488 | buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; | 511 | } |
512 | |||
513 | QMap<QString, ORecur::RepeatType> ORecur::rTypeValueConvertMap() const | ||
514 | { | ||
515 | QMap<QString, RepeatType> convertMap; | ||
516 | |||
517 | convertMap.insert( QString( "Daily" ), ORecur::Daily ); | ||
518 | convertMap.insert( QString( "Weekly" ), ORecur::Weekly ); | ||
519 | convertMap.insert( QString( "MonthlyDay" ), ORecur::MonthlyDay ); | ||
520 | convertMap.insert( QString( "MonthlyDate" ), ORecur::MonthlyDate ); | ||
521 | convertMap.insert( QString( "Yearly" ), ORecur::Yearly ); | ||
522 | convertMap.insert( QString( "NoRepeat" ), ORecur::NoRepeat ); | ||
523 | |||
524 | return convertMap; | ||
525 | } | ||
526 | |||
527 | |||
528 | QMap<int, QString> ORecur::toMap() const | ||
529 | { | ||
530 | QMap<int, QString> retMap; | ||
531 | |||
532 | retMap.insert( ORecur::RType, rTypeString() ); | ||
533 | retMap.insert( ORecur::RWeekdays, QString::number( static_cast<int>( data->days ) ) ); | ||
534 | retMap.insert( ORecur::RPosition, QString::number(data->pos ) ); | ||
535 | retMap.insert( ORecur::RFreq, QString::number( data->freq ) ); | ||
536 | retMap.insert( ORecur::RHasEndDate, QString::number( static_cast<int>( data->hasEnd ) ) ); | ||
489 | if ( data->hasEnd ) | 537 | if ( data->hasEnd ) |
490 | buf += " enddt=\"" | 538 | retMap.insert( ORecur::EndDate, QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) ); |
491 | + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) | 539 | retMap.insert( ORecur::Created, QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) ); |
492 | + "\""; | 540 | |
493 | buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; | 541 | if ( data->list.isEmpty() ) return retMap; |
494 | 542 | ||
495 | if ( data->list.isEmpty() ) return buf; | ||
496 | // save exceptions list here!! | 543 | // save exceptions list here!! |
497 | ExceptionList::ConstIterator it; | 544 | ExceptionList::ConstIterator it; |
498 | ExceptionList list = data->list; | 545 | ExceptionList list = data->list; |
499 | buf += " exceptions=\""; | 546 | QString exceptBuf; |
500 | QDate date; | 547 | QDate date; |
501 | for ( it = list.begin(); it != list.end(); ++it ) { | 548 | for ( it = list.begin(); it != list.end(); ++it ) { |
502 | date = (*it); | 549 | date = (*it); |
503 | if ( it != list.begin() ) buf += " "; | 550 | if ( it != list.begin() ) exceptBuf += " "; |
504 | 551 | ||
505 | buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); | 552 | exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); |
506 | } | 553 | } |
507 | buf += "\" "; | ||
508 | 554 | ||
509 | return buf; | 555 | retMap.insert( ORecur::Exceptions, exceptBuf ); |
556 | |||
557 | return retMap; | ||
558 | } | ||
559 | |||
560 | void ORecur::fromMap( const QMap<int, QString>& map ) | ||
561 | { | ||
562 | QMap<QString, RepeatType> repTypeMap = rTypeValueConvertMap(); | ||
563 | |||
564 | data -> type = repTypeMap[ map [ORecur::RType] ]; | ||
565 | data -> days = (char) map[ ORecur::RWeekdays ].toInt(); | ||
566 | data -> pos = map[ ORecur::RPosition ].toInt(); | ||
567 | data -> freq = map[ ORecur::RFreq ].toInt(); | ||
568 | data -> hasEnd= map[ ORecur::RHasEndDate ].toInt() ? true : false; | ||
569 | OTimeZone utc = OTimeZone::utc(); | ||
570 | if ( data -> hasEnd ){ | ||
571 | data -> end = utc.fromUTCDateTime( (time_t) map[ ORecur::EndDate ].toLong() ).date(); | ||
572 | } | ||
573 | data -> create = utc.fromUTCDateTime( (time_t) map[ ORecur::Created ].toLong() ).date(); | ||
574 | |||
575 | #if 0 | ||
576 | // FIXME: Exceptions currently not supported... | ||
577 | // Convert the list of exceptions from QString into ExceptionList | ||
578 | data -> list.clear(); | ||
579 | QString exceptStr = map[ ORecur::Exceptions ]; | ||
580 | QStringList exceptList = QStringList::split( " ", exceptStr ); | ||
581 | ... | ||
582 | #endif | ||
583 | |||
584 | |||
510 | } | 585 | } |
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h index b214b3f..47901b0 100644 --- a/libopie2/opiepim/core/orecur.h +++ b/libopie2/opiepim/core/orecur.h | |||
@@ -1,32 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | * GPL from TT | 2 | * GPL from TT |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef OPIE_RECUR_H | 5 | #ifndef OPIE_RECUR_H |
6 | #define OPIE_RECUR_H | 6 | #define OPIE_RECUR_H |
7 | 7 | ||
8 | #include <sys/types.h> | 8 | #include <sys/types.h> |
9 | 9 | ||
10 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
11 | #include <qvaluelist.h> | 11 | #include <qvaluelist.h> |
12 | 12 | #include <qmap.h> | |
13 | 13 | ||
14 | class ORecur { | 14 | class ORecur { |
15 | public: | 15 | public: |
16 | typedef QValueList<QDate> ExceptionList; | 16 | typedef QValueList<QDate> ExceptionList; |
17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, | 17 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, |
18 | MonthlyDate, Yearly }; | 18 | MonthlyDate, Yearly }; |
19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, | 19 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, |
20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; | 20 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; |
21 | enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, | ||
22 | EndDate, Created, Exceptions }; | ||
23 | |||
21 | ORecur(); | 24 | ORecur(); |
22 | ORecur( const ORecur& ); | 25 | ORecur( const ORecur& ); |
23 | ~ORecur(); | 26 | ~ORecur(); |
24 | 27 | ||
25 | ORecur &operator=( const ORecur& ); | 28 | ORecur &operator=( const ORecur& ); |
26 | bool operator==(const ORecur& )const; | 29 | bool operator==(const ORecur& )const; |
27 | 30 | ||
28 | bool doesRecur()const; | 31 | bool doesRecur()const; |
29 | /* if it recurrs on that day */ | 32 | /* if it recurrs on that day */ |
30 | bool doesRecur( const QDate& ); | 33 | bool doesRecur( const QDate& ); |
31 | RepeatType type()const; | 34 | RepeatType type()const; |
32 | int frequency()const; | 35 | int frequency()const; |
@@ -65,27 +68,34 @@ public: | |||
65 | void setType( const RepeatType& ); | 68 | void setType( const RepeatType& ); |
66 | void setFrequency( int freq ); | 69 | void setFrequency( int freq ); |
67 | void setPosition( int pos ); | 70 | void setPosition( int pos ); |
68 | void setDays( char c); | 71 | void setDays( char c); |
69 | void setEndDate( const QDate& dt ); | 72 | void setEndDate( const QDate& dt ); |
70 | void setStart( const QDate& dt ); | 73 | void setStart( const QDate& dt ); |
71 | void setCreatedDateTime( const QDateTime& ); | 74 | void setCreatedDateTime( const QDateTime& ); |
72 | void setHasEndDate( bool b ); | 75 | void setHasEndDate( bool b ); |
73 | void setRepitition(int ); | 76 | void setRepitition(int ); |
74 | 77 | ||
75 | void setService( const QString& ser ); | 78 | void setService( const QString& ser ); |
76 | 79 | ||
80 | QMap<int, QString> toMap() const; | ||
81 | void fromMap( const QMap<int, QString>& map ); | ||
82 | |||
77 | /* almost internal */ | 83 | /* almost internal */ |
78 | QString toString()const; | 84 | QString toString()const; |
79 | private: | 85 | private: |
80 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 86 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
81 | void deref(); | 87 | void deref(); |
82 | inline void checkOrModify(); | 88 | inline void checkOrModify(); |
83 | 89 | ||
90 | /* Converts rType to String */ | ||
91 | QString rTypeString() const; | ||
92 | /* Returns a map to convert Stringname for RType to RepeatType */ | ||
93 | QMap<QString, RepeatType> rTypeValueConvertMap() const; | ||
84 | 94 | ||
85 | class Data; | 95 | class Data; |
86 | Data* data; | 96 | Data* data; |
87 | class ORecurPrivate; | 97 | class ORecurPrivate; |
88 | ORecurPrivate *d; | 98 | ORecurPrivate *d; |
89 | }; | 99 | }; |
90 | 100 | ||
91 | #endif | 101 | #endif |
diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf index 04f1c8b..7bc67c7 100644 --- a/mkspecs/qws/macx-generic-g++/qmake.conf +++ b/mkspecs/qws/macx-generic-g++/qmake.conf | |||
@@ -15,35 +15,35 @@ QMAKE_LEXFLAGS = | |||
15 | QMAKE_YACC = yacc | 15 | QMAKE_YACC = yacc |
16 | QMAKE_YACCFLAGS = -d | 16 | QMAKE_YACCFLAGS = -d |
17 | QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) | 17 | QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) |
18 | QMAKE_CFLAGS_WARN_ON= -Wall -W | 18 | QMAKE_CFLAGS_WARN_ON= -Wall -W |
19 | QMAKE_CFLAGS_WARN_OFF= | 19 | QMAKE_CFLAGS_WARN_OFF= |
20 | QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2 -fno-default-inline) | 20 | QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2 -fno-default-inline) |
21 | QMAKE_CFLAGS_DEBUG= -g | 21 | QMAKE_CFLAGS_DEBUG= -g |
22 | QMAKE_CFLAGS_SHLIB= -fPIC | 22 | QMAKE_CFLAGS_SHLIB= -fPIC |
23 | QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses | 23 | QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses |
24 | QMAKE_CFLAGS_THREAD= -D_REENTRANT | 24 | QMAKE_CFLAGS_THREAD= -D_REENTRANT |
25 | 25 | ||
26 | QMAKE_CXX = $(TB)c++ | 26 | QMAKE_CXX = $(TB)c++ |
27 | QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -DQ_OS_MACX -DQT_NO_SOUND -DOPIE_NO_OVERRIDE_QT | 27 | QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -DQ_OS_MACX -DQT_NO_SOUND -DOPIE_NO_OVERRIDE_QT -DOPIE_NO_BACKTRACE |
28 | QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON | 28 | QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON |
29 | QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF | 29 | QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF |
30 | QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE | 30 | QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE |
31 | QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG | 31 | QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG |
32 | QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB | 32 | QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB |
33 | QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC | 33 | QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC |
34 | QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD | 34 | QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD |
35 | 35 | ||
36 | QMAKE_INCDIR = | 36 | QMAKE_INCDIR = /sw/include |
37 | QMAKE_LIBDIR = | 37 | QMAKE_LIBDIR = /sw/lib |
38 | QMAKE_INCDIR_X11= | 38 | QMAKE_INCDIR_X11= |
39 | QMAKE_LIBDIR_X11= | 39 | QMAKE_LIBDIR_X11= |
40 | QMAKE_INCDIR_QT = $(QTDIR)/include | 40 | QMAKE_INCDIR_QT = $(QTDIR)/include |
41 | QMAKE_LIBDIR_QT = $(QTDIR)/lib | 41 | QMAKE_LIBDIR_QT = $(QTDIR)/lib |
42 | QMAKE_INCDIR_OPENGL= /usr/X11R6/include | 42 | QMAKE_INCDIR_OPENGL= /usr/X11R6/include |
43 | QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib | 43 | QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib |
44 | 44 | ||
45 | QMAKE_LINK = $$QMAKE_CXX | 45 | QMAKE_LINK = $$QMAKE_CXX |
46 | QMAKE_LINK_SHLIB= $$QMAKE_CXX | 46 | QMAKE_LINK_SHLIB= $$QMAKE_CXX |
47 | QMAKE_LFLAGS = $(LFLAGS_EXTRA) | 47 | QMAKE_LFLAGS = $(LFLAGS_EXTRA) |
48 | QMAKE_LFLAGS_RELEASE= | 48 | QMAKE_LFLAGS_RELEASE= |
49 | QMAKE_LFLAGS_DEBUG= | 49 | QMAKE_LFLAGS_DEBUG= |