summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/private
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/private') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/private/opimeventsortvector.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libopie2/opiepim/private/opimeventsortvector.cpp b/libopie2/opiepim/private/opimeventsortvector.cpp
index 4220c63..b85f848 100644
--- a/libopie2/opiepim/private/opimeventsortvector.cpp
+++ b/libopie2/opiepim/private/opimeventsortvector.cpp
@@ -24,69 +24,66 @@
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "opimeventsortvector.h"
#include <opie2/ocontactaccess.h>
#include <opie2/opimnotifymanager.h>
#include <opie2/odatebookaccess.h>
#include <qvaluelist.h>
namespace Opie {
namespace Internal {
-namespace{
-
-inline int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){
+int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){
OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms();
OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms();
// Well.. How could we compare two lists of alarms? I think we should find the most early datetimes
// and compare them.. (se)
// Find the first alarm of the left list
OPimNotifyManager::Alarms::Iterator it;
QDateTime left_earliest; // This datetime is initialized as invalid!!
for ( it = left_alarms.begin(); it != left_alarms.end(); ++it ){
if ( !left_earliest.isValid() || left_earliest > (*it).dateTime() ){
left_earliest = (*it).dateTime();
}
}
QDateTime right_earliest; // This datetime is initialized as invalid!!
for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){
if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){
right_earliest = (*it).dateTime();
}
}
- int ret;
+ int ret = 0;
// Now compare this found alarms
if ( !left_earliest .isValid() ) ret++;
if ( !right_earliest.isValid() ) ret--;
if ( left_earliest.isValid() && right_earliest.isValid() ){
- ret += left_earliest < right_earliest ? -1 : 1;
+ left_earliest < right_earliest ? ret-- : ret++;
}
return ret;
}
-}
OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort )
: OPimSortVector<OPimEvent>( size, asc, sort ) {}
int OPimEventSortVector::compareItems( const OPimEvent& left,
const OPimEvent& right ) {
if ( left.uid() == right.uid() )
return 0;
int ret = 0;
bool asc = sortAscending();
switch( sortOrder() ) {
case ODateBookAccess::SortDescription:
ret = testString( left.description(), right.description() );
break;