logsui/logsapp/src/logsdetailsview.cpp
changeset 18 acd4e87b24b4
parent 17 90fe74753f71
child 21 2f0af9ba7665
--- a/logsui/logsapp/src/logsdetailsview.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsdetailsview.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -35,6 +35,8 @@
 #include <hblineedit.h>
 #include <hbnotificationdialog.h>
 #include <hbabstractviewitem.h>
+#include <QGraphicsLinearLayout>
+
 Q_DECLARE_METATYPE(LogsDetailsModel*)
 
 
@@ -321,7 +323,6 @@
     Q_ASSERT_X(mListView != 0, "logs [UI] ", "couldn't find list widget !!");
 
     mListView->setItemRecycling(true);
-
     LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initListWidget() " );
 }
 
@@ -432,7 +433,7 @@
 // -----------------------------------------------------------------------------
 //
 LogsDetailsViewItem::LogsDetailsViewItem()
-: HbListViewItem(0)    
+    : HbListViewItem(0), mLayout(0)    
 {
 }
 
@@ -470,7 +471,42 @@
 void LogsDetailsViewItem::updateChildItems()
 {  
     HbListViewItem::updateChildItems();
+
+    QVariant customData = modelIndex().data(LogsDetailsModel::RoleDuplicatesSeparator);
+    if (customData.isValid() && customData.toBool()) {
+        LOGS_QDEBUG( "logs [UI] -> LogsDetailsViewItem::updateChildItems(), groupbox" ); 
+        HbGroupBox* groupBox = new HbGroupBox(this);
+        groupBox->setHeading(modelIndex().data(Qt::DisplayRole).toString());
+        //groupBox->setCollapsable(true);
+
+        HbWidget* content = new HbWidget();
+        content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        content->setMaximumHeight(0);
+        groupBox->setContentWidget(content);
+        groupBox->setCollapsed(true);
+          
+        connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(groupBoxClicked(bool)));
+
+        if (!mLayout) {
+            mLayout = new QGraphicsLinearLayout(Qt::Horizontal, 0);
+            mLayout->setContentsMargins(0,0,0,0);        
+        }
+
+        mLayout->addItem(layout());
+        mLayout->addItem(groupBox);
+        mLayout->setItemSpacing(0,0);
+        setLayout(mLayout);             
+    }
 }
 
-
-
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsViewItem::groupBoxClicked(bool collapsed)
+{
+    LOGS_QDEBUG_2( "logs [UI] -> LogsDetailsViewItem::groupBoxClicked(): ", collapsed );    
+    QAbstractItemModel* model = const_cast <QAbstractItemModel*>(modelIndex().model());
+    model->setData(modelIndex(), QVariant(collapsed));
+    LOGS_QDEBUG( "logs [UI] <- LogsDetailsViewItem::groupBoxClicked()" );
+}