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 @@ -28,12 +28,7 @@ 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> @@ -43,6 +38,15 @@ #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; @@ -291,7 +295,7 @@ namespace { } - qDebug("add %s", qu.latin1() ); + odebug << "add " << qu << "" << oendl; return qu; } @@ -456,7 +460,7 @@ 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; @@ -466,7 +470,7 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, /* 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++; } @@ -541,7 +545,7 @@ 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 "; @@ -600,11 +604,11 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, } 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) ); } @@ -629,19 +633,19 @@ 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. @@ -649,7 +653,7 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { 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"), @@ -750,7 +754,7 @@ 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 ) { @@ -776,7 +780,7 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const qu += ")"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); @@ -816,7 +820,7 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ 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; @@ -842,12 +846,12 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ } 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; } } @@ -860,7 +864,7 @@ QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const 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; } |