calendarui/controller/src/calenviewmanager.cpp
changeset 68 a5a1242fd2e8
parent 58 ef813d54df51
child 80 fa7c359294fa
equal deleted inserted replaced
58:ef813d54df51 68:a5a1242fd2e8
   256 	mCalenMonthView = static_cast<CalenMonthView *> 
   256 	mCalenMonthView = static_cast<CalenMonthView *> 
   257 							(mMonthViewDocLoader->findWidget(CALEN_MONTHVIEW));
   257 							(mMonthViewDocLoader->findWidget(CALEN_MONTHVIEW));
   258 	Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", 
   258 	Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", 
   259 											"Unable to load calenMonth view");
   259 											"Unable to load calenMonth view");
   260 	
   260 	
       
   261 	// Set the parent to delete the view once will exit the application
       
   262 	mCalenMonthView->setParent(this);
       
   263 	
   261 	// Setup the month view.
   264 	// Setup the month view.
   262 	mCalenMonthView->setupView(mMonthViewDocLoader);
   265 	mCalenMonthView->setupView(mMonthViewDocLoader);
   263 	
   266 	
   264 	OstTraceFunctionExit0( CALENVIEWMANAGER_LOADMONTHVIEW_EXIT );
   267 	OstTraceFunctionExit0( CALENVIEWMANAGER_LOADMONTHVIEW_EXIT );
   265 }
   268 }
   287 	// Get the calenagenda view from the loader
   290 	// Get the calenagenda view from the loader
   288 	mCalenAgendaView = static_cast<CalenAgendaView *> (mAgendaViewDocLoader->findWidget(CALEN_AGENDAVIEW));
   291 	mCalenAgendaView = static_cast<CalenAgendaView *> (mAgendaViewDocLoader->findWidget(CALEN_AGENDAVIEW));
   289 	if (!mCalenAgendaView) {
   292 	if (!mCalenAgendaView) {
   290 		qFatal("calenviewmanager.cpp : Unable to find agenda view");
   293 		qFatal("calenviewmanager.cpp : Unable to find agenda view");
   291 	}
   294 	}
       
   295 	
       
   296 	// Set the parent to delete the view once will exit the application
       
   297 	mCalenAgendaView->setParent(this);
   292 	
   298 	
   293 	// Setup the agenda view
   299 	// Setup the agenda view
   294 	mCalenAgendaView->setupView(mAgendaViewDocLoader);
   300 	mCalenAgendaView->setupView(mAgendaViewDocLoader);
   295 	
   301 	
   296 	// The following code is done to provide swipe support
   302 	// The following code is done to provide swipe support
   323         mCalenDayView = static_cast<CalenDayView *>
   329         mCalenDayView = static_cast<CalenDayView *>
   324             (docLoader->findWidget(CALEN_DAYVIEW));
   330             (docLoader->findWidget(CALEN_DAYVIEW));
   325         if (!mCalenDayView) {
   331         if (!mCalenDayView) {
   326             qFatal("calenviewmanager.cpp : Unable to find day view");
   332             qFatal("calenviewmanager.cpp : Unable to find day view");
   327         }
   333         }
       
   334         
       
   335         // Set the parent to delete the view once will exit the application
       
   336         mCalenDayView->setParent(this);
   328         
   337         
   329         // Set up the day view - day view takes the ownership
   338         // Set up the day view - day view takes the ownership
   330         mCalenDayView->setupView(docLoader);
   339         mCalenDayView->setupView(docLoader);
   331     }
   340     }
   332 }
   341 }
   687     mCalenAgendaViewAlt = static_cast<CalenAgendaView *> (mAgendaViewAltDocLoader->findWidget(CALEN_AGENDAVIEW));
   696     mCalenAgendaViewAlt = static_cast<CalenAgendaView *> (mAgendaViewAltDocLoader->findWidget(CALEN_AGENDAVIEW));
   688     if (!mCalenAgendaViewAlt) {
   697     if (!mCalenAgendaViewAlt) {
   689         qFatal("calenviewmanager.cpp : Unable to find alternate agenda view");
   698         qFatal("calenviewmanager.cpp : Unable to find alternate agenda view");
   690     }
   699     }
   691 
   700 
       
   701     // Set the parent to delete the view once will exit the application
       
   702     mCalenAgendaViewAlt->setParent(this);
       
   703     
   692     // Setup the agenda view
   704     // Setup the agenda view
   693     mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader);
   705     mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader);
   694     OstTraceFunctionExit0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_EXIT );
   706     OstTraceFunctionExit0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_EXIT );
   695 }
   707 }
   696 
   708 
   942 	// Ideal colution should be to call a uniform function, e.g. PopulateEvents
   954 	// Ideal colution should be to call a uniform function, e.g. PopulateEvents
   943 	// where PopulateEvents should be implemeted by all views. Since the current
   955 	// where PopulateEvents should be implemeted by all views. Since the current
   944 	// solution for the month view implements the construction in two phases so 
   956 	// solution for the month view implements the construction in two phases so 
   945 	// it needs to be refactored and a common solution needs to be put here. So 
   957 	// it needs to be refactored and a common solution needs to be put here. So 
   946 	// that code doesn't break if another view is added tomorow
   958 	// that code doesn't break if another view is added tomorow
   947 	if (mCalenMonthView) {
   959 	HbView *currentview = mController.MainWindow().currentView();
       
   960 	
       
   961 	if (mCalenMonthView && currentview == mCalenMonthView) {
   948 		mCalenMonthView->fetchEntriesAndUpdateModel();
   962 		mCalenMonthView->fetchEntriesAndUpdateModel();
   949 	}
   963 	}
   950 	else if (mCalenAgendaView) {
   964 	else if (mCalenAgendaView && currentview == mCalenAgendaView) {
   951 		mCalenAgendaView->doPopulation();
   965 		mCalenAgendaView->doPopulation();
   952 	}
   966 	}
       
   967     else if (mCalenDayView && currentview == mCalenDayView) {
       
   968         mCalenDayView->doPopulation();
       
   969     }
   953 	// Calls the emitAppReady function of CalenController. Need to emit this
   970 	// Calls the emitAppReady function of CalenController. Need to emit this
   954 	// signal after the view is fully constructed & populated
   971 	// signal after the view is fully constructed & populated
   955 	// with actual data and ready to be used. So entry view & instance view
   972 	// with actual data and ready to be used. So entry view & instance view
   956 	// needs to be created so that a new entry can also be created. Finally
   973 	// needs to be created so that a new entry can also be created. Finally
   957 	// NotesApplication object needs to emit applicationReady Signal.
   974 	// NotesApplication object needs to emit applicationReady Signal.
  1037     }
  1054     }
  1038     
  1055     
  1039     OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_EXIT );
  1056     OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_EXIT );
  1040 }
  1057 }
  1041 
  1058 
       
  1059 
       
  1060 // ----------------------------------------------------------------------------
       
  1061 // CalenViewManager::removeSettingsView
       
  1062 // remove settings view
       
  1063 // ----------------------------------------------------------------------------
       
  1064 //
       
  1065 void CalenViewManager::removeSettingsView()
       
  1066 {
       
  1067     if(mSettingsView){
       
  1068         mController.Services().MainWindow().removeView(mSettingsView);
       
  1069     }
       
  1070 }
       
  1071     
       
  1072 // ----------------------------------------------------------------------------
       
  1073 // CalenViewManager::isEventViewerActive
       
  1074 // check if Agenda Event Viewer is active
       
  1075 // ----------------------------------------------------------------------------
       
  1076 //
       
  1077 bool CalenViewManager::isEventViewerActive()
       
  1078 {
       
  1079    if(mCalenEventViewer)
       
  1080        return true;
       
  1081    else
       
  1082        return false;
       
  1083 }
       
  1084 
       
  1085 // ----------------------------------------------------------------------------
       
  1086 // CalenViewManager::saveAndCloseEditor
       
  1087 // save the entry and close the editor
       
  1088 // isEventViewerActive() should be called before this function
       
  1089 // ----------------------------------------------------------------------------
       
  1090 //
       
  1091 void CalenViewManager::saveAndCloseEditor()
       
  1092 {
       
  1093    mCalenEventViewer->saveAndCloseEditor();
       
  1094 }
       
  1095 
       
  1096 // ----------------------------------------------------------------------------
       
  1097 // CalenViewManager::closeAgendaEventView
       
  1098 // close the agenda event view 
       
  1099 // isEventViewerActive() should be called before this function
       
  1100 // ----------------------------------------------------------------------------
       
  1101 //
       
  1102 void CalenViewManager::closeAgendaEventView()
       
  1103 {
       
  1104    mCalenEventViewer->closeAgendaEventView();
       
  1105 }
       
  1106 
       
  1107 
  1042 // End of file	--Don't remove this.
  1108 // End of file	--Don't remove this.