958 // --------------------------------------------------------------------------- |
958 // --------------------------------------------------------------------------- |
959 // |
959 // |
960 void CIpsPlgSearch::CollectMessagesL() |
960 void CIpsPlgSearch::CollectMessagesL() |
961 { |
961 { |
962 FUNC_LOG; |
962 FUNC_LOG; |
|
963 TMsvId mailboxId = iCurrentSearch.iMailbox.Id(); |
|
964 TMsvId serviceId; |
|
965 TMsvEntry tEntry; |
|
966 TMsvEntry mailboxServiceEntry; |
|
967 |
963 // Lets make a huge list of message id's. |
968 // Lets make a huge list of message id's. |
964 iEmailMessages.Reset(); |
969 iEmailMessages.Reset(); |
965 |
970 |
966 const TInt folders = iCurrentSearch.iFolderIds.Count(); |
971 const TInt folders = iCurrentSearch.iFolderIds.Count(); |
967 for ( TInt folder = 0; folder < folders; folder++ ) |
972 for ( TInt folder = 0; folder < folders; folder++ ) |
968 { |
973 { |
969 iActiveEntry->SetEntryL( iCurrentSearch.iFolderIds[folder].Id() ); |
974 iActiveEntry->SetEntryL( iCurrentSearch.iFolderIds[folder].Id() ); |
|
975 if( iActiveEntry->Entry().Parent() == KMsvLocalServiceIndexEntryIdValue ) |
|
976 { |
|
977 User::LeaveIfError( |
|
978 iMsvSession.GetEntry( mailboxId, serviceId, tEntry ) ); |
|
979 User::LeaveIfError( |
|
980 iMsvSession.GetEntry( tEntry.iRelatedId, serviceId, mailboxServiceEntry ) ); |
|
981 } |
|
982 else |
|
983 { |
|
984 serviceId = mailboxId; |
|
985 } |
|
986 |
970 const TInt msgs = iActiveEntry->Count(); |
987 const TInt msgs = iActiveEntry->Count(); |
971 for ( TInt msg = 0; msg < msgs; msg++ ) |
988 for ( TInt msg = 0; msg < msgs; msg++ ) |
972 { |
989 { |
973 const TMsvEntry& entry = ( *iActiveEntry )[msg]; |
990 const TMsvEntry& entry = ( *iActiveEntry )[msg]; |
974 if ( entry.iType == KUidMsvMessageEntry && |
991 if ( entry.iType == KUidMsvMessageEntry && |
|
992 entry.iServiceId == serviceId && |
975 ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue || |
993 ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue || |
976 entry.iMtm.iUid == iPlugin.MtmId().iUid ) ) |
994 entry.iMtm.iUid == iPlugin.MtmId().iUid ) ) |
977 { |
995 { |
978 iEmailMessages.AppendL( TMsgContainer( |
996 iEmailMessages.AppendL( TMsgContainer( |
979 entry.Id(), iCurrentSearch.iSortCriteria, iMsvSession ) ); |
997 entry.Id(), iCurrentSearch.iSortCriteria, iMsvSession ) ); |