calendarui/editors/src/calenunifiededitor.cpp
branchRCL_3
changeset 14 21239b3bcd78
parent 13 1984aceb8774
child 16 55d60436f00b
equal deleted inserted replaced
13:1984aceb8774 14:21239b3bcd78
   581              // Fall through...
   581              // Fall through...
   582              }
   582              }
   583          case ECalenEditSeries:
   583          case ECalenEditSeries:
   584          case ECalenEditOccurrence:
   584          case ECalenEditOccurrence:
   585          case EAknCmdExit:
   585          case EAknCmdExit:
       
   586          case EAknSoftkeyExit:
   586          case EEikBidCancel:
   587          case EEikBidCancel:
   587              {
   588              {
   588              // EEikBidCancel is called when Red End key is pressed or
   589              // EEikBidCancel is called when Red End key is pressed or
   589              // MMC card is taken out or application is killed via Swap Window
   590              // MMC card is taken out or application is killed via Swap Window
   590              // EAknCmdExit is called, when user selects Options->Exit
   591              // EAknCmdExit is called, when user selects Options->Exit
   599             
   600             
   600              if( iServices->EntryViewL(colId) )
   601              if( iServices->EntryViewL(colId) )
   601                  {
   602                  {
   602                  PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
   603                  PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
   603                  }
   604                  }
       
   605              if(EAknSoftkeyExit == aButtonId)
       
   606                  iServices->IssueCommandL(aButtonId);
       
   607              
   604              break;
   608              break;
   605              }
   609              }
   606          case EAknSoftkeyDone:
   610          case EAknSoftkeyDone:
   607              {
   611              {
   608              // Need an entry view before starting to
   612              // Need an entry view before starting to
  1049             break;
  1053             break;
  1050         case ECalenDeleteCurrentEntry:
  1054         case ECalenDeleteCurrentEntry:
  1051             OnCmdDeleteNoteL();
  1055             OnCmdDeleteNoteL();
  1052             break;
  1056             break;
  1053         case EAknCmdExit:
  1057         case EAknCmdExit:
  1054             OnCmdExitL();
  1058         case EAknSoftkeyExit:            
       
  1059             OnCmdExitL(aCommandId);
  1055             break;
  1060             break;
  1056         case EAknCmdHelp:
  1061         case EAknCmdHelp:
  1057             OnCmdHelpL();
  1062             OnCmdHelpL();
  1058             break;
  1063             break;
  1059         case ECalenSend:
  1064         case ECalenSend:
  1418 // CCalenUnifiedEditor::OnCmdExitL
  1423 // CCalenUnifiedEditor::OnCmdExitL
  1419 // Handles exit command.
  1424 // Handles exit command.
  1420 // (other items were commented in a header).
  1425 // (other items were commented in a header).
  1421 // -----------------------------------------------------------------------------
  1426 // -----------------------------------------------------------------------------
  1422 //
  1427 //
  1423 void CCalenUnifiedEditor::OnCmdExitL()
  1428 void CCalenUnifiedEditor::OnCmdExitL(TInt aCmd)
  1424     {
  1429     {
  1425     TRACE_ENTRY_POINT;
  1430     TRACE_ENTRY_POINT;   
  1426 
  1431     
  1427     TryExitL( EAknCmdExit );
  1432             TryExitL( aCmd );
  1428 
  1433        
  1429     TRACE_EXIT_POINT;
  1434     TRACE_EXIT_POINT;
  1430     }
  1435     }
  1431 
  1436 
  1432 // -----------------------------------------------------------------------------
  1437 // -----------------------------------------------------------------------------
  1433 // CCalenUnifiedEditor::TryToDeleteNoteL
  1438 // CCalenUnifiedEditor::TryToDeleteNoteL
  1435 // (other items were commented in a header).
  1440 // (other items were commented in a header).
  1436 // -----------------------------------------------------------------------------
  1441 // -----------------------------------------------------------------------------
  1437 //
  1442 //
  1438 void CCalenUnifiedEditor::TryToDeleteNoteL( TBool /* aIsViaDeleteMenu */ )
  1443 void CCalenUnifiedEditor::TryToDeleteNoteL( TBool /* aIsViaDeleteMenu */ )
  1439     {
  1444     {
  1440     TRACE_ENTRY_POINT;    
  1445     TRACE_ENTRY_POINT;
       
  1446 	
       
  1447 	TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems(); 		   
       
  1448 	 if(Edited().AttachmentCount() || attachmentCount)
       
  1449 		 {
       
  1450 		 iServices->GetAttachmentData()->Reset();
       
  1451 		 }
  1441     if (IsCreatingNewEntry())
  1452     if (IsCreatingNewEntry())
  1442         {
  1453         {
  1443         iEntryUpdater->TryDeleteInstanceWithUiL( EditorDataHandler().Entry() ,
  1454         iEntryUpdater->TryDeleteInstanceWithUiL( EditorDataHandler().Entry() ,
  1444                                         EditorDataHandler().InstanceDateTime() ,
  1455                                         EditorDataHandler().InstanceDateTime() ,
  1445                                         *iServices );
  1456                                         *iServices );
  1917         
  1928         
  1918         if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
  1929         if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
  1919                 endDate == CalenDateUtils::BeginningOfDay( endDate ) )
  1930                 endDate == CalenDateUtils::BeginningOfDay( endDate ) )
  1920             {
  1931             {
  1921             TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
  1932             TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
  1922             if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() == 1 )
  1933             if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() >= 1 )
  1923                 {
  1934                 {
  1924                 Edited().SetEntryType( CCalEntry::EEvent );
  1935                 Edited().SetEntryType( CCalEntry::EEvent );
  1925                 }
  1936                 }
  1926             }
  1937             }
  1927         
  1938