-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 11 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 80b8599..f3b0783 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp @@ -444,17 +444,15 @@ public: * we take the sortorder( switch on it ) * */ int compareItems( Item d1, Item d2 ) { - qWarning("compare items"); int ret =0; OTodoXMLContainer* con1 = (OTodoXMLContainer*)d1; OTodoXMLContainer* con2 = (OTodoXMLContainer*)d2; /* same item */ if ( con1->todo.uid() == con2->todo.uid() ) return 0; - qWarning("m_sort %d", m_sort ); switch ( m_sort ) { /* completed */ case 0: { @@ -486,8 +484,10 @@ public: */ if ( con1->todo.hasDueDate() && con2->todo.hasDueDate() ) ret = con1->todo.dueDate().daysTo( con2->todo.dueDate() ); + + else if ( con1->todo.hasDueDate() ) ret = -1; else if ( con2->todo.hasDueDate() ) ret = 0; @@ -510,23 +510,23 @@ public: }; QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, int sortFilter, int cat ) { + qWarning("sorted! %d cat", cat); OTodoXMLVector vector(m_events.count(), asc,sortOrder ); QMap<int, OTodo>::Iterator it; int item = 0; bool bCat = sortFilter & 1 ? true : false; - bool bOver = sortFilter & 0 ? true : false; bool bOnly = sortFilter & 2 ? true : false; for ( it = m_events.begin(); it != m_events.end(); ++it ) { /* show category */ - if ( bCat ) + if ( bCat && cat != 0) if (!(*it).categories().contains( cat ) ) continue; /* isOverdue but we should not show overdue */ - if ( (*it).isOverdue() && ( !bOver || !bOnly ) ) + if ( (*it).isOverdue() && !bOnly ) continue; if ( !(*it).isOverdue() && bOnly ) continue; @@ -543,6 +543,7 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, QArray<int> array( vector.count() ); for (uint i= 0; i < vector.count(); i++ ) { array[i] = ( vector.at(i) )->todo.uid(); } + qWarning("array count = %d %d", array.count(), vector.count() ); return array; }; diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 80b8599..f3b0783 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp @@ -444,17 +444,15 @@ public: * we take the sortorder( switch on it ) * */ int compareItems( Item d1, Item d2 ) { - qWarning("compare items"); int ret =0; OTodoXMLContainer* con1 = (OTodoXMLContainer*)d1; OTodoXMLContainer* con2 = (OTodoXMLContainer*)d2; /* same item */ if ( con1->todo.uid() == con2->todo.uid() ) return 0; - qWarning("m_sort %d", m_sort ); switch ( m_sort ) { /* completed */ case 0: { @@ -486,8 +484,10 @@ public: */ if ( con1->todo.hasDueDate() && con2->todo.hasDueDate() ) ret = con1->todo.dueDate().daysTo( con2->todo.dueDate() ); + + else if ( con1->todo.hasDueDate() ) ret = -1; else if ( con2->todo.hasDueDate() ) ret = 0; @@ -510,23 +510,23 @@ public: }; QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, int sortFilter, int cat ) { + qWarning("sorted! %d cat", cat); OTodoXMLVector vector(m_events.count(), asc,sortOrder ); QMap<int, OTodo>::Iterator it; int item = 0; bool bCat = sortFilter & 1 ? true : false; - bool bOver = sortFilter & 0 ? true : false; bool bOnly = sortFilter & 2 ? true : false; for ( it = m_events.begin(); it != m_events.end(); ++it ) { /* show category */ - if ( bCat ) + if ( bCat && cat != 0) if (!(*it).categories().contains( cat ) ) continue; /* isOverdue but we should not show overdue */ - if ( (*it).isOverdue() && ( !bOver || !bOnly ) ) + if ( (*it).isOverdue() && !bOnly ) continue; if ( !(*it).isOverdue() && bOnly ) continue; @@ -543,6 +543,7 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, QArray<int> array( vector.count() ); for (uint i= 0; i < vector.count(); i++ ) { array[i] = ( vector.at(i) )->todo.uid(); } + qWarning("array count = %d %d", array.count(), vector.count() ); return array; }; |