23 #include <hblistview.h> |
23 #include <hblistview.h> |
24 #include <hbmainwindow.h> |
24 #include <hbmainwindow.h> |
25 #include <hbdocumentloader.h> |
25 #include <hbdocumentloader.h> |
26 #include <hbabstractviewitem.h> |
26 #include <hbabstractviewitem.h> |
27 #include <hblistviewitem.h> |
27 #include <hblistviewitem.h> |
|
28 #include <hbgroupbox.h> |
|
29 #include <hbparameterlengthlimiter.h> |
|
30 |
28 //User Includes |
31 //User Includes |
29 #include "glxviewids.h" |
32 #include "glxviewids.h" |
30 #include "glxlistview.h" |
33 #include "glxlistview.h" |
31 #include "glxmodelparm.h" |
34 #include "glxmodelparm.h" |
32 #include "glxdocloaderdefs.h" |
35 #include "glxdocloaderdefs.h" |
33 #include "glxcommandhandlers.hrh" |
36 #include "glxcommandhandlers.hrh" |
34 |
37 #include "glxlocalisationstrings.h" |
35 |
38 |
36 GlxListView::GlxListView(HbMainWindow *window) |
39 GlxListView::GlxListView(HbMainWindow *window) |
37 : GlxView ( GLX_LISTVIEW_ID ), |
40 : GlxView ( GLX_LISTVIEW_ID ), |
38 mListView(NULL), |
41 mListView(NULL), |
39 mView(NULL), |
42 mView(NULL), |
|
43 mAlbumCount(NULL), |
40 mWindow(window), |
44 mWindow(window), |
41 mModel ( NULL), |
45 mModel ( NULL), |
42 mIsLongPress( false ) |
46 mIsLongPress( false ) |
43 { |
47 { |
44 qDebug("GlxListView::GlxListView()"); |
48 qDebug("GlxListView::GlxListView()"); |
62 void GlxListView::setModel(QAbstractItemModel *model) |
66 void GlxListView::setModel(QAbstractItemModel *model) |
63 { |
67 { |
64 qDebug("GlxListView::setModel()"); |
68 qDebug("GlxListView::setModel()"); |
65 if ( mModel ) { |
69 if ( mModel ) { |
66 disconnect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); |
70 disconnect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); |
|
71 disconnect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); |
|
72 disconnect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); |
67 } |
73 } |
68 mModel = model ; |
74 mModel = model ; |
69 mListView->setModel(mModel); |
75 mListView->setModel(mModel); |
70 connect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); |
76 connect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); |
|
77 connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); |
|
78 connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); |
|
79 showAlbumCount(); |
71 } |
80 } |
72 |
81 |
73 void GlxListView::addToolBar( HbToolBar *toolBar ) |
82 void GlxListView::addToolBar( HbToolBar *toolBar ) |
74 { |
83 { |
75 setToolBar(toolBar) ; |
84 setToolBar(toolBar) ; |
137 mDocLoader->load(GLX_LISTVIEW_DOCMLPATH,&loaded); |
146 mDocLoader->load(GLX_LISTVIEW_DOCMLPATH,&loaded); |
138 if(loaded) { |
147 if(loaded) { |
139 //retrieve the widgets |
148 //retrieve the widgets |
140 mView = static_cast<HbView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_VIEW))); |
149 mView = static_cast<HbView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_VIEW))); |
141 mListView = static_cast<HbListView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_LIST))); |
150 mListView = static_cast<HbListView*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_LIST))); |
|
151 mAlbumCount = static_cast<HbGroupBox*>(mDocLoader->findWidget(QString(GLX_LISTVIEW_ALBUMCOUNT))); |
142 |
152 |
143 if( mListView ) { |
153 if( mListView ) { |
144 //sets the widget |
154 //sets the widget |
145 setWidget((QGraphicsWidget*) mView); |
155 setWidget((QGraphicsWidget*) mView); |
146 HbListViewItem *prototype = mListView->listItemPrototype(); |
156 HbListViewItem *prototype = mListView->listItemPrototype(); |