calendarui/views/src/calensettingsview.cpp
changeset 45 b6db4fd4947b
parent 18 c198609911f9
child 51 0b38fc5b94c6
--- a/calendarui/views/src/calensettingsview.cpp	Mon May 03 12:30:32 2010 +0300
+++ b/calendarui/views/src/calensettingsview.cpp	Mon Jun 28 15:22:02 2010 +0530
@@ -31,7 +31,11 @@
 #include "calensettings.h"
 
 CalenSettingsView::CalenSettingsView(MCalenServices& services, QGraphicsItem *parent)
-:HbView(parent), mServices(services)
+:HbView(parent), 
+ mServices(services),
+ mCalenSettingsForm(NULL),
+ mCalenSettings(NULL),
+ mSoftKeyAction(NULL)
 {
 
 	mCalenSettingsForm = new HbDataForm(this);
@@ -40,17 +44,26 @@
 	setTitle(hbTrId("txt_calendar_title_calendar"));
 
 	// Construct the settings utility.
-	mCalenSettings = new CalenSettings(mCalenSettingsForm);
-	mCalenSettings->createModel();
-
-
-	setWidget(mCalenSettingsForm);
+	if(mCalenSettingsForm)
+	{
+	    mCalenSettings = new CalenSettings(mServices, mCalenSettingsForm);
+        if(mCalenSettings)
+        {
+    	    mCalenSettings->createModel();
+            setWidget(mCalenSettingsForm);
+        }
+    }
 	
 }
 
 CalenSettingsView::~CalenSettingsView()
 {
-	// Nothing yet.
+	if (mCalenSettings) {
+		delete mCalenSettings;
+	}
+	if (mSoftKeyAction) {
+		delete mSoftKeyAction;
+	}
 }
 
 void CalenSettingsView::launchPreviousView()
@@ -61,30 +74,27 @@
 											this, SLOT(launchPreviousView()));
 	mServices.MainWindow().removeView(this);
 	mServices.IssueNotificationL(ECalenNotifySettingsClosed);
-   
-    //TODO :: For ART3 we are launching agenda view later we have to use week view
-    // GEt the current orientation
-   /* Qt::Orientation orientation = mServices.MainWindow().orientation();
-    if(orientation == Qt::Vertical)
-        {
-        mServices.IssueCommandL(ECalenDayView);
-        }
-    else if(orientation == Qt::Horizontal)
-        {
-        mServices.IssueCommandL(ECalenLandscapeDayView);
-        }*/
 }
 
 void CalenSettingsView::initializeForm()
-    {
+{
     mCalenSettings->populateSettingList();
     
     // Add view on main window and set back softkey
 	mServices.MainWindow().addView(this);
-	mSoftKeyAction = new HbAction(Hb::BackAction);
-	setNavigationAction(mSoftKeyAction);
-	connect(mSoftKeyAction, SIGNAL(triggered()), 
+	mSoftKeyAction = new HbAction(Hb::BackNaviAction);
+	if(mSoftKeyAction)
+	{
+		setNavigationAction(mSoftKeyAction);
+		connect(mSoftKeyAction, SIGNAL(triggered()), 
 											this, SLOT(launchPreviousView()));
+	}
+}
+
+void CalenSettingsView::refreshView()
+    {
+    //populate the new items 
+    mCalenSettings->populateSettingList();
     }
 
 // End of file