securitydialogs/SecUi/SecUiTestQt/dirviewitem.cpp
changeset 66 67b3e3c1fc87
--- /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 <hbpushbutton.h>
+#include <hbabstractitemview.h>
+#include <hbtextitem.h>
+#include <hbstyle.h>
+
+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;
+}
+