locationpickerservice/src/locationpickercollectioncontent.cpp
changeset 30 96df3ab41000
parent 20 cd10d5b85554
child 31 8db05346071b
equal deleted inserted replaced
26:f3533f6eae3f 30:96df3ab41000
    34     mDataManager(NULL),
    34     mDataManager(NULL),
    35 	mLocationFound(false)
    35 	mLocationFound(false)
    36 {
    36 {
    37     // Create a standard model for the view list
    37     // Create a standard model for the view list
    38     mModel = new QStandardItemModel( this );
    38     mModel = new QStandardItemModel( this );
    39     // create data manager to manage data in the model
    39     if(mModel)
    40     mDataManager = LocationPickerDataManager::getInstance();
       
    41     if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
       
    42     {
    40     {
    43         // Create the proxy model.
    41         // create data manager to manage data in the model
    44         mProxyModel = new LocationPickerProxyModel(mOrientation);
    42         mDataManager = LocationPickerDataManager::getInstance();
    45         mProxyModel->setSourceModel(mModel);
    43         if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
    46         mProxyModel->setDynamicSortFilter(TRUE);
    44         {
    47         mProxyModel->setSortRole(Qt::DisplayRole);
    45             // Create the proxy model.
    48         mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    46             mProxyModel = new LocationPickerProxyModel(mOrientation);
    49         // sort
    47             mProxyModel->setSourceModel(mModel);
    50         mProxyModel->sort(0, Qt::AscendingOrder);
    48             mProxyModel->setDynamicSortFilter(TRUE);
    51         mLocationFound = true;
    49             mProxyModel->setSortRole(Qt::DisplayRole);
       
    50             mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
       
    51             // sort
       
    52             mProxyModel->sort(0, Qt::AscendingOrder);
       
    53             mLocationFound = true;
       
    54         }
       
    55         else
       
    56         {
       
    57             // no locations to display.
       
    58             QStandardItem *modelItem = new QStandardItem();
       
    59             modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
       
    60             mModel->appendRow( modelItem );
       
    61             mLocationFound = false;
       
    62         }
    52     }
    63     }
    53     else
       
    54     {
       
    55         // no locations to display.
       
    56         QStandardItem *modelItem = new QStandardItem();
       
    57         modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
       
    58         mModel->appendRow( modelItem );
       
    59         mLocationFound = false;
       
    60      }
       
    61 }
    64 }
    62 
    65 
    63 // ----------------------------------------------------------------
    66 // ----------------------------------------------------------------
    64 // LocationPickerCollectionContent::~LocationPickerCollectionContent
    67 // LocationPickerCollectionContent::~LocationPickerCollectionContent
    65 // -----------------------------------------------------------------
    68 // -----------------------------------------------------------------