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