calendarui/controller/src/calenviewmanager.cpp
changeset 68 a5a1242fd2e8
parent 58 ef813d54df51
child 80 fa7c359294fa
--- a/calendarui/controller/src/calenviewmanager.cpp	Wed Aug 18 09:47:38 2010 +0300
+++ b/calendarui/controller/src/calenviewmanager.cpp	Thu Sep 02 20:25:23 2010 +0300
@@ -258,6 +258,9 @@
 	Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", 
 											"Unable to load calenMonth view");
 	
+	// Set the parent to delete the view once will exit the application
+	mCalenMonthView->setParent(this);
+	
 	// Setup the month view.
 	mCalenMonthView->setupView(mMonthViewDocLoader);
 	
@@ -290,6 +293,9 @@
 		qFatal("calenviewmanager.cpp : Unable to find agenda view");
 	}
 	
+	// Set the parent to delete the view once will exit the application
+	mCalenAgendaView->setParent(this);
+	
 	// Setup the agenda view
 	mCalenAgendaView->setupView(mAgendaViewDocLoader);
 	
@@ -326,6 +332,9 @@
             qFatal("calenviewmanager.cpp : Unable to find day view");
         }
         
+        // Set the parent to delete the view once will exit the application
+        mCalenDayView->setParent(this);
+        
         // Set up the day view - day view takes the ownership
         mCalenDayView->setupView(docLoader);
     }
@@ -689,6 +698,9 @@
         qFatal("calenviewmanager.cpp : Unable to find alternate agenda view");
     }
 
+    // Set the parent to delete the view once will exit the application
+    mCalenAgendaViewAlt->setParent(this);
+    
     // Setup the agenda view
     mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader);
     OstTraceFunctionExit0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_EXIT );
@@ -944,12 +956,17 @@
 	// solution for the month view implements the construction in two phases so 
 	// it needs to be refactored and a common solution needs to be put here. So 
 	// that code doesn't break if another view is added tomorow
-	if (mCalenMonthView) {
+	HbView *currentview = mController.MainWindow().currentView();
+	
+	if (mCalenMonthView && currentview == mCalenMonthView) {
 		mCalenMonthView->fetchEntriesAndUpdateModel();
 	}
-	else if (mCalenAgendaView) {
+	else if (mCalenAgendaView && currentview == mCalenAgendaView) {
 		mCalenAgendaView->doPopulation();
 	}
+    else if (mCalenDayView && currentview == mCalenDayView) {
+        mCalenDayView->doPopulation();
+    }
 	// Calls the emitAppReady function of CalenController. Need to emit this
 	// signal after the view is fully constructed & populated
 	// with actual data and ready to be used. So entry view & instance view
@@ -1039,4 +1056,53 @@
     OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_EXIT );
 }
 
+
+// ----------------------------------------------------------------------------
+// CalenViewManager::removeSettingsView
+// remove settings view
+// ----------------------------------------------------------------------------
+//
+void CalenViewManager::removeSettingsView()
+{
+    if(mSettingsView){
+        mController.Services().MainWindow().removeView(mSettingsView);
+    }
+}
+    
+// ----------------------------------------------------------------------------
+// CalenViewManager::isEventViewerActive
+// check if Agenda Event Viewer is active
+// ----------------------------------------------------------------------------
+//
+bool CalenViewManager::isEventViewerActive()
+{
+   if(mCalenEventViewer)
+       return true;
+   else
+       return false;
+}
+
+// ----------------------------------------------------------------------------
+// CalenViewManager::saveAndCloseEditor
+// save the entry and close the editor
+// isEventViewerActive() should be called before this function
+// ----------------------------------------------------------------------------
+//
+void CalenViewManager::saveAndCloseEditor()
+{
+   mCalenEventViewer->saveAndCloseEditor();
+}
+
+// ----------------------------------------------------------------------------
+// CalenViewManager::closeAgendaEventView
+// close the agenda event view 
+// isEventViewerActive() should be called before this function
+// ----------------------------------------------------------------------------
+//
+void CalenViewManager::closeAgendaEventView()
+{
+   mCalenEventViewer->closeAgendaEventView();
+}
+
+
 // End of file	--Don't remove this.