summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index ef036d5..132b5a6 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -166,7 +166,7 @@ namespace {
166 QArray<int> m_uids; 166 QArray<int> m_uids;
167 int m_uid; 167 int m_uid;
168 }; 168 };
169 169
170 170
171 171
172 CreateQuery::CreateQuery() : OSQLQuery() {} 172 CreateQuery::CreateQuery() : OSQLQuery() {}
@@ -176,7 +176,7 @@ namespace {
176 qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; 176 qu += "create table todolist( uid PRIMARY KEY, categories, completed, ";
177 qu += "description, summary, priority, DueDate, progress , state, "; 177 qu += "description, summary, priority, DueDate, progress , state, ";
178 // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers) 178 // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers)
179 qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; 179 qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, ";
180 qu += "reminders, alarms, maintainer, startdate, completeddate);"; 180 qu += "reminders, alarms, maintainer, startdate, completeddate);";
181 qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; 181 qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );";
182 return qu; 182 return qu;
@@ -220,7 +220,7 @@ namespace {
220 sYear = sDate.year(); 220 sYear = sDate.year();
221 sMonth= sDate.month(); 221 sMonth= sDate.month();
222 sDay = sDate.day(); 222 sDay = sDate.day();
223 } 223 }
224 224
225 int eYear = 0, eMonth = 0, eDay = 0; 225 int eYear = 0, eMonth = 0, eDay = 0;
226 if( m_todo.hasCompletedDate() ){ 226 if( m_todo.hasCompletedDate() ){
@@ -228,17 +228,17 @@ namespace {
228 eYear = eDate.year(); 228 eYear = eDate.year();
229 eMonth= eDate.month(); 229 eMonth= eDate.month();
230 eDay = eDate.day(); 230 eDay = eDate.day();
231 } 231 }
232 QString qu; 232 QString qu;
233 QMap<int, QString> recMap = m_todo.recurrence().toMap(); 233 QMap<int, QString> recMap = m_todo.recurrence().toMap();
234 qu = "insert into todolist VALUES(" 234 qu = "insert into todolist VALUES("
235 + QString::number( m_todo.uid() ) + "," 235 + QString::number( m_todo.uid() ) + ","
236 + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," 236 + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + ","
237 + QString::number( m_todo.isCompleted() ) + "," 237 + QString::number( m_todo.isCompleted() ) + ","
238 + "'" + m_todo.description() + "'" + "," 238 + "'" + m_todo.description() + "'" + ","
239 + "'" + m_todo.summary() + "'" + "," 239 + "'" + m_todo.summary() + "'" + ","
240 + QString::number(m_todo.priority() ) + "," 240 + QString::number(m_todo.priority() ) + ","
241 + "'" + QString::number(year).rightJustify( 4, '0' ) + "-" 241 + "'" + QString::number(year).rightJustify( 4, '0' ) + "-"
242 + QString::number(month).rightJustify( 2, '0' ) 242 + QString::number(month).rightJustify( 2, '0' )
243 + "-" + QString::number( day ).rightJustify( 2, '0' )+ "'" + "," 243 + "-" + QString::number( day ).rightJustify( 2, '0' )+ "'" + ","
244 + QString::number( m_todo.progress() ) + "," 244 + QString::number( m_todo.progress() ) + ","
@@ -251,10 +251,10 @@ namespace {
251 + "'" + recMap[ OPimRecurrence::EndDate ] + "'" + "," 251 + "'" + recMap[ OPimRecurrence::EndDate ] + "'" + ","
252 + "'" + recMap[ OPimRecurrence::Created ] + "'" + "," 252 + "'" + recMap[ OPimRecurrence::Created ] + "'" + ","
253 + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ","; 253 + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ",";
254 254
255 if ( m_todo.hasNotifiers() ) { 255 if ( m_todo.hasNotifiers() ) {
256 OPimNotifyManager manager = m_todo.notifiers(); 256 OPimNotifyManager manager = m_todo.notifiers();
257 qu += "'" + manager.remindersToString() + "'" + "," 257 qu += "'" + manager.remindersToString() + "'" + ","
258 + "'" + manager.alarmsToString() + "'" + ","; 258 + "'" + manager.alarmsToString() + "'" + ",";
259 } 259 }
260 else{ 260 else{
@@ -263,33 +263,33 @@ namespace {
263 } 263 }
264 264
265 qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) 265 qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !)
266 + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-" 266 + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-"
267 + QString::number(sMonth).rightJustify( 2, '0' ) 267 + QString::number(sMonth).rightJustify( 2, '0' )
268 + "-" + QString::number(sDay).rightJustify( 2, '0' )+ "'" + "," 268 + "-" + QString::number(sDay).rightJustify( 2, '0' )+ "'" + ","
269 + "'" + QString::number(eYear).rightJustify( 4, '0' ) + "-" 269 + "'" + QString::number(eYear).rightJustify( 4, '0' ) + "-"
270 + QString::number(eMonth).rightJustify( 2, '0' ) 270 + QString::number(eMonth).rightJustify( 2, '0' )
271 + "-"+QString::number(eDay).rightJustify( 2, '0' ) + "'" 271 + "-"+QString::number(eDay).rightJustify( 2, '0' ) + "'"
272 + ")"; 272 + "); ";
273 273
274 // Save custom Entries: 274 // Save custom Entries:
275 int id = 0; 275 int id = 0;
276 id = 0; 276 id = 0;
277 QMap<QString, QString> customMap = m_todo.toExtraMap(); 277 QMap<QString, QString> customMap = m_todo.toExtraMap();
278 for( QMap<QString, QString>::Iterator it = customMap.begin(); 278 for( QMap<QString, QString>::Iterator it = customMap.begin();
279 it != customMap.end(); ++it ){ 279 it != customMap.end(); ++it ){
280 qu += "insert into custom_data VALUES(" 280 qu += "insert into custom_data VALUES("
281 + QString::number( m_todo.uid() ) 281 + QString::number( m_todo.uid() )
282 + "," 282 + ","
283 + QString::number( id++ ) 283 + QString::number( id++ )
284 + ",'" 284 + ",'"
285 + it.key() 285 + it.key()
286 + "'," 286 + "',"
287 + "0" // Priority for future enhancements 287 + "0" // Priority for future enhancements
288 + ",'" 288 + ",'"
289 + it.data() 289 + it.data()
290 + "');"; 290 + "');";
291 } 291 }
292 292
293 293
294 qDebug("add %s", qu.latin1() ); 294 qDebug("add %s", qu.latin1() );
295 return qu; 295 return qu;
@@ -644,7 +644,7 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
644 qDebug("todo(ResultItem)"); 644 qDebug("todo(ResultItem)");
645 645
646 // Request information from addressbook table and create the OPimTodo-object. 646 // Request information from addressbook table and create the OPimTodo-object.
647 647
648 bool hasDueDate = false; QDate dueDate = QDate::currentDate(); 648 bool hasDueDate = false; QDate dueDate = QDate::currentDate();
649 hasDueDate = date( dueDate, item.data("DueDate") ); 649 hasDueDate = date( dueDate, item.data("DueDate") );
650 QStringList cats = QStringList::split(";", item.data("categories") ); 650 QStringList cats = QStringList::split(";", item.data("categories") );
@@ -670,7 +670,7 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
670 to.setStartDate( startDate ); 670 to.setStartDate( startDate );
671 if ( hasCompletedDate ) 671 if ( hasCompletedDate )
672 to.setCompletedDate( completedDate ); 672 to.setCompletedDate( completedDate );
673 673
674 OPimNotifyManager& manager = to.notifiers(); 674 OPimNotifyManager& manager = to.notifiers();
675 manager.alarmsFromString( item.data("alarms") ); 675 manager.alarmsFromString( item.data("alarms") );
676 manager.remindersFromString( item.data("reminders") ); 676 manager.remindersFromString( item.data("reminders") );
@@ -688,7 +688,7 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
688 recMap.insert( OPimRecurrence::EndDate , item.data("EndDate") ); 688 recMap.insert( OPimRecurrence::EndDate , item.data("EndDate") );
689 recMap.insert( OPimRecurrence::Created , item.data("Created") ); 689 recMap.insert( OPimRecurrence::Created , item.data("Created") );
690 recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); 690 recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") );
691 691
692 OPimRecurrence recur; 692 OPimRecurrence recur;
693 recur.fromMap( recMap ); 693 recur.fromMap( recMap );
694 to.setRecurrence( recur ); 694 to.setRecurrence( recur );
@@ -773,7 +773,7 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const
773 // Do it make sense to search other fields, too ? 773 // Do it make sense to search other fields, too ?
774 qu += " rlike(\""+ r.pattern() + "\",\"description\") OR"; 774 qu += " rlike(\""+ r.pattern() + "\",\"description\") OR";
775 qu += " rlike(\""+ r.pattern() + "\",\"summary\")"; 775 qu += " rlike(\""+ r.pattern() + "\",\"summary\")";
776 776
777 qu += ")"; 777 qu += ")";
778 778
779 qDebug( "query: %s", qu.latin1() ); 779 qDebug( "query: %s", qu.latin1() );
@@ -801,12 +801,12 @@ QBitArray OPimTodoAccessBackendSQL::sup() const{
801 ar[OPimTodo::Reminders] = false; 801 ar[OPimTodo::Reminders] = false;
802 ar[OPimTodo::Notifiers] = false; 802 ar[OPimTodo::Notifiers] = false;
803 ar[OPimTodo::Maintainer] = false; 803 ar[OPimTodo::Maintainer] = false;
804 804
805 return ar; 805 return ar;
806} 806}
807 807
808void OPimTodoAccessBackendSQL::removeAllCompleted(){ 808void OPimTodoAccessBackendSQL::removeAllCompleted(){
809 // First we need the uids from all entries which are 809 // First we need the uids from all entries which are
810 // completed. Then, we just have to remove them... 810 // completed. Then, we just have to remove them...
811 811
812 QString qu = "SELECT uid FROM todolist WHERE completed = 1"; 812 QString qu = "SELECT uid FROM todolist WHERE completed = 1";
@@ -855,7 +855,7 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){
855QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const 855QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const
856{ 856{
857 QMap<QString, QString> customMap; 857 QMap<QString, QString> customMap;
858 858
859 FindCustomQuery query( uid ); 859 FindCustomQuery query( uid );
860 OSQLResult res_custom = m_driver->query( &query ); 860 OSQLResult res_custom = m_driver->query( &query );
861 861