You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.7 KiB
85 lines
2.7 KiB
/*********
|
|
*
|
|
* This file is part of BibleTime's source code, http://www.bibletime.info/.
|
|
*
|
|
* Copyright 1999-2006 by the BibleTime developers.
|
|
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
|
|
*
|
|
**********/
|
|
|
|
|
|
|
|
#include "csortlistviewitem.h"
|
|
|
|
//#include <versekey.h>
|
|
|
|
namespace util {
|
|
|
|
CSortListViewItem::CSortListViewItem(TQListViewItem* tqparent) : KListViewItem(tqparent)
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListView * tqparent, TQListViewItem * after )
|
|
: KListViewItem ( tqparent, after )
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListViewItem * tqparent, TQListViewItem * after )
|
|
: KListViewItem ( tqparent, after )
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListView * tqparent, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8 )
|
|
: KListViewItem( tqparent, label1, label2, label3, label4, label5, label6, label7, label8 )
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListViewItem * tqparent, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8 )
|
|
: KListViewItem ( tqparent, label1, label2, label3, label4, label5, label6, label7, label8 )
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListView * tqparent, TQListViewItem * after, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8 )
|
|
: KListViewItem ( tqparent, after, label1, label2, label3, label4, label5, label6, label7, label8 )
|
|
{
|
|
}
|
|
|
|
CSortListViewItem::CSortListViewItem( TQListViewItem * tqparent, TQListViewItem * after, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8 )
|
|
: KListViewItem ( tqparent, after, label1, label2, label3, label4, label5, label6, label7, label8 )
|
|
{
|
|
|
|
}
|
|
|
|
|
|
CSortListViewItem::~CSortListViewItem() {
|
|
}
|
|
|
|
int CSortListViewItem::compare( TQListViewItem* i, int col, bool ascending ) const {
|
|
int ret = 0;
|
|
|
|
if ( !columnSorting.contains(col) ) {
|
|
return KListViewItem::compare(i, col, ascending);
|
|
}
|
|
|
|
Type t = columnSorting[col];
|
|
if (t == String) {
|
|
ret = KListViewItem::compare(i, col, ascending);
|
|
}
|
|
else if (t == Number) {
|
|
ret = (int) (text(col).toLong() - (i->text(col).toLong()));
|
|
}
|
|
// else if (t == BibleKey) {
|
|
// //ret = (int) (text(col).toLong() - (i->text(col).toLong()));
|
|
// ret = sword::VerseKey( (const char*) text(col).utf8() )._compare( sword::VerseKey( (const char*) i->text(col).utf8()) );
|
|
// }
|
|
|
|
return ret;
|
|
}
|
|
|
|
void CSortListViewItem::setColumnSorting(int column, CSortListViewItem::Type type) {
|
|
columnSorting[ column ] = type;
|
|
}
|
|
|
|
}
|
|
|