calendarui/editors/src/calenunifiededitor.cpp
branchRCL_3
changeset 27 55d60436f00b
parent 20 21239b3bcd78
child 30 d68a4b5d5885
equal deleted inserted replaced
21:9711e452b5e9 27:55d60436f00b
   286 
   286 
   287     iUnifiedEditorControl = CCalenUnifiedEditorControl::NewL( *this,*iServices );
   287     iUnifiedEditorControl = CCalenUnifiedEditorControl::NewL( *this,*iServices );
   288     
   288     
   289     isReplaceLocation = EFalse;
   289     isReplaceLocation = EFalse;
   290     
   290     
   291    
   291     iCheck = EFalse;
   292     TCallBack callback(CCalenUnifiedEditor::AsyncProcessCommandL,this);
   292     TCallBack callback(CCalenUnifiedEditor::AsyncProcessCommandL,this);
   293     iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
   293     iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
   294     
   294     
   295     
   295     
   296     iIdle = CIdle::NewL( CActive::EPriorityUserInput );
   296     iIdle = CIdle::NewL( CActive::EPriorityUserInput );
   599              // Will exit and lose some data if entry was really edited.
   599              // Will exit and lose some data if entry was really edited.
   600             
   600             
   601              if( iServices->EntryViewL(colId) )
   601              if( iServices->EntryViewL(colId) )
   602                  {
   602                  {
   603                  PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
   603                  PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
       
   604                  iCheck = EFalse;
   604                  }
   605                  }
   605              if(EAknSoftkeyExit == aButtonId)
   606              if(EAknSoftkeyExit == aButtonId)
   606                  iServices->IssueCommandL(aButtonId);
   607                  iServices->IssueCommandL(aButtonId);
   607              
   608              
   608              break;
   609              break;
  1469 // CCalenUnifiedEditor::TryInsertSendMenuL
  1470 // CCalenUnifiedEditor::TryInsertSendMenuL
  1470 // Inserts the send menu, if needed.
  1471 // Inserts the send menu, if needed.
  1471 // (other items were commented in a header).
  1472 // (other items were commented in a header).
  1472 // -----------------------------------------------------------------------------
  1473 // -----------------------------------------------------------------------------
  1473 //
  1474 //
  1474 void CCalenUnifiedEditor::TryInsertSendMenuL( TInt aResourceId, CEikMenuPane* aMenuPane )
  1475 void CCalenUnifiedEditor::TryInsertSendMenuL( TInt /*aResourceId*/, CEikMenuPane* aMenuPane )
  1475     {
  1476     {
  1476     TRACE_ENTRY_POINT;
  1477     TRACE_ENTRY_POINT;
  1477 
  1478 
  1478     // Only insert if there is some summary (or location)
  1479     // Only insert if there is some summary (or location)
  1479     // Changes done to remove Lunar calendar item from options menu
  1480     // Changes done to remove Lunar calendar item from options menu
  1923     if ( status == EEntryOk )
  1924     if ( status == EEntryOk )
  1924         {
  1925         {
  1925         
  1926         
  1926         TTime startDate = Edited().StartDateTime();
  1927         TTime startDate = Edited().StartDateTime();
  1927         TTime endDate = Edited().EndDateTime();
  1928         TTime endDate = Edited().EndDateTime();
       
  1929         TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
  1928         
  1930         
  1929         if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
  1931         if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
  1930                 endDate == CalenDateUtils::BeginningOfDay( endDate ) )
  1932                 endDate == CalenDateUtils::BeginningOfDay( endDate ) )
  1931             {
  1933             {
  1932             TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
       
  1933             if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() >= 1 )
  1934             if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() >= 1 )
  1934                 {
  1935                 {
  1935                 Edited().SetEntryType( CCalEntry::EEvent );
  1936                 Edited().SetEntryType( CCalEntry::EEvent );
  1936                 }
  1937                 }
       
  1938             }
       
  1939         if(differenceInTime.Int() == 0 && (CCalEntry::EAppt == Edited().EntryType() || CCalEntry::EEvent == Edited().EntryType()))
       
  1940             {
       
  1941             Edited().SetEntryType( CCalEntry::EAppt ); //changed
  1937             }
  1942             }
  1938         
  1943         
  1939         switch ( EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL() ) 
  1944         switch ( EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL() ) 
  1940             {
  1945             {
  1941             case CCalenEditorDataHandler::EActionSave:
  1946             case CCalenEditorDataHandler::EActionSave:
  2243 // -----------------------------------------------------------------------------
  2248 // -----------------------------------------------------------------------------
  2244 //
  2249 //
  2245 void CCalenUnifiedEditor::TryToSaveNoteOnForcedExitL()
  2250 void CCalenUnifiedEditor::TryToSaveNoteOnForcedExitL()
  2246     {
  2251     {
  2247     TRACE_ENTRY_POINT;
  2252     TRACE_ENTRY_POINT;
  2248     
  2253     iCheck = ETrue;
  2249     if( EntryStillExistsL() == EEntryOk )
  2254     if( EntryStillExistsL() == EEntryOk )
  2250         {
  2255         {
  2251         if( CheckSpaceBelowCriticalLevelL() )
  2256         if( CheckSpaceBelowCriticalLevelL() )
  2252             {
  2257             {
  2253             TRACE_EXIT_POINT;
  2258             TRACE_EXIT_POINT;
  3000     TRACE_ENTRY_POINT;
  3005     TRACE_ENTRY_POINT;
  3001     TInt attachmentCount = Edited().AttachmentCount();
  3006     TInt attachmentCount = Edited().AttachmentCount();
  3002     if( attachmentCount )
  3007     if( attachmentCount )
  3003         {
  3008         {
  3004         RPointerArray<HBufC> attachmentNames;
  3009         RPointerArray<HBufC> attachmentNames;
       
  3010         CleanupResetAndDestroyPushL(attachmentNames);
  3005         GetAttachmentNamesL(attachmentNames);
  3011         GetAttachmentNamesL(attachmentNames);
  3006         attachmentCount = attachmentNames.Count();            
  3012         attachmentCount = attachmentNames.Count();            
  3007         TInt attachmentLength(0);        
  3013         TInt attachmentLength(0);        
  3008         for( TInt index =0; index<attachmentCount; index++ )
  3014         for( TInt index =0; index<attachmentCount; index++ )
  3009             {
  3015             {
  3024         SetUnderLineForAttachmentL( EUnderlineOn );
  3030         SetUnderLineForAttachmentL( EUnderlineOn );
  3025         SetEdwinTextL( ECalenEditorAttachment, attachmentNamesString );
  3031         SetEdwinTextL( ECalenEditorAttachment, attachmentNamesString );
  3026         
  3032         
  3027         // Cleanup
  3033         // Cleanup
  3028         delete attachmentNamesString;
  3034         delete attachmentNamesString;
  3029         attachmentNames.ResetAndDestroy();
  3035         CleanupStack::PopAndDestroy(&attachmentNames);
  3030         }
  3036         }
  3031     
  3037     
  3032     TRACE_EXIT_POINT;
  3038     TRACE_EXIT_POINT;
  3033     }
  3039     }
  3034 
  3040