summaryrefslogtreecommitdiffstats
path: root/kteatime/tealist.cpp
blob: dcc4209a38fbd71d0d300ad305e9d4df9af237d8 (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
/* -------------------------------------------------------------

   tealist.cpp

   (C) 2003 by Daniel Teske (teske@bigfoot.com)

 ------------------------------------------------------------- */

#include <klocale.h>
#include <tqlistview.h>
#include "tealist.h"


TQString int2time(int time)
{
	TQString str;
	if (time / 60)
		str.append(i18n("%1 min").tqarg(time / 60));
	if (time % 60)
          if (str.isEmpty())
            str.append(i18n("%1 s").tqarg(time % 60));
          else
            str.append(i18n(" %1 s").tqarg(time % 60));
	return str;
}


TeaListItem::TeaListItem(TQListView * parent)
    :TQListViewItem(parent)
{

}

TeaListItem::TeaListItem(TQListView * parent, TQListViewItem *after)
    :TQListViewItem(parent, after)
{

}

TeaListItem::~TeaListItem()
{
}

void TeaListItem::setTime(int t)
{
	TQListViewItem::setText(1, int2time(t));
	tim = t;
}

void TeaListItem::setName(const TQString &n)
{
	nam = n;
	TQListViewItem::setText(0, n);
}

TQString TeaListItem::name()
{
	return nam;
}

int TeaListItem::time()
{
	return tim;
}