emailservices/emailstore/base_plugin/src/BaseMrInfoObject.cpp
changeset 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Meeting request support implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "BaseMrInfoObject.h"
       
    22 #include "BasePlugin.h"
       
    23 
       
    24 
       
    25 /**
       
    26  * Defaults: Method of EMRMethodRequest.
       
    27  */
       
    28 EXPORT_C CBaseMrInfoObject* CBaseMrInfoObject::NewL()
       
    29     {
       
    30     CBaseMrInfoObject* self = new(ELeave) CBaseMrInfoObject();
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL();
       
    33     CleanupStack::Pop( self );
       
    34     return self;
       
    35     }
       
    36 
       
    37 
       
    38 /**
       
    39  * Copy construction.
       
    40  */
       
    41 EXPORT_C CBaseMrInfoObject* CBaseMrInfoObject::NewL(
       
    42     MMRInfoObject& aMrInfo )
       
    43     {
       
    44     CBaseMrInfoObject* self = new(ELeave) CBaseMrInfoObject();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL( aMrInfo );
       
    47     CleanupStack::Pop( self );
       
    48     return self;
       
    49     }
       
    50     
       
    51     
       
    52 /**
       
    53  *
       
    54  */
       
    55 CBaseMrInfoObject::CBaseMrInfoObject()
       
    56     : iCreationTime( Time::NullTTime() ), iStartTime( Time::NullTTime() ),
       
    57     iEndTime( Time::NullTTime() ), iAlarmTime( Time::NullTTime() ),
       
    58     iRecurrenceId( Time::NullTTime() ), iPriority( KIcalNormalPriority ), iMethod( EMRMethodRequest ),
       
    59     iResponse( EMrCmdResponseTentative )
       
    60     {
       
    61     }
       
    62 
       
    63 
       
    64 /**
       
    65  * Copy construction
       
    66  */
       
    67 void CBaseMrInfoObject::ConstructL(
       
    68     MMRInfoObject& aMrInfo )
       
    69     {    
       
    70     iSubject = aMrInfo.SubjectL().AllocL();
       
    71     iDescription = aMrInfo.DescriptionL().AllocL();
       
    72     iLocation = aMrInfo.LocationL().AllocL();
       
    73     iUid = aMrInfo.UidL().AllocL();
       
    74     
       
    75     iCreationTime = aMrInfo.CreationTimeInUtcL();
       
    76     iStartTime = aMrInfo.StartTimeInUtcL();
       
    77     iEndTime = aMrInfo.EndTimeInUtcL();
       
    78     iAlarmTime = aMrInfo.AlarmInUtcL();
       
    79     iMethod = aMrInfo.MRMethodL();
       
    80     iResponse = aMrInfo.MRResponse();
       
    81     iRecurrenceId = aMrInfo.MRRecurrenceId();
       
    82     
       
    83     iSequenceNumber = aMrInfo.MRSequenceNumberL();
       
    84     iPriority = aMrInfo.PriorityL();
       
    85 
       
    86     iOrganizer = CBaseMrAttendee::NewL();
       
    87     /*iOrganizer = CBaseMrAttendee::NewL( aMrInfo.MROrganizerL() );
       
    88     
       
    89     RPointerArray<MMRAttendee>& attendees = aMrInfo.AttendeesL();
       
    90     TInt count = attendees.Count();
       
    91     for ( TInt i = 0; i < count; i++ )
       
    92         {
       
    93         MMRAttendee* attendee = CBaseMrAttendee::NewL( *(attendees[i]) );
       
    94         CleanupStack::PushL( attendee );
       
    95         iAttendees.AppendL( attendee );
       
    96         CleanupStack::Pop( attendee );
       
    97         }*/
       
    98     
       
    99     iRrule = CBaseMrRecurrenceRule::NewL( aMrInfo.RecurrenceRuleL() );
       
   100     /**@ copy construction for iExceptions, iAttachments.*/
       
   101     }
       
   102 
       
   103 
       
   104 /**
       
   105  *
       
   106  */
       
   107 void CBaseMrInfoObject::ConstructL()
       
   108     {    
       
   109     iSubject = KNullDesC().AllocL();
       
   110     iDescription = KNullDesC().AllocL();
       
   111     iLocation = KNullDesC().AllocL();
       
   112     iUid = KNullDesC().AllocL();
       
   113     
       
   114     iOrganizer = CBaseMrAttendee::NewL();
       
   115     }
       
   116 
       
   117     
       
   118 /**
       
   119  *
       
   120  */
       
   121 EXPORT_C CBaseMrInfoObject::~CBaseMrInfoObject()
       
   122     {
       
   123     delete iSubject;
       
   124     delete iDescription;
       
   125     delete iLocation;
       
   126     delete iUid;
       
   127 
       
   128     delete iOrganizer;
       
   129 
       
   130     iExceptions.ResetAndDestroy();
       
   131     iAttachments.ResetAndDestroy();
       
   132     iAttendees.ResetAndDestroy();
       
   133 
       
   134     delete iRrule;
       
   135     }
       
   136     
       
   137 
       
   138 /**
       
   139  *
       
   140  */
       
   141 EXPORT_C void CBaseMrInfoObject::SetMRRecurrenceIdL( TTime aRecId )
       
   142     {
       
   143     iRecurrenceId = aRecId;
       
   144     }
       
   145 
       
   146 
       
   147 /**
       
   148  *
       
   149  */
       
   150 EXPORT_C TTime CBaseMrInfoObject::MRRecurrenceId() const
       
   151     {
       
   152     return iRecurrenceId;
       
   153     }
       
   154 
       
   155 /**
       
   156  * 
       
   157  */
       
   158 EXPORT_C void CBaseMrInfoObject::SetMRSequenceNumber( TInt aSeqNo )
       
   159 	{
       
   160 	iSequenceNumber = aSeqNo;
       
   161 	}
       
   162 
       
   163 /**
       
   164  *
       
   165  */
       
   166 EXPORT_C TInt CBaseMrInfoObject::SupportedFields(
       
   167     RArray<TESMRInfoField>& aFields ) const
       
   168     
       
   169     {
       
   170     /**@ have more fields to add.*/
       
   171     TESMRInfoField fields[] = 
       
   172         {
       
   173         EESMRInfoFieldId,
       
   174         EESMRInfoFieldSeqNo,
       
   175         EESMRInfoFieldMethod,
       
   176         EESMRInfoFieldMStatus,
       
   177         EESMRInfoFieldCreationDateTime,
       
   178         EESMRInfoFieldOrganizer,
       
   179         EESMRInfoFieldAttendee,
       
   180         EESMRInfoFieldOptAttendee,
       
   181         EESMRInfoFieldStartDateTime,
       
   182         EESMRInfoFieldStopDateTime,
       
   183         EESMRInfoFieldLocation,
       
   184         EESMRInfoFieldAlarm,
       
   185         EESMRInfoFieldSubject,
       
   186         EESMRInfoFieldDescription,
       
   187         EESMRInfoFieldRecurrence,
       
   188         EESMRInfoFieldPriority
       
   189         };
       
   190     
       
   191     TInt result = KErrNone;
       
   192     for ( TInt i = 0;
       
   193         i < sizeof( fields ) / sizeof( TESMRInfoField ) && result == KErrNone;
       
   194         i++ )
       
   195         {
       
   196         result = aFields.Append( fields[i] );
       
   197         }
       
   198     
       
   199     return result;
       
   200     }
       
   201     
       
   202 
       
   203 /**
       
   204  *
       
   205  */
       
   206 EXPORT_C void CBaseMrInfoObject::SetUidL(
       
   207     const TDesC& aUid )
       
   208     {
       
   209     delete iUid;
       
   210     iUid = NULL;
       
   211     
       
   212     iUid = aUid.AllocL();
       
   213     }
       
   214 
       
   215 
       
   216 /**
       
   217  *
       
   218  */
       
   219 EXPORT_C void CBaseMrInfoObject::SetUidL(
       
   220     HBufC* aUid )
       
   221     {
       
   222     delete iUid;
       
   223     iUid = NULL;
       
   224 
       
   225     iUid = aUid;
       
   226     }
       
   227 
       
   228 
       
   229 /**
       
   230  *
       
   231  */
       
   232 EXPORT_C const TDesC& CBaseMrInfoObject::UidL() const
       
   233     {
       
   234     return *iUid;
       
   235     }
       
   236     
       
   237     
       
   238 /**
       
   239  *
       
   240  */
       
   241 EXPORT_C TInt CBaseMrInfoObject::MRSequenceNumberL() const
       
   242     {
       
   243     return iSequenceNumber;
       
   244     }
       
   245     
       
   246     
       
   247 /**
       
   248  *
       
   249  */
       
   250 EXPORT_C void CBaseMrInfoObject::SetMethod(
       
   251     TMRMethod aMethod )
       
   252     {
       
   253     iMethod = aMethod;
       
   254     }
       
   255     
       
   256         
       
   257 /**
       
   258  *
       
   259  */
       
   260 EXPORT_C MMRInfoObject::TMRMethod CBaseMrInfoObject::MRMethodL() const
       
   261     {
       
   262     return iMethod;
       
   263     }
       
   264         
       
   265 
       
   266 /**
       
   267  *
       
   268  */
       
   269 EXPORT_C MMROrganizer& CBaseMrInfoObject::MROrganizerL()
       
   270     {
       
   271     return *iOrganizer;
       
   272     }
       
   273         
       
   274 
       
   275 /**
       
   276  *
       
   277  */
       
   278 EXPORT_C void CBaseMrInfoObject::AddAttendeeL(
       
   279     MMRAttendee* aAttendee )
       
   280     {
       
   281     iAttendees.AppendL( aAttendee );
       
   282     }
       
   283         
       
   284 
       
   285 /**
       
   286  *
       
   287  */
       
   288 EXPORT_C RPointerArray<MMRAttendee>& CBaseMrInfoObject::AttendeesL()
       
   289     {
       
   290     return iAttendees;
       
   291     }
       
   292     
       
   293 
       
   294 /**
       
   295  *
       
   296  */
       
   297 EXPORT_C void CBaseMrInfoObject::SetCreationTimeInUtcL(
       
   298     TTime aTime )
       
   299     {
       
   300     iCreationTime = aTime;
       
   301     }
       
   302     
       
   303 
       
   304 /**
       
   305  *
       
   306  */
       
   307 EXPORT_C TTime CBaseMrInfoObject::CreationTimeInUtcL() const
       
   308     {
       
   309     return iCreationTime;
       
   310     }
       
   311         
       
   312 
       
   313 /**
       
   314  *
       
   315  */
       
   316 EXPORT_C void CBaseMrInfoObject::SetStartTimeInUtcL(
       
   317     TTime aTime )
       
   318     {
       
   319     iStartTime = aTime;
       
   320     }
       
   321     
       
   322 
       
   323 /**
       
   324  *
       
   325  */
       
   326 EXPORT_C TTime CBaseMrInfoObject::StartTimeInUtcL() const
       
   327     {
       
   328     return iStartTime;
       
   329     }
       
   330         
       
   331 
       
   332 /**
       
   333  *
       
   334  */
       
   335 EXPORT_C void CBaseMrInfoObject::SetEndTimeInUtcL(
       
   336     TTime aTime )
       
   337     {
       
   338     iEndTime = aTime;
       
   339     }
       
   340         
       
   341 
       
   342 /**
       
   343  *
       
   344  */
       
   345 EXPORT_C TTime CBaseMrInfoObject::EndTimeInUtcL() const
       
   346     {
       
   347     return iEndTime;
       
   348     }
       
   349         
       
   350 
       
   351 /**
       
   352  *
       
   353  */
       
   354 EXPORT_C void CBaseMrInfoObject::SetAlarmInUtcL(
       
   355     TTime aTime )
       
   356     {
       
   357     iAlarmTime = aTime;
       
   358     }
       
   359         
       
   360 
       
   361 /**
       
   362  *
       
   363  */
       
   364 EXPORT_C TTime CBaseMrInfoObject::AlarmInUtcL() const
       
   365     {
       
   366     return iAlarmTime;
       
   367     }
       
   368         
       
   369 
       
   370 /**
       
   371  *
       
   372  */
       
   373 EXPORT_C void CBaseMrInfoObject::SetLocationL(
       
   374     const TDesC& aLocation )
       
   375     {
       
   376     delete iLocation;
       
   377     iLocation = NULL;
       
   378     
       
   379     iLocation = aLocation.AllocL();
       
   380     }
       
   381         
       
   382 
       
   383 /**
       
   384  *
       
   385  */
       
   386 EXPORT_C const TDesC& CBaseMrInfoObject::LocationL() const
       
   387     {
       
   388     return *iLocation;
       
   389     }
       
   390         
       
   391         
       
   392 /**
       
   393  *
       
   394  */
       
   395 EXPORT_C void CBaseMrInfoObject::SetDescriptionL(
       
   396     const TDesC& aDescription )
       
   397     {
       
   398     delete iDescription;
       
   399     iDescription = NULL;
       
   400     
       
   401     iDescription = aDescription.AllocL();
       
   402     }
       
   403         
       
   404         
       
   405 /**
       
   406  *
       
   407  */
       
   408 EXPORT_C const TDesC& CBaseMrInfoObject::DescriptionL() const
       
   409     {
       
   410     return *iDescription;
       
   411     }
       
   412         
       
   413 
       
   414 /**
       
   415  *
       
   416  */
       
   417 EXPORT_C void CBaseMrInfoObject::SetSubjectL(
       
   418     const TDesC& aSubject )
       
   419     {
       
   420     delete iSubject;
       
   421     iSubject = NULL;
       
   422     
       
   423     iSubject = aSubject.AllocL();
       
   424     }
       
   425         
       
   426 
       
   427 /**
       
   428  *
       
   429  */
       
   430 EXPORT_C const TDesC& CBaseMrInfoObject::SubjectL() const
       
   431     {
       
   432     return *iSubject;
       
   433     }
       
   434         
       
   435         
       
   436 /**
       
   437  *
       
   438  */
       
   439 EXPORT_C void CBaseMrInfoObject::SetRecurrenceRuleL(
       
   440     const MRRecurrenceRule& aRRule )
       
   441     {
       
   442     iRrule = &aRRule;
       
   443     }
       
   444         
       
   445 
       
   446 /**
       
   447  *
       
   448  */
       
   449 EXPORT_C const MRRecurrenceRule& CBaseMrInfoObject::RecurrenceRuleL() const
       
   450     {
       
   451     return *iRrule;
       
   452     }
       
   453 
       
   454 
       
   455 /**
       
   456  *
       
   457  */
       
   458 EXPORT_C void CBaseMrInfoObject::AddRecurrenceExceptionL(
       
   459     MMRInfoObject* aException )
       
   460     {
       
   461     iExceptions.AppendL( aException );
       
   462     }
       
   463         
       
   464         
       
   465 /**
       
   466  *
       
   467  */
       
   468 EXPORT_C const RPointerArray<MMRInfoObject>&
       
   469     CBaseMrInfoObject::RecurrenceExceptionsL() const
       
   470     {
       
   471     return iExceptions;
       
   472     }
       
   473         
       
   474         
       
   475 /**
       
   476  *
       
   477  */
       
   478 EXPORT_C void CBaseMrInfoObject::SetPriorityL(
       
   479     TUint aPriority )
       
   480     {
       
   481     iPriority = aPriority;
       
   482     }
       
   483             
       
   484 
       
   485 /**
       
   486  *
       
   487  */
       
   488 EXPORT_C TUint CBaseMrInfoObject::PriorityL() const
       
   489     {
       
   490     return iPriority;
       
   491     }
       
   492         
       
   493 
       
   494 /**
       
   495  *
       
   496  */
       
   497 EXPORT_C const RPointerArray<MMRAttachment>& CBaseMrInfoObject::AttachmentsL() const
       
   498     {
       
   499     return iAttachments;
       
   500     }
       
   501         
       
   502         
       
   503 /**
       
   504  *
       
   505  */
       
   506 EXPORT_C void CBaseMrInfoObject::AddAttachmentsL(
       
   507     MMRAttachment* aAttachment )
       
   508     {
       
   509     iAttachments.AppendL( aAttachment );
       
   510     }
       
   511         
       
   512         
       
   513 /**
       
   514  *
       
   515  */
       
   516 EXPORT_C TAny* CBaseMrInfoObject::ExtensionL(
       
   517     TUid /*aExtensionUid*/ )
       
   518     {
       
   519     return NULL;
       
   520     }
       
   521 
       
   522 
       
   523 /**
       
   524  *
       
   525  */
       
   526 EXPORT_C void CBaseMrInfoObject::SetMRResponseL(
       
   527     TResponse aResponse )
       
   528     {
       
   529     iResponse = aResponse;
       
   530     }
       
   531     
       
   532 
       
   533 /**
       
   534  *
       
   535  */
       
   536 EXPORT_C MMRInfoObject::TResponse CBaseMrInfoObject::MRResponse() const
       
   537     {
       
   538     return iResponse;
       
   539     }
       
   540 
       
   541 
       
   542 #pragma mark -
       
   543 
       
   544 
       
   545 /**
       
   546  *
       
   547  */
       
   548 EXPORT_C CBaseMrAttendee* CBaseMrAttendee::NewL()
       
   549     {
       
   550     CBaseMrAttendee* self = new (ELeave) CBaseMrAttendee();
       
   551     CleanupStack::PushL( self );
       
   552     self->ConstructL();
       
   553     CleanupStack::Pop( self );
       
   554     return self;
       
   555     }
       
   556 
       
   557 
       
   558 /**
       
   559  *
       
   560  */
       
   561 EXPORT_C CBaseMrAttendee* CBaseMrAttendee::NewL(
       
   562     const MMRAttendee& aAttendee )
       
   563     {
       
   564     CBaseMrAttendee* self = new (ELeave) CBaseMrAttendee();
       
   565     CleanupStack::PushL( self );
       
   566     self->ConstructL( aAttendee );
       
   567     CleanupStack::Pop( self );
       
   568     return self;
       
   569     }
       
   570 
       
   571 
       
   572 /**
       
   573  *
       
   574  */
       
   575 EXPORT_C CBaseMrAttendee* CBaseMrAttendee::NewL(
       
   576     const MMROrganizer& aOrganizer )
       
   577     {
       
   578     CBaseMrAttendee* self = new (ELeave) CBaseMrAttendee();
       
   579     CleanupStack::PushL( self );
       
   580     self->ConstructL( aOrganizer );
       
   581     CleanupStack::Pop( self );
       
   582     return self;
       
   583     }
       
   584 
       
   585 
       
   586 /**
       
   587  *
       
   588  */
       
   589 CBaseMrAttendee::CBaseMrAttendee()
       
   590     : iRole( MMRAttendee::EMRAttendeeNotSet ),
       
   591     iStatus( MMRAttendee::EMRAttendeeActionNotSet ), iRsvp( EFalse )
       
   592     {
       
   593     }
       
   594 
       
   595 
       
   596 /**
       
   597  *
       
   598  */
       
   599 void CBaseMrAttendee::ConstructL()
       
   600     {
       
   601     iAddress = KNullDesC().AllocL();
       
   602     iCommonName = KNullDesC().AllocL();
       
   603     }
       
   604 
       
   605 
       
   606 /**
       
   607  *
       
   608  */
       
   609 void CBaseMrAttendee::ConstructL(
       
   610     const MMRAttendee& aAttendee )
       
   611     {
       
   612     iAddress = aAttendee.Address().AllocL();
       
   613     iCommonName = aAttendee.CommonName().AllocL();
       
   614     
       
   615     iRole = aAttendee.AttendeeRole();
       
   616     iStatus = aAttendee.AttendeeStatus();
       
   617     iRsvp = aAttendee.ResponseRequested();
       
   618     }
       
   619 
       
   620 
       
   621 /**
       
   622  *
       
   623  */
       
   624 void CBaseMrAttendee::ConstructL(
       
   625     const MMROrganizer& aOrganizer )
       
   626     {
       
   627     iAddress = aOrganizer.Address().AllocL();
       
   628     iCommonName = aOrganizer.CommonName().AllocL();
       
   629     }
       
   630 
       
   631 
       
   632 /**
       
   633  *
       
   634  */
       
   635 EXPORT_C CBaseMrAttendee::~CBaseMrAttendee()
       
   636     {
       
   637     delete iCommonName;
       
   638     delete iAddress;
       
   639     }
       
   640 
       
   641 
       
   642 /**
       
   643  *
       
   644  */
       
   645 EXPORT_C void CBaseMrAttendee::SetAttendeeRoleL(
       
   646     TAttendeeRole aRole )
       
   647     {
       
   648     iRole = aRole;
       
   649     }
       
   650 
       
   651      
       
   652 /**
       
   653  *
       
   654  */
       
   655 EXPORT_C MMRAttendee::TAttendeeRole CBaseMrAttendee::AttendeeRole() const
       
   656     {
       
   657     return iRole;
       
   658     }
       
   659 
       
   660 
       
   661 /**
       
   662  *
       
   663  */
       
   664 EXPORT_C void CBaseMrAttendee::SetAddressL(  
       
   665     const TDesC& aAddress )
       
   666     {
       
   667     delete iAddress;
       
   668     iAddress = NULL;
       
   669     
       
   670     iAddress = aAddress.AllocL();
       
   671     }
       
   672 
       
   673 
       
   674 /**
       
   675  *
       
   676  */
       
   677 EXPORT_C const TDesC& CBaseMrAttendee::Address() const
       
   678     {
       
   679     return *iAddress;    
       
   680     }
       
   681     
       
   682     
       
   683 /**
       
   684  *
       
   685  */
       
   686 EXPORT_C void CBaseMrAttendee::SetCommonNameL(
       
   687     const TDesC& aCommonName )
       
   688     {
       
   689     delete iCommonName;
       
   690     iCommonName = NULL;
       
   691     
       
   692     iCommonName = aCommonName.AllocL();
       
   693     }
       
   694     
       
   695     
       
   696 /**
       
   697  *
       
   698  */
       
   699 EXPORT_C const TDesC& CBaseMrAttendee::CommonName() const
       
   700     {
       
   701     return *iCommonName;
       
   702     }
       
   703     
       
   704     
       
   705 /**
       
   706  *
       
   707  */
       
   708 EXPORT_C void CBaseMrAttendee::SetAttendeeStatusL(
       
   709     TAttendeeStatus& aStatus )
       
   710     {
       
   711     iStatus = aStatus;
       
   712     }
       
   713     
       
   714 
       
   715 /**
       
   716  *
       
   717  */
       
   718 EXPORT_C MMRAttendee::TAttendeeStatus CBaseMrAttendee::AttendeeStatus() const
       
   719     {
       
   720     return iStatus;
       
   721     }
       
   722     
       
   723 
       
   724 /**
       
   725  *
       
   726  */
       
   727 EXPORT_C void CBaseMrAttendee::SetResponseRequestedL(
       
   728     TBool aRsvp )
       
   729     {
       
   730     iRsvp = aRsvp;
       
   731     }
       
   732     
       
   733 
       
   734 /**
       
   735  *
       
   736  */
       
   737 EXPORT_C TBool CBaseMrAttendee::ResponseRequested() const
       
   738     {
       
   739     return iRsvp;
       
   740     }
       
   741 
       
   742 
       
   743 #pragma mark -
       
   744 
       
   745 
       
   746 /**
       
   747  *
       
   748  */
       
   749 EXPORT_C CBaseMrRecurrenceRule* CBaseMrRecurrenceRule::NewL()
       
   750     {
       
   751     CBaseMrRecurrenceRule* self = new(ELeave) CBaseMrRecurrenceRule();
       
   752     CleanupStack::PushL( self );
       
   753     self->ConstructL();
       
   754     CleanupStack::Pop( self );
       
   755     return self;
       
   756     }
       
   757 
       
   758 
       
   759 /**
       
   760  *
       
   761  */
       
   762 EXPORT_C CBaseMrRecurrenceRule* CBaseMrRecurrenceRule::NewL(
       
   763     const MRRecurrenceRule& aRrule )
       
   764     {
       
   765     CBaseMrRecurrenceRule* self = new(ELeave) CBaseMrRecurrenceRule( aRrule );
       
   766     CleanupStack::PushL( self );
       
   767     self->ConstructL( aRrule );
       
   768     CleanupStack::Pop( self );
       
   769     return self;
       
   770     }
       
   771 
       
   772 
       
   773 /**
       
   774  *
       
   775  */
       
   776 CBaseMrRecurrenceRule::CBaseMrRecurrenceRule()
       
   777     : iStartTime( Time::NullTTime() ), iUntilTime( Time::NullTTime() )
       
   778     {
       
   779     }
       
   780     
       
   781     
       
   782 /**
       
   783  *
       
   784  */
       
   785 CBaseMrRecurrenceRule::CBaseMrRecurrenceRule(
       
   786     const MRRecurrenceRule& aRrule )
       
   787     : iStartTime( aRrule.RecurrenceStartTime() ), iUntilTime( aRrule.RecurrentUntil() ), iType( aRrule.Type() ),
       
   788     iInterval( aRrule.RecurrentInterval() ), iCount( aRrule.RecurrentCount() )
       
   789     {
       
   790 
       
   791     }
       
   792 
       
   793 
       
   794 /**
       
   795  *
       
   796  */
       
   797 void CBaseMrRecurrenceRule::ConstructL()
       
   798     {    
       
   799     }
       
   800 
       
   801 
       
   802 /**
       
   803  *
       
   804  */
       
   805 void CBaseMrRecurrenceRule::ConstructL(
       
   806     const MRRecurrenceRule& aRrule )
       
   807     {
       
   808     
       
   809     const RArray<TMRRecurrentDay>& weekDays = aRrule.RecurrentWeekDays();
       
   810     TInt count = weekDays.Count();
       
   811     for ( TInt i = 0; i < count; i++ )
       
   812         {
       
   813         iWeekDays.AppendL( weekDays[i] );
       
   814         }
       
   815     
       
   816     const RArray<TInt>& monthDays = aRrule.RecurrentMonthDays();
       
   817     count = monthDays.Count();
       
   818     for ( TInt i = 0; i < count; i++ )
       
   819         {
       
   820         iMonthDays.AppendL( monthDays[i] );
       
   821         }
       
   822     
       
   823     const RArray<TMRRecurrenceMonth>& months = aRrule.RecurrentMonths();
       
   824     count = months.Count();
       
   825     for ( TInt i = 0; i < count; i++ )
       
   826         {
       
   827         iMonths.AppendL( months[i] );
       
   828         }
       
   829     
       
   830     const RArray<TRecurrentDaysofMonth>& daysofMonth = aRrule.RecurrentDaysofMonth();
       
   831     count = daysofMonth.Count();
       
   832     for ( TInt i = 0; i < count; i++ )
       
   833         {
       
   834         iDaysofMonth.AppendL( daysofMonth[i] );
       
   835         }
       
   836     }
       
   837 
       
   838     
       
   839 /**
       
   840  *
       
   841  */
       
   842 EXPORT_C CBaseMrRecurrenceRule::~CBaseMrRecurrenceRule()
       
   843     {
       
   844     iDaysofMonth.Close();
       
   845     iWeekDays.Close();
       
   846     iMonthDays.Close();
       
   847     iMonths.Close();
       
   848     }
       
   849 
       
   850 
       
   851 /**
       
   852  *
       
   853  */
       
   854 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrenceTypeL(
       
   855     MRRecurrenceRule::TMRRecurrenceType aType )
       
   856     {
       
   857     iType = aType;
       
   858     }
       
   859 
       
   860 
       
   861 /**
       
   862  *
       
   863  */
       
   864 EXPORT_C MRRecurrenceRule::TMRRecurrenceType CBaseMrRecurrenceRule::Type() const
       
   865     {
       
   866     return iType;
       
   867     }
       
   868 
       
   869 
       
   870 /**
       
   871  *
       
   872  */
       
   873 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrenceStartTimeL(
       
   874     TTime aStartTime )
       
   875     {
       
   876     iStartTime = aStartTime;
       
   877     }
       
   878 
       
   879 
       
   880 /**
       
   881  *
       
   882  */
       
   883 EXPORT_C TTime CBaseMrRecurrenceRule::RecurrenceStartTime() const
       
   884     {
       
   885     return iStartTime;
       
   886     }
       
   887 
       
   888 
       
   889 /**
       
   890  *
       
   891  */
       
   892 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrenceUntilL(
       
   893     TTime aUntilTime )
       
   894     {
       
   895     iUntilTime = aUntilTime;
       
   896     }
       
   897 
       
   898 
       
   899 /**
       
   900  *
       
   901  */
       
   902 EXPORT_C TTime CBaseMrRecurrenceRule::RecurrentUntil() const
       
   903     {
       
   904     return iUntilTime;
       
   905     }
       
   906     
       
   907 
       
   908 /**
       
   909  *
       
   910  */
       
   911 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentInterval(
       
   912     TInt aInterval )
       
   913     {
       
   914     iInterval = aInterval;
       
   915     }
       
   916     
       
   917 
       
   918 /**
       
   919  *
       
   920  */
       
   921 EXPORT_C TInt CBaseMrRecurrenceRule::RecurrentInterval() const
       
   922     {
       
   923     return iInterval;
       
   924     }
       
   925     
       
   926 
       
   927 /**
       
   928  *
       
   929  */
       
   930 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentCountL(
       
   931     TInt aCount )
       
   932     {
       
   933     iCount = aCount;
       
   934     }
       
   935     
       
   936 
       
   937 /**
       
   938  *
       
   939  */
       
   940 EXPORT_C TUint CBaseMrRecurrenceRule::RecurrentCount() const
       
   941     {
       
   942     return iCount;
       
   943     }
       
   944     
       
   945 
       
   946 /**
       
   947  *
       
   948  */
       
   949 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentWeekDaysL(
       
   950     RArray<TMRRecurrentDay>& aDays )
       
   951     {
       
   952     TInt count = aDays.Count();
       
   953     for ( TInt i = 0; i < count; i++ )
       
   954         {
       
   955         iWeekDays.AppendL( aDays[i] );
       
   956         }
       
   957     }
       
   958     
       
   959 
       
   960 /**
       
   961  *
       
   962  */
       
   963 EXPORT_C const RArray<MRRecurrenceRule::TMRRecurrentDay>&
       
   964     CBaseMrRecurrenceRule::RecurrentWeekDays() const
       
   965     {
       
   966     return iWeekDays;
       
   967     }
       
   968     
       
   969 
       
   970 /**
       
   971  *
       
   972  */
       
   973 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentMonthDaysL(
       
   974     RArray<TInt>& aDays )
       
   975     {
       
   976     TInt count = aDays.Count();
       
   977     for ( TInt i = 0; i < count; i++ )
       
   978         {
       
   979         iMonthDays.AppendL( aDays[i] );
       
   980         }    
       
   981     }
       
   982     
       
   983 
       
   984 /**
       
   985  *
       
   986  */
       
   987 EXPORT_C const RArray<TInt>& CBaseMrRecurrenceRule::RecurrentMonthDays() const
       
   988     {
       
   989     return iMonthDays;    
       
   990     }
       
   991 
       
   992 
       
   993 /**
       
   994  *
       
   995  */
       
   996 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentDaysofMonthL(
       
   997     RArray<TRecurrentDaysofMonth>& aDaysofMonth )
       
   998     {
       
   999     TInt count = aDaysofMonth.Count();
       
  1000     for ( TInt i = 0; i < count; i++ )
       
  1001         {
       
  1002         iDaysofMonth.AppendL( aDaysofMonth[i] );
       
  1003         }
       
  1004     }
       
  1005 
       
  1006 
       
  1007 /**
       
  1008  *
       
  1009  */
       
  1010 EXPORT_C const RArray<MRRecurrenceRule::TRecurrentDaysofMonth>&
       
  1011     CBaseMrRecurrenceRule::RecurrentDaysofMonth() const
       
  1012     {
       
  1013     return iDaysofMonth;
       
  1014     }
       
  1015 
       
  1016 
       
  1017 /**
       
  1018  *
       
  1019  */
       
  1020 EXPORT_C void CBaseMrRecurrenceRule::SetRecurrentMonthsL(
       
  1021     RArray<TMRRecurrenceMonth>& aMonths )
       
  1022     {
       
  1023     TInt count = aMonths.Count();
       
  1024     for ( TInt i = 0; i < count; i++ )
       
  1025         {
       
  1026         iMonths.AppendL( aMonths[i] );
       
  1027         }
       
  1028     }
       
  1029     
       
  1030 
       
  1031 /**
       
  1032  *
       
  1033  */
       
  1034 EXPORT_C const RArray<MRRecurrenceRule::TMRRecurrenceMonth>&
       
  1035     CBaseMrRecurrenceRule::RecurrentMonths() const
       
  1036     {
       
  1037     return iMonths;    
       
  1038     }
       
  1039 
       
  1040 
       
  1041 #pragma mark -
       
  1042 
       
  1043 
       
  1044 /**
       
  1045  *
       
  1046  */
       
  1047 EXPORT_C CBaseMrInfoProcessor* CBaseMrInfoProcessor::NewL(
       
  1048     CBasePlugin& aPlugin )
       
  1049     {
       
  1050     CBaseMrInfoProcessor* self = new (ELeave) CBaseMrInfoProcessor( aPlugin );
       
  1051     CleanupStack::PushL( self );
       
  1052     self->ConstructL();
       
  1053     CleanupStack::Pop( self );
       
  1054     return self;
       
  1055     }
       
  1056 
       
  1057 
       
  1058 /**
       
  1059  *
       
  1060  */
       
  1061 CBaseMrInfoProcessor::CBaseMrInfoProcessor( CBasePlugin& aPlugin )
       
  1062     : iPlugin( aPlugin )
       
  1063     {
       
  1064     }
       
  1065 
       
  1066 
       
  1067 /**
       
  1068  *
       
  1069  */
       
  1070 void CBaseMrInfoProcessor::ConstructL()
       
  1071     {
       
  1072     }
       
  1073 
       
  1074 
       
  1075 /**
       
  1076  *
       
  1077  */
       
  1078 EXPORT_C CBaseMrInfoProcessor::~CBaseMrInfoProcessor()
       
  1079     {
       
  1080     }
       
  1081 
       
  1082 
       
  1083 /**
       
  1084  * Create and send a MR response email.
       
  1085  */
       
  1086 EXPORT_C void CBaseMrInfoProcessor::ReplyToMeetingRequestL(
       
  1087     const TFSMailMsgId& aMailBoxId,
       
  1088     const TFSMailMsgId& aMessageId,
       
  1089     MMRInfoObject& aMeetingRequest,
       
  1090     TMRInfoResponseMode& aResponseMode,
       
  1091     const TDesC& aResponseText /*= KNullDesC()*/ )
       
  1092 
       
  1093     {
       
  1094     if ( MMRInfoProcessor::EMRInfoResponseSync != aResponseMode )
       
  1095         {
       
  1096         CFSMailMessage* reply = iPlugin.CreateMrReplyMessageL(
       
  1097             aMailBoxId, aMeetingRequest, aMessageId );
       
  1098         CleanupStack::PushL( reply );
       
  1099         
       
  1100         //body.
       
  1101         if ( aResponseText != KNullDesC )
       
  1102             {
       
  1103             CFSMailMessagePart* body = reply->PlainTextBodyPartL();
       
  1104             if ( NULL != body )
       
  1105                 {
       
  1106                 CleanupStack::PushL( body );
       
  1107                 
       
  1108                 /**@ completely unnecessary but the fw needs to accept a TDesC in
       
  1109                 SetContent instead.*/
       
  1110                 HBufC* descCopy = aResponseText.AllocLC();
       
  1111                 TPtr ptr = descCopy->Des();
       
  1112                 body->SetContent( ptr );
       
  1113                 
       
  1114                 CleanupStack::PopAndDestroy( descCopy );
       
  1115                 CleanupStack::PopAndDestroy( body );
       
  1116                 }
       
  1117             }
       
  1118         
       
  1119         CBaseMrInfoObject* mrInfo = CBaseMrInfoObject::NewL( aMeetingRequest );
       
  1120     
       
  1121         if ( MMRInfoProcessor::EMRInfoRemoveFromCal == aResponseMode )
       
  1122         	{
       
  1123         	mrInfo->SetMethod( MMRInfoObject::EMRMethodCancel );
       
  1124         	}
       
  1125         else
       
  1126         	{
       
  1127         	mrInfo->SetMethod( MMRInfoObject::EMRMethodResponse );
       
  1128         	}
       
  1129     
       
  1130         reply->SetMRInfo( mrInfo );
       
  1131         iPlugin.SendMessageL( *reply );
       
  1132     
       
  1133         CleanupStack::PopAndDestroy( reply );
       
  1134         }
       
  1135     	
       
  1136     } //ReplyToMeetingRequestL.