calendarui/caleneditor/src/caleneditorrepeatfield.cpp
changeset 64 1881ad52dc45
parent 63 a3cb48f6c889
child 70 a5ed90760192
equal deleted inserted replaced
63:a3cb48f6c889 64:1881ad52dc45
    30 #include <agendautil.h>
    30 #include <agendautil.h>
    31 
    31 
    32 // User Included
    32 // User Included
    33 #include "caleneditorrepeatfield.h"
    33 #include "caleneditorrepeatfield.h"
    34 #include "caleneditorcustomitem.h"
    34 #include "caleneditorcustomitem.h"
       
    35 #include "caleneditorreminderfield.h"
    35 #include "calendateutils.h"
    36 #include "calendateutils.h"
    36 #include "OstTraceDefinitions.h"
    37 #include "OstTraceDefinitions.h"
    37 #ifdef OST_TRACE_COMPILER_IN_USE
    38 #ifdef OST_TRACE_COMPILER_IN_USE
    38 #include "caleneditorrepeatfieldTraces.h"
    39 #include "caleneditorrepeatfieldTraces.h"
    39 #endif
    40 #endif
   398 	}
   399 	}
   399 	// Depending on repeatPropertyChange value and the repeatuntil date change 
   400 	// Depending on repeatPropertyChange value and the repeatuntil date change 
   400 	// the reminder choices are updated 
   401 	// the reminder choices are updated 
   401 	if(repeatPropertyChange || repeatUntilDate != mRepeatUntilDate) {
   402 	if(repeatPropertyChange || repeatUntilDate != mRepeatUntilDate) {
   402 		mCalenEditor->updateReminderChoices();
   403 		mCalenEditor->updateReminderChoices();
       
   404 		// Once the entry is changed from  non repeating to repeating 
       
   405 		// and if the alarm set is off 
       
   406 		// Then change the reminder option to the default 'one day before' 
       
   407 		// if the option is valid
       
   408 		if (mCalenEditor->isAllDayEvent() && 
       
   409 					repeatPropertyChange && mRepeatUntilItemAdded) {
       
   410 			if(!mCalenEditor->isReminderTimeForAllDayAdded() &&
       
   411 					mCalenEditor->getReminderCount() >= 3) {
       
   412 				mCalenEditor->setCurrentIndexOfReminderField(
       
   413 							CalenEditorReminderField::ReminderOneDayBefore);
       
   414 			}
       
   415 		}
   403 	}
   416 	}
   404 	OstTraceFunctionExit0( CALENEDITORREPEATFIELD_HANDLEREPEATINDEXCHANGED_EXIT );
   417 	OstTraceFunctionExit0( CALENEDITORREPEATFIELD_HANDLEREPEATINDEXCHANGED_EXIT );
   405 }
   418 }
   406 
   419 
   407 /*!
   420 /*!
   521 	Sets the repeat until date on the repeat until item
   534 	Sets the repeat until date on the repeat until item
   522  */
   535  */
   523 void CalenEditorRepeatField::setRepeatUntilDate()
   536 void CalenEditorRepeatField::setRepeatUntilDate()
   524 {
   537 {
   525 	OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_ENTRY );
   538 	OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_ENTRY );
       
   539 	//Get the previous date which was set
       
   540 	QDate previousDate = mRepeatUntilDate;
   526 	mRepeatUntilDate = mDatePicker->date();
   541 	mRepeatUntilDate = mDatePicker->date();
   527 	if (mRepeatUntilDate.isValid()) {
   542 	if (mRepeatUntilDate.isValid()) {
   528 		HbExtendedLocale locale = HbExtendedLocale::system();
   543 		HbExtendedLocale locale = HbExtendedLocale::system();
   529 		QString dateString = locale.format(mRepeatUntilDate,
   544 		QString dateString = locale.format(mRepeatUntilDate,
   530 									r_qtn_date_usual_with_zero);
   545 									r_qtn_date_usual_with_zero);
   531 		mCustomRepeatUntilItem->setContentWidgetData("text", dateString);
   546 		mCustomRepeatUntilItem->setContentWidgetData("text", dateString);
   532 	}
   547 	}
   533 	mCalenEditor->updateReminderChoices();
   548 	mCalenEditor->updateReminderChoices();
       
   549 	// If the entry's  repeatuntil date is changed from past to a future date
       
   550 	// And if the alarm set set is off 
       
   551 	// Then change the reminder option to the default 'one day before' 
       
   552 	// if the option is valid
       
   553 	if (mCalenEditor->isAllDayEvent() && previousDate <= QDate::currentDate()) {
       
   554 		if(mRepeatUntilDate > QDate::currentDate() && 
       
   555 							!mCalenEditor->isReminderTimeForAllDayAdded() &&
       
   556 							 mCalenEditor->getReminderCount() >= 3) {
       
   557 			mCalenEditor->setCurrentIndexOfReminderField(
       
   558 							CalenEditorReminderField::ReminderOneDayBefore);
       
   559 		}
       
   560 	}
   534 	OstTraceFunctionExit0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_EXIT );
   561 	OstTraceFunctionExit0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_EXIT );
   535 }
   562 }
   536 
   563 
   537 /*!
   564 /*!
   538 	Returns the repeatuntildate displayed.
   565 	Returns the repeatuntildate displayed.