locationpickerservice/src/locationpickerview.cpp
changeset 35 59575560d1e6
parent 31 8db05346071b
child 41 b3dd5ec3089d
equal deleted inserted replaced
31:8db05346071b 35:59575560d1e6
   119 void LocationPickerView::backTriggered()
   119 void LocationPickerView::backTriggered()
   120 {
   120 {
   121     //if current model is collection content, go back to collectionlist content  
   121     //if current model is collection content, go back to collectionlist content  
   122     if(mViewType == ELocationPickerCollectionContent)
   122     if(mViewType == ELocationPickerCollectionContent)
   123     {
   123     {
   124         removeDetailsLabel();
   124         mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
   125         colectionTabTriggered();
   125 		removeDetailsLabel();
       
   126         mAscendingAction->setDisabled(true);
       
   127         mDescendingAction->setDisabled(true);
       
   128         mAllAction->setChecked(false);
       
   129         mViewType = ELocationPickerCollectionListContent;
       
   130         manageListView();
       
   131 
   126         clearContentModel();
   132         clearContentModel();
   127     }
   133     }
   128     else
   134     else
   129     {
   135     {
   130         //complete the service
   136         //complete the service
   191     mHgModel = new HgWidgetDataModel( mProxyModel, this );
   197     mHgModel = new HgWidgetDataModel( mProxyModel, this );
   192     mHgModel->setImageDataType(HgWidgetDataModel::ETypeQImage);
   198     mHgModel->setImageDataType(HgWidgetDataModel::ETypeQImage);
   193     //create MediaWall Object
   199     //create MediaWall Object
   194     mWidget = new HgMediawall();
   200     mWidget = new HgMediawall();
   195     HbIcon defaultIcon(KDummyImage);
   201     HbIcon defaultIcon(KDummyImage);
   196     QImage defaultImage = defaultIcon.pixmap().toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
   202     QPainter painter;
   197     mWidget->setDefaultImage(defaultImage);
   203     QPixmap defaultImage(defaultIcon.width(),defaultIcon.height());
       
   204     painter.begin(&defaultImage);
       
   205     defaultIcon.paint(&painter,QRectF(0,0,defaultIcon.width(),defaultIcon.height()));
       
   206     painter.end();
       
   207     mWidget->setDefaultImage( defaultImage.toImage() );
   198     HgMediawall* mediawall = qobject_cast<HgMediawall*>( mWidget );
   208     HgMediawall* mediawall = qobject_cast<HgMediawall*>( mWidget );
   199     mediawall->setObjectName("location");
   209     mediawall->setObjectName("location");
   200     HbStyleLoader::registerFilePath(":/location.hgmediawall.widgetml");
   210     HbStyleLoader::registerFilePath(":/location.hgmediawall.widgetml");
   201     HbStyleLoader::registerFilePath(":/location.hgmediawall.css");
   211     HbStyleLoader::registerFilePath(":/location.hgmediawall.css");
   202     mediawall->enableReflections(false);
   212     mediawall->enableReflections(false);
   461 // -----------------------------------------------------------------------------
   471 // -----------------------------------------------------------------------------
   462 // LocationPickerView::colectionTabTriggered()
   472 // LocationPickerView::colectionTabTriggered()
   463 // -----------------------------------------------------------------------------
   473 // -----------------------------------------------------------------------------
   464 void LocationPickerView::colectionTabTriggered()
   474 void LocationPickerView::colectionTabTriggered()
   465 {
   475 {
       
   476 	  if( mViewType == ELocationPickerCollectionListContent ||
       
   477 	      mViewType == ELocationPickerCollectionContent )
       
   478 	  {
       
   479 	  	  mCollectionAction->setChecked(true);
       
   480 	      return;
       
   481 	  }
   466     mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
   482     mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
   467     removeDetailsLabel();
   483     removeDetailsLabel();
   468     //execute only if tab is not pressed
   484     //execute only if tab is not pressed
   469     if (mCollectionAction->isChecked())
   485     if (mCollectionAction->isChecked())
   470     {           
   486     {           
   484 // -----------------------------------------------------------------------------
   500 // -----------------------------------------------------------------------------
   485 // LocationPickerView::searchTabTriggered()
   501 // LocationPickerView::searchTabTriggered()
   486 // -----------------------------------------------------------------------------
   502 // -----------------------------------------------------------------------------
   487 void LocationPickerView::searchTabTriggered()
   503 void LocationPickerView::searchTabTriggered()
   488 {
   504 {
       
   505     mWidget->hide();
   489     emit switchToSearchView();
   506     emit switchToSearchView();
   490 }
   507 }
   491 
   508 
   492 // -----------------------------------------------------------------------------
   509 // -----------------------------------------------------------------------------
   493 // LocationPickerView::setCollectionData()
   510 // LocationPickerView::setCollectionData()
   505         QString categoryname;
   522         QString categoryname;
   506         removeDetailsLabel();    
   523         removeDetailsLabel();    
   507         switch(acategoryId)
   524         switch(acategoryId)
   508         {
   525         {
   509 
   526 
   510             case 1: categoryname = "Landmarks";
   527             case 1: categoryname = QString(hbTrId("txt_lint_subhead_places"));
   511             break;
   528             break;
   512             case 8: categoryname = "Contacts";     
   529             case 8: categoryname = QString(hbTrId("txt_lint_subhead_contact_addresses"));     
   513             break;
   530             break;
   514             case 9: categoryname = "Calender";
   531             case 9: categoryname = QString(hbTrId("txt_lint_subhead_calendar_event_locations"));
   515             break;
   532             break;
   516         }
   533         }
   517         if(mCollectionContent->locationFound())
   534         if(mCollectionContent->locationFound())
   518         {
   535         {
   519             mListView->setModel( mCollectionContent->getProxyModel(),mListItem );
   536             mListView->setModel( mCollectionContent->getProxyModel(),mListItem );
   592 void LocationPickerView::launchPopUpMenu( HbAbstractViewItem *aItem, const QPointF &aPoint )
   609 void LocationPickerView::launchPopUpMenu( HbAbstractViewItem *aItem, const QPointF &aPoint )
   593 {
   610 {
   594     mLongPressMenu = new HbMenu();
   611     mLongPressMenu = new HbMenu();
   595     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
   612     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
   596     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
   613     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
   597     mSelectAction  = mLongPressMenu->addAction(hbTrId("Select"));
   614     mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_list_select"));
   598     if( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent )
   615     if( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent )
   599     {
   616     {
   600         mDetailsAction  = mLongPressMenu->addAction(hbTrId("txt_lint_list_details"));
   617         mDetailsAction  = mLongPressMenu->addAction(hbTrId("txt_lint_menu_details"));
   601         connect(mDetailsAction, SIGNAL(triggered()), this, SLOT(handleDetails()));
   618         connect(mDetailsAction, SIGNAL(triggered()), this, SLOT(handleDetails()));
   602     }
   619     }
   603     mIndex = aItem->modelIndex();
   620     mIndex = aItem->modelIndex();
   604     connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
   621     connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
   605     mLongPressMenu->setPreferredPos(aPoint);
   622     mLongPressMenu->setPreferredPos(aPoint);
   612 void LocationPickerView::launchPopUpMenu( const QModelIndex &aIndex, const QPointF &aPoint )
   629 void LocationPickerView::launchPopUpMenu( const QModelIndex &aIndex, const QPointF &aPoint )
   613 {
   630 {
   614     mLongPressMenu = new HbMenu();
   631     mLongPressMenu = new HbMenu();
   615     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
   632     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
   616     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
   633     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
   617     mSelectAction  = mLongPressMenu->addAction(hbTrId("Select"));
   634     mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_list_select"));
   618     mIndex = aIndex;
   635     mIndex = aIndex;
   619     connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
   636     connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
   620     mLongPressMenu->setPreferredPos(aPoint);
   637     mLongPressMenu->setPreferredPos(aPoint);
   621     mLongPressMenu->open();
   638     mLongPressMenu->open();
   622 }
   639 }