summaryrefslogtreecommitdiffstats
path: root/kteatime/tealist.cpp
blob: 8ef9dc5021b1559fc42a933bee633fcc7d7094dc (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 * tqparent)
    :TQListViewItem(tqparent)
{

}

TeaListItem::TeaListItem(TQListView * tqparent, TQListViewItem *after)
    :TQListViewItem(tqparent, 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;
}