diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/dirviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/dirviewitem.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,55 @@ +#include "dirviewitem.h" + +#include +#include +#include +#include + +const QString KExpandButtonItemName = "subitem-button"; + +DirViewItem::DirViewItem(QGraphicsItem* parent) : + HbTreeViewItem(parent), + mExpandButton(0) +{ +} + +DirViewItem::~DirViewItem() +{ +} + +int DirViewItem::type() const +{ + return DirViewItem::Type; +} + +HbAbstractViewItem *DirViewItem::createItem() +{ + return new DirViewItem(*this); +} + +void DirViewItem::buttonReleased() +{ + if (isExpanded()) { + setExpanded(false); + } else { + setExpanded(true); + } +} + +HbWidgetBase *DirViewItem::updateExpandItem() +{ + if (!mExpandButton) { + mExpandButton = new HbPushButton(this); + connect(mExpandButton, SIGNAL(released()), this, SLOT(buttonReleased())); + HbStyle::setItemName(mExpandButton, KExpandButtonItemName); + } + + if (isExpanded()) { + mExpandButton->setText("Close"); + } else { + mExpandButton->setText("Open"); + } + + return mExpandButton; +} +