summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccess.h6
-rw-r--r--libopie/pim/otodoaccesssql.cpp61
-rw-r--r--libopie/pim/otodoaccesssql.h6
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp61
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.h6
-rw-r--r--libopie2/opiepim/core/otodoaccess.h6
6 files changed, 130 insertions, 16 deletions
diff --git a/libopie/pim/otodoaccess.h b/libopie/pim/otodoaccess.h
index 12997aa..390ab0e 100644
--- a/libopie/pim/otodoaccess.h
+++ b/libopie/pim/otodoaccess.h
@@ -23,5 +23,5 @@ public:
23 Deadline }; 23 Deadline };
24 enum SortFilter{ ShowOverdue = 0, 24 enum SortFilter{ Category =1,
25 Category =1, 25 OnlyOverDue= 2,
26 OnlyOverDue= 2 }; 26 DoNotShowCompleted =4 };
27 /** 27 /**
diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp
index 209e714..25536e0 100644
--- a/libopie/pim/otodoaccesssql.cpp
+++ b/libopie/pim/otodoaccesssql.cpp
@@ -310,6 +310,63 @@ QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s,
310} 310}
311/*
312 *
313 */
311QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, 314QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
312 int sortFilter, int cat ) { 315 int sortFilter, int cat ) {
313 QArray<int> ints(0); 316 QString query;
314 return ints; 317 query = "select uid from todolist WHERE ";
318
319 /*
320 * Sort Filter stuff
321 * not that straight forward
322 *
323 */
324 /* Category */
325 if ( sortFilter & 1 ) {
326 query += " categories like '%" +QString::number(cat)+"%' AND";
327 }
328 /* Show only overdue */
329 if ( sortFilter & 2 ) {
330 QDate date = QDate::currentDate();
331 QString due;
332 QString base;
333 base = QString("DueDate <= '%1-%2-%3' AND WHERE completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() );
334 query += " " + base + " AND";
335 }
336 /* not show completed */
337 if ( sortFilter & 4 ) {
338 query += " completed = 0 AND";
339 }else{
340 query += " ( completed = 1 OR completed = 0) AND";
341 }
342 /* srtip the end */
343 query = query.remove( query.length()-3, 3 );
344
345
346 /*
347 * sort order stuff
348 * quite straight forward
349 */
350 query += "ORDER BY ";
351 switch( sortOrder ) {
352 /* completed */
353 case 0:
354 query += "completed";
355 break;
356 case 1:
357 query += "priority";
358 break;
359 case 2:
360 query += "description";
361 break;
362 case 3:
363 query += "DueDate";
364 break;
365 }
366 if ( !asc )
367 query += " DESC";
368
369 qWarning( query );
370 OSQLRawQuery raw(query );
371 return uids( m_driver->query(&raw) );
315} 372}
diff --git a/libopie/pim/otodoaccesssql.h b/libopie/pim/otodoaccesssql.h
index 966628d..6c5f50a 100644
--- a/libopie/pim/otodoaccesssql.h
+++ b/libopie/pim/otodoaccesssql.h
@@ -34,5 +34,5 @@ private:
34 void fillDict(); 34 void fillDict();
35 bool date( QDate& date, const QString& )const; 35 inline bool date( QDate& date, const QString& )const;
36 OTodo todo( const OSQLResult& )const; 36 inline OTodo todo( const OSQLResult& )const;
37 QArray<int> uids( const OSQLResult& )const; 37 inline QArray<int> uids( const OSQLResult& )const;
38 OTodo todo( int uid )const; 38 OTodo todo( int uid )const;
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 209e714..25536e0 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -310,6 +310,63 @@ QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s,
310} 310}
311/*
312 *
313 */
311QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, 314QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
312 int sortFilter, int cat ) { 315 int sortFilter, int cat ) {
313 QArray<int> ints(0); 316 QString query;
314 return ints; 317 query = "select uid from todolist WHERE ";
318
319 /*
320 * Sort Filter stuff
321 * not that straight forward
322 *
323 */
324 /* Category */
325 if ( sortFilter & 1 ) {
326 query += " categories like '%" +QString::number(cat)+"%' AND";
327 }
328 /* Show only overdue */
329 if ( sortFilter & 2 ) {
330 QDate date = QDate::currentDate();
331 QString due;
332 QString base;
333 base = QString("DueDate <= '%1-%2-%3' AND WHERE completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() );
334 query += " " + base + " AND";
335 }
336 /* not show completed */
337 if ( sortFilter & 4 ) {
338 query += " completed = 0 AND";
339 }else{
340 query += " ( completed = 1 OR completed = 0) AND";
341 }
342 /* srtip the end */
343 query = query.remove( query.length()-3, 3 );
344
345
346 /*
347 * sort order stuff
348 * quite straight forward
349 */
350 query += "ORDER BY ";
351 switch( sortOrder ) {
352 /* completed */
353 case 0:
354 query += "completed";
355 break;
356 case 1:
357 query += "priority";
358 break;
359 case 2:
360 query += "description";
361 break;
362 case 3:
363 query += "DueDate";
364 break;
365 }
366 if ( !asc )
367 query += " DESC";
368
369 qWarning( query );
370 OSQLRawQuery raw(query );
371 return uids( m_driver->query(&raw) );
315} 372}
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h
index 966628d..6c5f50a 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.h
+++ b/libopie2/opiepim/backend/otodoaccesssql.h
@@ -34,5 +34,5 @@ private:
34 void fillDict(); 34 void fillDict();
35 bool date( QDate& date, const QString& )const; 35 inline bool date( QDate& date, const QString& )const;
36 OTodo todo( const OSQLResult& )const; 36 inline OTodo todo( const OSQLResult& )const;
37 QArray<int> uids( const OSQLResult& )const; 37 inline QArray<int> uids( const OSQLResult& )const;
38 OTodo todo( int uid )const; 38 OTodo todo( int uid )const;
diff --git a/libopie2/opiepim/core/otodoaccess.h b/libopie2/opiepim/core/otodoaccess.h
index 12997aa..390ab0e 100644
--- a/libopie2/opiepim/core/otodoaccess.h
+++ b/libopie2/opiepim/core/otodoaccess.h
@@ -23,5 +23,5 @@ public:
23 Deadline }; 23 Deadline };
24 enum SortFilter{ ShowOverdue = 0, 24 enum SortFilter{ Category =1,
25 Category =1, 25 OnlyOverDue= 2,
26 OnlyOverDue= 2 }; 26 DoNotShowCompleted =4 };
27 /** 27 /**