clock/clockui/clockcityselectionlist/src/clockcityselectionlist_p.cpp
changeset 50 579cc610882e
parent 49 5de72ea7a065
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
    38 // User includes
    38 // User includes
    39 #include "clockcityselectionlist_p.h"
    39 #include "clockcityselectionlist_p.h"
    40 #include "clockcityselectionlist.h"
    40 #include "clockcityselectionlist.h"
    41 #include "clockcitylistproxymodel.h"
    41 #include "clockcitylistproxymodel.h"
    42 #include "clockcityselectionlistcommon.h"
    42 #include "clockcityselectionlistcommon.h"
    43 #include "clockcityselectionlistprototype.h"
    43 
    44 #include "timezoneclient.h"
    44 #include "timezoneclient.h"
    45 #include "clockdatatypes.h"
    45 #include "clockdatatypes.h"
    46 
    46 
    47 /*!
    47 /*!
    48 	\class ClockCitySelectionListPrivate
    48 	\class ClockCitySelectionListPrivate
    75 /*!
    75 /*!
    76 	Destructor.
    76 	Destructor.
    77  */
    77  */
    78 ClockCitySelectionListPrivate::~ClockCitySelectionListPrivate()
    78 ClockCitySelectionListPrivate::~ClockCitySelectionListPrivate()
    79 {
    79 {
    80 	if (mOwnsClient && !mClient->isNull()) {
    80 	if (mOwnsClient) {
    81 		mClient->deleteInstance();
    81 		mClient->deleteInstance();
    82 	}
    82 	}
    83 	if (mLoader) {
    83 	if (mLoader) {
    84 		mLoader->reset();
    84 		mLoader->reset();
    85 		delete mLoader;
    85 		delete mLoader;
   121 		LocationInfo info = infoList.at(iter);
   121 		LocationInfo info = infoList.at(iter);
   122 		QString displayString;
   122 		QString displayString;
   123 		displayString += info.cityName;
   123 		displayString += info.cityName;
   124 		displayString += ", ";
   124 		displayString += ", ";
   125 		displayString += info.countryName;
   125 		displayString += info.countryName;
       
   126 		mListModel->setData(index, displayString, Qt::DisplayRole);
   126 		mListModel->setData(index, displayString, Qt::UserRole + 100);
   127 		mListModel->setData(index, displayString, Qt::UserRole + 100);
   127 
   128 
   128 		// Now save the timezone and city group ids.
   129 		// Now save the timezone and city group ids.
   129 		mListModel->setData(
   130 		mListModel->setData(
   130 				index, QVariant(info.timezoneId), Qt::UserRole + 101);
   131 				index, QVariant(info.timezoneId), Qt::UserRole + 101);
   400 	mProxyModel = new ClockCityListProxyModel(this);
   401 	mProxyModel = new ClockCityListProxyModel(this);
   401 	mProxyModel->setDynamicSortFilter(true);
   402 	mProxyModel->setDynamicSortFilter(true);
   402 	mProxyModel->setSourceModel(mListModel);
   403 	mProxyModel->setSourceModel(mListModel);
   403 	mProxyModel->setFilterRole(Qt::UserRole + 100);
   404 	mProxyModel->setFilterRole(Qt::UserRole + 100);
   404 
   405 
   405 	// Construct the custom list item prototype.
       
   406 	ClockCitySelectionListPrototype *prototype =
       
   407 			new ClockCitySelectionListPrototype;
       
   408 
       
   409 	// Loader the custom list view layout.
       
   410 	HbStyleLoader::registerFilePath(":/style/");
       
   411 	mListView->setLayoutName("cityselectionlist-default");
       
   412 	mListView->setItemPrototype(prototype);
       
   413 
       
   414 	// Construct the model for the list.
   406 	// Construct the model for the list.
   415 	QTimer::singleShot(1, this, SLOT(populateListModel()));
   407 	QTimer::singleShot(1, this, SLOT(populateListModel()));
   416 
   408 
   417 	// Set the model to the list.
   409 	// Set the model to the list.
   418 	mListView->setModel(mProxyModel);
   410 	mListView->setModel(mProxyModel);