calendarui/controller/src/caleneditui.cpp
changeset 50 579cc610882e
parent 18 c198609911f9
child 51 0b38fc5b94c6
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
    54 // ----------------------------------------------------------------------------
    54 // ----------------------------------------------------------------------------
    55 //
    55 //
    56 CCalenEditUi::~CCalenEditUi()
    56 CCalenEditUi::~CCalenEditUi()
    57     {
    57     {
    58     TRACE_ENTRY_POINT;
    58     TRACE_ENTRY_POINT;
    59 
    59     iController.CancelNotifications(this);
    60     TRACE_EXIT_POINT;
    60     TRACE_EXIT_POINT;
    61     }
    61     }
    62 
    62 
    63 // ----------------------------------------------------------------------------
    63 // ----------------------------------------------------------------------------
    64 // CCalenEditUi::CCalenEditUi
    64 // CCalenEditUi::CCalenEditUi
   100 
   100 
   101     TBool continueCommand(EFalse);
   101     TBool continueCommand(EFalse);
   102     TInt command = aCommand.Command();
   102     TInt command = aCommand.Command();
   103     MCalenContext& context = iController.Services().Context();
   103     MCalenContext& context = iController.Services().Context();
   104     AgendaEntry editedEntry;
   104     AgendaEntry editedEntry;
   105     QDateTime newEntryDateTime = iController.context().focusDateAndTimeL();
   105     QDateTime newEntryDateTime = iController.context().focusDateAndTime();
   106    
   106    
   107     // Check if it is not on same day and set the default time and date accordingly.
   107     // Check if it is not on same day and set the default time and date accordingly.
   108     bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime);
   108     bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime);
   109     if (!isSameDay) {
   109     if (!isSameDay) {
   110     	newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime);
   110     	newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime);
   120         case ECalenEditCurrentEntry:            
   120         case ECalenEditCurrentEntry:            
   121             editedEntry = iController.Services().agendaInterface()->fetchById(
   121             editedEntry = iController.Services().agendaInterface()->fetchById(
   122                                     context.instanceId().mEntryLocalUid );
   122                                     context.instanceId().mEntryLocalUid );
   123             // For repeating entry, we need to update proper start time here
   123             // For repeating entry, we need to update proper start time here
   124             // from the context
   124             // from the context
   125             if (editedEntry.isRepeating()) {
   125             if(!editedEntry.isNull()) {
   126             	// Get the instancde time frm the context
   126             	if (editedEntry.isRepeating()) {
   127             	QDateTime instanceTime = context.focusDateAndTimeL();
   127             		// Get the instancde time frm the context
   128             	editedEntry.setStartAndEndTime(instanceTime, editedEntry.endTime());
   128             		QDateTime instanceTime = context.focusDateAndTime();
       
   129             		editedEntry.setStartAndEndTime(instanceTime, editedEntry.endTime());
       
   130             	}
       
   131             	iEditor= new CalenEditor(iController.Services().agendaInterface());
       
   132             	iEditor->edit(editedEntry, false);
       
   133             	connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved()));
       
   134             	connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed()));
   129             }
   135             }
   130 			iEditor= new CalenEditor(iController.Services().agendaInterface());
       
   131 			iEditor->edit(editedEntry, false);
       
   132 		    connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved()));
       
   133 		    connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed()));
       
   134             break;
   136             break;
   135         default:
   137         default:
   136             // Controller decided this class was the place to handle this
   138             // Controller decided this class was the place to handle this
   137             // command
   139             // command
   138             break;
   140             break;