summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp41
-rw-r--r--libopie/pim/opimrecord.h4
-rw-r--r--libopie/pim/opimstate.cpp64
-rw-r--r--libopie/pim/opimstate.h44
-rw-r--r--libopie/pim/orecordlist.h2
-rw-r--r--libopie/pim/orecur.cpp9
-rw-r--r--libopie/pim/orecur.h2
-rw-r--r--libopie/pim/otodo.cpp23
-rw-r--r--libopie/pim/otodo.h27
-rw-r--r--libopie2/opiepim/core/opimrecord.h4
-rw-r--r--libopie2/opiepim/core/opimstate.cpp64
-rw-r--r--libopie2/opiepim/core/opimstate.h44
-rw-r--r--libopie2/opiepim/core/orecur.cpp9
-rw-r--r--libopie2/opiepim/core/orecur.h2
-rw-r--r--libopie2/opiepim/ocontact.cpp41
-rw-r--r--libopie2/opiepim/orecordlist.h2
-rw-r--r--libopie2/opiepim/otodo.cpp23
-rw-r--r--libopie2/opiepim/otodo.h27
18 files changed, 388 insertions, 44 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index acd65c4..cd238ef 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -1128,5 +1128,5 @@ static VObject *createVObject( const OContact &c )
1128 if ( c.birthday().isValid() ){ 1128 if ( c.birthday().isValid() ){
1129 QString birthd_rfc2425 = QString("%1-%2-%3") 1129 QString birthd_rfc2425 = QString("%1-%2-%3")
1130 .arg( c.birthday().year() ) 1130 .arg( c.birthday().year() )
1131 .arg( c.birthday().month(), 2 ) 1131 .arg( c.birthday().month(), 2 )
1132 .arg( c.birthday().day(), 2 ); 1132 .arg( c.birthday().day(), 2 );
@@ -1135,5 +1135,5 @@ static VObject *createVObject( const OContact &c )
1135 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) 1135 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 )
1136 birthd_rfc2425.replace( pos, 1, "0" ); 1136 birthd_rfc2425.replace( pos, 1, "0" );
1137 1137
1138 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); 1138 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1());
1139 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); 1139 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() );
@@ -1389,9 +1389,9 @@ static OContact parseVObject( VObject *obj )
1389 else if ( name == "X-Qtopia-Children" ) { 1389 else if ( name == "X-Qtopia-Children" ) {
1390 c.setChildren( value ); 1390 c.setChildren( value );
1391 } 1391 }
1392 else if ( name == VCBirthDateProp ) { 1392 else if ( name == VCBirthDateProp ) {
1393 // Reading Birthdate regarding RFC 2425 (5.8.4) 1393 // Reading Birthdate regarding RFC 2425 (5.8.4)
1394 c.setBirthday( convVCardDateToDate( value ) ); 1394 c.setBirthday( convVCardDateToDate( value ) );
1395 1395
1396 } 1396 }
1397 1397
@@ -1465,5 +1465,14 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
1465 1465
1466 while ( obj ) { 1466 while ( obj ) {
1467 contacts.append( parseVObject( obj ) ); 1467 OContact con = parseVObject( obj );
1468 /*
1469 * if uid is 0 assign a new one
1470 * this at least happens on
1471 * Nokia6210
1472 */
1473 if ( con.uid() == 0 )
1474 con.setUid( 1 );
1475
1476 contacts.append(con );
1468 1477
1469 VObject *t = obj; 1478 VObject *t = obj;
@@ -1528,5 +1537,5 @@ class QString OContact::recordField( int pos ) const
1528 1537
1529// In future releases, we should store birthday and anniversary 1538// In future releases, we should store birthday and anniversary
1530// internally as QDate instead of QString ! 1539// internally as QDate instead of QString !
1531// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 1540// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1532 1541
@@ -1535,8 +1544,8 @@ class QString OContact::recordField( int pos ) const
1535*/ 1544*/
1536void OContact::setBirthday( const QDate &v ) 1545void OContact::setBirthday( const QDate &v )
1537{ 1546{
1538 if ( ( !v.isNull() ) && ( v.isValid() ) ) 1547 if ( ( !v.isNull() ) && ( v.isValid() ) )
1539 replace( Qtopia::Birthday, TimeConversion::toString( v ) ); 1548 replace( Qtopia::Birthday, TimeConversion::toString( v ) );
1540 1549
1541} 1550}
1542 1551
@@ -1554,6 +1563,6 @@ void OContact::setAnniversary( const QDate &v )
1554 Returns the birthday of the contact. 1563 Returns the birthday of the contact.
1555*/ 1564*/
1556QDate OContact::birthday() const 1565QDate OContact::birthday() const
1557{ 1566{
1558 QString str = find( Qtopia::Birthday ); 1567 QString str = find( Qtopia::Birthday );
1559 qWarning ("Birthday %s", str.latin1() ); 1568 qWarning ("Birthday %s", str.latin1() );
@@ -1568,11 +1577,11 @@ QDate OContact::birthday() const
1568 Returns the anniversary of the contact. 1577 Returns the anniversary of the contact.
1569*/ 1578*/
1570QDate OContact::anniversary() const 1579QDate OContact::anniversary() const
1571{ 1580{
1572 QDate empty; 1581 QDate empty;
1573 QString str = find( Qtopia::Anniversary ); 1582 QString str = find( Qtopia::Anniversary );
1574 qWarning ("Anniversary %s", str.latin1() ); 1583 qWarning ("Anniversary %s", str.latin1() );
1575 if ( !str.isEmpty() ) 1584 if ( !str.isEmpty() )
1576 return TimeConversion::fromString ( str ); 1585 return TimeConversion::fromString ( str );
1577 else 1586 else
1578 return empty; 1587 return empty;
@@ -1608,5 +1617,5 @@ void OContact::removeEmail( const QString &v )
1608 QString emailsStr = find( Qtopia::Emails ); 1617 QString emailsStr = find( Qtopia::Emails );
1609 QStringList emails = emailList(); 1618 QStringList emails = emailList();
1610 1619
1611 // otherwise, must first contain it 1620 // otherwise, must first contain it
1612 if ( !emailsStr.contains( e ) ) 1621 if ( !emailsStr.contains( e ) )
@@ -1641,7 +1650,7 @@ void OContact::setDefaultEmail( const QString &v )
1641 replace( Qtopia::DefaultEmail, e ); 1650 replace( Qtopia::DefaultEmail, e );
1642 1651
1643 if ( !e.isEmpty() ) 1652 if ( !e.isEmpty() )
1644 insertEmail( e ); 1653 insertEmail( e );
1645 1654
1646} 1655}
1647 1656
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index dbb94ed..d9ccad4 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -10,5 +10,5 @@
10 10
11/** 11/**
12 * This is the base class for 12 * This is the base class for
13 * all PIM Records 13 * all PIM Records
14 * 14 *
@@ -111,5 +111,5 @@ public:
111 */ 111 */
112 void setRelations( const QString&, QArray<int> ids ); 112 void setRelations( const QString&, QArray<int> ids );
113 113
114 /** 114 /**
115 * set the uid 115 * set the uid
diff --git a/libopie/pim/opimstate.cpp b/libopie/pim/opimstate.cpp
new file mode 100644
index 0000000..6fb2feb
--- a/dev/null
+++ b/libopie/pim/opimstate.cpp
@@ -0,0 +1,64 @@
1#include <qshared.h>
2
3#include "opimstate.h"
4
5/*
6 * for one int this does not make
7 * much sense but never the less
8 * we will do it for the future
9 */
10struct OPimState::Data : public QShared {
11 Data() : QShared(),state(Undefined) {
12 }
13 int state;
14};
15
16OPimState::OPimState( int state ) {
17 data = new Data;
18 data->state = state;
19}
20OPimState::OPimState( const OPimState& st) :
21 data( st.data ) {
22 /* ref up */
23 data->ref();
24}
25OPimState::~OPimState() {
26 if ( data->deref() ) {
27 delete data ;
28 data = 0;
29 }
30}
31bool OPimState::operator==( const OPimState& st) {
32 if ( data->state == st.data->state ) return true;
33
34 return false;
35}
36OPimState &OPimState::operator=( const OPimState& st) {
37 st.data->ref();
38 deref();
39 data = st.data;
40
41 return *this;
42}
43void OPimState::setState( int st) {
44 copyInternally();
45 data->state = st;
46}
47int OPimState::state()const {
48 return data->state;
49}
50void OPimState::deref() {
51 if ( data->deref() ) {
52 delete data;
53 data = 0l;
54 }
55}
56void OPimState::copyInternally() {
57 /* we need to change it */
58 if ( data->count != 1 ) {
59 data->deref();
60 Data* d2 = new Data;
61 d2->state = data->state;
62 data = d2;
63 }
64}
diff --git a/libopie/pim/opimstate.h b/libopie/pim/opimstate.h
new file mode 100644
index 0000000..731181e
--- a/dev/null
+++ b/libopie/pim/opimstate.h
@@ -0,0 +1,44 @@
1#ifndef OPIE_PIM_STATE_H
2#define OPIE_PIM_STATE_H
3
4#include <qstring.h>
5
6/**
7 * The State of a Task
8 * This class encapsules the state of a todo
9 * and it's shared too
10 */
11/*
12 * in c a simple struct would be enough ;)
13 * g_new_state();
14 * g_do_some_thing( state_t* );
15 * ;)
16 */
17class OPimState {
18public:
19 enum State {
20 Started = 0,
21 Postponed,
22 Finished,
23 NotStarted,
24 Undefined
25 };
26 OPimState( int state = Undefined );
27 OPimState( const OPimState& );
28 ~OPimState();
29
30 bool operator==( const OPimState& );
31 OPimState &operator=( const OPimState& );
32 void setState( int state);
33 int state()const;
34private:
35 void deref();
36 inline void copyInternally();
37 struct Data;
38 Data* data;
39 class Private;
40 Private *d;
41};
42
43
44#endif
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h
index 2f4a5d3..8ed41e2 100644
--- a/libopie/pim/orecordlist.h
+++ b/libopie/pim/orecordlist.h
@@ -235,5 +235,5 @@ void ORecordListIterator<T>::setCurrent( uint cur ) {
235template <class T> 235template <class T>
236uint ORecordListIterator<T>::count()const { 236uint ORecordListIterator<T>::count()const {
237 return m_uids.count(); 237 return m_uids.count();
238} 238}
239template <class T> 239template <class T>
diff --git a/libopie/pim/orecur.cpp b/libopie/pim/orecur.cpp
index 6c81f8f..257d4fd 100644
--- a/libopie/pim/orecur.cpp
+++ b/libopie/pim/orecur.cpp
@@ -22,4 +22,5 @@ struct ORecur::Data : public QShared {
22 time_t end; 22 time_t end;
23 time_t create; 23 time_t create;
24 int rep;
24}; 25};
25 26
@@ -79,4 +80,7 @@ time_t ORecur::createTime()const {
79 return data->create; 80 return data->create;
80} 81}
82int ORecur::repetition()const {
83 return data->rep;
84}
81void ORecur::setType( const RepeatType& z) { 85void ORecur::setType( const RepeatType& z) {
82 checkOrModify(); 86 checkOrModify();
@@ -111,4 +115,8 @@ void ORecur::setHasEndDate( bool b) {
111 data->hasEnd = b; 115 data->hasEnd = b;
112} 116}
117void ORecur::setRepitition( int rep ) {
118 checkOrModify();
119 data->rep = rep;
120}
113void ORecur::checkOrModify() { 121void ORecur::checkOrModify() {
114 if ( data->count != 1 ) { 122 if ( data->count != 1 ) {
@@ -122,4 +130,5 @@ void ORecur::checkOrModify() {
122 d2->end = data->end; 130 d2->end = data->end;
123 d2->create = data->create; 131 d2->create = data->create;
132 d2->rep = data->rep;
124 data = d2; 133 data = d2;
125 } 134 }
diff --git a/libopie/pim/orecur.h b/libopie/pim/orecur.h
index 89258f8..d24d72d 100644
--- a/libopie/pim/orecur.h
+++ b/libopie/pim/orecur.h
@@ -32,4 +32,5 @@ public:
32 time_t endDateUTC()const; 32 time_t endDateUTC()const;
33 time_t createTime()const; 33 time_t createTime()const;
34 int repetition()const;
34 35
35 void setType( const RepeatType& ); 36 void setType( const RepeatType& );
@@ -41,4 +42,5 @@ public:
41 void setCreateTime( time_t ); 42 void setCreateTime( time_t );
42 void setHasEndDate( bool b ); 43 void setHasEndDate( bool b );
44 void setRepitition(int );
43private: 45private:
44 void deref(); 46 void deref();
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index 765d5a9..0d5b1d3 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -13,5 +13,6 @@
13 13
14 14
15 15#include "opimstate.h"
16#include "orecur.h"
16#include "otodo.h" 17#include "otodo.h"
17 18
@@ -31,4 +32,6 @@ struct OTodo::OTodoData : public QShared {
31 bool hasAlarmDateTime :1; 32 bool hasAlarmDateTime :1;
32 QDateTime alarmDateTime; 33 QDateTime alarmDateTime;
34 OPimState state;
35 ORecur recur;
33}; 36};
34 37
@@ -145,4 +148,10 @@ QString OTodo::description()const
145 return data->desc; 148 return data->desc;
146} 149}
150OPimState OTodo::state()const {
151 return data->state;
152}
153ORecur OTodo::recurrence()const {
154 return data->recur;
155}
147void OTodo::setCompleted( bool completed ) 156void OTodo::setCompleted( bool completed )
148{ 157{
@@ -186,4 +195,12 @@ void OTodo::setAlarmDateTime( const QDateTime& alarm )
186 data->alarmDateTime = alarm; 195 data->alarmDateTime = alarm;
187} 196}
197void OTodo::setState( const OPimState& state ) {
198 changeOrModify();
199 data->state = state;
200}
201void OTodo::setRecurrence( const ORecur& rec) {
202 changeOrModify();
203 data->recur = rec;
204}
188bool OTodo::isOverdue( ) 205bool OTodo::isOverdue( )
189{ 206{
@@ -359,5 +376,5 @@ QMap<QString, QString> OTodo::toExtraMap()const {
359void OTodo::changeOrModify() { 376void OTodo::changeOrModify() {
360 if ( data->count != 1 ) { 377 if ( data->count != 1 ) {
361// qWarning("changeOrModify"); 378 qWarning("changeOrModify");
362 data->deref(); 379 data->deref();
363 OTodoData* d2 = new OTodoData(); 380 OTodoData* d2 = new OTodoData();
@@ -377,4 +394,6 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
377 dest->hasAlarmDateTime = src->hasAlarmDateTime; 394 dest->hasAlarmDateTime = src->hasAlarmDateTime;
378 dest->alarmDateTime = src->alarmDateTime; 395 dest->alarmDateTime = src->alarmDateTime;
396 dest->state = src->state;
397 dest->recur = src->recur;
379} 398}
380QString OTodo::type() const { 399QString OTodo::type() const {
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index 5bd91d6..2cdc587 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -17,4 +17,6 @@
17 17
18 18
19class OPimState;
20class ORecur;
19class OTodo : public OPimRecord { 21class OTodo : public OPimRecord {
20public: 22public:
@@ -34,5 +36,10 @@ public:
34 CrossReference, 36 CrossReference,
35 HasAlarmDateTime, 37 HasAlarmDateTime,
36 AlarmDateTime 38 AlarmDateTime,
39 State,
40 Recurrance,
41 Alarms,
42 Reminders,
43 Notifiers
37 }; 44 };
38 public: 45 public:
@@ -112,4 +119,14 @@ public:
112 119
113 /** 120 /**
121 * What is the state of this OTodo?
122 */
123 OPimState state()const;
124
125 /**
126 * the recurrance of this
127 */
128 ORecur recurrence()const;
129
130 /**
114 * The description of the todo 131 * The description of the todo
115 */ 132 */
@@ -171,4 +188,6 @@ public:
171 void setDueDate( QDate date ); 188 void setDueDate( QDate date );
172 189
190
191 void setRecurrence( const ORecur& );
173 /** 192 /**
174 * set the alarm time 193 * set the alarm time
@@ -178,4 +197,10 @@ public:
178 void setDescription(const QString& ); 197 void setDescription(const QString& );
179 void setSummary(const QString& ); 198 void setSummary(const QString& );
199
200 /**
201 * set the state of a Todo
202 * @param state State what the todo should take
203 */
204 void setState( const OPimState& state);
180 bool isOverdue(); 205 bool isOverdue();
181 206
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index dbb94ed..d9ccad4 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -10,5 +10,5 @@
10 10
11/** 11/**
12 * This is the base class for 12 * This is the base class for
13 * all PIM Records 13 * all PIM Records
14 * 14 *
@@ -111,5 +111,5 @@ public:
111 */ 111 */
112 void setRelations( const QString&, QArray<int> ids ); 112 void setRelations( const QString&, QArray<int> ids );
113 113
114 /** 114 /**
115 * set the uid 115 * set the uid
diff --git a/libopie2/opiepim/core/opimstate.cpp b/libopie2/opiepim/core/opimstate.cpp
new file mode 100644
index 0000000..6fb2feb
--- a/dev/null
+++ b/libopie2/opiepim/core/opimstate.cpp
@@ -0,0 +1,64 @@
1#include <qshared.h>
2
3#include "opimstate.h"
4
5/*
6 * for one int this does not make
7 * much sense but never the less
8 * we will do it for the future
9 */
10struct OPimState::Data : public QShared {
11 Data() : QShared(),state(Undefined) {
12 }
13 int state;
14};
15
16OPimState::OPimState( int state ) {
17 data = new Data;
18 data->state = state;
19}
20OPimState::OPimState( const OPimState& st) :
21 data( st.data ) {
22 /* ref up */
23 data->ref();
24}
25OPimState::~OPimState() {
26 if ( data->deref() ) {
27 delete data ;
28 data = 0;
29 }
30}
31bool OPimState::operator==( const OPimState& st) {
32 if ( data->state == st.data->state ) return true;
33
34 return false;
35}
36OPimState &OPimState::operator=( const OPimState& st) {
37 st.data->ref();
38 deref();
39 data = st.data;
40
41 return *this;
42}
43void OPimState::setState( int st) {
44 copyInternally();
45 data->state = st;
46}
47int OPimState::state()const {
48 return data->state;
49}
50void OPimState::deref() {
51 if ( data->deref() ) {
52 delete data;
53 data = 0l;
54 }
55}
56void OPimState::copyInternally() {
57 /* we need to change it */
58 if ( data->count != 1 ) {
59 data->deref();
60 Data* d2 = new Data;
61 d2->state = data->state;
62 data = d2;
63 }
64}
diff --git a/libopie2/opiepim/core/opimstate.h b/libopie2/opiepim/core/opimstate.h
new file mode 100644
index 0000000..731181e
--- a/dev/null
+++ b/libopie2/opiepim/core/opimstate.h
@@ -0,0 +1,44 @@
1#ifndef OPIE_PIM_STATE_H
2#define OPIE_PIM_STATE_H
3
4#include <qstring.h>
5
6/**
7 * The State of a Task
8 * This class encapsules the state of a todo
9 * and it's shared too
10 */
11/*
12 * in c a simple struct would be enough ;)
13 * g_new_state();
14 * g_do_some_thing( state_t* );
15 * ;)
16 */
17class OPimState {
18public:
19 enum State {
20 Started = 0,
21 Postponed,
22 Finished,
23 NotStarted,
24 Undefined
25 };
26 OPimState( int state = Undefined );
27 OPimState( const OPimState& );
28 ~OPimState();
29
30 bool operator==( const OPimState& );
31 OPimState &operator=( const OPimState& );
32 void setState( int state);
33 int state()const;
34private:
35 void deref();
36 inline void copyInternally();
37 struct Data;
38 Data* data;
39 class Private;
40 Private *d;
41};
42
43
44#endif
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp
index 6c81f8f..257d4fd 100644
--- a/libopie2/opiepim/core/orecur.cpp
+++ b/libopie2/opiepim/core/orecur.cpp
@@ -22,4 +22,5 @@ struct ORecur::Data : public QShared {
22 time_t end; 22 time_t end;
23 time_t create; 23 time_t create;
24 int rep;
24}; 25};
25 26
@@ -79,4 +80,7 @@ time_t ORecur::createTime()const {
79 return data->create; 80 return data->create;
80} 81}
82int ORecur::repetition()const {
83 return data->rep;
84}
81void ORecur::setType( const RepeatType& z) { 85void ORecur::setType( const RepeatType& z) {
82 checkOrModify(); 86 checkOrModify();
@@ -111,4 +115,8 @@ void ORecur::setHasEndDate( bool b) {
111 data->hasEnd = b; 115 data->hasEnd = b;
112} 116}
117void ORecur::setRepitition( int rep ) {
118 checkOrModify();
119 data->rep = rep;
120}
113void ORecur::checkOrModify() { 121void ORecur::checkOrModify() {
114 if ( data->count != 1 ) { 122 if ( data->count != 1 ) {
@@ -122,4 +130,5 @@ void ORecur::checkOrModify() {
122 d2->end = data->end; 130 d2->end = data->end;
123 d2->create = data->create; 131 d2->create = data->create;
132 d2->rep = data->rep;
124 data = d2; 133 data = d2;
125 } 134 }
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h
index 89258f8..d24d72d 100644
--- a/libopie2/opiepim/core/orecur.h
+++ b/libopie2/opiepim/core/orecur.h
@@ -32,4 +32,5 @@ public:
32 time_t endDateUTC()const; 32 time_t endDateUTC()const;
33 time_t createTime()const; 33 time_t createTime()const;
34 int repetition()const;
34 35
35 void setType( const RepeatType& ); 36 void setType( const RepeatType& );
@@ -41,4 +42,5 @@ public:
41 void setCreateTime( time_t ); 42 void setCreateTime( time_t );
42 void setHasEndDate( bool b ); 43 void setHasEndDate( bool b );
44 void setRepitition(int );
43private: 45private:
44 void deref(); 46 void deref();
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index acd65c4..cd238ef 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -1128,5 +1128,5 @@ static VObject *createVObject( const OContact &c )
1128 if ( c.birthday().isValid() ){ 1128 if ( c.birthday().isValid() ){
1129 QString birthd_rfc2425 = QString("%1-%2-%3") 1129 QString birthd_rfc2425 = QString("%1-%2-%3")
1130 .arg( c.birthday().year() ) 1130 .arg( c.birthday().year() )
1131 .arg( c.birthday().month(), 2 ) 1131 .arg( c.birthday().month(), 2 )
1132 .arg( c.birthday().day(), 2 ); 1132 .arg( c.birthday().day(), 2 );
@@ -1135,5 +1135,5 @@ static VObject *createVObject( const OContact &c )
1135 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) 1135 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 )
1136 birthd_rfc2425.replace( pos, 1, "0" ); 1136 birthd_rfc2425.replace( pos, 1, "0" );
1137 1137
1138 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); 1138 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1());
1139 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); 1139 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() );
@@ -1389,9 +1389,9 @@ static OContact parseVObject( VObject *obj )
1389 else if ( name == "X-Qtopia-Children" ) { 1389 else if ( name == "X-Qtopia-Children" ) {
1390 c.setChildren( value ); 1390 c.setChildren( value );
1391 } 1391 }
1392 else if ( name == VCBirthDateProp ) { 1392 else if ( name == VCBirthDateProp ) {
1393 // Reading Birthdate regarding RFC 2425 (5.8.4) 1393 // Reading Birthdate regarding RFC 2425 (5.8.4)
1394 c.setBirthday( convVCardDateToDate( value ) ); 1394 c.setBirthday( convVCardDateToDate( value ) );
1395 1395
1396 } 1396 }
1397 1397
@@ -1465,5 +1465,14 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
1465 1465
1466 while ( obj ) { 1466 while ( obj ) {
1467 contacts.append( parseVObject( obj ) ); 1467 OContact con = parseVObject( obj );
1468 /*
1469 * if uid is 0 assign a new one
1470 * this at least happens on
1471 * Nokia6210
1472 */
1473 if ( con.uid() == 0 )
1474 con.setUid( 1 );
1475
1476 contacts.append(con );
1468 1477
1469 VObject *t = obj; 1478 VObject *t = obj;
@@ -1528,5 +1537,5 @@ class QString OContact::recordField( int pos ) const
1528 1537
1529// In future releases, we should store birthday and anniversary 1538// In future releases, we should store birthday and anniversary
1530// internally as QDate instead of QString ! 1539// internally as QDate instead of QString !
1531// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 1540// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1532 1541
@@ -1535,8 +1544,8 @@ class QString OContact::recordField( int pos ) const
1535*/ 1544*/
1536void OContact::setBirthday( const QDate &v ) 1545void OContact::setBirthday( const QDate &v )
1537{ 1546{
1538 if ( ( !v.isNull() ) && ( v.isValid() ) ) 1547 if ( ( !v.isNull() ) && ( v.isValid() ) )
1539 replace( Qtopia::Birthday, TimeConversion::toString( v ) ); 1548 replace( Qtopia::Birthday, TimeConversion::toString( v ) );
1540 1549
1541} 1550}
1542 1551
@@ -1554,6 +1563,6 @@ void OContact::setAnniversary( const QDate &v )
1554 Returns the birthday of the contact. 1563 Returns the birthday of the contact.
1555*/ 1564*/
1556QDate OContact::birthday() const 1565QDate OContact::birthday() const
1557{ 1566{
1558 QString str = find( Qtopia::Birthday ); 1567 QString str = find( Qtopia::Birthday );
1559 qWarning ("Birthday %s", str.latin1() ); 1568 qWarning ("Birthday %s", str.latin1() );
@@ -1568,11 +1577,11 @@ QDate OContact::birthday() const
1568 Returns the anniversary of the contact. 1577 Returns the anniversary of the contact.
1569*/ 1578*/
1570QDate OContact::anniversary() const 1579QDate OContact::anniversary() const
1571{ 1580{
1572 QDate empty; 1581 QDate empty;
1573 QString str = find( Qtopia::Anniversary ); 1582 QString str = find( Qtopia::Anniversary );
1574 qWarning ("Anniversary %s", str.latin1() ); 1583 qWarning ("Anniversary %s", str.latin1() );
1575 if ( !str.isEmpty() ) 1584 if ( !str.isEmpty() )
1576 return TimeConversion::fromString ( str ); 1585 return TimeConversion::fromString ( str );
1577 else 1586 else
1578 return empty; 1587 return empty;
@@ -1608,5 +1617,5 @@ void OContact::removeEmail( const QString &v )
1608 QString emailsStr = find( Qtopia::Emails ); 1617 QString emailsStr = find( Qtopia::Emails );
1609 QStringList emails = emailList(); 1618 QStringList emails = emailList();
1610 1619
1611 // otherwise, must first contain it 1620 // otherwise, must first contain it
1612 if ( !emailsStr.contains( e ) ) 1621 if ( !emailsStr.contains( e ) )
@@ -1641,7 +1650,7 @@ void OContact::setDefaultEmail( const QString &v )
1641 replace( Qtopia::DefaultEmail, e ); 1650 replace( Qtopia::DefaultEmail, e );
1642 1651
1643 if ( !e.isEmpty() ) 1652 if ( !e.isEmpty() )
1644 insertEmail( e ); 1653 insertEmail( e );
1645 1654
1646} 1655}
1647 1656
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 2f4a5d3..8ed41e2 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -235,5 +235,5 @@ void ORecordListIterator<T>::setCurrent( uint cur ) {
235template <class T> 235template <class T>
236uint ORecordListIterator<T>::count()const { 236uint ORecordListIterator<T>::count()const {
237 return m_uids.count(); 237 return m_uids.count();
238} 238}
239template <class T> 239template <class T>
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 765d5a9..0d5b1d3 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -13,5 +13,6 @@
13 13
14 14
15 15#include "opimstate.h"
16#include "orecur.h"
16#include "otodo.h" 17#include "otodo.h"
17 18
@@ -31,4 +32,6 @@ struct OTodo::OTodoData : public QShared {
31 bool hasAlarmDateTime :1; 32 bool hasAlarmDateTime :1;
32 QDateTime alarmDateTime; 33 QDateTime alarmDateTime;
34 OPimState state;
35 ORecur recur;
33}; 36};
34 37
@@ -145,4 +148,10 @@ QString OTodo::description()const
145 return data->desc; 148 return data->desc;
146} 149}
150OPimState OTodo::state()const {
151 return data->state;
152}
153ORecur OTodo::recurrence()const {
154 return data->recur;
155}
147void OTodo::setCompleted( bool completed ) 156void OTodo::setCompleted( bool completed )
148{ 157{
@@ -186,4 +195,12 @@ void OTodo::setAlarmDateTime( const QDateTime& alarm )
186 data->alarmDateTime = alarm; 195 data->alarmDateTime = alarm;
187} 196}
197void OTodo::setState( const OPimState& state ) {
198 changeOrModify();
199 data->state = state;
200}
201void OTodo::setRecurrence( const ORecur& rec) {
202 changeOrModify();
203 data->recur = rec;
204}
188bool OTodo::isOverdue( ) 205bool OTodo::isOverdue( )
189{ 206{
@@ -359,5 +376,5 @@ QMap<QString, QString> OTodo::toExtraMap()const {
359void OTodo::changeOrModify() { 376void OTodo::changeOrModify() {
360 if ( data->count != 1 ) { 377 if ( data->count != 1 ) {
361// qWarning("changeOrModify"); 378 qWarning("changeOrModify");
362 data->deref(); 379 data->deref();
363 OTodoData* d2 = new OTodoData(); 380 OTodoData* d2 = new OTodoData();
@@ -377,4 +394,6 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
377 dest->hasAlarmDateTime = src->hasAlarmDateTime; 394 dest->hasAlarmDateTime = src->hasAlarmDateTime;
378 dest->alarmDateTime = src->alarmDateTime; 395 dest->alarmDateTime = src->alarmDateTime;
396 dest->state = src->state;
397 dest->recur = src->recur;
379} 398}
380QString OTodo::type() const { 399QString OTodo::type() const {
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index 5bd91d6..2cdc587 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -17,4 +17,6 @@
17 17
18 18
19class OPimState;
20class ORecur;
19class OTodo : public OPimRecord { 21class OTodo : public OPimRecord {
20public: 22public:
@@ -34,5 +36,10 @@ public:
34 CrossReference, 36 CrossReference,
35 HasAlarmDateTime, 37 HasAlarmDateTime,
36 AlarmDateTime 38 AlarmDateTime,
39 State,
40 Recurrance,
41 Alarms,
42 Reminders,
43 Notifiers
37 }; 44 };
38 public: 45 public:
@@ -112,4 +119,14 @@ public:
112 119
113 /** 120 /**
121 * What is the state of this OTodo?
122 */
123 OPimState state()const;
124
125 /**
126 * the recurrance of this
127 */
128 ORecur recurrence()const;
129
130 /**
114 * The description of the todo 131 * The description of the todo
115 */ 132 */
@@ -171,4 +188,6 @@ public:
171 void setDueDate( QDate date ); 188 void setDueDate( QDate date );
172 189
190
191 void setRecurrence( const ORecur& );
173 /** 192 /**
174 * set the alarm time 193 * set the alarm time
@@ -178,4 +197,10 @@ public:
178 void setDescription(const QString& ); 197 void setDescription(const QString& );
179 void setSummary(const QString& ); 198 void setSummary(const QString& );
199
200 /**
201 * set the state of a Todo
202 * @param state State what the todo should take
203 */
204 void setState( const OPimState& state);
180 bool isOverdue(); 205 bool isOverdue();
181 206