107 |
107 |
108 TBool continueCommand(EFalse); |
108 TBool continueCommand(EFalse); |
109 TInt command = aCommand.Command(); |
109 TInt command = aCommand.Command(); |
110 MCalenContext& context = iController.Services().Context(); |
110 MCalenContext& context = iController.Services().Context(); |
111 AgendaEntry editedEntry; |
111 AgendaEntry editedEntry; |
112 QDateTime newEntryDateTime = iController.context().focusDateAndTime(); |
112 |
113 |
113 QDateTime newEntryDateTime = iController.context().startDateAndTimeForNewInstance(); |
114 // Check if it is not on same day and set the default time and date accordingly. |
114 if (newEntryDateTime.isValid()) { |
115 bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime); |
115 // Use start date and time from context, reset it before next usage |
116 if (!isSameDay) { |
116 iController.context().setStartDateAndTimeForNewInstance(QDateTime()); |
117 newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime); |
117 } else { |
|
118 // Use focused date and time from context |
|
119 newEntryDateTime = iController.context().focusDateAndTime(); |
|
120 // Check if it is not on same day and set the default time and date accordingly. |
|
121 bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime); |
|
122 if (!isSameDay) { |
|
123 newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime); |
|
124 } |
118 } |
125 } |
119 switch ( command ) |
126 switch ( command ) |
120 { |
127 { |
121 case ECalenNewMeeting: |
128 case ECalenNewMeeting: |
122 iEditor= new CalenEditor(iController.Services().agendaInterface()); |
129 iEditor= new CalenEditor(iController.Services().agendaInterface()); |
123 iEditor->create(newEntryDateTime, false, CalenEditor::TypeAppointment ); |
130 iEditor->create(newEntryDateTime, false, CalenEditor::TypeAppointment ); |
124 connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); |
131 connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); |
125 connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); |
132 connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); |
|
133 connect(iEditor, SIGNAL(forcedExit()), this, SLOT(handleForcedExit())); |
126 break; |
134 break; |
127 case ECalenEditCurrentEntry: |
135 case ECalenEditCurrentEntry: |
128 editedEntry = iController.Services().agendaInterface()->fetchById( |
136 editedEntry = iController.Services().agendaInterface()->fetchById( |
129 context.instanceId().mEntryLocalUid ); |
137 context.instanceId().mEntryLocalUid ); |
130 // For repeating entry, we need to update proper start time here |
138 // For repeating entry, we need to update proper start time here |
137 } |
145 } |
138 iEditor= new CalenEditor(iController.Services().agendaInterface()); |
146 iEditor= new CalenEditor(iController.Services().agendaInterface()); |
139 iEditor->edit(editedEntry, false); |
147 iEditor->edit(editedEntry, false); |
140 connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); |
148 connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); |
141 connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); |
149 connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); |
|
150 connect(iEditor, SIGNAL(forcedExit()), this, SLOT(handleForcedExit())); |
142 } |
151 } |
143 break; |
152 break; |
144 default: |
153 default: |
145 // Controller decided this class was the place to handle this |
154 // Controller decided this class was the place to handle this |
146 // command |
155 // command |
201 // save the entry from editor |
210 // save the entry from editor |
202 // ---------------------------------------------------------------------------- |
211 // ---------------------------------------------------------------------------- |
203 // |
212 // |
204 void CCalenEditUi::saveAndCloseEditor() |
213 void CCalenEditUi::saveAndCloseEditor() |
205 { |
214 { |
|
215 OstTraceFunctionEntry0( CCALENEDITUI_SAVEANDCLOSEEDITOR_ENTRY ); |
206 iEditor->saveAndCloseEditor(); |
216 iEditor->saveAndCloseEditor(); |
|
217 OstTraceFunctionExit0( CCALENEDITUI_SAVEANDCLOSEEDITOR_EXIT ); |
|
218 } |
|
219 |
|
220 // ---------------------------------------------------------------------------- |
|
221 // CCalenEditUi::handleForcedExit |
|
222 // notification for forced exit |
|
223 // ---------------------------------------------------------------------------- |
|
224 // |
|
225 void CCalenEditUi::handleForcedExit() |
|
226 { |
|
227 OstTraceFunctionEntry0( CCALENEDITUI_HANDLEFORCEDEXIT_ENTRY ); |
|
228 iController.Services().IssueNotificationL(ECalenNotifyForcedExit); |
|
229 OstTraceFunctionExit0( CCALENEDITUI_HANDLEFORCEDEXIT_EXIT); |
207 } |
230 } |
208 // End of file |
231 // End of file |