-rw-r--r-- | libopie/pim/opimrecord.cpp | 3 | ||||
-rw-r--r-- | libopie/pim/orecordlist.h | 2 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 4 | ||||
-rw-r--r-- | libopie/pim/otodoaccess.cpp | 4 | ||||
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 4 |
10 files changed, 40 insertions, 26 deletions
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp index 60cdbf3..62dc353 100644 --- a/libopie/pim/opimrecord.cpp +++ b/libopie/pim/opimrecord.cpp | |||
@@ -117,17 +117,18 @@ QString OPimRecord::crossToString()const { | |||
117 | } | 117 | } |
118 | str = str.remove( str.length()-1, 1); // strip the ; | 118 | str = str.remove( str.length()-1, 1); // strip the ; |
119 | //qWarning("IDS " + str ); | 119 | //qWarning("IDS " + str ); |
120 | 120 | ||
121 | return str; | 121 | return str; |
122 | } | 122 | } |
123 | /* if uid = 1 assign a new one */ | 123 | /* if uid = 1 assign a new one */ |
124 | void OPimRecord::setUid( int uid ) { | 124 | void OPimRecord::setUid( int uid ) { |
125 | 125 | // qWarning("setting uid" ); | |
126 | if ( uid == 1) | 126 | if ( uid == 1) |
127 | uid = uidGen().generate(); | 127 | uid = uidGen().generate(); |
128 | 128 | ||
129 | // qWarning(" uid %d", uid); | ||
129 | Qtopia::Record::setUid( uid ); | 130 | Qtopia::Record::setUid( uid ); |
130 | }; | 131 | }; |
131 | Qtopia::UidGen &OPimRecord::uidGen() { | 132 | Qtopia::UidGen &OPimRecord::uidGen() { |
132 | return m_uidGen; | 133 | return m_uidGen; |
133 | } | 134 | } |
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index 36728b8..1795938 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h | |||
@@ -66,16 +66,18 @@ template <class T = OPimRecord > | |||
66 | class ORecordList { | 66 | class ORecordList { |
67 | public: | 67 | public: |
68 | typedef OTemplateBase<T> Base; | 68 | typedef OTemplateBase<T> Base; |
69 | typedef ORecordListIterator<T> Iterator; | 69 | typedef ORecordListIterator<T> Iterator; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * c'tor | 72 | * c'tor |
73 | */ | 73 | */ |
74 | ORecordList () { | ||
75 | } | ||
74 | ORecordList( const QArray<int>& ids, | 76 | ORecordList( const QArray<int>& ids, |
75 | const Base* ); | 77 | const Base* ); |
76 | ~ORecordList(); | 78 | ~ORecordList(); |
77 | 79 | ||
78 | /** | 80 | /** |
79 | * the first iterator | 81 | * the first iterator |
80 | */ | 82 | */ |
81 | Iterator begin(); | 83 | Iterator begin(); |
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index cc46b21..6dd4c0e 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -156,17 +156,17 @@ void OTodo::setHasDueDate( bool hasDate ) | |||
156 | } | 156 | } |
157 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | 157 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) |
158 | { | 158 | { |
159 | changeOrModify(); | 159 | changeOrModify(); |
160 | data->hasAlarmDateTime = hasAlarmDateTime; | 160 | data->hasAlarmDateTime = hasAlarmDateTime; |
161 | } | 161 | } |
162 | void OTodo::setDescription(const QString &desc ) | 162 | void OTodo::setDescription(const QString &desc ) |
163 | { | 163 | { |
164 | qWarning( "desc " + desc ); | 164 | // qWarning( "desc " + desc ); |
165 | changeOrModify(); | 165 | changeOrModify(); |
166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
167 | } | 167 | } |
168 | void OTodo::setSummary( const QString& sum ) | 168 | void OTodo::setSummary( const QString& sum ) |
169 | { | 169 | { |
170 | changeOrModify(); | 170 | changeOrModify(); |
171 | data->sum = sum; | 171 | data->sum = sum; |
172 | } | 172 | } |
@@ -313,17 +313,17 @@ void OTodo::deref() { | |||
313 | if ( data->deref() ) { | 313 | if ( data->deref() ) { |
314 | // qWarning("deleting"); | 314 | // qWarning("deleting"); |
315 | delete data; | 315 | delete data; |
316 | data= 0; | 316 | data= 0; |
317 | } | 317 | } |
318 | } | 318 | } |
319 | OTodo &OTodo::operator=(const OTodo &item ) | 319 | OTodo &OTodo::operator=(const OTodo &item ) |
320 | { | 320 | { |
321 | // OPimRecord::operator=( item ); | 321 | OPimRecord::operator=( item ); |
322 | //qWarning("operator= ref "); | 322 | //qWarning("operator= ref "); |
323 | item.data->ref(); | 323 | item.data->ref(); |
324 | deref(); | 324 | deref(); |
325 | data = item.data; | 325 | data = item.data; |
326 | 326 | ||
327 | return *this; | 327 | return *this; |
328 | } | 328 | } |
329 | 329 | ||
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp index a65cf5c..8ec09bc 100644 --- a/libopie/pim/otodoaccess.cpp +++ b/libopie/pim/otodoaccess.cpp | |||
@@ -10,17 +10,17 @@ OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) | |||
10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) | 10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) |
11 | { | 11 | { |
12 | if (end == 0l ) | 12 | if (end == 0l ) |
13 | m_todoBackEnd = new OTodoAccessXML( "Todolist" ); | 13 | m_todoBackEnd = new OTodoAccessXML( "Todolist" ); |
14 | 14 | ||
15 | setBackEnd( m_todoBackEnd ); | 15 | setBackEnd( m_todoBackEnd ); |
16 | } | 16 | } |
17 | OTodoAccess::~OTodoAccess() { | 17 | OTodoAccess::~OTodoAccess() { |
18 | qWarning("~OTodoAccess"); | 18 | // qWarning("~OTodoAccess"); |
19 | } | 19 | } |
20 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { | 20 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { |
21 | QValueList<OTodo>::ConstIterator it; | 21 | QValueList<OTodo>::ConstIterator it; |
22 | for ( it = list.begin(); it != list.end(); ++it ) { | 22 | for ( it = list.begin(); it != list.end(); ++it ) { |
23 | replace( (*it) ); | 23 | replace( (*it) ); |
24 | } | 24 | } |
25 | } | 25 | } |
26 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, | 26 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, |
@@ -58,14 +58,14 @@ void OTodoAccess::delAlarm( int uid) { | |||
58 | 58 | ||
59 | QDateTime schedule; // Create null DateTime | 59 | QDateTime schedule; // Create null DateTime |
60 | 60 | ||
61 | // I hope this will remove all scheduled alarms | 61 | // I hope this will remove all scheduled alarms |
62 | // with the given uid !? | 62 | // with the given uid !? |
63 | // If not: I have to rethink how to remove already | 63 | // If not: I have to rethink how to remove already |
64 | // scheduled events... (se) | 64 | // scheduled events... (se) |
65 | // it should be fine -zecke | 65 | // it should be fine -zecke |
66 | qWarning("Removing alarm for event with uid %d", uid ); | 66 | // qWarning("Removing alarm for event with uid %d", uid ); |
67 | AlarmServer::deleteAlarm( schedule , | 67 | AlarmServer::deleteAlarm( schedule , |
68 | "QPE/Application/todolist", | 68 | "QPE/Application/todolist", |
69 | "alarm(QDateTime,int)", uid ); | 69 | "alarm(QDateTime,int)", uid ); |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 3a72881..5fe733c 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp | |||
@@ -16,17 +16,17 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName, | |||
16 | m_file = fileName; | 16 | m_file = fileName; |
17 | else | 17 | else |
18 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); | 18 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); |
19 | } | 19 | } |
20 | OTodoAccessXML::~OTodoAccessXML() { | 20 | OTodoAccessXML::~OTodoAccessXML() { |
21 | 21 | ||
22 | } | 22 | } |
23 | bool OTodoAccessXML::load() { | 23 | bool OTodoAccessXML::load() { |
24 | m_opened = false; | 24 | m_opened = true; |
25 | m_changed = false; | 25 | m_changed = false; |
26 | /* initialize dict */ | 26 | /* initialize dict */ |
27 | /* | 27 | /* |
28 | * UPDATE dict if you change anything!!! | 28 | * UPDATE dict if you change anything!!! |
29 | */ | 29 | */ |
30 | QAsciiDict<int> dict(15); | 30 | QAsciiDict<int> dict(15); |
31 | dict.setAutoDelete( TRUE ); | 31 | dict.setAutoDelete( TRUE ); |
32 | dict.insert("Categories" , new int(OTodo::Category) ); | 32 | dict.insert("Categories" , new int(OTodo::Category) ); |
@@ -64,31 +64,33 @@ bool OTodoAccessXML::load() { | |||
64 | } | 64 | } |
65 | /* here is the right element for a task */ | 65 | /* here is the right element for a task */ |
66 | OTodo ev = todo( &dict, element ); | 66 | OTodo ev = todo( &dict, element ); |
67 | m_events.insert( ev.uid(), ev ); | 67 | m_events.insert( ev.uid(), ev ); |
68 | 68 | ||
69 | element = element->nextChild(); | 69 | element = element->nextChild(); |
70 | } | 70 | } |
71 | }else { | 71 | }else { |
72 | qWarning("could not parse"); | 72 | // qWarning("could not parse"); |
73 | return false;; | 73 | return false;; |
74 | } | 74 | } |
75 | delete root; | 75 | delete root; |
76 | 76 | ||
77 | m_opened = true; | 77 | // qWarning("Access %d" + m_events.count() ); |
78 | qWarning("Access %d" + m_events.count() ); | ||
79 | return true; | 78 | return true; |
80 | } | 79 | } |
81 | bool OTodoAccessXML::reload() { | 80 | bool OTodoAccessXML::reload() { |
82 | return load(); | 81 | return load(); |
83 | } | 82 | } |
84 | bool OTodoAccessXML::save() { | 83 | bool OTodoAccessXML::save() { |
85 | if (!m_opened || !m_changed ) | 84 | // qWarning("saving"); |
85 | if (!m_opened || !m_changed ) { | ||
86 | // qWarning("not saving"); | ||
86 | return true; | 87 | return true; |
88 | } | ||
87 | QString strNewFile = m_file + ".new"; | 89 | QString strNewFile = m_file + ".new"; |
88 | QFile f( strNewFile ); | 90 | QFile f( strNewFile ); |
89 | if (!f.open( IO_WriteOnly|IO_Raw ) ) | 91 | if (!f.open( IO_WriteOnly|IO_Raw ) ) |
90 | return false; | 92 | return false; |
91 | 93 | ||
92 | int written; | 94 | int written; |
93 | QString out; | 95 | QString out; |
94 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; | 96 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; |
@@ -117,17 +119,17 @@ bool OTodoAccessXML::save() { | |||
117 | f.close(); | 119 | f.close(); |
118 | QFile::remove( strNewFile ); | 120 | QFile::remove( strNewFile ); |
119 | return false; | 121 | return false; |
120 | } | 122 | } |
121 | /* flush before renaming */ | 123 | /* flush before renaming */ |
122 | f.close(); | 124 | f.close(); |
123 | 125 | ||
124 | if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { | 126 | if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { |
125 | qWarning("error renaming"); | 127 | // qWarning("error renaming"); |
126 | QFile::remove( strNewFile ); | 128 | QFile::remove( strNewFile ); |
127 | } | 129 | } |
128 | 130 | ||
129 | m_changed = false; | 131 | m_changed = false; |
130 | return true; | 132 | return true; |
131 | } | 133 | } |
132 | QArray<int> OTodoAccessXML::allRecords()const { | 134 | QArray<int> OTodoAccessXML::allRecords()const { |
133 | QArray<int> ids( m_events.count() ); | 135 | QArray<int> ids( m_events.count() ); |
@@ -155,16 +157,17 @@ OTodo OTodoAccessXML::find( int uid )const { | |||
155 | } | 157 | } |
156 | void OTodoAccessXML::clear() { | 158 | void OTodoAccessXML::clear() { |
157 | if (m_opened ) | 159 | if (m_opened ) |
158 | m_changed = true; | 160 | m_changed = true; |
159 | 161 | ||
160 | m_events.clear(); | 162 | m_events.clear(); |
161 | } | 163 | } |
162 | bool OTodoAccessXML::add( const OTodo& todo ) { | 164 | bool OTodoAccessXML::add( const OTodo& todo ) { |
165 | // qWarning("add"); | ||
163 | m_changed = true; | 166 | m_changed = true; |
164 | m_events.insert( todo.uid(), todo ); | 167 | m_events.insert( todo.uid(), todo ); |
165 | 168 | ||
166 | return true; | 169 | return true; |
167 | } | 170 | } |
168 | bool OTodoAccessXML::remove( int uid ) { | 171 | bool OTodoAccessXML::remove( int uid ) { |
169 | m_changed = true; | 172 | m_changed = true; |
170 | m_events.remove( uid ); | 173 | m_events.remove( uid ); |
@@ -212,28 +215,28 @@ QArray<int> OTodoAccessXML::overDue() { | |||
212 | } | 215 | } |
213 | ids.resize( i ); | 216 | ids.resize( i ); |
214 | return ids; | 217 | return ids; |
215 | } | 218 | } |
216 | 219 | ||
217 | 220 | ||
218 | /* private */ | 221 | /* private */ |
219 | OTodo OTodoAccessXML::todo( QAsciiDict<int>* dict, Opie::XMLElement* element)const { | 222 | OTodo OTodoAccessXML::todo( QAsciiDict<int>* dict, Opie::XMLElement* element)const { |
220 | qWarning("parse to do from XMLElement" ); | 223 | // qWarning("parse to do from XMLElement" ); |
221 | OTodo ev; | 224 | OTodo ev; |
222 | QMap<QString, QString> attributes = element->attributes(); | 225 | QMap<QString, QString> attributes = element->attributes(); |
223 | QMap<QString, QString>::Iterator it; | 226 | QMap<QString, QString>::Iterator it; |
224 | 227 | ||
225 | int *find=0; | 228 | int *find=0; |
226 | int day, month, year; | 229 | int day, month, year; |
227 | day = month = year = -1; | 230 | day = month = year = -1; |
228 | for ( it = attributes.begin(); it != attributes.end(); ++it ) { | 231 | for ( it = attributes.begin(); it != attributes.end(); ++it ) { |
229 | find = (*dict)[ it.key() ]; | 232 | find = (*dict)[ it.key() ]; |
230 | if (!find ) { | 233 | if (!find ) { |
231 | qWarning("Unknown option" + it.key() ); | 234 | // qWarning("Unknown option" + it.key() ); |
232 | ev.setCustomField( it.key(), it.data() ); | 235 | ev.setCustomField( it.key(), it.data() ); |
233 | continue; | 236 | continue; |
234 | } | 237 | } |
235 | 238 | ||
236 | switch( *find ) { | 239 | switch( *find ) { |
237 | case OTodo::Uid: | 240 | case OTodo::Uid: |
238 | ev.setUid( it.data().toInt() ); | 241 | ev.setUid( it.data().toInt() ); |
239 | break; | 242 | break; |
@@ -315,16 +318,17 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
315 | str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; | 318 | str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; |
316 | str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; | 319 | str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; |
317 | 320 | ||
318 | if ( ev.hasDueDate() ) { | 321 | if ( ev.hasDueDate() ) { |
319 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; | 322 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; |
320 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; | 323 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; |
321 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; | 324 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; |
322 | } | 325 | } |
326 | // qWarning( "Uid %d", ev.uid() ); | ||
323 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; | 327 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; |
324 | 328 | ||
325 | // append the extra options | 329 | // append the extra options |
326 | /* FIXME Qtopia::Record this is currently not | 330 | /* FIXME Qtopia::Record this is currently not |
327 | * possible you can set custom fields | 331 | * possible you can set custom fields |
328 | * but don' iterate over the list | 332 | * but don' iterate over the list |
329 | * I may do #define private protected | 333 | * I may do #define private protected |
330 | * for this case - cough --zecke | 334 | * for this case - cough --zecke |
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 3a72881..5fe733c 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp | |||
@@ -16,17 +16,17 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName, | |||
16 | m_file = fileName; | 16 | m_file = fileName; |
17 | else | 17 | else |
18 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); | 18 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); |
19 | } | 19 | } |
20 | OTodoAccessXML::~OTodoAccessXML() { | 20 | OTodoAccessXML::~OTodoAccessXML() { |
21 | 21 | ||
22 | } | 22 | } |
23 | bool OTodoAccessXML::load() { | 23 | bool OTodoAccessXML::load() { |
24 | m_opened = false; | 24 | m_opened = true; |
25 | m_changed = false; | 25 | m_changed = false; |
26 | /* initialize dict */ | 26 | /* initialize dict */ |
27 | /* | 27 | /* |
28 | * UPDATE dict if you change anything!!! | 28 | * UPDATE dict if you change anything!!! |
29 | */ | 29 | */ |
30 | QAsciiDict<int> dict(15); | 30 | QAsciiDict<int> dict(15); |
31 | dict.setAutoDelete( TRUE ); | 31 | dict.setAutoDelete( TRUE ); |
32 | dict.insert("Categories" , new int(OTodo::Category) ); | 32 | dict.insert("Categories" , new int(OTodo::Category) ); |
@@ -64,31 +64,33 @@ bool OTodoAccessXML::load() { | |||
64 | } | 64 | } |
65 | /* here is the right element for a task */ | 65 | /* here is the right element for a task */ |
66 | OTodo ev = todo( &dict, element ); | 66 | OTodo ev = todo( &dict, element ); |
67 | m_events.insert( ev.uid(), ev ); | 67 | m_events.insert( ev.uid(), ev ); |
68 | 68 | ||
69 | element = element->nextChild(); | 69 | element = element->nextChild(); |
70 | } | 70 | } |
71 | }else { | 71 | }else { |
72 | qWarning("could not parse"); | 72 | // qWarning("could not parse"); |
73 | return false;; | 73 | return false;; |
74 | } | 74 | } |
75 | delete root; | 75 | delete root; |
76 | 76 | ||
77 | m_opened = true; | 77 | // qWarning("Access %d" + m_events.count() ); |
78 | qWarning("Access %d" + m_events.count() ); | ||
79 | return true; | 78 | return true; |
80 | } | 79 | } |
81 | bool OTodoAccessXML::reload() { | 80 | bool OTodoAccessXML::reload() { |
82 | return load(); | 81 | return load(); |
83 | } | 82 | } |
84 | bool OTodoAccessXML::save() { | 83 | bool OTodoAccessXML::save() { |
85 | if (!m_opened || !m_changed ) | 84 | // qWarning("saving"); |
85 | if (!m_opened || !m_changed ) { | ||
86 | // qWarning("not saving"); | ||
86 | return true; | 87 | return true; |
88 | } | ||
87 | QString strNewFile = m_file + ".new"; | 89 | QString strNewFile = m_file + ".new"; |
88 | QFile f( strNewFile ); | 90 | QFile f( strNewFile ); |
89 | if (!f.open( IO_WriteOnly|IO_Raw ) ) | 91 | if (!f.open( IO_WriteOnly|IO_Raw ) ) |
90 | return false; | 92 | return false; |
91 | 93 | ||
92 | int written; | 94 | int written; |
93 | QString out; | 95 | QString out; |
94 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; | 96 | out = "<!DOCTYPE Tasks>\n<Tasks>\n"; |
@@ -117,17 +119,17 @@ bool OTodoAccessXML::save() { | |||
117 | f.close(); | 119 | f.close(); |
118 | QFile::remove( strNewFile ); | 120 | QFile::remove( strNewFile ); |
119 | return false; | 121 | return false; |
120 | } | 122 | } |
121 | /* flush before renaming */ | 123 | /* flush before renaming */ |
122 | f.close(); | 124 | f.close(); |
123 | 125 | ||
124 | if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { | 126 | if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { |
125 | qWarning("error renaming"); | 127 | // qWarning("error renaming"); |
126 | QFile::remove( strNewFile ); | 128 | QFile::remove( strNewFile ); |
127 | } | 129 | } |
128 | 130 | ||
129 | m_changed = false; | 131 | m_changed = false; |
130 | return true; | 132 | return true; |
131 | } | 133 | } |
132 | QArray<int> OTodoAccessXML::allRecords()const { | 134 | QArray<int> OTodoAccessXML::allRecords()const { |
133 | QArray<int> ids( m_events.count() ); | 135 | QArray<int> ids( m_events.count() ); |
@@ -155,16 +157,17 @@ OTodo OTodoAccessXML::find( int uid )const { | |||
155 | } | 157 | } |
156 | void OTodoAccessXML::clear() { | 158 | void OTodoAccessXML::clear() { |
157 | if (m_opened ) | 159 | if (m_opened ) |
158 | m_changed = true; | 160 | m_changed = true; |
159 | 161 | ||
160 | m_events.clear(); | 162 | m_events.clear(); |
161 | } | 163 | } |
162 | bool OTodoAccessXML::add( const OTodo& todo ) { | 164 | bool OTodoAccessXML::add( const OTodo& todo ) { |
165 | // qWarning("add"); | ||
163 | m_changed = true; | 166 | m_changed = true; |
164 | m_events.insert( todo.uid(), todo ); | 167 | m_events.insert( todo.uid(), todo ); |
165 | 168 | ||
166 | return true; | 169 | return true; |
167 | } | 170 | } |
168 | bool OTodoAccessXML::remove( int uid ) { | 171 | bool OTodoAccessXML::remove( int uid ) { |
169 | m_changed = true; | 172 | m_changed = true; |
170 | m_events.remove( uid ); | 173 | m_events.remove( uid ); |
@@ -212,28 +215,28 @@ QArray<int> OTodoAccessXML::overDue() { | |||
212 | } | 215 | } |
213 | ids.resize( i ); | 216 | ids.resize( i ); |
214 | return ids; | 217 | return ids; |
215 | } | 218 | } |
216 | 219 | ||
217 | 220 | ||
218 | /* private */ | 221 | /* private */ |
219 | OTodo OTodoAccessXML::todo( QAsciiDict<int>* dict, Opie::XMLElement* element)const { | 222 | OTodo OTodoAccessXML::todo( QAsciiDict<int>* dict, Opie::XMLElement* element)const { |
220 | qWarning("parse to do from XMLElement" ); | 223 | // qWarning("parse to do from XMLElement" ); |
221 | OTodo ev; | 224 | OTodo ev; |
222 | QMap<QString, QString> attributes = element->attributes(); | 225 | QMap<QString, QString> attributes = element->attributes(); |
223 | QMap<QString, QString>::Iterator it; | 226 | QMap<QString, QString>::Iterator it; |
224 | 227 | ||
225 | int *find=0; | 228 | int *find=0; |
226 | int day, month, year; | 229 | int day, month, year; |
227 | day = month = year = -1; | 230 | day = month = year = -1; |
228 | for ( it = attributes.begin(); it != attributes.end(); ++it ) { | 231 | for ( it = attributes.begin(); it != attributes.end(); ++it ) { |
229 | find = (*dict)[ it.key() ]; | 232 | find = (*dict)[ it.key() ]; |
230 | if (!find ) { | 233 | if (!find ) { |
231 | qWarning("Unknown option" + it.key() ); | 234 | // qWarning("Unknown option" + it.key() ); |
232 | ev.setCustomField( it.key(), it.data() ); | 235 | ev.setCustomField( it.key(), it.data() ); |
233 | continue; | 236 | continue; |
234 | } | 237 | } |
235 | 238 | ||
236 | switch( *find ) { | 239 | switch( *find ) { |
237 | case OTodo::Uid: | 240 | case OTodo::Uid: |
238 | ev.setUid( it.data().toInt() ); | 241 | ev.setUid( it.data().toInt() ); |
239 | break; | 242 | break; |
@@ -315,16 +318,17 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
315 | str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; | 318 | str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; |
316 | str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; | 319 | str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; |
317 | 320 | ||
318 | if ( ev.hasDueDate() ) { | 321 | if ( ev.hasDueDate() ) { |
319 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; | 322 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; |
320 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; | 323 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; |
321 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; | 324 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; |
322 | } | 325 | } |
326 | // qWarning( "Uid %d", ev.uid() ); | ||
323 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; | 327 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; |
324 | 328 | ||
325 | // append the extra options | 329 | // append the extra options |
326 | /* FIXME Qtopia::Record this is currently not | 330 | /* FIXME Qtopia::Record this is currently not |
327 | * possible you can set custom fields | 331 | * possible you can set custom fields |
328 | * but don' iterate over the list | 332 | * but don' iterate over the list |
329 | * I may do #define private protected | 333 | * I may do #define private protected |
330 | * for this case - cough --zecke | 334 | * for this case - cough --zecke |
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index 60cdbf3..62dc353 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp | |||
@@ -117,17 +117,18 @@ QString OPimRecord::crossToString()const { | |||
117 | } | 117 | } |
118 | str = str.remove( str.length()-1, 1); // strip the ; | 118 | str = str.remove( str.length()-1, 1); // strip the ; |
119 | //qWarning("IDS " + str ); | 119 | //qWarning("IDS " + str ); |
120 | 120 | ||
121 | return str; | 121 | return str; |
122 | } | 122 | } |
123 | /* if uid = 1 assign a new one */ | 123 | /* if uid = 1 assign a new one */ |
124 | void OPimRecord::setUid( int uid ) { | 124 | void OPimRecord::setUid( int uid ) { |
125 | 125 | // qWarning("setting uid" ); | |
126 | if ( uid == 1) | 126 | if ( uid == 1) |
127 | uid = uidGen().generate(); | 127 | uid = uidGen().generate(); |
128 | 128 | ||
129 | // qWarning(" uid %d", uid); | ||
129 | Qtopia::Record::setUid( uid ); | 130 | Qtopia::Record::setUid( uid ); |
130 | }; | 131 | }; |
131 | Qtopia::UidGen &OPimRecord::uidGen() { | 132 | Qtopia::UidGen &OPimRecord::uidGen() { |
132 | return m_uidGen; | 133 | return m_uidGen; |
133 | } | 134 | } |
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index a65cf5c..8ec09bc 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp | |||
@@ -10,17 +10,17 @@ OTodoAccess::OTodoAccess( OTodoAccessBackend* end ) | |||
10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) | 10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) |
11 | { | 11 | { |
12 | if (end == 0l ) | 12 | if (end == 0l ) |
13 | m_todoBackEnd = new OTodoAccessXML( "Todolist" ); | 13 | m_todoBackEnd = new OTodoAccessXML( "Todolist" ); |
14 | 14 | ||
15 | setBackEnd( m_todoBackEnd ); | 15 | setBackEnd( m_todoBackEnd ); |
16 | } | 16 | } |
17 | OTodoAccess::~OTodoAccess() { | 17 | OTodoAccess::~OTodoAccess() { |
18 | qWarning("~OTodoAccess"); | 18 | // qWarning("~OTodoAccess"); |
19 | } | 19 | } |
20 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { | 20 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { |
21 | QValueList<OTodo>::ConstIterator it; | 21 | QValueList<OTodo>::ConstIterator it; |
22 | for ( it = list.begin(); it != list.end(); ++it ) { | 22 | for ( it = list.begin(); it != list.end(); ++it ) { |
23 | replace( (*it) ); | 23 | replace( (*it) ); |
24 | } | 24 | } |
25 | } | 25 | } |
26 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, | 26 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, |
@@ -58,14 +58,14 @@ void OTodoAccess::delAlarm( int uid) { | |||
58 | 58 | ||
59 | QDateTime schedule; // Create null DateTime | 59 | QDateTime schedule; // Create null DateTime |
60 | 60 | ||
61 | // I hope this will remove all scheduled alarms | 61 | // I hope this will remove all scheduled alarms |
62 | // with the given uid !? | 62 | // with the given uid !? |
63 | // If not: I have to rethink how to remove already | 63 | // If not: I have to rethink how to remove already |
64 | // scheduled events... (se) | 64 | // scheduled events... (se) |
65 | // it should be fine -zecke | 65 | // it should be fine -zecke |
66 | qWarning("Removing alarm for event with uid %d", uid ); | 66 | // qWarning("Removing alarm for event with uid %d", uid ); |
67 | AlarmServer::deleteAlarm( schedule , | 67 | AlarmServer::deleteAlarm( schedule , |
68 | "QPE/Application/todolist", | 68 | "QPE/Application/todolist", |
69 | "alarm(QDateTime,int)", uid ); | 69 | "alarm(QDateTime,int)", uid ); |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index 36728b8..1795938 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -66,16 +66,18 @@ template <class T = OPimRecord > | |||
66 | class ORecordList { | 66 | class ORecordList { |
67 | public: | 67 | public: |
68 | typedef OTemplateBase<T> Base; | 68 | typedef OTemplateBase<T> Base; |
69 | typedef ORecordListIterator<T> Iterator; | 69 | typedef ORecordListIterator<T> Iterator; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * c'tor | 72 | * c'tor |
73 | */ | 73 | */ |
74 | ORecordList () { | ||
75 | } | ||
74 | ORecordList( const QArray<int>& ids, | 76 | ORecordList( const QArray<int>& ids, |
75 | const Base* ); | 77 | const Base* ); |
76 | ~ORecordList(); | 78 | ~ORecordList(); |
77 | 79 | ||
78 | /** | 80 | /** |
79 | * the first iterator | 81 | * the first iterator |
80 | */ | 82 | */ |
81 | Iterator begin(); | 83 | Iterator begin(); |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index cc46b21..6dd4c0e 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -156,17 +156,17 @@ void OTodo::setHasDueDate( bool hasDate ) | |||
156 | } | 156 | } |
157 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | 157 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) |
158 | { | 158 | { |
159 | changeOrModify(); | 159 | changeOrModify(); |
160 | data->hasAlarmDateTime = hasAlarmDateTime; | 160 | data->hasAlarmDateTime = hasAlarmDateTime; |
161 | } | 161 | } |
162 | void OTodo::setDescription(const QString &desc ) | 162 | void OTodo::setDescription(const QString &desc ) |
163 | { | 163 | { |
164 | qWarning( "desc " + desc ); | 164 | // qWarning( "desc " + desc ); |
165 | changeOrModify(); | 165 | changeOrModify(); |
166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
167 | } | 167 | } |
168 | void OTodo::setSummary( const QString& sum ) | 168 | void OTodo::setSummary( const QString& sum ) |
169 | { | 169 | { |
170 | changeOrModify(); | 170 | changeOrModify(); |
171 | data->sum = sum; | 171 | data->sum = sum; |
172 | } | 172 | } |
@@ -313,17 +313,17 @@ void OTodo::deref() { | |||
313 | if ( data->deref() ) { | 313 | if ( data->deref() ) { |
314 | // qWarning("deleting"); | 314 | // qWarning("deleting"); |
315 | delete data; | 315 | delete data; |
316 | data= 0; | 316 | data= 0; |
317 | } | 317 | } |
318 | } | 318 | } |
319 | OTodo &OTodo::operator=(const OTodo &item ) | 319 | OTodo &OTodo::operator=(const OTodo &item ) |
320 | { | 320 | { |
321 | // OPimRecord::operator=( item ); | 321 | OPimRecord::operator=( item ); |
322 | //qWarning("operator= ref "); | 322 | //qWarning("operator= ref "); |
323 | item.data->ref(); | 323 | item.data->ref(); |
324 | deref(); | 324 | deref(); |
325 | data = item.data; | 325 | data = item.data; |
326 | 326 | ||
327 | return *this; | 327 | return *this; |
328 | } | 328 | } |
329 | 329 | ||