Diffstat (limited to 'libopie2/opiepim/backend/otodoaccesssql.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 132b5a6..6f65c48 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -27,14 +27,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qdatetime.h> -#include <qmap.h> -#include <qstring.h> - -#include <qpe/global.h> - +/* OPIE */ #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> @@ -42,8 +37,17 @@ #include <opie2/otodoaccesssql.h> #include <opie2/opimstate.h> #include <opie2/opimnotifymanager.h> #include <opie2/opimrecurrence.h> +#include <opie2/odebug.h> + +#include <qpe/global.h> + +/* QT */ +#include <qdatetime.h> +#include <qmap.h> +#include <qstring.h> + using namespace Opie::DB; using namespace Opie; @@ -290,9 +294,9 @@ namespace { + "');"; } - qDebug("add %s", qu.latin1() ); + odebug << "add " << qu << "" << oendl; return qu; } RemoveQuery::RemoveQuery(int uid ) @@ -455,9 +459,9 @@ OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ } OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ uint CACHE = readAhead(); - qDebug("searching for %d", uid ); + odebug << "searching for " << uid << "" << oendl; QArray<int> search( CACHE ); uint size =0; OPimTodo to; @@ -465,9 +469,9 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, switch( dir ) { /* forward */ case 0: // FIXME: Not a good style to use magic numbers here (eilers) for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { - qDebug("size %d %d", size, ints[i] ); + odebug << "size " << size << " " << ints[i] << "" << oendl; search[size] = ints[i]; size++; } break; @@ -540,9 +544,9 @@ QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s, * */ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, int sortFilter, int cat ) { - qDebug("sorted %d, %d", asc, sortOrder ); + odebug << "sorted " << asc << ", " << sortOrder << "" << oendl; QString query; query = "select uid from todolist WHERE "; /* @@ -599,13 +603,13 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, break; } if ( !asc ) { - qDebug("not ascending!"); + odebug << "not ascending!" << oendl; query += " DESC"; } - qDebug( query ); + odebug << query << oendl; OSQLRawQuery raw(query ); return uids( m_driver->query(&raw) ); } bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ @@ -628,29 +632,29 @@ OPimTodo OPimTodoAccessBackendSQL::todo( const OSQLResult& res ) const{ } OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it = list.begin(); - qDebug("todo1"); + odebug << "todo1" << oendl; OPimTodo to = todo( (*it) ); cache( to ); ++it; for ( ; it != list.end(); ++it ) { - qDebug("caching"); + odebug << "caching" << oendl; cache( todo( (*it) ) ); } return to; } OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { - qDebug("todo(ResultItem)"); + odebug << "todo(ResultItem)" << oendl; // Request information from addressbook table and create the OPimTodo-object. bool hasDueDate = false; QDate dueDate = QDate::currentDate(); hasDueDate = date( dueDate, item.data("DueDate") ); QStringList cats = QStringList::split(";", item.data("categories") ); - qDebug("Item is completed: %d", item.data("completed").toInt() ); + odebug << "Item is completed: " << item.data("completed").toInt() << "" << oendl; OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), cats, item.data("summary"), item.data("description"), item.data("progress").toUShort(), hasDueDate, dueDate, @@ -749,9 +753,9 @@ QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{ OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray<int> ints(list.count() ); - qDebug(" count = %d", list.count() ); + odebug << " count = " << list.count() << "" << oendl; int i = 0; for (it = list.begin(); it != list.end(); ++it ) { ints[i] = (*it).data("uid").toInt(); @@ -775,9 +779,9 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const qu += " rlike(\""+ r.pattern() + "\",\"summary\")"; qu += ")"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); @@ -815,9 +819,9 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ OSQLResult res = m_driver->query( &raw ); QArray<int> completed_uids = uids( res ); - qDebug( "Number of completed: %d", completed_uids.size() ); + odebug << "Number of completed: " << completed_uids.size() << "" << oendl; if ( completed_uids.size() == 0 ) return; @@ -841,14 +845,14 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ query += QString( "uid = %1" ).arg( completed_uids[i] ); } qu += query + " );"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw2( qu ); res = m_driver->query( &raw2 ); if ( res.state() == OSQLResult::Failure ) { - qWarning("OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: %s", qu.latin1() ); + owarn << "OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: " << qu << "" << oendl; } } @@ -859,9 +863,9 @@ QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const FindCustomQuery query( uid ); OSQLResult res_custom = m_driver->query( &query ); if ( res_custom.state() == OSQLResult::Failure ) { - qWarning("OSQLResult::Failure in find query !!"); + owarn << "OSQLResult::Failure in find query !!" << oendl; QMap<QString, QString> empty; return empty; } |