summaryrefslogtreecommitdiffstats
path: root/kshowmail/showlistviewitem.cpp
blob: 4835470b652f5ee38ad41b38f5b14c6c860a582a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/***************************************************************************
                          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 (TQListView * parent,
                  ShowListViewItem* after):
TQListViewItem (parent, after)
{}

ShowListViewItem::ShowListViewItem( TQListView * parent ) :
    TQListViewItem( parent )
{
}

ShowListViewItem::~ShowListViewItem()
{}

TQString 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( TQListViewItem *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 TQString& number)
{
  setText (_colNumber, number);
}

void ShowListViewItem::setAccount(const TQString& account)
{
  setText (_colAccount, account);
}

void ShowListViewItem::setFrom(const TQString& from)
{
  setText (_colFrom, from);
}

void ShowListViewItem::setTo(const TQString& to)
{
  setText (_colTo, to);
}

void ShowListViewItem::setSubject(const TQString& subject)
{
  setText (_colSubject, subject);
}

void ShowListViewItem::setDate(const TQString& date)
{
  setText (_colDate, date);
}

void ShowListViewItem::setSize(const TQString& size)
{
  setText (_colSize, size);
}

void ShowListViewItem::setContent(const TQString& content)
{
  setText (_colContent, content);
}

void ShowListViewItem::setState(const TQString& state)
{
  setText (_colState, state);
}

void ShowListViewItem::setTime (const TQString& time)
{
	m_time = time;
}