calendarui/controller/src/calenattachmentui.cpp
branchRCL_3
changeset 5 42814f902fe6
parent 0 f979ecb2b13e
child 12 38571fd2a704
equal deleted inserted replaced
0:f979ecb2b13e 5:42814f902fe6
   106     notificationArray.Append(ECalenNotifyEntryDeleted);
   106     notificationArray.Append(ECalenNotifyEntryDeleted);
   107     notificationArray.Append(ECalenNotifyEntryClosed);
   107     notificationArray.Append(ECalenNotifyEntryClosed);
   108     notificationArray.Append(ECalenNotifyInstanceDeleted);
   108     notificationArray.Append(ECalenNotifyInstanceDeleted);
   109     notificationArray.Append(ECalenNotifyMarkedEntryDeleted);
   109     notificationArray.Append(ECalenNotifyMarkedEntryDeleted);
   110     notificationArray.Append(ECalenNotifyMultipleEntriesDeleted);
   110     notificationArray.Append(ECalenNotifyMultipleEntriesDeleted);
   111     notificationArray.Append(ECalenNotifyDialogClosed);
   111     //notificationArray.Append(ECalenNotifyDialogClosed);
   112     notificationArray.Append(ECalenNotifyAttachmentViewerClosed);
   112     notificationArray.Append(ECalenNotifyAttachmentViewerClosed);
   113     iController.RegisterForNotificationsL( this, notificationArray );
   113     iController.RegisterForNotificationsL( this, notificationArray );
   114     notificationArray.Reset();
   114     notificationArray.Reset();
   115     
   115     
   116     iAttachmentModel = &iController.AttachmentData();
   116     iAttachmentModel = &iController.AttachmentData();
   159             
   159             
   160             if(!iAddAttachmentFromViewer && (attachmentInfoList.Count()))
   160             if(!iAddAttachmentFromViewer && (attachmentInfoList.Count()))
   161                 {                                
   161                 {                                
   162                 iAttachmentModel->Reset();
   162                 iAttachmentModel->Reset();
   163                 iController.BroadcastNotification(ECalenNotifyAttachmentRemoved);
   163                 iController.BroadcastNotification(ECalenNotifyAttachmentRemoved);
       
   164                 RemoveTemporaryFiles();
   164                 }                    
   165                 }                    
   165             else
   166             else
   166                 {
   167                 {
   167                 iAttachmentModel->DeleteAttachment(0);
   168                 iAttachmentModel->DeleteAttachment(0);
   168                 }
   169                 }
   169             RemoveTemporaryFiles();
       
   170             attachmentInfoList.Close(); 
   170             attachmentInfoList.Close(); 
   171             }
   171             }
   172             break;
   172             break;
   173         default:
   173         default:
   174             break;
   174             break;
   229             }
   229             }
   230             break;            
   230             break;            
   231         case ECalenNotifyEntryClosed:
   231         case ECalenNotifyEntryClosed:
   232         case ECalenNotifyMarkedEntryDeleted:
   232         case ECalenNotifyMarkedEntryDeleted:
   233         case ECalenNotifyMultipleEntriesDeleted:
   233         case ECalenNotifyMultipleEntriesDeleted:
   234         case ECalenNotifyDialogClosed:
   234         //case ECalenNotifyDialogClosed:
   235             {
   235             {
   236             if(!(iAddAttachmentFromViewer) && !(iAttachmentAlreadyExists))
   236             if(!(iAddAttachmentFromViewer) && !(iAttachmentAlreadyExists))
   237                 {
   237                 {
   238                 iAttachmentModel->Reset();
   238                 iAttachmentModel->Reset();
   239                 }    
   239                 }    
   243             break;
   243             break;
   244         case ECalenNotifyAttachmentViewerClosed:
   244         case ECalenNotifyAttachmentViewerClosed:
   245             {
   245             {
   246             if(iAddAttachmentFromViewer)
   246             if(iAddAttachmentFromViewer)
   247                 {
   247                 {
   248                 // add attachments to the entry being viewed in event viewer
   248                 
   249                 AddAttachmentsToEntryL();
       
   250                 
   249                 
   251                 // Do not reset the model if the attachment list has been opened from the editor.
   250                 // Do not reset the model if the attachment list has been opened from the editor.
   252                 if(!iController.IsEditorActive())
   251                 if(!iController.IsEditorActive())
   253                     {
   252                     {
       
   253                     // add attachments to the entry being viewed in event viewer
       
   254                     AddAttachmentsToEntryL();
   254                     // clear calendar editor's folder
   255                     // clear calendar editor's folder
   255                     RemoveTemporaryFiles();
   256                     RemoveTemporaryFiles();
   256                     
   257                     
   257                     iAttachmentModel->Reset();
   258                     iAttachmentModel->Reset();
   258                     }
   259                     }
   691                     }
   692                     }
   692                 }
   693                 }
   693                         
   694                         
   694             attachmentInfoList.Close();
   695             attachmentInfoList.Close();
   695             
   696             
   696             // If user is adding it from editors, then dont save it now as there is a chance that user discards these
   697             if(!iController.IsEditorActive())
   697             // changes. If user saves it, then editors will save these newly added attachments.
       
   698             if(iController.IsEditorActive())
       
   699                 {
   698                 {
   700                     CCalEntryView* entryView = iController.Services().EntryViewL(context.InstanceId().iColId);
   699                     CCalEntryView* entryView = iController.Services().EntryViewL(context.InstanceId().iColId);
   701                     CCalenInterimUtils2::StoreL( *entryView, *entry, ETrue );
   700                     CCalenInterimUtils2::StoreL( *entryView, *entry, ETrue );
   702                 }
   701                 }
   703             }
   702             }