66
|
1 |
#include "dirviewitem.h"
|
|
2 |
|
|
3 |
#include <hbpushbutton.h>
|
|
4 |
#include <hbabstractitemview.h>
|
|
5 |
#include <hbtextitem.h>
|
|
6 |
#include <hbstyle.h>
|
|
7 |
|
|
8 |
const QString KExpandButtonItemName = "subitem-button";
|
|
9 |
|
|
10 |
DirViewItem::DirViewItem(QGraphicsItem* parent) :
|
|
11 |
HbTreeViewItem(parent),
|
|
12 |
mExpandButton(0)
|
|
13 |
{
|
|
14 |
}
|
|
15 |
|
|
16 |
DirViewItem::~DirViewItem()
|
|
17 |
{
|
|
18 |
}
|
|
19 |
|
|
20 |
int DirViewItem::type() const
|
|
21 |
{
|
|
22 |
return DirViewItem::Type;
|
|
23 |
}
|
|
24 |
|
|
25 |
HbAbstractViewItem *DirViewItem::createItem()
|
|
26 |
{
|
|
27 |
return new DirViewItem(*this);
|
|
28 |
}
|
|
29 |
|
|
30 |
void DirViewItem::buttonReleased()
|
|
31 |
{
|
|
32 |
if (isExpanded()) {
|
|
33 |
setExpanded(false);
|
|
34 |
} else {
|
|
35 |
setExpanded(true);
|
|
36 |
}
|
|
37 |
}
|
|
38 |
|
|
39 |
HbWidgetBase *DirViewItem::updateExpandItem()
|
|
40 |
{
|
|
41 |
if (!mExpandButton) {
|
|
42 |
mExpandButton = new HbPushButton(this);
|
|
43 |
connect(mExpandButton, SIGNAL(released()), this, SLOT(buttonReleased()));
|
|
44 |
HbStyle::setItemName(mExpandButton, KExpandButtonItemName);
|
|
45 |
}
|
|
46 |
|
|
47 |
if (isExpanded()) {
|
|
48 |
mExpandButton->setText("Close");
|
|
49 |
} else {
|
|
50 |
mExpandButton->setText("Open");
|
|
51 |
}
|
|
52 |
|
|
53 |
return mExpandButton;
|
|
54 |
}
|
|
55 |
|