meetingrequest/mrentry/src/cesmrmeetingrequestentry.cpp
branchRCL_3
changeset 19 b13141f05c3d
parent 16 4ce476e64c59
equal deleted inserted replaced
17:8592a65ad3fb 19:b13141f05c3d
    27 #include "cesmralarminfohandler.h"
    27 #include "cesmralarminfohandler.h"
    28 #include "cesmrrecurrenceinfohandler.h"
    28 #include "cesmrrecurrenceinfohandler.h"
    29 #include "mmrinfoobject.h"
    29 #include "mmrinfoobject.h"
    30 #include "mmrattendee.h"
    30 #include "mmrattendee.h"
    31 
    31 
    32 #include "CFSMailMessage.h"
    32 #include "cfsmailmessage.h"
    33 
    33 
    34 #include "esmrconfig.hrh"
    34 #include "esmrconfig.hrh"
    35 #include "cesmrfeaturesettings.h"
    35 #include "cesmrfeaturesettings.h"
    36 
    36 
    37 #include "emailtrace.h"
    37 #include "emailtrace.h"
    40 #include <calentry.h>
    40 #include <calentry.h>
    41 #include <calinstance.h>
    41 #include <calinstance.h>
    42 #include <calinstanceview.h>
    42 #include <calinstanceview.h>
    43 #include <caluser.h>
    43 #include <caluser.h>
    44 #include <calattachment.h>
    44 #include <calattachment.h>
    45 #include <caleninterimutils2.h>
    45 #include <CalenInterimUtils2.h>
    46 #include <cmrmailboxutils.h>
    46 #include <cmrmailboxutils.h>
    47 #include <calrrule.h>
    47 #include <calrrule.h>
    48 #include <centralrepository.h>
    48 #include <centralrepository.h>
    49 #include <calalarm.h>
    49 #include <calalarm.h>
    50 #include <calendarinternalcrkeys.h>
    50 #include <CalendarInternalCRKeys.h>
    51 #include <data_caging_path_literals.hrh>
    51 #include <data_caging_path_literals.hrh>
    52 #include <coemain.h>
    52 #include <coemain.h>
    53 #include <calentryview.h>
    53 #include <calentryview.h>
    54 #include <ct/rcpointerarray.h>
    54 #include <ct/rcpointerarray.h>
    55 #include <apmstd.h>
    55 #include <apmstd.h>
   239     iOrginalEntry->SetDescriptionL( *newDescription );
   239     iOrginalEntry->SetDescriptionL( *newDescription );
   240 
   240 
   241     CleanupStack::PopAndDestroy( newDescription );
   241     CleanupStack::PopAndDestroy( newDescription );
   242 
   242 
   243     __ASSERT_DEBUG( iEntry->PhoneOwnerL(), Panic( EESMRPhoneOwnerNotSet) );
   243     __ASSERT_DEBUG( iEntry->PhoneOwnerL(), Panic( EESMRPhoneOwnerNotSet) );
   244     
   244 
   245     CESMRFeatureSettings* settings = CESMRFeatureSettings::NewL();
   245     CESMRFeatureSettings* settings = CESMRFeatureSettings::NewL();
   246     if ( settings->FeatureSupported(
   246     if ( settings->FeatureSupported(
   247             CESMRFeatureSettings::EMRUIMeetingRequestViewerCmailOnly ) )
   247             CESMRFeatureSettings::EMRUIMeetingRequestViewerCmailOnly ) )
   248         {
   248         {
   249         // Meeting request viewer available only from email.
   249         // Meeting request viewer available only from email.
   250         // Remove attachments from entry.  
   250         // Remove attachments from entry.
   251         iRemoveAttachments = ETrue;
   251         iRemoveAttachments = ETrue;
   252         }
   252         }
   253     delete settings;
   253     delete settings;
       
   254 
       
   255     if ( CurrentPluginL() == EESMRActiveSync )
       
   256         {
       
   257         // Set correct calendar database
       
   258         SetDefaultDatabaseL();
       
   259         }
   254     }
   260     }
   255 
   261 
   256 // ---------------------------------------------------------------------------
   262 // ---------------------------------------------------------------------------
   257 // CESMRMeetingRequestEntry::ReplaceCharactersFromBufferL
   263 // CESMRMeetingRequestEntry::ReplaceCharactersFromBufferL
   258 // ---------------------------------------------------------------------------
   264 // ---------------------------------------------------------------------------
   381     FUNC_LOG;
   387     FUNC_LOG;
   382 
   388 
   383     __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) );
   389     __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) );
   384 
   390 
   385     TBool canSetRecurrence( ETrue );
   391     TBool canSetRecurrence( ETrue );
   386     
   392 
   387     if ( iEntry->EntryTypeL() == CCalEntry::EAppt &&
   393     if ( iEntry->EntryTypeL() == CCalEntry::EAppt &&
   388             ESMREntryHelper::IsRepeatingMeetingL(*iEntry) &&
   394             ESMREntryHelper::IsRepeatingMeetingL(*iEntry) &&
   389         (!ESMREntryHelper::IsModifyingEntryL(*iEntry) &&
   395         (!ESMREntryHelper::IsModifyingEntryL(*iEntry) &&
   390           MESMRCalEntry::EESMRThisOnly == iRecurrenceModRule ))
   396           MESMRCalEntry::EESMRThisOnly == iRecurrenceModRule ))
   391         {
   397         {
   638                 iEntry->SetSequenceNumberL( seqNo );
   644                 iEntry->SetSequenceNumberL( seqNo );
   639                 iOrginalEntry->SetSequenceNumberL( seqNo );
   645                 iOrginalEntry->SetSequenceNumberL( seqNo );
   640                 }
   646                 }
   641             }
   647             }
   642         }
   648         }
   643     else if ( ERecurrenceNot != orginalRecurrence && 
   649     else if ( ERecurrenceNot != orginalRecurrence &&
   644     		aTypeChanging && !modifyingEntry )
   650     		aTypeChanging && !modifyingEntry )
   645     	{
   651     	{
   646 		// if entry( in the memory) is a recurrent event 
   652 		// if entry( in the memory) is a recurrent event
   647 		// ,and if entry type is changing, and not in modifying status then EESMRAllInSeries
   653 		// ,and if entry type is changing, and not in modifying status then EESMRAllInSeries
   648 		iRecurrenceModRule = EESMRAllInSeries ;
   654 		iRecurrenceModRule = EESMRAllInSeries ;
   649 		return;
   655 		return;
   650     	}
   656     	}
   651     
   657 
   652     iRecurrenceModRule = aRule;
   658     iRecurrenceModRule = aRule;
   653 
   659 
   654     }
   660     }
   655 
   661 
   656 // ---------------------------------------------------------------------------
   662 // ---------------------------------------------------------------------------
   870 // ---------------------------------------------------------------------------
   876 // ---------------------------------------------------------------------------
   871 //
   877 //
   872 TBool CESMRMeetingRequestEntry::IsEntryTypeChangedL() const
   878 TBool CESMRMeetingRequestEntry::IsEntryTypeChangedL() const
   873     {
   879     {
   874     FUNC_LOG;
   880     FUNC_LOG;
   875     
   881 
   876     return iTypeChanged;
   882     return iTypeChanged;
   877     }
   883     }
   878 
   884 
   879 // ---------------------------------------------------------------------------
   885 // ---------------------------------------------------------------------------
   880 // CESMRMeetingRequestEntry::GetAlarmL
   886 // CESMRMeetingRequestEntry::GetAlarmL
  1459 
  1465 
  1460     TTime currentTimeUtc;
  1466     TTime currentTimeUtc;
  1461     currentTimeUtc.UniversalTime();
  1467     currentTimeUtc.UniversalTime();
  1462 
  1468 
  1463     TTime startTimeUtc = iEntry->StartTimeL().TimeUtcL();
  1469     TTime startTimeUtc = iEntry->StartTimeL().TimeUtcL();
  1464 
  1470     
       
  1471     if( IsRecurrentEventL() &&
       
  1472     		IsOpenedFromMail() &&
       
  1473     		EESMRAllInSeries == iRecurrenceModRule )
       
  1474     	{
       
  1475 		// Get recurrence
       
  1476 		TESMRRecurrenceValue recValue( ERecurrenceNot ); 
       
  1477 		GetRecurrenceL( recValue, startTimeUtc );
       
  1478     	}
  1465 
  1479 
  1466     return (startTimeUtc < currentTimeUtc);
  1480     return (startTimeUtc < currentTimeUtc);
  1467     }
  1481     }
  1468 
  1482 
  1469 // ---------------------------------------------------------------------------
  1483 // ---------------------------------------------------------------------------
  1663 
  1677 
  1664     if ( iRemoveAttachments )
  1678     if ( iRemoveAttachments )
  1665         {
  1679         {
  1666         // Remove attachments from the entry
  1680         // Remove attachments from the entry
  1667         TInt count( entry->AttachmentCountL() );
  1681         TInt count( entry->AttachmentCountL() );
  1668         
  1682 
  1669         for ( TInt i = 0; i < count; ++i )
  1683         for ( TInt i = 0; i < count; ++i )
  1670             {
  1684             {
  1671             CCalAttachment* attachment = entry->AttachmentL( i );
  1685             CCalAttachment* attachment = entry->AttachmentL( i );
  1672             entry->DeleteAttachmentL( *attachment );
  1686             entry->DeleteAttachmentL( *attachment );
  1673             }
  1687             }
  1815         retValue = ETrue;
  1829         retValue = ETrue;
  1816 
  1830 
  1817         aStartupParams.iCalEntry       = iESMRInputParams->iCalEntry;
  1831         aStartupParams.iCalEntry       = iESMRInputParams->iCalEntry;
  1818         aStartupParams.iMRInfoObject   = iESMRInputParams->iMRInfoObject;
  1832         aStartupParams.iMRInfoObject   = iESMRInputParams->iMRInfoObject;
  1819         aStartupParams.iMailMessage    = iESMRInputParams->iMailMessage;
  1833         aStartupParams.iMailMessage    = iESMRInputParams->iMailMessage;
  1820         aStartupParams.iMailClient     = iESMRInputParams->iMailClient;        
  1834         aStartupParams.iMailClient     = iESMRInputParams->iMailClient;
  1821         aStartupParams.iSpare          = iESMRInputParams->iSpare;
  1835         aStartupParams.iSpare          = iESMRInputParams->iSpare;
  1822         }
  1836         }
  1823     return retValue;
  1837     return retValue;
  1824     }
  1838     }
  1825 
  1839 
  2156         CESMRConflictChecker::NewL( iCalDb );
  2170         CESMRConflictChecker::NewL( iCalDb );
  2157     CleanupStack::PushL( conflictCheckker );
  2171     CleanupStack::PushL( conflictCheckker );
  2158 
  2172 
  2159     CCalInstance* instance = InstanceL();
  2173     CCalInstance* instance = InstanceL();
  2160     CleanupStack::PushL( instance );
  2174     CleanupStack::PushL( instance );
  2161     
  2175 
  2162     TCalCollectionId colId = instance->InstanceIdL().iCollectionId;
  2176     TCalCollectionId colId = instance->InstanceIdL().iCollectionId;
  2163     CleanupStack::PopAndDestroy( instance );
  2177     CleanupStack::PopAndDestroy( instance );
  2164     
  2178 
  2165     conflictCheckker->FindInstancesForEntryL( aStart,
  2179     conflictCheckker->FindInstancesForEntryL( aStart,
  2166                                               aEnd,
  2180                                               aEnd,
  2167                                               *iEntry,
  2181                                               *iEntry,
  2168                                               colId, 
  2182                                               colId,
  2169                                               entries );
  2183                                               entries );
  2170 
  2184 
  2171     if ( entries.Count() )
  2185     if ( entries.Count() )
  2172         {
  2186         {
  2173         retValue = ETrue;
  2187         retValue = ETrue;
  2243 
  2257 
  2244 // ---------------------------------------------------------------------------
  2258 // ---------------------------------------------------------------------------
  2245 // CESMRMeetingRequestEntry::SupportsCapabilityL
  2259 // CESMRMeetingRequestEntry::SupportsCapabilityL
  2246 // ---------------------------------------------------------------------------
  2260 // ---------------------------------------------------------------------------
  2247 //
  2261 //
  2248 TBool CESMRMeetingRequestEntry::SupportsCapabilityL( 
  2262 TBool CESMRMeetingRequestEntry::SupportsCapabilityL(
  2249         MESMRCalEntry::TMREntryCapability aCapability ) const
  2263         MESMRCalEntry::TMREntryCapability aCapability ) const
  2250     {
  2264     {
  2251     TBool retValue( EFalse );
  2265     TBool retValue( EFalse );
  2252     
  2266 
  2253     switch( aCapability )
  2267     switch( aCapability )
  2254         {
  2268         {
  2255         case MESMRCalEntry::EMRCapabilityAttachments:
  2269         case MESMRCalEntry::EMRCapabilityAttachments:
  2256             {
  2270             {
  2257             CESMRFsMailboxUtils* fsMbUtils =
  2271             CESMRFsMailboxUtils* fsMbUtils =
  2258                     CESMRFsMailboxUtils::NewL( iMRMailboxUtils );
  2272                     CESMRFsMailboxUtils::NewL( iMRMailboxUtils );
  2259             CleanupStack::PushL( fsMbUtils );
  2273             CleanupStack::PushL( fsMbUtils );
  2260 
  2274 
  2261             retValue = fsMbUtils->DefaultMailboxSupportCapabilityL(
  2275             retValue = fsMbUtils->DefaultMailboxSupportCapabilityL(
  2262                     CESMRFsMailboxUtils::EMRCapabilityAttachment );
  2276                     CESMRFsMailboxUtils::EMRCapabilityAttachment );
  2263             CleanupStack::PopAndDestroy( fsMbUtils );        
  2277             CleanupStack::PopAndDestroy( fsMbUtils );
  2264             }
  2278             }
  2265             break;
  2279             break;
  2266         }
  2280         }
  2267     
  2281 
  2268     return retValue;
  2282     return retValue;
  2269     }
  2283     }
  2270 
  2284 
  2271 // ---------------------------------------------------------------------------
  2285 // ---------------------------------------------------------------------------
  2272 // CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL
  2286 // CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL
  2273 // ---------------------------------------------------------------------------
  2287 // ---------------------------------------------------------------------------
  2274 //
  2288 //
  2275 TBool CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL()
  2289 TBool CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL()
  2276     {
  2290     {
  2277     FUNC_LOG;
  2291     FUNC_LOG;
  2278     
  2292 
  2279     TBool retValue( EFalse );
  2293     TBool retValue( EFalse );
  2280     
  2294 
  2281     TInt attachmentCount( iEntry->AttachmentCountL() );
  2295     TInt attachmentCount( iEntry->AttachmentCountL() );
  2282     
  2296 
  2283     for ( TInt i(0); i < attachmentCount && !retValue; ++i )
  2297     for ( TInt i(0); i < attachmentCount && !retValue; ++i )
  2284         {
  2298         {
  2285         CCalAttachment* attachment = iEntry->AttachmentL(i);        
  2299         CCalAttachment* attachment = iEntry->AttachmentL(i);
  2286         CCalAttachment::TType type( attachment->Type() );
  2300         CCalAttachment::TType type( attachment->Type() );
  2287         
  2301 
  2288         if ( CCalAttachment::EFile != type )
  2302         if ( CCalAttachment::EFile != type )
  2289             {
  2303             {
  2290             retValue = ETrue;
  2304             retValue = ETrue;
  2291             }        
  2305             }
  2292         }
  2306         }
  2293     
  2307 
  2294     return retValue;
  2308     return retValue;
  2295     }
  2309     }
  2296 
  2310 
  2297 // ---------------------------------------------------------------------------
  2311 // ---------------------------------------------------------------------------
  2298 // CESMRMeetingRequestEntry::SendCanellationAvailable
  2312 // CESMRMeetingRequestEntry::SendCanellationAvailable
  2318 // ---------------------------------------------------------------------------
  2332 // ---------------------------------------------------------------------------
  2319 //
  2333 //
  2320 void CESMRMeetingRequestEntry::SetTypeChanged( TBool aTypeChanged )
  2334 void CESMRMeetingRequestEntry::SetTypeChanged( TBool aTypeChanged )
  2321     {
  2335     {
  2322     FUNC_LOG;
  2336     FUNC_LOG;
  2323     
  2337 
  2324     iTypeChanged = aTypeChanged;
  2338     iTypeChanged = aTypeChanged;
  2325     }
  2339     }
  2326 
  2340 
       
  2341 // ---------------------------------------------------------------------------
       
  2342 // CESMRMeetingRequestEntry::SetDefaultDatabaseL
       
  2343 // ---------------------------------------------------------------------------
       
  2344 //
       
  2345 void CESMRMeetingRequestEntry::SetDefaultDatabaseL()
       
  2346     {
       
  2347     FUNC_LOG;
       
  2348 
       
  2349     if ( !IsStoredL() )
       
  2350         {
       
  2351         // If entry has not been stored, set database manager to use correct
       
  2352         // database supported by plugin sync solution.
       
  2353         CESMRFsMailboxUtils* fsMbUtils =
       
  2354                 CESMRFsMailboxUtils::NewL( iMRMailboxUtils );
       
  2355         CleanupStack::PushL( fsMbUtils );
       
  2356         TCalFileId aDbId( KNullFileId );
       
  2357         fsMbUtils->GetCalendarDatabaseIdL( CurrentPluginL(), aDbId );
       
  2358         CleanupStack::PopAndDestroy( fsMbUtils );
       
  2359 
       
  2360         if ( aDbId != KNullFileId )
       
  2361             {
       
  2362             iCalDb.SetCurCalendarByDbIdL( aDbId );
       
  2363             }
       
  2364         else if ( CurrentPluginL() == EESMRActiveSync )
       
  2365             {
       
  2366             _LIT( KMfeDb, "Mail for Exchange" );
       
  2367             iCalDb.SetCurCalendarByNameL( KMfeDb );
       
  2368             }
       
  2369         }
       
  2370     }
       
  2371 
  2327 // EOF
  2372 // EOF