clock/clockui/clocksettingsview/src/clockregionalsettingsview.cpp
changeset 58 ef813d54df51
parent 50 579cc610882e
child 68 a5a1242fd2e8
equal deleted inserted replaced
50:579cc610882e 58:ef813d54df51
    29 #include <HbPushButton>
    29 #include <HbPushButton>
    30 #include <HbListWidget>
    30 #include <HbListWidget>
    31 #include <HbComboBox>
    31 #include <HbComboBox>
    32 #include <HbListWidgetItem>
    32 #include <HbListWidgetItem>
    33 #include <HbTranslator>
    33 #include <HbTranslator>
       
    34 #include <QLocale>
    34 
    35 
    35 // User includes
    36 // User includes
    36 #include "clockregionalsettingsview.h"
    37 #include "clockregionalsettingsview.h"
    37 #include "clocksettingsdocloader.h"
    38 #include "clocksettingsdocloader.h"
    38 #include "clocksettingsdefines.h"
    39 #include "clocksettingsdefines.h"
    39 #include "settingsdatatypes.h"
    40 #include "settingsdatatypes.h"
    40 #include "settingscustomitem.h"
    41 #include "settingscustomitem.h"
       
    42 #include "OstTraceDefinitions.h"
       
    43 #ifdef OST_TRACE_COMPILER_IN_USE
       
    44 #include "clockregionalsettingsviewTraces.h"
       
    45 #endif
       
    46 
    41 
    47 
    42 /*!
    48 /*!
    43 	\class ClockRegionalSettingsView
    49 	\class ClockRegionalSettingsView
    44 
    50 
    45 	The view for regional setting items in clock applications settings.
    51 	The view for regional setting items in clock applications settings.
    51 ClockRegionalSettingsView::ClockRegionalSettingsView(QObject *parent)
    57 ClockRegionalSettingsView::ClockRegionalSettingsView(QObject *parent)
    52 :QObject(parent),
    58 :QObject(parent),
    53  mView(0),
    59  mView(0),
    54  mLoader(0)
    60  mLoader(0)
    55 {
    61 {
       
    62 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_CLOCKREGIONALSETTINGSVIEW_ENTRY );
    56 	// Construct the document loader.
    63 	// Construct the document loader.
    57 	mLoader = new ClockSettingsDocLoader;
    64 	mLoader = new ClockSettingsDocLoader;
    58 	
    65 	
    59 	// Construct the settignsutility.
    66 	// Construct the settignsutility.
    60 	mSettingsUtility = new SettingsUtility();
    67 	mSettingsUtility = new SettingsUtility();
    63     mTranslator = new HbTranslator("clocksettingsview");
    70     mTranslator = new HbTranslator("clocksettingsview");
    64     mTranslator->loadCommon();
    71     mTranslator->loadCommon();
    65     
    72     
    66 	// Create the custom prototype.
    73 	// Create the custom prototype.
    67 	mCustomPrototype = new SettingsCustomItem();
    74 	mCustomPrototype = new SettingsCustomItem();
       
    75 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_CLOCKREGIONALSETTINGSVIEW_EXIT );
    68 }
    76 }
    69 
    77 
    70 /*!
    78 /*!
    71 	Destructor.
    79 	Destructor.
    72  */
    80  */
    73 ClockRegionalSettingsView::~ClockRegionalSettingsView()
    81 ClockRegionalSettingsView::~ClockRegionalSettingsView()
    74 {
    82 {
       
    83 	OstTraceFunctionEntry0( DUP1_CLOCKREGIONALSETTINGSVIEW_CLOCKREGIONALSETTINGSVIEW_ENTRY );
    75 	if (mLoader) {
    84 	if (mLoader) {
    76 		delete mLoader;
    85 		delete mLoader;
    77 		mLoader = 0;
    86 		mLoader = 0;
    78 	}
    87 	}
    79 	
    88 	
    87 // Remove the translator
    96 // Remove the translator
    88     if (mTranslator) {
    97     if (mTranslator) {
    89         delete mTranslator;
    98         delete mTranslator;
    90         mTranslator = 0;
    99         mTranslator = 0;
    91     }
   100     }
       
   101     OstTraceFunctionExit0( DUP1_CLOCKREGIONALSETTINGSVIEW_CLOCKREGIONALSETTINGSVIEW_EXIT );
    92 }
   102 }
    93 
   103 
    94 /*!
   104 /*!
    95 	Shows the regional settings view.
   105 	Shows the regional settings view.
    96  */
   106  */
    97 void ClockRegionalSettingsView::showView()
   107 void ClockRegionalSettingsView::showView()
    98 {
   108 {
       
   109 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_SHOWVIEW_ENTRY );
    99 	bool success;
   110 	bool success;
   100 
   111 
   101 	// Load the application xml.
   112 	// Load the application xml.
   102 	mLoader->load(CLOCK_REG_SETTINGS_VIEW_DOCML, &success);
   113 	mLoader->load(CLOCK_REG_SETTINGS_VIEW_DOCML, &success);
   103 	if (!success) {
   114 	if (!success) {
   139 	HbAction *backAction = new HbAction(Hb::BackNaviAction);
   150 	HbAction *backAction = new HbAction(Hb::BackNaviAction);
   140 	mView->setNavigationAction(backAction);
   151 	mView->setNavigationAction(backAction);
   141 	connect(
   152 	connect(
   142 			backAction, SIGNAL(triggered()),
   153 			backAction, SIGNAL(triggered()),
   143 			this, SLOT(handleBackAction()));
   154 			this, SLOT(handleBackAction()));
       
   155 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_SHOWVIEW_EXIT );
   144 }
   156 }
   145 
   157 
   146 /*!
   158 /*!
   147 	The view is removed from main window and a deleteLater is called on `this'.
   159 	The view is removed from main window and a deleteLater is called on `this'.
   148  */
   160  */
   149 void ClockRegionalSettingsView::handleBackAction()
   161 void ClockRegionalSettingsView::handleBackAction()
   150 {
   162 {
       
   163 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLEBACKACTION_ENTRY );
   151 	HbExtendedLocale locale = HbExtendedLocale::system();
   164 	HbExtendedLocale locale = HbExtendedLocale::system();
   152 	HbExtendedLocale::WeekDay startOfWeekIndex =
   165 	HbExtendedLocale::WeekDay startOfWeekIndex =
   153 				HbExtendedLocale::system().startOfWeek();
   166 				HbExtendedLocale::system().startOfWeek();
   154 	// TODO: Save workdays settings.
   167 	// Save workdays settings.
   155 	QItemSelectionModel *model = 0;
   168 	QItemSelectionModel *model = 0;
   156 	model = mWorkdaysItem->selectionModel();
   169 	model = mWorkdaysItem->selectionModel();
   157 	QModelIndexList selectedModelIndex = model->selectedIndexes();
   170 	QModelIndexList selectedModelIndex = model->selectedIndexes();
   158 	int count = selectedModelIndex.count();
   171 	int count = selectedModelIndex.count();
   159 	QModelIndex index;
   172 	QModelIndex index;
   183 	
   196 	
   184 	HbMainWindow *window = hbInstance->allMainWindows().first();
   197 	HbMainWindow *window = hbInstance->allMainWindows().first();
   185 	// Cleanup.
   198 	// Cleanup.
   186 	window->removeView(mView);
   199 	window->removeView(mView);
   187 	deleteLater();
   200 	deleteLater();
       
   201 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLEBACKACTION_EXIT );
   188 }
   202 }
   189 
   203 
   190 /*!
   204 /*!
   191 	Called when each of the form items are displayed. Using this slot, we
   205 	Called when each of the form items are displayed. Using this slot, we
   192 	connect to SIGNALS of the items that have been added to the form.
   206 	connect to SIGNALS of the items that have been added to the form.
   193 
   207 
   194 	\param index QModelIndex of the row that was just displayed.
   208 	\param index QModelIndex of the row that was just displayed.
   195  */
   209  */
   196 void ClockRegionalSettingsView::handleItemDisplayed(const QModelIndex &index)
   210 void ClockRegionalSettingsView::handleItemDisplayed(const QModelIndex &index)
   197 {
   211 {
       
   212 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLEITEMDISPLAYED_ENTRY );
   198 	if (!index.isValid()) {
   213 	if (!index.isValid()) {
       
   214 		OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLEITEMDISPLAYED_EXIT );
   199 		return;
   215 		return;
   200 	}
   216 	}
   201 
   217 
   202 	HbDataFormViewItem *item =
   218 	HbDataFormViewItem *item =
   203 			static_cast<HbDataFormViewItem*>(mForm->itemByIndex(index));
   219 			static_cast<HbDataFormViewItem*>(mForm->itemByIndex(index));
   225 			mStartOfWeekItem = static_cast<HbComboBox *> (widget);
   241 			mStartOfWeekItem = static_cast<HbComboBox *> (widget);
   226 			break;
   242 			break;
   227 		default:
   243 		default:
   228 			break;
   244 			break;
   229 	}
   245 	}
       
   246 	OstTraceFunctionExit0( DUP1_CLOCKREGIONALSETTINGSVIEW_HANDLEITEMDISPLAYED_EXIT );
   230 }
   247 }
   231 
   248 
   232 /*!
   249 /*!
   233 	Called when the time format toggle item is clicked. Here we update the
   250 	Called when the time format toggle item is clicked. Here we update the
   234 	value in the locale.
   251 	value in the locale.
   235  */
   252  */
   236 void ClockRegionalSettingsView::handleTimeFormatChange()
   253 void ClockRegionalSettingsView::handleTimeFormatChange()
   237 {
   254 {
   238 //	mSettingsUtility->setTimeFormat(mTimeFormatItem->text());
   255 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLETIMEFORMATCHANGE_ENTRY );
   239 	mSettingsUtility->setTimeFormat(
   256 	mSettingsUtility->setTimeFormat(
   240 			mTimeFormatItem->contentWidgetData("text").toString());
   257 			mTimeFormatItem->contentWidgetData("text").toString());
       
   258 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLETIMEFORMATCHANGE_EXIT );
   241 }
   259 }
   242 
   260 
   243 /*!
   261 /*!
   244 	Called when the time separator toggle item is clicked. Here we update the
   262 	Called when the time separator toggle item is clicked. Here we update the
   245 	value in the locale.
   263 	value in the locale.
   246  */
   264  */
   247 void ClockRegionalSettingsView::handleTimeSeparatorChange()
   265 void ClockRegionalSettingsView::handleTimeSeparatorChange()
   248 {
   266 {
   249 //	mSettingsUtility->setTimeSeparator(mTimeSeparatorItem->text());
   267 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLETIMESEPARATORCHANGE_ENTRY );
   250 	mSettingsUtility->setTimeSeparator(
   268 	mSettingsUtility->setTimeSeparator(
   251 			mTimeSeparatorItem->contentWidgetData("text").toString());
   269 			mTimeSeparatorItem->contentWidgetData("text").toString());
       
   270 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLETIMESEPARATORCHANGE_EXIT );
   252 }
   271 }
   253 
   272 
   254 /*!
   273 /*!
   255  */
   274  */
   256 void ClockRegionalSettingsView::handleDateFormatChange(QString text)
   275 void ClockRegionalSettingsView::handleDateFormatChange(QString text)
   257 {
   276 {
       
   277 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATEFORMATCHANGE_ENTRY );
   258 	mSettingsUtility->setDateFormat(text);
   278 	mSettingsUtility->setDateFormat(text);
       
   279 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATEFORMATCHANGE_EXIT );
   259 }
   280 }
   260 
   281 
   261 /*!
   282 /*!
   262     Called when the date separator item is changed. Here we update the
   283     Called when the date separator item is changed. Here we update the
   263     value in the locale.
   284     value in the locale.
   264  */
   285  */
   265 void ClockRegionalSettingsView::handleDateSeparatorChange(QString text)
   286 void ClockRegionalSettingsView::handleDateSeparatorChange(QString text)
   266 {
   287 {
       
   288 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATESEPARATORCHANGE_ENTRY );
   267 	mSettingsUtility->setDateSeparator(text);
   289 	mSettingsUtility->setDateSeparator(text);
       
   290 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATESEPARATORCHANGE_EXIT );
   268 }
   291 }
   269 
   292 
   270 /*!
   293 /*!
   271 	This slot is called any item in the data form is changed.
   294 	This slot is called any item in the data form is changed.
   272  */
   295  */
   273 void ClockRegionalSettingsView::handleDataChanged(
   296 void ClockRegionalSettingsView::handleDataChanged(
   274 		const QModelIndex& topLeft, const QModelIndex& bottomRight)
   297 		const QModelIndex& topLeft, const QModelIndex& bottomRight)
   275 {
   298 {
       
   299 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATACHANGED_ENTRY );
   276 	Q_UNUSED(bottomRight)
   300 	Q_UNUSED(bottomRight)
   277 
   301 
   278 
   302 
   279 	switch (topLeft.row()) {
   303 	switch (topLeft.row()) {
   280 		case 5:
   304 		case 5:
   291 		break;
   315 		break;
   292 
   316 
   293 		default:
   317 		default:
   294 		break;
   318 		break;
   295 	}
   319 	}
       
   320 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_HANDLEDATACHANGED_EXIT );
   296 }
   321 }
   297 
   322 
   298 /*!
   323 /*!
   299 	Here we create the form model.
   324 	Here we create the form model.
   300  */
   325  */
   301 void ClockRegionalSettingsView::createModel()
   326 void ClockRegionalSettingsView::createModel()
   302 {
   327 {
       
   328 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_CREATEMODEL_ENTRY );
   303 	if (mForm->model()) {
   329 	if (mForm->model()) {
   304 		delete mForm->model();
   330 		delete mForm->model();
   305 		mForm->setModel(0);
   331 		mForm->setModel(0);
   306 	}
   332 	}
   307 
   333 
   315 	connect(
   341 	connect(
   316 			mFormModel,
   342 			mFormModel,
   317 			SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
   343 			SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
   318 			this,
   344 			this,
   319 			SLOT(handleDataChanged(const QModelIndex, const QModelIndex)));
   345 			SLOT(handleDataChanged(const QModelIndex, const QModelIndex)));
       
   346 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_CREATEMODEL_EXIT );
   320 }
   347 }
   321 
   348 
   322 /*!
   349 /*!
   323 	Function in which we populate the form model.
   350 	Function in which we populate the form model.
   324  */
   351  */
   325 void ClockRegionalSettingsView::populateFormModel()
   352 void ClockRegionalSettingsView::populateFormModel()
   326 {
   353 {
       
   354 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_POPULATEFORMMODEL_ENTRY );
   327 	if (!mFormModel) {
   355 	if (!mFormModel) {
   328 		createModel();
   356 		createModel();
   329 	}
   357 	}
   330 
   358 
   331 	// Get the locale.
   359 	// Get the locale.
   341 		mTimeFormatItem->setContentWidgetData("additionalText", mTimeFormatStringList[1]);
   369 		mTimeFormatItem->setContentWidgetData("additionalText", mTimeFormatStringList[1]);
   342 	} else {
   370 	} else {
   343 		mTimeFormatItem->setContentWidgetData("text", mTimeFormatStringList[1]);
   371 		mTimeFormatItem->setContentWidgetData("text", mTimeFormatStringList[1]);
   344 		mTimeFormatItem->setContentWidgetData("additionalText", mTimeFormatStringList[0]);
   372 		mTimeFormatItem->setContentWidgetData("additionalText", mTimeFormatStringList[0]);
   345 	}
   373 	}
       
   374 	mTimeFormatItem->setContentWidgetData("objectName", "timeFormat");
   346 	mForm->addConnection(
   375 	mForm->addConnection(
   347 			mTimeFormatItem, SIGNAL(clicked()),
   376 			mTimeFormatItem, SIGNAL(clicked()),
   348 			this, SLOT(handleTimeFormatChange()));
   377 			this, SLOT(handleTimeFormatChange()));
   349 
   378 
   350 	// Time separator item.
   379 	// Time separator item.
   359 	} else {
   388 	} else {
   360 		mTimeSeparatorItem->setContentWidgetData("text", mTimeSeparatorStringList[1]);
   389 		mTimeSeparatorItem->setContentWidgetData("text", mTimeSeparatorStringList[1]);
   361 		mTimeSeparatorItem->setContentWidgetData(
   390 		mTimeSeparatorItem->setContentWidgetData(
   362 				"additionalText", mTimeSeparatorStringList[0]);
   391 				"additionalText", mTimeSeparatorStringList[0]);
   363 	}
   392 	}
       
   393 	mTimeSeparatorItem->setContentWidgetData("objectName", "timeSeparator");
   364 	mForm->addConnection(
   394 	mForm->addConnection(
   365 			mTimeSeparatorItem, SIGNAL(clicked()),
   395 			mTimeSeparatorItem, SIGNAL(clicked()),
   366 			this, SLOT(handleTimeSeparatorChange()));
   396 			this, SLOT(handleTimeSeparatorChange()));
   367 
   397 
   368 	// Date format.
   398 	// Date format.
   371 			hbTrId("txt_clock_setlabel_date_format"));
   401 			hbTrId("txt_clock_setlabel_date_format"));
   372 	index = mSettingsUtility->dateFormat(mDateFormatStringList);
   402 	index = mSettingsUtility->dateFormat(mDateFormatStringList);
   373 
   403 
   374 	mDateFormatItem->setContentWidgetData("items", mDateFormatStringList);
   404 	mDateFormatItem->setContentWidgetData("items", mDateFormatStringList);
   375 	mDateFormatItem->setContentWidgetData("currentIndex",index);
   405 	mDateFormatItem->setContentWidgetData("currentIndex",index);
       
   406 	mDateFormatItem->setContentWidgetData("objectName", "dateFormat");
   376 	mForm->addConnection(
   407 	mForm->addConnection(
   377 			mDateFormatItem, SIGNAL(currentIndexChanged(QString)),
   408 			mDateFormatItem, SIGNAL(currentIndexChanged(QString)),
   378 	 		this, SLOT(handleDateFormatChange(QString)));
   409 	 		this, SLOT(handleDateFormatChange(QString)));
   379 
   410 
   380 	// Date separator.
   411 	// Date separator.
   383 			hbTrId("txt_clock_setlabel_date_separator"));
   414 			hbTrId("txt_clock_setlabel_date_separator"));
   384 	index = mSettingsUtility->dateSeparator(mDateSeparatorStringList);
   415 	index = mSettingsUtility->dateSeparator(mDateSeparatorStringList);
   385 
   416 
   386 	mDateSeparatorItem->setContentWidgetData("items", mDateSeparatorStringList);
   417 	mDateSeparatorItem->setContentWidgetData("items", mDateSeparatorStringList);
   387 	mDateSeparatorItem->setContentWidgetData("currentIndex",index);
   418 	mDateSeparatorItem->setContentWidgetData("currentIndex",index);
       
   419 	mDateSeparatorItem->setContentWidgetData("objectName", "dateSeparator");
   388 	mForm->addConnection(
   420 	mForm->addConnection(
   389 			mDateSeparatorItem, SIGNAL(currentIndexChanged(QString)),
   421 			mDateSeparatorItem, SIGNAL(currentIndexChanged(QString)),
   390 			this, SLOT(handleDateSeparatorChange(QString)));
   422 			this, SLOT(handleDateSeparatorChange(QString)));
   391 
   423 
   392 	// Workdays.
   424 	// Workdays.
   393 	HbDataFormModelItem *item = 0;
   425 	HbDataFormModelItem *item = 0;
   394 	// Create the weekday list based on start of week.
   426 	// Create the weekday list based on start of week.
   395 	QStringList weekdaysList;
   427 	QStringList weekdaysList;
       
   428 	QLocale qLocale;
   396 	weekdaysList
   429 	weekdaysList
   397 			<< hbTrId("txt_clk_setlabel_val_monday")
   430 			<< qLocale.dayName(1)
   398 			<< hbTrId("txt_clk_setlabel_val_tuesday")
   431 			<< qLocale.dayName(2)
   399 			<< hbTrId("txt_clk_setlabel_val_wednesday")
   432 			<< qLocale.dayName(3)
   400 			<< hbTrId("txt_clk_setlabel_val_thursday")
   433 			<< qLocale.dayName(4)
   401 			<< hbTrId("txt_clk_setlabel_val_friday")
   434 			<< qLocale.dayName(5)
   402 			<< hbTrId("txt_clk_setlabel_val_saturday")
   435 			<< qLocale.dayName(6)
   403 			<< hbTrId("txt_clk_setlabel_val_sunday");
   436 			<< qLocale.dayName(7);
   404 	
   437 	
   405 	HbDataFormModelItem::DataItemType workdaysItemType =
   438 	HbDataFormModelItem::DataItemType workdaysItemType =
   406 			static_cast<HbDataFormModelItem::DataItemType>
   439 			static_cast<HbDataFormModelItem::DataItemType>
   407 			(HbDataFormModelItem::CustomItemBase + 50);
   440 			(HbDataFormModelItem::CustomItemBase + 50);
   408 	item = new HbDataFormModelItem(workdaysItemType,
   441 	item = new HbDataFormModelItem(workdaysItemType,
   409 			hbTrId("txt_clock_setlabel_workdays"));
   442 			hbTrId("txt_clock_setlabel_workdays"));
   410 	mFormModel->appendDataFormItem(item);
   443 	mFormModel->appendDataFormItem(item);
       
   444 	item->setContentWidgetData("objectName", "workdays");
   411 
   445 
   412 	// Start of week item.
   446 	// Start of week item.
   413 	item = 0;
   447 	item = 0;
   414 	item = mFormModel->appendDataFormItem(HbDataFormModelItem::ComboBoxItem,
   448 	item = mFormModel->appendDataFormItem(HbDataFormModelItem::ComboBoxItem,
   415 		hbTrId("txt_clock_setlabel_week_starts_on"));
   449 		hbTrId("txt_clock_setlabel_week_starts_on"));
   416 	HbExtendedLocale::WeekDay startOfWeek = locale.startOfWeek();
   450 	HbExtendedLocale::WeekDay startOfWeek = locale.startOfWeek();
   417 	item->setContentWidgetData("items", weekdaysList);
   451 	item->setContentWidgetData("items", weekdaysList);
   418 	item->setContentWidgetData("currentIndex", startOfWeek);
   452 	item->setContentWidgetData("currentIndex", startOfWeek);
       
   453 	item->setContentWidgetData("objectName", "startOfWeek");
       
   454 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_POPULATEFORMMODEL_EXIT );
   419 }
   455 }
   420 
   456 
   421 /*!
   457 /*!
   422 	Returns the weekday list ordered based on start of week.
   458 	Returns the weekday list ordered based on start of week.
   423  */
   459  */
   424 
   460 
   425 QStringList ClockRegionalSettingsView::weekdayList()
   461 QStringList ClockRegionalSettingsView::weekdayList()
   426 {
   462 {
       
   463 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_WEEKDAYLIST_ENTRY );
   427 	QStringList weekDays;
   464 	QStringList weekDays;
   428 	QStringList daysList;
   465 	QStringList daysList;
       
   466 	QLocale qLocale;
   429 	daysList
   467 	daysList
   430 			<< hbTrId("txt_clk_setlabel_val_monday")
   468 			<< qLocale.dayName(1)
   431 			<< hbTrId("txt_clk_setlabel_val_tuesday")
   469 			<< qLocale.dayName(2)
   432 			<< hbTrId("txt_clk_setlabel_val_wednesday")
   470 			<< qLocale.dayName(3)
   433 			<< hbTrId("txt_clk_setlabel_val_thursday")
   471 			<< qLocale.dayName(4)
   434 			<< hbTrId("txt_clk_setlabel_val_friday")
   472 			<< qLocale.dayName(5)
   435 			<< hbTrId("txt_clk_setlabel_val_saturday")
   473 			<< qLocale.dayName(6)
   436 			<< hbTrId("txt_clk_setlabel_val_sunday");
   474 			<< qLocale.dayName(7);
   437 	
   475 	
   438 	HbExtendedLocale::WeekDay startOfWeekIndex =
   476 	HbExtendedLocale::WeekDay startOfWeekIndex =
   439 			HbExtendedLocale::system().startOfWeek();
   477 			HbExtendedLocale::system().startOfWeek();
   440 	
   478 	
   441 	for (int i = 0, index = startOfWeekIndex; i < daysList.count(); ++i) {
   479 	for (int i = 0, index = startOfWeekIndex; i < daysList.count(); ++i) {
   445 		} else {
   483 		} else {
   446 			index++;
   484 			index++;
   447 		}
   485 		}
   448 	}
   486 	}
   449 	
   487 	
       
   488 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_WEEKDAYLIST_EXIT );
   450 	return weekDays;
   489 	return weekDays;
   451 }
   490 }
   452 
   491 
   453 
   492 
   454 /*!
   493 /*!
   455     update the start week on .
   494     update the start week on .
   456  */
   495  */
   457 
   496 
   458 void ClockRegionalSettingsView::updateWeekStartOn()
   497 void ClockRegionalSettingsView::updateWeekStartOn()
   459 {
   498 {
   460 if (mStartOfWeekItem != 0)
   499 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_UPDATEWEEKSTARTON_ENTRY );
   461     {
   500 	if (mStartOfWeekItem != 0)
   462     HbExtendedLocale locale;
   501 	{
   463     HbExtendedLocale::WeekDay weekdDayStart = locale.startOfWeek();
   502 		HbExtendedLocale locale;
   464     int currentDay = mStartOfWeekItem->currentIndex();
   503 		HbExtendedLocale::WeekDay weekdDayStart = locale.startOfWeek();
   465     if(currentDay == weekdDayStart )
   504 		int currentDay = mStartOfWeekItem->currentIndex();
   466         {
   505 		if(currentDay == weekdDayStart )
   467         return;
   506 		{
   468         }
   507 			OstTraceFunctionExit0(
   469     else
   508 					CLOCKREGIONALSETTINGSVIEW_UPDATEWEEKSTARTON_EXIT );
   470         {
   509 			return;
   471         mStartOfWeekItem->setCurrentIndex(weekdDayStart);
   510 		}
   472         updateWeekDays();
   511 		else
   473         }
   512 		{
   474     }
   513 			mStartOfWeekItem->setCurrentIndex(weekdDayStart);
       
   514 			updateWeekDays();
       
   515 		}
       
   516 	}
       
   517 	OstTraceFunctionExit0(
       
   518 			DUP1_CLOCKREGIONALSETTINGSVIEW_UPDATEWEEKSTARTON_EXIT );
   475 }
   519 }
   476 
   520 
   477 /*!
   521 /*!
   478     update the  week days .
   522     update the  week days .
   479  */
   523  */
   480 void ClockRegionalSettingsView::updateWeekDays()
   524 void ClockRegionalSettingsView::updateWeekDays()
   481 {
   525 {
   482 QStringList weekdays = weekdayList();
   526 	OstTraceFunctionEntry0( CLOCKREGIONALSETTINGSVIEW_UPDATEWEEKDAYS_ENTRY );
   483 QString workdays = mCustomPrototype->workdaysSetting();
   527 	QStringList weekdays = weekdayList();
   484 QItemSelectionModel *model = 0;
   528 	QString workdays = mCustomPrototype->workdaysSetting();
   485 model = mWorkdaysItem->selectionModel();
   529 	QItemSelectionModel *model = 0;
   486 
   530 	model = mWorkdaysItem->selectionModel();
   487 for (int i = 0, index = workdays.size() - 1;
   531 
   488         i < mWorkdaysItem->count(); ++i, index--)
   532 	for (int i = 0, index = workdays.size() - 1;
   489     {
   533 			i < mWorkdaysItem->count(); ++i, index--)
   490     QString str = weekdays[i];
   534 	{
   491     mWorkdaysItem->item(i)->setText(str);
   535 		QString str = weekdays[i];
   492 
   536 		mWorkdaysItem->item(i)->setText(str);
   493     QChar ch = workdays.at(index);
   537 
   494     if ( ch == QChar('0')) 
   538 		QChar ch = workdays.at(index);
   495         {
   539 		if ( ch == QChar('0')) 
   496         // Not a workday.
   540 		{
   497         model->select(
   541 			// Not a workday.
   498         model->model()->index(i,0),
   542 			model->select(
   499         QItemSelectionModel::Deselect);
   543 					model->model()->index(i,0),
   500         }
   544 					QItemSelectionModel::Deselect);
   501     else
   545 		}
   502         {
   546 		else
   503         // Workday.
   547 		{
   504         model->select(
   548 			// Workday.
   505         model->model()->index(i,0),
   549 			model->select(
   506         QItemSelectionModel::Select);}
   550 					model->model()->index(i,0),
   507         }
   551 					QItemSelectionModel::Select);}
       
   552 	}
       
   553 	OstTraceFunctionExit0( CLOCKREGIONALSETTINGSVIEW_UPDATEWEEKDAYS_EXIT );
   508 }
   554 }
   509 // End of file	--Don't remove this.
   555 // End of file	--Don't remove this.