ui/views/listview/src/glxlistview.cpp
changeset 71 27f2d7aec52a
parent 54 0f0f3f26f787
child 72 0a8e959402e5
--- a/ui/views/listview/src/glxlistview.cpp	Mon Sep 27 15:13:20 2010 +0530
+++ b/ui/views/listview/src/glxlistview.cpp	Wed Oct 06 14:49:39 2010 +0530
@@ -25,18 +25,22 @@
 #include <hbdocumentloader.h>
 #include <hbabstractviewitem.h>
 #include <hblistviewitem.h>
+#include <hbgroupbox.h>
+#include <hbparameterlengthlimiter.h>
+
 //User Includes
 #include "glxviewids.h"
 #include "glxlistview.h"
 #include "glxmodelparm.h"
 #include "glxdocloaderdefs.h"
 #include "glxcommandhandlers.hrh"
-
+#include "glxlocalisationstrings.h"
 
 GlxListView::GlxListView(HbMainWindow *window) 
     : GlxView ( GLX_LISTVIEW_ID ), 
       mListView(NULL), 
       mView(NULL), 
+      mAlbumCount(NULL),
       mWindow(window), 
       mModel ( NULL),
       mIsLongPress( false )
@@ -64,10 +68,15 @@
     qDebug("GlxListView::setModel()");
     if ( mModel ) {
         disconnect(mModel, SIGNAL(listPopulated()), this, SLOT( populated()));
+        disconnect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) );
+        disconnect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) );
     }
     mModel =  model ;
     mListView->setModel(mModel);
     connect(mModel, SIGNAL(listPopulated()), this, SLOT( populated()));
+    connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) );
+    connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) );
+    showAlbumCount();
 }
 
 void GlxListView::addToolBar( HbToolBar *toolBar ) 
@@ -139,6 +148,7 @@
             //retrieve the widgets
             mView = static_cast<HbView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_VIEW)));
             mListView = static_cast<HbListView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_LIST)));
+            mAlbumCount = static_cast<HbGroupBox*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_ALBUMCOUNT)));
 
             if( mListView ) { 
                 //sets the widget
@@ -168,6 +178,11 @@
 
     removeViewConnection();
 
+    if(mAlbumCount) {
+        delete mAlbumCount ;
+        mAlbumCount = NULL;
+    }
+
     if(mListView) {
         delete mListView;
         mListView = NULL;
@@ -231,3 +246,9 @@
     emit itemSpecificMenuTriggered(viewId(),coords);
 }
 
+void GlxListView::showAlbumCount()
+{
+    int albumCnt = mModel->rowCount();
+    QString text = HbParameterLengthLimiter(GLX_ALBUM_LIST_COUNT_LABEL, albumCnt);
+    mAlbumCount->setHeading(text);
+}