clock/clockui/clocksettingsview/src/settingscustomitem.cpp
changeset 63 a3cb48f6c889
parent 57 bb2d3e476f29
child 70 a5ed90760192
--- a/clock/clockui/clocksettingsview/src/settingscustomitem.cpp	Mon Aug 09 18:30:52 2010 +0530
+++ b/clock/clockui/clocksettingsview/src/settingscustomitem.cpp	Wed Aug 25 14:02:13 2010 +0530
@@ -28,6 +28,7 @@
 #include <HbListWidget>
 #include <HbExtendedLocale>
 #include <HbListWidgetItem>
+#include <HbStyleLoader>
 
 // User includes
 #include "settingscustomitem.h"
@@ -54,14 +55,16 @@
 	\param parent The parent.
  */
 
-SettingsCustomItem::SettingsCustomItem(QGraphicsItem *parent)
-:HbDataFormViewItem(parent)
+SettingsCustomItem::SettingsCustomItem(QGraphicsItem *parent, bool launchedByClock)
+:HbDataFormViewItem(parent), mLaunchedByClock(launchedByClock)
 {
 	OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY );
 	// Construct the settignsutility.
 	mSettingsUtility = new SettingsUtility();
 	// Construct the timezone client.
 	mTimezoneClient = TimezoneClient::getInstance();
+	// Register for the css.
+	HbStyleLoader::registerFilePath(":/style/settingscustomitem.css");
 	OstTraceFunctionExit0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT );
 }
 
@@ -71,7 +74,8 @@
 SettingsCustomItem::~SettingsCustomItem()
 {
 	OstTraceFunctionEntry0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY );
-	// Nothing yet.
+	// Unregister the css.
+	HbStyleLoader::unregisterFilePath(":/style/settingscustomitem.css");
 	OstTraceFunctionExit0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT );
 }
 
@@ -185,6 +189,7 @@
 	switch (itemType) {
 		case (TimeItemOffset + HbDataFormModelItem::CustomItemBase):
 		{
+			setProperty("expandItem", false);
 			mTimeWidget = new HbPushButton(this);
 			connect(
 					mTimeWidget, SIGNAL(clicked()),
@@ -195,6 +200,7 @@
 
 		case (DateItemOffset + HbDataFormModelItem::CustomItemBase):
 		{
+			setProperty("expandItem", false);
 			mDateWidget = new HbPushButton(this);
 			connect(
 					mDateWidget, SIGNAL(clicked()),
@@ -205,6 +211,7 @@
 
 		case (PlaceItemOffset + HbDataFormModelItem::CustomItemBase):
 		{
+			setProperty("expandItem", false);
 			mPlaceWidget = new HbPushButton(this);
 			connect(
 					mPlaceWidget, SIGNAL(clicked()),
@@ -215,6 +222,7 @@
 
 		case (RegionalItemOffset + HbDataFormModelItem::CustomItemBase):
 		{
+			setProperty("expandItem", false);
 			mRegSettingsWidget = new HbPushButton(this);
 			connect(
 					mRegSettingsWidget, SIGNAL(clicked()),
@@ -223,8 +231,11 @@
 			return mRegSettingsWidget;
 		}
 
-		case (50 + HbDataFormModelItem::CustomItemBase):
+		case (WorkdaysItemOffset + HbDataFormModelItem::CustomItemBase):
 		{
+			// Set the property so that the custom item layout 
+			// will be the same for both portrait and landscape 
+			setProperty("expandItem", true);
 			mWorkdaysWidget = new HbListWidget(this);
 			mWorkdaysWidget->setSelectionMode(HbAbstractItemView::MultiSelection);
 			mWorkdaysWidget->setScrollDirections(0);
@@ -424,7 +435,8 @@
 {
 	OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_LAUNCHREGSETTINGSVIEW_ENTRY );
 	ClockRegionalSettingsView *view =
-			new ClockRegionalSettingsView();
+			new ClockRegionalSettingsView(0, mLaunchedByClock);
+
 	connect(mTimezoneClient, SIGNAL(timechanged()),
           view, SLOT(updateWeekStartOn()));
 	view->showView();