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.
115 lines
2.9 KiB
115 lines
2.9 KiB
11 years ago
|
/***************************************************************************
|
||
|
showlistviewitem.cpp - description
|
||
|
-------------------
|
||
|
begin : Son Apr 21 2002
|
||
|
copyright : (C) 2002 by Eggert Ehmke
|
||
|
email : eggert.ehmke@berlin.de
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#include "showlistviewitem.h"
|
||
|
|
||
|
ShowListViewItem::ShowListViewItem (QListView * parent,
|
||
|
ShowListViewItem* after):
|
||
|
QListViewItem (parent, after)
|
||
|
{}
|
||
|
|
||
|
ShowListViewItem::ShowListViewItem( QListView * parent ) :
|
||
|
QListViewItem( parent )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
ShowListViewItem::~ShowListViewItem()
|
||
|
{}
|
||
|
|
||
|
QString ShowListViewItem::key (int column, bool /*ascending*/) const
|
||
|
{
|
||
|
switch (column)
|
||
|
{
|
||
|
case _colNumber:
|
||
|
return text (_colAccount) + text (_colNumber);
|
||
|
case _colDate:
|
||
|
return m_time;
|
||
|
default:
|
||
|
return text (column);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* reimplement compare to solve bug #856005
|
||
|
* standard compare is locale dependant
|
||
|
*/
|
||
|
int ShowListViewItem::compare( QListViewItem *i, int col,
|
||
|
bool ascending ) const
|
||
|
{
|
||
|
if( col == _colNumber )
|
||
|
{
|
||
|
return text( _colNumber ).toInt() - i->text( _colNumber ).toInt();
|
||
|
}
|
||
|
else if( col == _colSize )
|
||
|
{
|
||
|
return text( _colSize ).toInt() - i->text( _colSize ).toInt();
|
||
|
}
|
||
|
else
|
||
|
return key( col, ascending ).compare( i->key( col, ascending) );
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setNumber (const QString& number)
|
||
|
{
|
||
|
setText (_colNumber, number);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setAccount(const QString& account)
|
||
|
{
|
||
|
setText (_colAccount, account);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setFrom(const QString& from)
|
||
|
{
|
||
|
setText (_colFrom, from);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setTo(const QString& to)
|
||
|
{
|
||
|
setText (_colTo, to);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setSubject(const QString& subject)
|
||
|
{
|
||
|
setText (_colSubject, subject);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setDate(const QString& date)
|
||
|
{
|
||
|
setText (_colDate, date);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setSize(const QString& size)
|
||
|
{
|
||
|
setText (_colSize, size);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setContent(const QString& content)
|
||
|
{
|
||
|
setText (_colContent, content);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setState(const QString& state)
|
||
|
{
|
||
|
setText (_colState, state);
|
||
|
}
|
||
|
|
||
|
void ShowListViewItem::setTime (const QString& time)
|
||
|
{
|
||
|
m_time = time;
|
||
|
}
|
||
|
|