Revision: 201019
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 12:49:34 +0300
changeset 24 ccec19943943
parent 20 cd10d5b85554
child 26 f3533f6eae3f
Revision: 201019 Kit: 2010121
locationpickerservice/inc/locationpickerpotraitview.h
locationpickerservice/resources/locationpickerlandscape.docml
locationpickerservice/resources/locationpickerpotrait.docml
locationpickerservice/src/locationpickerlandscapeview.cpp
locationpickerservice/src/locationpickerpotraitview.cpp
--- a/locationpickerservice/inc/locationpickerpotraitview.h	Fri May 14 15:47:27 2010 +0300
+++ b/locationpickerservice/inc/locationpickerpotraitview.h	Thu May 27 12:49:34 2010 +0300
@@ -63,6 +63,7 @@
 private slots:
     //slot to handle list item actions     
     void handleActivated( const QModelIndex &aIndex );
+    void changeModel();
     //slots to handle menu action items     
     void sortDescending();
     void sortAscending();
@@ -108,6 +109,8 @@
     TViewType mViewType ;
     // get the collection/category id
     quint32 mCategoryId;
+    // model Index
+    QModelIndex mIndex;
 };
 
 
--- a/locationpickerservice/resources/locationpickerlandscape.docml	Fri May 14 15:47:27 2010 +0300
+++ b/locationpickerservice/resources/locationpickerlandscape.docml	Thu May 27 12:49:34 2010 +0300
@@ -39,11 +39,6 @@
                 <anchoritem dst="gridView" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
             </layout>
         </widget>
-        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
-            <ref object="allAction" role="HbToolBar:addAction"/>
-            <ref object="collectionAction" role="HbToolBar:addAction"/>
-            <ref object="searchAction" role="HbToolBar:addAction"/>
-        </widget>
         <widget name="viewMenu" role="HbView:menu" type="HbMenu">
             <widget name="sortByMenu" role="HbMenu:menu" type="HbMenu">
                 <ref object="ascendingAction" role="HbMenu:addAction"/>
--- a/locationpickerservice/resources/locationpickerpotrait.docml	Fri May 14 15:47:27 2010 +0300
+++ b/locationpickerservice/resources/locationpickerpotrait.docml	Thu May 27 12:49:34 2010 +0300
@@ -36,11 +36,6 @@
                 <anchoritem dst="ListView" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
             </layout>
         </widget>
-        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
-            <ref object="allAction" role="HbToolBar:addAction"/>
-            <ref object="collectionAction" role="HbToolBar:addAction"/>
-            <ref object="searchAction" role="HbToolBar:addAction"/>
-        </widget>
         <widget name="viewMenu" role="HbView:menu" type="HbMenu">
             <widget name="sortByMenu" role="HbMenu:menu" type="HbMenu">
                 <ref object="ascendingAction" role="HbMenu:addAction"/>
--- a/locationpickerservice/src/locationpickerlandscapeview.cpp	Fri May 14 15:47:27 2010 +0300
+++ b/locationpickerservice/src/locationpickerlandscapeview.cpp	Thu May 27 12:49:34 2010 +0300
@@ -23,6 +23,7 @@
 #include <HbGridView>
 #include <HbStyleLoader>
 #include <HbAction>
+#include <HbToolBar>
 
 #include "locationpickerproxymodel.h"
 #include "locationpickerdatamanager.h"
@@ -107,13 +108,22 @@
      //Get HbAction items
 	 mGridView = qobject_cast<HbGridView*> (mDocumentLoader->findObject(QString(
                   "gridView")));
-      //get the action items from docml
-      mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
-              "allAction")));
-      mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
-              QString("collectionAction")));
-      mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
-              "searchAction")));
+	 HbToolBar* toolbar = new HbToolBar();
+	//Create Action Items
+	 mAllAction = new HbAction();
+	 mAllAction->setIcon(QString("qtg_mono_location"));
+	 mAllAction->setCheckable(true);
+	 mCollectionAction =new HbAction();
+	 mCollectionAction->setIcon(QString("qtg_mono_location_collection"));
+	 mCollectionAction->setCheckable(true);
+	 mSearchAction = new HbAction();
+	 mSearchAction->setIcon(QString("qtg_mono_search"));
+
+	 toolbar->addAction(mAllAction);
+	 toolbar->addAction(mCollectionAction);
+	 toolbar->addAction(mSearchAction);
+	 this->setToolBar(toolbar);
+	 
       mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
               QString("ascendingAction")));
       mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
@@ -143,7 +153,9 @@
       connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
 }
 
-
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::manageGridView()
+// -----------------------------------------------------------------------------
 void LocationPickerLandscapeView::manageGridView()
 {
     //set the appropriate model
--- a/locationpickerservice/src/locationpickerpotraitview.cpp	Fri May 14 15:47:27 2010 +0300
+++ b/locationpickerservice/src/locationpickerpotraitview.cpp	Thu May 27 12:49:34 2010 +0300
@@ -22,6 +22,8 @@
 #include <HbListView>
 #include <HbListViewItem>
 #include <HbAction>
+#include <QTimer>
+#include <HbToolBar>
 
 #include "locationpickerproxymodel.h"
 #include "locationpickerdatamanager.h"
@@ -115,13 +117,21 @@
     //Get HbAction items
     mListView = qobject_cast<HbListView*> (mDocumentLoader->findObject(QString(
                    "ListView")));
-    //get the action items from docml
-    mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
-            "allAction")));
-    mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
-            QString("collectionAction")));
-    mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
-            "searchAction")));
+    HbToolBar* toolbar = new HbToolBar();
+    //Create Action Items
+    mAllAction = new HbAction();
+    mAllAction->setIcon(QString("qtg_mono_location"));
+    mAllAction->setCheckable(true);
+    mCollectionAction =new HbAction();
+    mCollectionAction->setIcon(QString("qtg_mono_location_collection"));
+    mCollectionAction->setCheckable(true);
+    mSearchAction = new HbAction();
+    mSearchAction->setIcon(QString("qtg_mono_search"));
+    
+    toolbar->addAction(mAllAction);
+    toolbar->addAction(mCollectionAction);
+    toolbar->addAction(mSearchAction);
+    this->setToolBar(toolbar);
     mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
             QString("ascendingAction")));
     mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
@@ -195,7 +205,16 @@
 // -----------------------------------------------------------------------------
 // LocationPickerView::handleActivated()
 // -----------------------------------------------------------------------------
-void LocationPickerPotraitView::handleActivated( const QModelIndex &aIndex )
+void LocationPickerPotraitView::handleActivated(const QModelIndex &aIndex)
+{
+    mIndex = aIndex;
+    QTimer::singleShot(0, this, SLOT(changeModel()));
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerPotraitView::changeModel()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::changeModel()
 {   
     //handle the activated signal according to model set
     switch(mViewType)
@@ -207,7 +226,7 @@
             break;
             }
             QModelIndex   index = mProxyModel->mapToSource(
-                    aIndex);
+                    mIndex);
             quint32 lm = 0;
             QStandardItem* item = mModel->item( index.row(), index.column() );
             QVariant var = item->data( Qt::UserRole );
@@ -219,7 +238,7 @@
         case ELocationPickerCollectionListContent:
         {
             mLocationPickerCollectionListContent->getData(
-                    aIndex, mCategoryId );
+                    mIndex, mCategoryId );
             mViewType = ELocationPickerCollectionContent;
             //send categoryID to set the collection content
             emit sendCategoryID(mCategoryId);
@@ -232,7 +251,7 @@
                 break;
             }
             QModelIndex  index = mCollectionContent->getProxyModel()->mapToSource(
-                        aIndex);
+                    mIndex);
             quint32 lm = 0;
             mCollectionContent->getData(index, lm);
             //item selected, complete request
@@ -245,7 +264,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::sortAscending()
+// LocationPickerPotraitView::sortAscending()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::sortAscending()
 {   
@@ -261,7 +280,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::sortDescending()
+// LocationPickerPotraitView::sortDescending()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::sortDescending()
 {
@@ -277,7 +296,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::handleAllTab()
+// LocationPickerPotraitView::handleAllTab()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::allTabTriggered()
 {
@@ -314,7 +333,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::handleCollectionTab()
+// LocationPickerPotraitView::handleCollectionTab()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::colectionTabTriggered()
 {
@@ -336,7 +355,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::searchTabTriggered()
+// LocationPickerPotraitView::searchTabTriggered()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::searchTabTriggered()
 {
@@ -344,7 +363,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::setCollectionData()
+// LocationPickerPotraitView::setCollectionData()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::setCollectionData( quint32 acategoryId )
 {
@@ -371,7 +390,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::setCategoryID()
+// LocationPickerPotraitView::setCategoryID()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::setCategoryID( quint32 aCategoryId  )
 {
@@ -379,7 +398,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::getViewType()
+// LocationPickerPotraitView::getViewType()
 // -----------------------------------------------------------------------------
 TViewType LocationPickerPotraitView::getViewType()
 {
@@ -387,7 +406,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::setViewType()
+// LocationPickerPotraitView::setViewType()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::setViewType(TViewType aViewType)
 {
@@ -396,7 +415,7 @@
 
 
 // -----------------------------------------------------------------------------
-// LocationPickerView::clearContentModel()
+// LocationPickerPotraitView::clearContentModel()
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::clearContentModel()
 {