Main | License | Installation | FAQ | Screenshots | Contact | Links | Sf.net | Freshmeat.net | KDE-Apps.org
Requirements | Design | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

categoryListItem.cpp

Go to the documentation of this file.
00001 /* Copyright (C) 2002, 2003, 2004, 2005 Jan Wedekind.
00002    This file is part of the recipe database application AnyMeal.
00003 
00004    AnyMeal is free software; you can redistribute it and/or modify it under
00005    the terms of the GNU GENERAL PUBLIC LICENSE as published by the Free
00006    Software Foundation; either version 3 of the License, or (at your option)
00007    any later version.
00008 
00009    AnyMeal is distributed in the hope that it will be useful, but WITHOUT ANY
00010    WARRANTY; without even the implied warranty of MERCHANTIBILITY or FITNESS
00011    FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
00012    details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
00016 #include <cassert>
00017 #include <stdlib.h>
00018 #include "categoryListItem.hpp"
00019 
00020 using namespace std;
00021 
00022 CategoryListItem::CategoryListItem( QListView *parent, const QString &text ):
00023   QCheckListItem( parent, text, CheckBox )
00024 {
00025 }
00026 
00027 int CategoryListItem::compare( QListViewItem *i, int col, bool ascending ) const
00028 {
00029   int retVal;
00030   if ( col != 1 ) {
00031     double
00032       a = atof( key( col, ascending ) ),
00033       b = atof( i->key( col, ascending ) );
00034     if ( a < b )
00035       retVal = -1;
00036     else
00037       if ( a > b )
00038         retVal = 1;
00039       else
00040         retVal = 0;
00041   } else
00042     retVal = QCheckListItem::compare( i, col, ascending );
00043   return retVal;
00044 }


anymeal 0.30 - recipe management software - Make the most of your food! - © Jan Wedekind Sun Sep 14 16:01:26 2008 - GNU Free Documentation License