calendarui/views/src/calenmonthview.cpp
changeset 58 ef813d54df51
parent 50 579cc610882e
child 68 a5a1242fd2e8
--- a/calendarui/views/src/calenmonthview.cpp	Tue Jul 06 14:14:56 2010 +0300
+++ b/calendarui/views/src/calenmonthview.cpp	Wed Aug 18 09:47:38 2010 +0300
@@ -51,6 +51,14 @@
 #include "calendarprivatecrkeys.h"
 #include "calenpluginlabel.h"
 #include "calenconstants.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "calenmonthviewTraces.h"
+#endif
+
+// CONSTANTS
+#define WEEKNUMWIDTH 6.41604 // in units, need to update this value if it 
+								// is changed in the docml
 /*!
  \class CalenMonthView
 
@@ -68,6 +76,8 @@
 	mNextRegionalInfo(0),
 	mIsAboutToQuitEventConnected(false)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_CALENMONTHVIEW_ENTRY );
+    
 	mIsWeekNumbersShown = 0;
 	mOrientation = mServices.MainWindow().orientation();
 	// Read the date from the context
@@ -85,6 +95,8 @@
 	mIsPrevPaneGesture = false;
 	// Get the week day color from the theme
 	mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day");
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_CALENMONTHVIEW_EXIT );
 }
 
 /*!
@@ -92,6 +104,9 @@
  */
 CalenMonthView::~CalenMonthView()
 {
+    OstTraceFunctionEntry0( DUP1_CALENMONTHVIEW_CALENMONTHVIEW_ENTRY );
+    
+    OstTraceFunctionExit0( DUP1_CALENMONTHVIEW_CALENMONTHVIEW_EXIT );
 }
 
 /*!
@@ -100,6 +115,8 @@
  */
 void CalenMonthView::setupView(CalenDocLoader *docLoader)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETUPVIEW_ENTRY );
+    
 	mDocLoader = docLoader;
 	mTitleLabel
 	        = qobject_cast<HbLabel *> (
@@ -214,6 +231,7 @@
 	// only for debugging purpose.
 	bool ok = activityManager->removeActivity(activityName);
 
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETUPVIEW_EXIT );
 }
 
 /*!
@@ -222,6 +240,7 @@
  */
 void CalenMonthView::doLazyLoading()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_DOLAZYLOADING_ENTRY );
 	// Add background items to all the widgets
 	addBackgroundFrame();
 	
@@ -293,6 +312,14 @@
 	// This is required to add/remove dynamically some options
 	connect(menu(), SIGNAL(aboutToShow ()), this,
 			SLOT(addRemoveActionsInMenu()));	
+	//add "show lunar data" action item ,if regional plugin is present
+	//regional plugin will add the option itself and handles it accordingly
+	//use this api after adding all action item to the menu
+	//so that plugin add the "Show lunar data" item as a second last option 
+	// in all views
+	mServices.OfferMenu(menu());
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_DOLAZYLOADING_EXIT );
 }
 
 /*!
@@ -300,6 +327,8 @@
  */
 void CalenMonthView::addWeekNumbers()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDWEEKNUMBERS_ENTRY );
+    
 	if (!mFirstWeekLabel) {
 	// Get all the six week labels
 	mFirstWeekLabel
@@ -338,20 +367,26 @@
 	        static_cast<QGraphicsLinearLayout *> (mDayNameWidget->layout());
 
 	if (KCalenDaysInWeek == dayNamesLayout->count()) {
-		// Add one item with text "Wk" in the day name grid
+		// Add one empty label in the day name grid
 		HbLabel *label = new HbLabel(mDayNameWidget);
 
 		// Set the attributes same as that of other day names to make it
 		// look similar to the day names
-		label->setPlainText(hbTrId("txt_calendar_grid_day_wk"));
+		label->setPlainText("");
 		label->setFont(mFirstDayLabel->font());
 		label->setFontSpec(mFirstDayLabel->fontSpec());
 		label->setAlignment(mFirstDayLabel->alignment());
 		label->setElideMode(mFirstDayLabel->elideMode());
 		label->setZValue(mFirstDayLabel->zValue());
-		label->setPreferredHeight(mFirstDayLabel->preferredHeight());
-		label->setMinimumHeight(mFirstDayLabel->minimumHeight());
-		label->setMaximumHeight(mFirstDayLabel->maximumHeight());
+		// Set the proper width to this empty label so that
+		// day names are dislayed against the correct columns
+		HbDeviceProfile deviceProf;
+        qreal unitValue = deviceProf.unitValue();
+        qreal widthInPixels = WEEKNUMWIDTH * unitValue;
+        label->setPreferredWidth(widthInPixels);
+        label->setMinimumWidth(widthInPixels);
+        label->setMaximumWidth(widthInPixels);
+        label->setContentsMargins(0,0,0,0);
 		
 		// Add this label into layout
 		dayNamesLayout->insertItem(0, label);
@@ -370,6 +405,8 @@
 		layout->invalidate();
 		layout->activate();
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_ADDWEEKNUMBERS_EXIT );
 }
 
 /*!
@@ -378,6 +415,8 @@
 void CalenMonthView::removeWeekNumbers()
 
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_REMOVEWEEKNUMBERS_ENTRY );
+    
 	// Remove the week number grid if setting is off
 	QGraphicsLinearLayout *layout = static_cast<QGraphicsLinearLayout *> 
 									(mMonthGridPlusWeekNumWidget->layout());
@@ -409,6 +448,8 @@
 			dayNamesLayout->activate();
 		}
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_REMOVEWEEKNUMBERS_EXIT );
 }
 
 /*!
@@ -416,6 +457,8 @@
  */
 void CalenMonthView::addBackgroundFrame()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDBACKGROUNDFRAME_ENTRY );
+    
     // Set the background items for all the widgets
     HbFrameItem* frame = NULL;
     HbFrameDrawer *drawer = NULL;
@@ -456,10 +499,14 @@
            frame = new HbFrameItem(drawer, this);
 	if(frame)
 	    mNextPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_ADDBACKGROUNDFRAME_EXIT );
 }
 
 void CalenMonthView::showHideRegionalInformation()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SHOWHIDEREGIONALINFORMATION_ENTRY );
+    
 	if (pluginEnabled()) {
 		XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository,
 									KCRUidCalendar, KCalendarShowRegionalInfo);
@@ -533,6 +580,8 @@
 			}
 		}
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_SHOWHIDEREGIONALINFORMATION_EXIT );
 }
 
 /*!
@@ -540,6 +589,7 @@
  */
 void CalenMonthView::onContextChanged()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ONCONTEXTCHANGED_ENTRY );
 	//Update plugin label after setting context
 	if (mCurrRegionalInfo && mPrevRegionalInfo && mNextPaneLayout
 	        && pluginEnabled()) {
@@ -548,6 +598,7 @@
 		mCurrRegionalInfo->setPlainText(*pluginString);
 		mNextRegionalInfo->setPlainText(*pluginString);
 	}
+	OstTraceFunctionExit0( CALENMONTHVIEW_ONCONTEXTCHANGED_EXIT );
 }
 
 /*!
@@ -556,6 +607,8 @@
 void CalenMonthView::updateWeekNumGridModel()
 
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEWEEKNUMGRIDMODEL_ENTRY );
+    
 	// Get the visible date
 	QDateTime firstVisibleDate = mFirstDayOfGrid.addDays(KCalenDaysInWeek
 	        * mNumOfRowsInPrevMonth);
@@ -583,6 +636,8 @@
 	mFifthWeekLabel->setPlainText(text);
 	text = QString::number(mWeekNumbers.at(5));
 	mSixthWeekLabel->setPlainText(text);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEWEEKNUMGRIDMODEL_EXIT );
 }
 
 /*!
@@ -590,6 +645,8 @@
  */
 void CalenMonthView::goToToday()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_GOTOTODAY_ENTRY );
+    
 	QDateTime today = CalenDateUtils::today();
 	// Set the context and repopulate the view
     MCalenContext &context = mServices.Context();
@@ -598,6 +655,7 @@
 	// First check if we are not alread
 	// showing today's month view
 	if (mDate == today) {
+		OstTraceFunctionExit0( CALENMONTHVIEW_GOTOTODAY_EXIT );
 		return;
 	} else if (mActiveMonth.date().year() == today.date().year() && 
 				mActiveMonth.date().month() == today.date().month()) {
@@ -611,6 +669,8 @@
 	} else {	
         refreshViewOnGoToDate();
 	}
+	
+	OstTraceFunctionExit0( DUP1_CALENMONTHVIEW_GOTOTODAY_EXIT );
 }
 
 /*
@@ -619,14 +679,17 @@
  */
 void CalenMonthView::addRemoveActionsInMenu()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDREMOVEACTIONSINMENU_ENTRY );
 	HbAction* menuAction = mDeleteSubMenu->menuAction();
-	// Check if there are no entries in the database
-	if (mAgendaUtil->areNoEntriesInCalendar() && menuAction) {
-		// hide the delete entries option
-		menuAction->setVisible(false);
-	} else if (menuAction) {
-		// Show the option to delete
-		menuAction->setVisible(true);
+	if (menuAction) {
+        if (!mEntriesInDataBase && mAgendaUtil->areNoEntriesInCalendar()) {
+            // hide the delete entries option
+            menuAction->setVisible(false);
+        } else {
+            mEntriesInDataBase = true;
+            // Show the option to delete
+            menuAction->setVisible(true);
+        }
 	}
 	
 	// Check if we are population for current day, if yes then disable the
@@ -636,6 +699,7 @@
 	} else if (mGoToTodayAction){
 		mGoToTodayAction->setVisible(true);
 	}
+	OstTraceFunctionExit0( CALENMONTHVIEW_ADDREMOVEACTIONSINMENU_EXIT );
 }
 
 /*!
@@ -643,7 +707,8 @@
  */
 void CalenMonthView::doPopulation()
 {
-
+    OstTraceFunctionEntry0( CALENMONTHVIEW_DOPOPULATION_ENTRY );
+    
  	// Get the layout and add the preview pane layout.
 	QGraphicsLinearLayout* viewLayout = static_cast<QGraphicsLinearLayout *>
 														(widget()->layout());
@@ -699,6 +764,8 @@
 	}
 	// Reset the first time load flag
 	mIsFirstTimeLoad = false;
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_DOPOPULATION_EXIT );
 }
 
 /*!
@@ -706,9 +773,13 @@
  */
 void CalenMonthView::prepareForPopulation()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_PREPAREFORPOPULATION_ENTRY );
+    
 	setActiveDay(dateFromContext(mServices.Context()));
 	setDate();
 	updateMonthDataArrayWithActiveDates();
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_PREPAREFORPOPULATION_EXIT );
 }
 
 /*!
@@ -716,6 +787,8 @@
  */
 void CalenMonthView::refreshViewOnGoToDate()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_REFRESHVIEWONGOTODATE_ENTRY );
+    
 	prepareForPopulation();
 	setDateToLabel();
 	// fetch list of required calendar instances
@@ -729,6 +802,8 @@
 	if (mIsWeekNumbersShown) {
 		updateWeekNumGridModel();
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_REFRESHVIEWONGOTODATE_EXIT );
 }
 
 /*!
@@ -736,6 +811,7 @@
  */
 QDateTime CalenMonthView::dateFromContext(const MCalenContext &context)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_DATEFROMCONTEXT_ENTRY );
 	QDateTime ret;
 	if (AgendaEntry::TypeTodo == context.instanceId().mType) {
 		QDateTime today = CalenDateUtils::today();
@@ -747,6 +823,7 @@
 	} else {
 		ret = context.focusDateAndTime();
 	}
+	OstTraceFunctionExit0( CALENMONTHVIEW_DATEFROMCONTEXT_EXIT );
 	return ret;
 }
 
@@ -755,6 +832,8 @@
  */
 void CalenMonthView::setActiveDay(QDateTime day)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETACTIVEDAY_ENTRY );
+    
 	mDate = day;
     
 	mActiveMonth = mDate;
@@ -814,6 +893,8 @@
 		mNumOfRowsInFutureMonth++;
 		dateTimeToCalc = dateTimeToCalc.addDays(-KCalenDaysInWeek);
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETACTIVEDAY_EXIT );
 }
 
 /*!
@@ -821,6 +902,8 @@
  */
 void CalenMonthView::setDate()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETDATE_ENTRY );
+    
 	mMonthDataArray.clear();
 	// Calculate the actual number of dates to be populated from previous month
 	// to future month
@@ -829,6 +912,8 @@
 		CalenMonthData element(currentDay);
 		mMonthDataArray.append(element);
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETDATE_EXIT );
 }
 
 /*!
@@ -836,6 +921,9 @@
  */
 QDateTime CalenMonthView::getCurrentDay()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_GETCURRENTDAY_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_GETCURRENTDAY_EXIT );
 	return mCurrentDay;
 }
 
@@ -844,14 +932,20 @@
  */
 QDateTime CalenMonthView::getActiveDay()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_GETACTIVEDAY_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_GETACTIVEDAY_EXIT );
 	return mDate;
 }
 
 /*!
  Returns the array of CalenMonthData items
  */
-QList<CalenMonthData> CalenMonthView::monthDataList()
+QList<CalenMonthData>& CalenMonthView::monthDataList()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_MONTHDATALIST_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_MONTHDATALIST_EXIT );
 	return mMonthDataArray;
 }
 
@@ -860,6 +954,7 @@
  */
 void CalenMonthView::createGrid()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_CREATEGRID_ENTRY );
 	// Update the month grid
 	mMonthGrid->updateMonthGridModel(mMonthDataArray, mIndexToBeScrolled, 
 	                                 mIsFirstTimeLoad);
@@ -884,6 +979,7 @@
 		// remove the weeknumbergrid from the layout
 		removeWeekNumbers();
 	}
+	OstTraceFunctionExit0( CALENMONTHVIEW_CREATEGRID_EXIT );
 }
 
 /*!
@@ -892,6 +988,8 @@
  */
 void CalenMonthView::updateModelWithPrevMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMODELWITHPREVMONTH_ENTRY );
+    
 	// Get the new previous month
 	QDateTime prevMonthDateTime = mActiveMonth.addMonths(-1);
 	QDateTime dateTime = mFirstDayOfGrid;
@@ -960,12 +1058,16 @@
 	if (mIsWeekNumbersShown) {
 		updateWeekNumGridModel();
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMODELWITHPREVMONTH_EXIT );
 }
 /*!
  Called when up gesture is performed
  */
 void CalenMonthView::updateModelWithFutureMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMODELWITHFUTUREMONTH_ENTRY );
+    
 	// Get the new future month
 	QDateTime previousLastDayOfGrid = mLastDayOfGrid;
 	QDateTime futureMonthDateTime = mActiveMonth.addMonths(2);
@@ -1029,6 +1131,7 @@
 	// Update the mMonthDataArray with instances if any
 	populateNextMonth();
 		
+	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMODELWITHFUTUREMONTH_EXIT );
 }
 
 /*!
@@ -1036,6 +1139,9 @@
  */
 int CalenMonthView::rowsInPrevMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ROWSINPREVMONTH_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_ROWSINPREVMONTH_EXIT );
 	return mNumOfRowsInPrevMonth;
 }
 
@@ -1044,6 +1150,9 @@
  */
 int CalenMonthView::rowsInFutMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ROWSINFUTMONTH_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_ROWSINFUTMONTH_EXIT );
 	return mNumOfRowsInFutureMonth;
 }
 
@@ -1052,6 +1161,9 @@
  */
 int CalenMonthView::getCurrGridIndex()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_GETCURRGRIDINDEX_ENTRY );
+    
+    OstTraceFunctionExit0( CALENMONTHVIEW_GETCURRGRIDINDEX_EXIT );
 	return mMonthGrid->getCurrentIndex();
 }
 
@@ -1060,8 +1172,10 @@
  */
 void CalenMonthView::setCurrGridIndex(int index)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETCURRGRIDINDEX_ENTRY );
 	mIsPrevPaneGesture = true;
 	mMonthGrid->setCurrentIdex(index);
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETCURRGRIDINDEX_EXIT );
 }
 
 /*!
@@ -1069,6 +1183,8 @@
  */
 void CalenMonthView::updateMonthDataArrayWithActiveDates()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMONTHDATAARRAYWITHACTIVEDATES_ENTRY );
+    
 	int activeMonth = mActiveMonth.date().month();
 	int monthDataCount = mMonthDataArray.count();
 	for (int i = 0; i < monthDataCount; i++) {
@@ -1080,6 +1196,8 @@
 			mMonthDataArray[i].setActive(false);
 		}
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMONTHDATAARRAYWITHACTIVEDATES_EXIT );
 }
 
 /*!
@@ -1088,6 +1206,8 @@
 void CalenMonthView::getInstanceList(QList<QDate> &list,
                                      QDateTime rangeStart, QDateTime rangeEnd)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_GETINSTANCELIST_ENTRY );
+    
 	AgendaUtil::FilterFlags filter =
 	        AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries
 	                | AgendaUtil::IncludeAppointments
@@ -1095,6 +1215,8 @@
 	                | AgendaUtil::IncludeReminders
 	                | AgendaUtil::IncludeIncompletedTodos);
 	mAgendaUtil->markDatesWithEvents(rangeStart, rangeEnd, filter, list);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_GETINSTANCELIST_EXIT );
 }
 
 /*!
@@ -1102,6 +1224,8 @@
  */
 void CalenMonthView::populateWithInstanceView()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEWITHINSTANCEVIEW_ENTRY );
+    
 	const QDateTime today(CalenDateUtils::today());
 	const QDateTime gridStart(CalenDateUtils::beginningOfDay(mFirstDayOfGrid));
 
@@ -1120,8 +1244,13 @@
 		int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i));
 		mMonthDataArray[offset].SetHasEvents(true);
 	}
-
 	datesWithEvents.clear();
+	
+	if (datesEventsCount) {
+        mEntriesInDataBase = true;
+	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEWITHINSTANCEVIEW_EXIT );
 }
 
 /*!
@@ -1130,6 +1259,8 @@
  */
 void CalenMonthView::populatePrevMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEPREVMONTH_ENTRY );
+    
 	const QDateTime gridStart(CalenDateUtils::beginningOfDay(mFirstDayOfGrid));
 	const QDateTime today(CalenDateUtils::today());
 
@@ -1149,6 +1280,12 @@
 		mMonthDataArray[offset].SetHasEvents(true);
 	}
 	datesWithEvents.clear();
+	
+	if (datesEventsCount) {
+        mEntriesInDataBase = true;
+    }
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEPREVMONTH_EXIT );
 }
 
 /*!
@@ -1157,6 +1294,7 @@
  */
 void CalenMonthView::populateNextMonth()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATENEXTMONTH_ENTRY );
 	QList<AgendaEntry> list;
 	int actualIndex = mNumOfRowsInFutureMonth * KCalenDaysInWeek;
 	const QDateTime gridStart(mLastDayOfGrid.addDays(-actualIndex));
@@ -1177,6 +1315,11 @@
 		mMonthDataArray[offset].SetHasEvents(true);
 	}
 	datesWithEvents.clear();
+	
+	if (datesEventsCount) {
+        mEntriesInDataBase = true;
+    }
+	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATENEXTMONTH_EXIT );
 }
 
 /*!
@@ -1185,12 +1328,16 @@
  */
 void CalenMonthView::fetchEntriesAndUpdateModel()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_FETCHENTRIESANDUPDATEMODEL_ENTRY );
+    
 	// Get to know if entries are there from the agenda server
 	populateWithInstanceView();
 	// Update the month grid model
 	mMonthGrid->updateMonthGridWithEventIndicators(mMonthDataArray);
 	// Populate the preview panes
 	populatePreviewPane(mDate);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_FETCHENTRIESANDUPDATEMODEL_EXIT );
 }
 
 /*!
@@ -1198,12 +1345,16 @@
  */
 void CalenMonthView::populatePreviewPane(QDateTime &dateTime)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEPREVIEWPANE_ENTRY );
+    
 	mPrevPreviewPane->populateLabel(dateTime.addDays(-1));
 	mCurrPreviewPane->populateLabel(dateTime);
 	mNextPreviewPane->populateLabel(dateTime.addDays(1));
 	
 	// Start the auto scroll on current preview pane
     mCurrPreviewPane->startAutoScroll();
+    
+    OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEPREVIEWPANE_EXIT );
 }
 
 /*!
@@ -1212,7 +1363,11 @@
  */
 void CalenMonthView::completePopulation()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_COMPLETEPOPULATION_ENTRY );
+    
 	setDateToLabel();
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_COMPLETEPOPULATION_EXIT );
 }
 
 /*!
@@ -1220,7 +1375,11 @@
  */
 void CalenMonthView::handleGridItemActivated()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLEGRIDITEMACTIVATED_ENTRY );
+    
 	mServices.IssueCommandL(ECalenDayView);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLEGRIDITEMACTIVATED_EXIT );
 }
 
 /*!
@@ -1228,6 +1387,7 @@
  */
 void CalenMonthView::setContextForActiveDay(int index)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETCONTEXTFORACTIVEDAY_ENTRY );
 	QDateTime newActiveDay = mFirstDayOfGrid.addDays(index);
 	// Set the context
 	mServices.Context().setFocusDate(newActiveDay);
@@ -1241,6 +1401,7 @@
 		mIsPrevPaneGesture = false;
 	}
 	
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETCONTEXTFORACTIVEDAY_EXIT );
 }
 
 /*!
@@ -1248,7 +1409,12 @@
  */
 void CalenMonthView::createEditor()
 {
+	OstTraceFunctionEntry0( CALENMONTHVIEW_CREATEEDITOR_ENTRY );
+	
+    captureScreenshot(true);
 	mServices.IssueCommandL(ECalenNewMeeting);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_CREATEEDITOR_EXIT );
 }
 
 /*!
@@ -1256,6 +1422,8 @@
  */
 void CalenMonthView::launchDayView()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_LAUNCHDAYVIEW_ENTRY );
+    
 	mServices.IssueCommandL(ECalenDayView);
 	// day view launched now, disconnect to get the call backs for saveActivity 
 	// on aboutToQuit signal
@@ -1264,6 +1432,8 @@
         disconnect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
         mIsAboutToQuitEventConnected = false;
 	    }
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_LAUNCHDAYVIEW_EXIT );
 }
 
 /*!
@@ -1271,11 +1441,15 @@
  */
 void CalenMonthView::changeOrientation(Qt::Orientation orientation)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_CHANGEORIENTATION_ENTRY );
+    
 		if (mOrientation != orientation) {
 			// change the orientation here
 			mOrientation = orientation;
 			handleChangeOrientation();
 		}
+		
+	OstTraceFunctionExit0( CALENMONTHVIEW_CHANGEORIENTATION_EXIT );
 }
 
 /*!
@@ -1284,6 +1458,8 @@
  */
 void CalenMonthView::handleChangeOrientation()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLECHANGEORIENTATION_ENTRY );
+    
 	bool loadSuccess = false;
 	if (mOrientation == Qt::Horizontal) {
 		mDocLoader->load(CALEN_MONTHVIEW_XML_FILE, CALEN_LANDSCAPE,
@@ -1307,6 +1483,8 @@
 	if (this == mServices.MainWindow().currentView()) {
 		viewLayout->addItem(mCurrPaneParent);
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLECHANGEORIENTATION_EXIT );
 }
 
 /*!
@@ -1314,13 +1492,18 @@
  */
 void CalenMonthView::setDateToLabel()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_SETDATETOLABEL_ENTRY );
+    
 	// Get the localised string for month name from system locale
-	QString monthString = mLocale.monthName(mDate.date().month(), HbExtendedLocale::LongFormat);
+	QString dateString = mLocale.monthName(mDate.date().month(), HbExtendedLocale::LongFormat);
 	// Append a single space
-	monthString.append(" ");
+	dateString.append(" ");
 	mLocale.setNumberOptions(QLocale::OmitGroupSeparator);
-	QString yearString = mLocale.toString(mDate.date().year());
-	mTitleLabel->setPlainText(hbTrId("txt_calendar_month_label_title_12").arg(monthString).arg(yearString));
+	// Append the year string also
+	dateString.append(mLocale.toString(mDate.date().year()));
+	mTitleLabel->setPlainText(dateString);
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_SETDATETOLABEL_EXIT );
 }
 
 /*!
@@ -1328,8 +1511,16 @@
  */
 void CalenMonthView::handlePreviewPaneGesture(bool rightGesture)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLEPREVIEWPANEGESTURE_ENTRY );
+    
 	QGraphicsLinearLayout* viewLayout = static_cast<QGraphicsLinearLayout *>
 												(widget()->layout());
+	
+	// Set the effect in progress flags for next and previous panes
+	// For current pane, we would have set it in gestureEvent() function
+	mPrevPreviewPane->effectStarted();
+	mNextPreviewPane->effectStarted();
+	
 	if(rightGesture) {
 		// Need to bring up the previous day preview pane
 		// Create the effect on mCurrPreviewPane to slide to right side
@@ -1388,6 +1579,8 @@
 		viewLayout->removeAt(1);
 		viewLayout->addItem(mNextPaneParent);
 	}
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLEPREVIEWPANEGESTURE_EXIT );
 }
 
 /*!
@@ -1395,6 +1588,9 @@
  */
 QDateTime CalenMonthView::firstDayOfGrid()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_FIRSTDAYOFGRID_ENTRY );
+    
+	OstTraceFunctionExit0( CALENMONTHVIEW_FIRSTDAYOFGRID_EXIT );
 	return mFirstDayOfGrid;
 }
 
@@ -1403,7 +1599,13 @@
  */
 void CalenMonthView::onLocaleChanged(int reason)
 {
-	Q_UNUSED(reason);
+    OstTraceFunctionEntry0( CALENMONTHVIEW_ONLOCALECHANGED_ENTRY );
+    
+    if ((reason & EChangesSystemTime) 
+    		|| (reason & EChangesMidnightCrossover)) {
+		mCurrentDay = CalenDateUtils::today();
+	}
+	OstTraceFunctionExit0( CALENMONTHVIEW_ONLOCALECHANGED_EXIT );
 }
 
 /*!
@@ -1412,6 +1614,7 @@
 void CalenMonthView::handleLeftEffectCompleted(
 										const HbEffect::EffectStatus &status)
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLELEFTEFFECTCOMPLETED_ENTRY );
 	Q_UNUSED(status);
 	
 	int index = getCurrGridIndex();
@@ -1434,11 +1637,17 @@
 	mPrevPaneParent = paneParent;
 	mPrevPaneLayoutWidget = paneLayoutWidget;
 	
+	// Reset the effect in progress flag
+	mCurrPreviewPane->effectFinished();
+    mPrevPreviewPane->effectFinished();
+    mNextPreviewPane->effectFinished();
+    
 	// Set the focus to proper date
 	setCurrGridIndex(index);
 	// Start the auto scroll on current preview pane
 	mCurrPreviewPane->startAutoScroll();
 	mNextPreviewPane->populateLabel(mDate.addDays(1));
+	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLELEFTEFFECTCOMPLETED_EXIT );
 }
 
 /*!
@@ -1447,6 +1656,8 @@
 void CalenMonthView::handleRightEffectCompleted(
 										const HbEffect::EffectStatus &status) 	
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLERIGHTEFFECTCOMPLETED_ENTRY );
+    
 	Q_UNUSED(status);
 	
 	int index = getCurrGridIndex();
@@ -1469,17 +1680,26 @@
 	mNextPaneParent = paneParent;
 	mNextPaneLayoutWidget = paneLayoutWidget;
 	
+	// Reset the effect in progress flag
+	mCurrPreviewPane->effectFinished();
+    mNextPreviewPane->effectFinished();
+    mPrevPreviewPane->effectFinished();
+    
 	// Set the focus to proper date
 	setCurrGridIndex(index);
 	// Start the auto scroll on current preview pane
 	mCurrPreviewPane->startAutoScroll();
 	mPrevPreviewPane->populateLabel(mDate.addDays(-1));
+	
+	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLERIGHTEFFECTCOMPLETED_EXIT );
 }
 /*!
  update the Day labels 
  */
 void CalenMonthView::updateDayLabel()
 {
+    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEDAYLABEL_ENTRY );
+    
     // Set the short day names to these labels  
     int startOfWeek = mLocale.startOfWeek();
     int weekDayIndex = startOfWeek;
@@ -1513,5 +1733,7 @@
         }
     labels.clear();
     weekDayArray.clear();
+    
+    OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEDAYLABEL_EXIT );
 }
 // End of file  --Don't remove this.