calendarui/views/src/calennativeview.cpp
changeset 75 7ac58b2aae6f
parent 70 a5ed90760192
child 81 ce92091cbd61
equal deleted inserted replaced
72:27feeedec790 75:7ac58b2aae6f
    50  Default constructor.
    50  Default constructor.
    51  */
    51  */
    52 CalenNativeView::CalenNativeView(MCalenServices &services) :
    52 CalenNativeView::CalenNativeView(MCalenServices &services) :
    53 	mServices(services),
    53 	mServices(services),
    54 	mEntriesInDataBase(false),
    54 	mEntriesInDataBase(false),
    55 	mIsCapturedScreenShotValid(false)
    55 	mIsCapturedScreenShotValid(false),
       
    56 	mDatePicker(0)
    56 {
    57 {
    57     OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY );
    58     OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY );
    58     
    59     
    59 	setTitle(hbTrId("txt_calendar_title_calendar"));
    60 	setTitle(hbTrId("txt_calendar_title_calendar"));
    60 
    61 
   118     
   119     
   119 	mServices.IssueCommandL(ECalenDeleteAllEntries);
   120 	mServices.IssueCommandL(ECalenDeleteAllEntries);
   120 	mEntriesInDataBase = false;
   121 	mEntriesInDataBase = false;
   121 	
   122 	
   122 	OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEALLENTRIES_EXIT );
   123 	OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEALLENTRIES_EXIT );
       
   124 }
       
   125 
       
   126 /*!
       
   127  Refreshes the already open date picker with proper 
       
   128  date format as per current locale settings.
       
   129  */
       
   130  void CalenNativeView::refreshDatePicker()
       
   131 {
       
   132 	if(!(mDatePicker.isNull())) {
       
   133 		mDatePicker->setDisplayFormat(CalenDateUtils::dateFormatString());
       
   134 		mDatePicker->setDate(QDate::currentDate());
       
   135 	}
   123 }
   136 }
   124 
   137 
   125 /*!
   138 /*!
   126  Slot to handle gotodate
   139  Slot to handle gotodate
   127  */
   140  */
   142 	}
   155 	}
   143 	mDatePicker = new HbDateTimePicker(QDate::currentDate(), popUp);
   156 	mDatePicker = new HbDateTimePicker(QDate::currentDate(), popUp);
   144 	// Set the date range.
   157 	// Set the date range.
   145 	mDatePicker->setMinimumDate(CalenDateUtils::minTime().date());
   158 	mDatePicker->setMinimumDate(CalenDateUtils::minTime().date());
   146 	mDatePicker->setMaximumDate(CalenDateUtils::maxTime().date());
   159 	mDatePicker->setMaximumDate(CalenDateUtils::maxTime().date());
       
   160 	mDatePicker->setDisplayFormat(CalenDateUtils::dateFormatString());
   147 	mDatePicker->setDate(QDate::currentDate());
   161 	mDatePicker->setDate(QDate::currentDate());
   148 	
   162 	
   149 	popUp->setContentWidget(mDatePicker);
   163 	popUp->setContentWidget(mDatePicker);
   150 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
   164 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
   151 	popUp->addAction(okAction);
   165 	popUp->addAction(okAction);
   229 {
   243 {
   230     OstTraceFunctionEntry0( CALENNATIVEVIEW_HANDLENOTIFICATION_ENTRY );
   244     OstTraceFunctionEntry0( CALENNATIVEVIEW_HANDLENOTIFICATION_ENTRY );
   231     
   245     
   232 	switch (notification) {
   246 	switch (notification) {
   233 		case ECalenNotifySystemLocaleChanged: {
   247 		case ECalenNotifySystemLocaleChanged: {
       
   248 			refreshDatePicker();
   234 			onLocaleChanged(EChangesLocale);
   249 			onLocaleChanged(EChangesLocale);
   235 		}
   250 		}
   236 		break;
   251 		break;
   237 		case ECalenNotifySystemTimeChanged: {
   252 		case ECalenNotifySystemTimeChanged: {
   238 			onLocaleChanged(EChangesSystemTime);
   253 			onLocaleChanged(EChangesSystemTime);
   330    if ( !ok )  {
   345    if ( !ok )  {
   331        qFatal("Add failed" ); // Panic is activity is not saved successfully
   346        qFatal("Add failed" ); // Panic is activity is not saved successfully
   332        }
   347        }
   333    OstTraceFunctionExit0( CALENNATIVEVIEW_SAVEACTIVITY_EXIT );
   348    OstTraceFunctionExit0( CALENNATIVEVIEW_SAVEACTIVITY_EXIT );
   334  }
   349  }
       
   350 
       
   351 /*!
       
   352  Function to tell if we can perform swipe effect on the preview pane.
       
   353  This will affect when the next preview pane that is not going to 
       
   354  come has valid date or not
       
   355  */
       
   356 bool CalenNativeView::checkIfWeCanSwipe(QDateTime& date, bool rightGesture)
       
   357 {
       
   358     OstTraceFunctionEntry0( CALENNATIVEVIEW_CHECKIFWECANSWIPE_ENTRY );
       
   359     
       
   360     bool value;
       
   361     // For right gesture, see if previous day is valid or not
       
   362     if (rightGesture) {
       
   363         value = CalenDateUtils::isValidDay(date.addDays(-1));
       
   364     } else { // For left gesture, see if next day is valid or not
       
   365         value = CalenDateUtils::isValidDay(date.addDays(1));
       
   366     }
       
   367     
       
   368     OstTraceFunctionExit0( CALENNATIVEVIEW_CHECKIFWECANSWIPE_EXIT );
       
   369     
       
   370     return value;
       
   371 }
   335 //End Of File
   372 //End Of File