calendarui/controller/src/calenviewmanager.cpp
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
child 63 a3cb48f6c889
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
    64 	mCalenAgendaView = NULL;
    64 	mCalenAgendaView = NULL;
    65 	mCalenMonthView = NULL;
    65 	mCalenMonthView = NULL;
    66 	mCalenAgendaViewAlt = NULL;
    66 	mCalenAgendaViewAlt = NULL;
    67 	mSettingsView = NULL;
    67 	mSettingsView = NULL;
    68 	mCalenDayView = NULL;
    68 	mCalenDayView = NULL;
       
    69 	mInstanceViewCreated = false;
    69 	
    70 	
    70 	// Connect to instance view and entry view creation signals from agenda
    71 	// Connect to instance view and entry view creation signals from agenda
    71 	// interface
    72 	// interface
    72 	connect(mController.agendaInterface(), SIGNAL(instanceViewCreationCompleted(int)),
    73 	connect(mController.agendaInterface(), SIGNAL(instanceViewCreationCompleted(int)),
    73 	        this, SLOT(handleInstanceViewCreation(int)));
    74 	        this, SLOT(handleInstanceViewCreation(int)));
   217 		loadAgendaView();
   218 		loadAgendaView();
   218 		ActivateDefaultViewL(ECalenAgendaView);
   219 		ActivateDefaultViewL(ECalenAgendaView);
   219 		// Add agenda view to mainwindow.
   220 		// Add agenda view to mainwindow.
   220 		mController.MainWindow().addView(mCalenAgendaView);
   221 		mController.MainWindow().addView(mCalenAgendaView);
   221 		mController.MainWindow().setCurrentView(mCalenAgendaView);
   222 		mController.MainWindow().setCurrentView(mCalenAgendaView);
       
   223 		mController.MainWindow().addView(mCalenAgendaViewAlt);
   222 	}
   224 	}
   223 	OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_EXIT );
   225 	OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_EXIT );
   224 }
   226 }
   225 
   227 
   226 // ----------------------------------------------------------------------------
   228 // ----------------------------------------------------------------------------
   338 void CalenViewManager::handleMainViewReady()
   340 void CalenViewManager::handleMainViewReady()
   339 {
   341 {
   340     OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_ENTRY );
   342     OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_ENTRY );
   341     
   343     
   342 	// Construct the month view part that is kept for lazy loading
   344 	// Construct the month view part that is kept for lazy loading
   343 	if (mCalenMonthView) {
   345     if (mCalenMonthView) {
   344 		mCalenMonthView->doLazyLoading();
   346 		mCalenMonthView->doLazyLoading();
       
   347 
       
   348 		if (mInstanceViewCreated) {
       
   349 			// populate entries for the month view if the month view is launched 
       
   350 			// from the service APIs. Otherwise the month view is not populated with 
       
   351 			// the entries as CalenViewManager::handleInstanceViewCreation is called 
       
   352 			// before the month view creation so the model array is not populated.
       
   353 			mCalenMonthView->fetchEntriesAndUpdateModel();
       
   354 		}
       
   355 
   345 	}
   356 	}
   346 	
   357 	
   347 	// Construct other views
   358 	// Construct other views
   348 	constructOtherViews();
   359 	constructOtherViews();
   349 	
   360 	
   917 void CalenViewManager::handleInstanceViewCreation(int status)
   928 void CalenViewManager::handleInstanceViewCreation(int status)
   918 {
   929 {
   919     OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_ENTRY );
   930     OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_ENTRY );
   920     
   931     
   921 	Q_UNUSED(status);
   932 	Q_UNUSED(status);
       
   933 	
       
   934 	// This flag is needed if mCalenMonthView and mCalenAgendaview is not created
       
   935 	// and before that this slot is getting called.
       
   936 	// if we launch views through services then this slot is getting called 
       
   937 	// before the view construction.
       
   938 	mInstanceViewCreated = true;
       
   939 	
   922 	// handleInstanceViewCreation function is called only once. Now that the instance
   940 	// handleInstanceViewCreation function is called only once. Now that the instance
   923 	// view creation is successfull. Events need to be populated on screen
   941 	// view creation is successfull. Events need to be populated on screen
   924 	// Ideal colution should be to call a uniform function, e.g. PopulateEvents
   942 	// Ideal colution should be to call a uniform function, e.g. PopulateEvents
   925 	// where PopulateEvents should be implemeted by all views. Since the current
   943 	// where PopulateEvents should be implemeted by all views. Since the current
   926 	// solution for the month view implements the construction in two phases so 
   944 	// solution for the month view implements the construction in two phases so 
   964 // ----------------------------------------------------------------------------
   982 // ----------------------------------------------------------------------------
   965 //
   983 //
   966 void CalenViewManager::handleEntriesChanged(QList<ulong> ids)
   984 void CalenViewManager::handleEntriesChanged(QList<ulong> ids)
   967 {
   985 {
   968 	Q_UNUSED(ids);
   986 	Q_UNUSED(ids);
   969 	// Update and refresh the view.
   987 	HbView *currentview = mController.MainWindow().currentView();
   970 	activateCurrentView();
   988 	if((mCalenMonthView == currentview)||(mCalenDayView == currentview)||
       
   989                                             (mCalenAgendaView == currentview ))
       
   990 	    {
       
   991         activateCurrentView();
       
   992 	    }
   971 }
   993 }
   972 
   994 
   973 // ----------------------------------------------------------------------------
   995 // ----------------------------------------------------------------------------
   974 // CalenViewManager::handleEntryUpdation
   996 // CalenViewManager::handleEntryUpdation
   975 // this function will be called when any entry is updated or added into database
   997 // this function will be called when any entry is updated or added into database