calendarui/caleneditor/src/caleneditorreminderfield.cpp
changeset 70 a5ed90760192
parent 64 1881ad52dc45
child 75 7ac58b2aae6f
equal deleted inserted replaced
64:1881ad52dc45 70:a5ed90760192
   141 	 before, if it is valid or else default the value to 15MinsBefore
   141 	 before, if it is valid or else default the value to 15MinsBefore
   142 	 or AtTheStart whichever is appropriate
   142 	 or AtTheStart whichever is appropriate
   143  */
   143  */
   144 void CalenEditorReminderField::setSavedMeetingReminderIndex()
   144 void CalenEditorReminderField::setSavedMeetingReminderIndex()
   145 {
   145 {
       
   146 	OstTraceFunctionEntry0( CALENEDITORREMINDERFIELD_SETSAVEDMEETINGREMINDERINDEX_ENTRY );
   146 	// Get the reminder offset value.
   147 	// Get the reminder offset value.
   147 	int reminderOffset =
   148 	int reminderOffset =
   148 	mCalenEditor->editedEntry()->alarm().timeOffset();
   149 	mCalenEditor->editedEntry()->alarm().timeOffset();
   149 	// Get the index value for the reminder combo box from the hash 
   150 	// Get the index value for the reminder combo box from the hash 
   150 	// table. 2nd argument is defaultKey if the hash contains no item mapped to value
   151 	// table. 2nd argument is defaultKey if the hash contains no item mapped to value
   155 		setCurrentIndex(index);
   156 		setCurrentIndex(index);
   156 	else if (reminderItemsCount() == (ReminderAtStart + 1)) //+1 because enum starts from 0.
   157 	else if (reminderItemsCount() == (ReminderAtStart + 1)) //+1 because enum starts from 0.
   157 		setCurrentIndex(ReminderAtStart); 
   158 		setCurrentIndex(ReminderAtStart); 
   158 	else
   159 	else
   159 		setCurrentIndex(Reminder15MinsBefore);
   160 		setCurrentIndex(Reminder15MinsBefore);
       
   161 	OstTraceFunctionExit0( CALENEDITORREMINDERFIELD_SETSAVEDMEETINGREMINDERINDEX_EXIT );
   160 }
   162 }
   161 
   163 
   162 /*!
   164 /*!
   163 	 Populates reminder item with available choices to the user
   165 	 Populates reminder item with available choices to the user
   164 	 \param newEntry bool value to indicate if its a new entry
   166 	 \param newEntry bool value to indicate if its a new entry
   409 	 Update the reminder choices when the meeting is on same day, 
   411 	 Update the reminder choices when the meeting is on same day, 
   410 	 based on the time available from current time to start time of the event.
   412 	 based on the time available from current time to start time of the event.
   411  */
   413  */
   412 void CalenEditorReminderField::UpdateReminderChoicesForSameDay(QTime startTime)
   414 void CalenEditorReminderField::UpdateReminderChoicesForSameDay(QTime startTime)
   413 {
   415 {
       
   416 	OstTraceFunctionEntry0( CALENEDITORREMINDERFIELD_UPDATEREMINDERCHOICESFORSAMEDAY_ENTRY );
   414 	QTime currentTime = QTime::currentTime();
   417 	QTime currentTime = QTime::currentTime();
   415 	int offset = currentTime.secsTo(startTime);
   418 	int offset = currentTime.secsTo(startTime);
   416 
   419 
   417 	// Disconnect the slot and connect it back again at end to avoid unnecessary
   420 	// Disconnect the slot and connect it back again at end to avoid unnecessary
   418 	// calls to handleReminderIndexChanged slot. Or else the slot gets called 
   421 	// calls to handleReminderIndexChanged slot. Or else the slot gets called 
   473 	}
   476 	}
   474 	mReminderItem->setEnabled(true);
   477 	mReminderItem->setEnabled(true);
   475 	mEditorForm->addConnection(mReminderItem,
   478 	mEditorForm->addConnection(mReminderItem,
   476 							SIGNAL(currentIndexChanged(int)), this,
   479 							SIGNAL(currentIndexChanged(int)), this,
   477 							SLOT(handleReminderIndexChanged(int)));
   480 							SLOT(handleReminderIndexChanged(int)));
       
   481 	OstTraceFunctionExit0( CALENEDITORREMINDERFIELD_UPDATEREMINDERCHOICESFORSAMEDAY_EXIT );
   478 }
   482 }
   479 
   483 
   480 /*!
   484 /*!
   481 	 Updates the reminder choices for an all day event.
   485 	 Updates the reminder choices for an all day event.
   482 	 \param referenceDate to indicate past or not.
   486 	 \param referenceDate to indicate past or not.
   635 	 Gets the reminder index for all day events based on the alarm
   639 	 Gets the reminder index for all day events based on the alarm
   636 	 which is saved for the entry
   640 	 which is saved for the entry
   637  */
   641  */
   638 int CalenEditorReminderField::getReminderIndexBasedOnEntryAlarm()
   642 int CalenEditorReminderField::getReminderIndexBasedOnEntryAlarm()
   639 {
   643 {
       
   644 	OstTraceFunctionEntry0( CALENEDITORREMINDERFIELD_GETREMINDERINDEXBASEDONENTRYALARM_ENTRY );
   640 	// Get the appropriate reminder index depending on the value of time offset.
   645 	// Get the appropriate reminder index depending on the value of time offset.
   641 	AgendaAlarm actualAlarm = mCalenEditor->editedEntry()->alarm();
   646 	AgendaAlarm actualAlarm = mCalenEditor->editedEntry()->alarm();
   642 	QTime referenceTime(0, 0, 0);
   647 	QTime referenceTime(0, 0, 0);
   643 	int index = ReminderOff;
   648 	int index = ReminderOff;
   644 	int offsetInMins = actualAlarm.timeOffset();
   649 	int offsetInMins = actualAlarm.timeOffset();
   656 		index = ReminderTwoDaysBefore;
   661 		index = ReminderTwoDaysBefore;
   657 		offsetInMins %= (24 * 60);
   662 		offsetInMins %= (24 * 60);
   658 		mReminderTimeForAllDay = referenceTime.addSecs(-(offsetInMins
   663 		mReminderTimeForAllDay = referenceTime.addSecs(-(offsetInMins
   659 				* 60));
   664 				* 60));
   660 	}
   665 	}
       
   666 	OstTraceFunctionExit0( CALENEDITORREMINDERFIELD_GETREMINDERINDEXBASEDONENTRYALARM_EXIT );
   661 	return index;
   667 	return index;
   662 }
   668 }
   663 
   669 
   664 /*!
   670 /*!
   665 	 Insert the reminder time field for an all day event.
   671 	 Insert the reminder time field for an all day event.
   733 void CalenEditorReminderField::launchReminderTimePicker()
   739 void CalenEditorReminderField::launchReminderTimePicker()
   734 {
   740 {
   735 	OstTraceFunctionEntry0( CALENEDITORREMINDERFIELD_LAUNCHREMINDERTIMEPICKER_ENTRY );
   741 	OstTraceFunctionEntry0( CALENEDITORREMINDERFIELD_LAUNCHREMINDERTIMEPICKER_ENTRY );
   736 	
   742 	
   737 	HbDialog *popUp = new HbDialog();
   743 	HbDialog *popUp = new HbDialog();
       
   744 	// Set the parent for the dialog
       
   745 	// Once the parent object is deleted the dialog will also be deleted
       
   746 	popUp->setParent(this);
   738 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   747 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   739 	popUp->setTimeout(HbDialog::NoTimeout);
   748 	popUp->setTimeout(HbDialog::NoTimeout);
   740 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   749 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   741 	popUp->setHeadingWidget( new HbLabel(
   750 	popUp->setHeadingWidget( new HbLabel(
   742 				hbTrId("Reminder Time")));
   751 				hbTrId("Reminder Time")));