summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro2
-rw-r--r--libopie/pim/orecur.cpp147
-rw-r--r--libopie/pim/orecur.h12
-rw-r--r--libopie/pim/otodoaccesssql.cpp31
-rw-r--r--libopie2/opiecore/oglobalsettings.h2
-rw-r--r--libopie2/opiedb/opiedb.pro4
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp31
-rw-r--r--libopie2/opiepim/core/orecur.cpp147
-rw-r--r--libopie2/opiepim/core/orecur.h12
-rw-r--r--mkspecs/qws/macx-generic-g++/qmake.conf6
10 files changed, 306 insertions, 88 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index bf6b78f..94434ae 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -101,5 +101,5 @@ contains( CONFTEST, y ){
101 101
102DEFINES += __USE_SQL 102DEFINES += __USE_SQL
103LIBS += -lopiedb2 -lsqlite 103LIBS += -lopiedb2
104HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h 104HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h
105SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp 105SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp
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
@@ -457,54 +457,129 @@ void ORecur::checkOrModify() {
457QString ORecur::toString()const { 457QString ORecur::toString()const {
458 QString buf; 458 QString buf;
459 QMap<int, QString> recMap = toMap();
459 460
460 buf += " rtype=\""; 461 buf += " rtype=\"";
461 switch ( data->type ) { 462 buf += recMap[ORecur::RType];
462 case ORecur::Daily:
463 buf += "Daily";
464 break;
465 case ORecur::Weekly:
466 buf += "Weekly";
467 break;
468 case ORecur::MonthlyDay:
469 buf += "MonthlyDay";
470 break;
471 case ORecur::MonthlyDate:
472 buf += "MonthlyDate";
473 break;
474 case ORecur::Yearly:
475 buf += "Yearly";
476 break;
477 default:
478 buf += "NoRepeat";
479 break;
480 }
481 buf += "\""; 463 buf += "\"";
482 if (data->days > 0 ) 464 if (data->days > 0 )
483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; 465 buf += " rweekdays=\"" + recMap[ORecur::RWeekdays] + "\"";
484 if ( data->pos != 0 ) 466 if ( data->pos != 0 )
485 buf += " rposition=\"" + QString::number(data->pos ) + "\""; 467 buf += " rposition=\"" + recMap[ORecur::RPosition] + "\"";
486 468
487 buf += " rfreq=\"" + QString::number( data->freq ) + "\""; 469 buf += " rfreq=\"" + recMap[ORecur::RFreq] + "\"";
488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; 470 buf += " rhasenddate=\"" + recMap[ORecur::RHasEndDate]+ "\"";
489 if ( data->hasEnd ) 471 if ( data->hasEnd )
490 buf += " enddt=\"" 472 buf += " enddt=\""
491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) 473 + recMap[ORecur::EndDate]
492 + "\""; 474 + "\"";
493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; 475 buf += " created=\"" + recMap[ORecur::Created] + "\"";
494 476
495 if ( data->list.isEmpty() ) return buf; 477 if ( data->list.isEmpty() ) return buf;
496 // save exceptions list here!!
497 ExceptionList::ConstIterator it;
498 ExceptionList list = data->list;
499 buf += " exceptions=\""; 478 buf += " exceptions=\"";
500 QDate date; 479 buf += recMap[ORecur::Exceptions];
501 for ( it = list.begin(); it != list.end(); ++it ) {
502 date = (*it);
503 if ( it != list.begin() ) buf += " ";
504
505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
506 }
507 buf += "\" "; 480 buf += "\" ";
508 481
509 return buf; 482 return buf;
510} 483}
484
485QString ORecur::rTypeString() const
486{
487 QString retString;
488 switch ( data->type ) {
489 case ORecur::Daily:
490 retString = "Daily";
491 break;
492 case ORecur::Weekly:
493 retString = "Weekly";
494 break;
495 case ORecur::MonthlyDay:
496 retString = "MonthlyDay";
497 break;
498 case ORecur::MonthlyDate:
499 retString = "MonthlyDate";
500 break;
501 case ORecur::Yearly:
502 retString = "Yearly";
503 break;
504 default:
505 retString = "NoRepeat";
506 break;
507
508 }
509
510 return retString;
511}
512
513QMap<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
528QMap<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 ) ) );
537 if( data -> hasEnd )
538 retMap.insert( ORecur::EndDate, QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) );
539 retMap.insert( ORecur::Created, QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) );
540
541 if ( data->list.isEmpty() ) return retMap;
542
543 // save exceptions list here!!
544 ExceptionList::ConstIterator it;
545 ExceptionList list = data->list;
546 QString exceptBuf;
547 QDate date;
548 for ( it = list.begin(); it != list.end(); ++it ) {
549 date = (*it);
550 if ( it != list.begin() ) exceptBuf += " ";
551
552 exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
553 }
554
555 retMap.insert( ORecur::Exceptions, exceptBuf );
556
557 return retMap;
558}
559
560void 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
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
@@ -10,5 +10,5 @@
10#include <qdatetime.h> 10#include <qdatetime.h>
11#include <qvaluelist.h> 11#include <qvaluelist.h>
12 12#include <qmap.h>
13 13
14class ORecur { 14class ORecur {
@@ -19,4 +19,7 @@ public:
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& );
@@ -74,4 +77,7 @@ public:
74 77
75 void setService( const QString& ser ); 78 void setService( const QString& ser );
79
80 QMap<int, QString> toMap() const;
81 void fromMap( const QMap<int, QString>& map );
76 82
77 /* almost internal */ 83 /* almost internal */
@@ -82,4 +88,8 @@ private:
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;
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
@@ -124,5 +124,7 @@ namespace {
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;
@@ -175,4 +177,5 @@ namespace {
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() ) + ","
@@ -187,5 +190,12 @@ namespace {
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() ) {
@@ -525,4 +535,6 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
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"),
@@ -553,6 +565,17 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
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;
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
@@ -205,5 +205,5 @@ class OGlobalSettings
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,
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
@@ -30,4 +30,6 @@ MOC_DIR = moc
30OBJECTS_DIR = obj 30OBJECTS_DIR = obj
31 31
32LIBS += -lsqlite -lqpe
33
32!contains( platform, x11 ) { 34!contains( platform, x11 ) {
33 include ( $(OPIEDIR)/include.pro ) 35 include ( $(OPIEDIR)/include.pro )
@@ -35,5 +37,5 @@ OBJECTS_DIR = obj
35 37
36contains( platform, x11 ) { 38contains( 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
@@ -124,5 +124,7 @@ namespace {
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;
@@ -175,4 +177,5 @@ namespace {
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() ) + ","
@@ -187,5 +190,12 @@ namespace {
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() ) {
@@ -525,4 +535,6 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
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"),
@@ -553,6 +565,17 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
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;
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
@@ -457,54 +457,129 @@ void ORecur::checkOrModify() {
457QString ORecur::toString()const { 457QString ORecur::toString()const {
458 QString buf; 458 QString buf;
459 QMap<int, QString> recMap = toMap();
459 460
460 buf += " rtype=\""; 461 buf += " rtype=\"";
461 switch ( data->type ) { 462 buf += recMap[ORecur::RType];
462 case ORecur::Daily:
463 buf += "Daily";
464 break;
465 case ORecur::Weekly:
466 buf += "Weekly";
467 break;
468 case ORecur::MonthlyDay:
469 buf += "MonthlyDay";
470 break;
471 case ORecur::MonthlyDate:
472 buf += "MonthlyDate";
473 break;
474 case ORecur::Yearly:
475 buf += "Yearly";
476 break;
477 default:
478 buf += "NoRepeat";
479 break;
480 }
481 buf += "\""; 463 buf += "\"";
482 if (data->days > 0 ) 464 if (data->days > 0 )
483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; 465 buf += " rweekdays=\"" + recMap[ORecur::RWeekdays] + "\"";
484 if ( data->pos != 0 ) 466 if ( data->pos != 0 )
485 buf += " rposition=\"" + QString::number(data->pos ) + "\""; 467 buf += " rposition=\"" + recMap[ORecur::RPosition] + "\"";
486 468
487 buf += " rfreq=\"" + QString::number( data->freq ) + "\""; 469 buf += " rfreq=\"" + recMap[ORecur::RFreq] + "\"";
488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; 470 buf += " rhasenddate=\"" + recMap[ORecur::RHasEndDate]+ "\"";
489 if ( data->hasEnd ) 471 if ( data->hasEnd )
490 buf += " enddt=\"" 472 buf += " enddt=\""
491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) 473 + recMap[ORecur::EndDate]
492 + "\""; 474 + "\"";
493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; 475 buf += " created=\"" + recMap[ORecur::Created] + "\"";
494 476
495 if ( data->list.isEmpty() ) return buf; 477 if ( data->list.isEmpty() ) return buf;
496 // save exceptions list here!!
497 ExceptionList::ConstIterator it;
498 ExceptionList list = data->list;
499 buf += " exceptions=\""; 478 buf += " exceptions=\"";
500 QDate date; 479 buf += recMap[ORecur::Exceptions];
501 for ( it = list.begin(); it != list.end(); ++it ) {
502 date = (*it);
503 if ( it != list.begin() ) buf += " ";
504
505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
506 }
507 buf += "\" "; 480 buf += "\" ";
508 481
509 return buf; 482 return buf;
510} 483}
484
485QString ORecur::rTypeString() const
486{
487 QString retString;
488 switch ( data->type ) {
489 case ORecur::Daily:
490 retString = "Daily";
491 break;
492 case ORecur::Weekly:
493 retString = "Weekly";
494 break;
495 case ORecur::MonthlyDay:
496 retString = "MonthlyDay";
497 break;
498 case ORecur::MonthlyDate:
499 retString = "MonthlyDate";
500 break;
501 case ORecur::Yearly:
502 retString = "Yearly";
503 break;
504 default:
505 retString = "NoRepeat";
506 break;
507
508 }
509
510 return retString;
511}
512
513QMap<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
528QMap<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 ) ) );
537 if( data -> hasEnd )
538 retMap.insert( ORecur::EndDate, QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) );
539 retMap.insert( ORecur::Created, QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) );
540
541 if ( data->list.isEmpty() ) return retMap;
542
543 // save exceptions list here!!
544 ExceptionList::ConstIterator it;
545 ExceptionList list = data->list;
546 QString exceptBuf;
547 QDate date;
548 for ( it = list.begin(); it != list.end(); ++it ) {
549 date = (*it);
550 if ( it != list.begin() ) exceptBuf += " ";
551
552 exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
553 }
554
555 retMap.insert( ORecur::Exceptions, exceptBuf );
556
557 return retMap;
558}
559
560void 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
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
@@ -10,5 +10,5 @@
10#include <qdatetime.h> 10#include <qdatetime.h>
11#include <qvaluelist.h> 11#include <qvaluelist.h>
12 12#include <qmap.h>
13 13
14class ORecur { 14class ORecur {
@@ -19,4 +19,7 @@ public:
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& );
@@ -74,4 +77,7 @@ public:
74 77
75 void setService( const QString& ser ); 78 void setService( const QString& ser );
79
80 QMap<int, QString> toMap() const;
81 void fromMap( const QMap<int, QString>& map );
76 82
77 /* almost internal */ 83 /* almost internal */
@@ -82,4 +88,8 @@ private:
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;
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
@@ -25,5 +25,5 @@ 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
@@ -34,6 +34,6 @@ 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=