ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 0 8466d47a6819
child 20 efd4f1afd43e
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    31     const TFSMailDetails aDetails,
    31     const TFSMailDetails aDetails,
    32     const RArray<TFSMailSortCriteria>& aSorting)
    32     const RArray<TFSMailSortCriteria>& aSorting)
    33     {
    33     {
    34     FUNC_LOG;
    34     FUNC_LOG;
    35     CIpsPlgMsgIterator* self = 
    35     CIpsPlgMsgIterator* self = 
    36         new( ELeave ) CIpsPlgMsgIterator( aPlugin, aMailboxId, aDetails, 
    36         new( ELeave ) CIpsPlgMsgIterator( aPlugin, aMailboxId, aDetails );
    37             aSorting );
       
    38     CleanupStack::PushL( self );
    37     CleanupStack::PushL( self );
    39     self->ConstructL( aMsvSession, aFolderId, aSorting );
    38     self->ConstructL( aMsvSession, aFolderId, aSorting );
    40     CleanupStack::Pop( self );
    39     CleanupStack::Pop( self );
    41     return self;
    40     return self;
    42     }
    41     }
    51     const TFSMailDetails aDetails,
    50     const TFSMailDetails aDetails,
    52     const RArray<TFSMailSortCriteria>& aSorting)
    51     const RArray<TFSMailSortCriteria>& aSorting)
    53     {
    52     {
    54     FUNC_LOG;
    53     FUNC_LOG;
    55     CIpsPlgMsgIterator* self = 
    54     CIpsPlgMsgIterator* self = 
    56         new( ELeave ) CIpsPlgMsgIterator( aPlugin, aMailboxId, aDetails, 
    55         new( ELeave ) CIpsPlgMsgIterator( aPlugin, aMailboxId, aDetails );
    57             aSorting );
       
    58     CleanupStack::PushL( self );
    56     CleanupStack::PushL( self );
    59     self->ConstructL( aFolderEntry, aSorting );
    57     self->ConstructL( aFolderEntry, aSorting );
    60     CleanupStack::Pop( self );
    58     CleanupStack::Pop( self );
    61     return self;
    59     return self;
    62     }
    60     }
    71     FUNC_LOG;
    69     FUNC_LOG;
    72     delete iFolderEntry;
    70     delete iFolderEntry;
    73     delete iMsgMapper;
    71     delete iMsgMapper;
    74     delete iMsgSortKey;
    72     delete iMsgSortKey;
    75     delete iMsgSwapper;
    73     delete iMsgSwapper;
       
    74     
       
    75     iSortingCriteria.Reset();
    76     }
    76     }
    77 
    77 
    78 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    79 // Searches the message matching with aCurrentMessageId and requests the
    79 // Searches the message matching with aCurrentMessageId and requests the
    80 // chunk of messages following the matching message
    80 // chunk of messages following the matching message
   321 // ---------------------------------------------------------------------------
   321 // ---------------------------------------------------------------------------
   322 //
   322 //
   323 CIpsPlgMsgIterator::CIpsPlgMsgIterator( 
   323 CIpsPlgMsgIterator::CIpsPlgMsgIterator( 
   324     CIpsPlgSosBasePlugin& aPlugin,
   324     CIpsPlgSosBasePlugin& aPlugin,
   325     const TFSMailMsgId& aMailboxId,
   325     const TFSMailMsgId& aMailboxId,
   326     const TFSMailDetails aDetails,
   326     const TFSMailDetails aDetails )
   327     const RArray<TFSMailSortCriteria>& aSorting )
       
   328     : iPlugin( aPlugin ), iRequestedDetails( aDetails ), 
   327     : iPlugin( aPlugin ), iRequestedDetails( aDetails ), 
   329       iSortingCriteria( aSorting ), iMailboxId( aMailboxId )
   328       iMailboxId( aMailboxId )
   330     {
   329     {
   331     FUNC_LOG;
   330     FUNC_LOG;
   332     // none
   331     // none
   333     }
   332     }
   334 
   333 
   342     const TFSMailMsgId aFolderId,
   341     const TFSMailMsgId aFolderId,
   343     const RArray<TFSMailSortCriteria>& aSorting )
   342     const RArray<TFSMailSortCriteria>& aSorting )
   344     {
   343     {
   345     FUNC_LOG;
   344     FUNC_LOG;
   346     iFolderEntry  = aMsvSession.GetEntryL( aFolderId.Id() );
   345     iFolderEntry  = aMsvSession.GetEntryL( aFolderId.Id() );
   347     iMsgSortKey   = new (ELeave) TIpsPlgMsgKey( *iFolderEntry, aSorting );
   346     
       
   347     StoreSortCriteriaL(aSorting);
       
   348     iMsgSortKey   = new (ELeave) TIpsPlgMsgKey( *iFolderEntry, iSortingCriteria );
   348     iMsgSwapper   = new (ELeave) TIpsPlgMsgSwap( *iFolderEntry );
   349     iMsgSwapper   = new (ELeave) TIpsPlgMsgSwap( *iFolderEntry );
   349     iSortingOn    = 
   350     iSortingOn    = 
   350         ( aSorting.Count() > 0 ) && ( aSorting[0].iField != EFSMailDontCare);
   351         ( aSorting.Count() > 0 ) && ( aSorting[0].iField != EFSMailDontCare);
   351     iMsgMapper    = CIpsPlgMsgMapper::NewL( aMsvSession, iPlugin );
   352     iMsgMapper    = CIpsPlgMsgMapper::NewL( aMsvSession, iPlugin );
   352     iMsvSession   = &aMsvSession;
   353     iMsvSession   = &aMsvSession;
   361     CMsvEntry* aFolderEntry, 
   362     CMsvEntry* aFolderEntry, 
   362     const RArray<TFSMailSortCriteria>& aSorting )
   363     const RArray<TFSMailSortCriteria>& aSorting )
   363     {
   364     {
   364     FUNC_LOG;
   365     FUNC_LOG;
   365     iFolderEntry  = aFolderEntry;
   366     iFolderEntry  = aFolderEntry;
   366     iMsgSortKey   = new (ELeave) TIpsPlgMsgKey( *iFolderEntry, aSorting );
   367     StoreSortCriteriaL(aSorting);
       
   368     iMsgSortKey   = new (ELeave) TIpsPlgMsgKey( *iFolderEntry, iSortingCriteria );
   367     iMsgSwapper   = new (ELeave) TIpsPlgMsgSwap( *iFolderEntry );
   369     iMsgSwapper   = new (ELeave) TIpsPlgMsgSwap( *iFolderEntry );
   368     iSortingOn    = 
   370     iSortingOn    = 
   369         ( aSorting.Count() > 0 ) && ( aSorting[0].iField != EFSMailDontCare);
   371         ( aSorting.Count() > 0 ) && ( aSorting[0].iField != EFSMailDontCare);
   370     iMsgMapper = CIpsPlgMsgMapper::NewL( aFolderEntry->Session(), iPlugin );
   372     iMsgMapper = CIpsPlgMsgMapper::NewL( aFolderEntry->Session(), iPlugin );
   371     iMsvSession = NULL;
   373     iMsvSession = NULL;
   480  		filteredEntries = iFolderEntry->ChildrenWithServiceL( iMailboxId.Id() );
   482  		filteredEntries = iFolderEntry->ChildrenWithServiceL( iMailboxId.Id() );
   481 		}
   483 		}
   482 	return filteredEntries;
   484 	return filteredEntries;
   483 	}
   485 	}
   484 
   486 
       
   487 // -----------------------------------------------------------------------------
       
   488 // stores sort criteria given by user
       
   489 // -----------------------------------------------------------------------------
       
   490 void CIpsPlgMsgIterator::StoreSortCriteriaL( 
       
   491      const RArray<TFSMailSortCriteria>& aSorting )
       
   492     {
       
   493     for ( TInt i=0; i < aSorting.Count(); i++ )
       
   494         {
       
   495         const TFSMailSortCriteria& criteria  = aSorting[i];
       
   496         TFSMailSortCriteria fsCriteria;
       
   497         fsCriteria.iField = criteria.iField;
       
   498         fsCriteria.iOrder = criteria.iOrder;
       
   499         iSortingCriteria.AppendL(fsCriteria);
       
   500         }
       
   501     }
       
   502