137 TFileName bitmapFileName= parse.FullName(); |
137 TFileName bitmapFileName= parse.FullName(); |
138 |
138 |
139 // Support for White label branding added |
139 // Support for White label branding added |
140 CFSMailClient* mailClient = CFSMailClient::NewL(); |
140 CFSMailClient* mailClient = CFSMailClient::NewL(); |
141 CleanupClosePushL(*mailClient); |
141 CleanupClosePushL(*mailClient); |
142 MFSMailBrandManager& brandManager = mailClient->GetBrandManagerL(); |
142 MFSMailBrandManager& brandManager = mailClient->GetBrandManagerL(); |
143 RPointerArray<CFSMailBox> mailboxes; |
143 RPointerArray<CFSMailBox> mailboxes; |
144 CleanupResetAndDestroyClosePushL( mailboxes ); |
144 CleanupResetAndDestroyClosePushL( mailboxes ); |
145 TFSMailMsgId id; |
145 TFSMailMsgId id; |
146 |
146 |
147 mailClient->ListMailBoxes( id, mailboxes ); |
147 mailClient->ListMailBoxes( id, mailboxes ); |
148 |
148 |
149 iIconArrays->Reset(); |
149 iIconArrays->Reset(); |
150 iMailboxIds.Reset(); |
150 iMailboxIds.Reset(); |
151 |
151 |
152 for ( TInt i = 0; i <= mailboxes.Count(); i++ ) // Last round is for setting the default mb icon at the end of the list |
152 for ( TInt i = 0; i <= mailboxes.Count(); i++ ) // Last round is for setting the default mb icon at the end of the list |
153 { |
153 { |
154 CFbsBitmap* bitmap(0); |
154 CFbsBitmap* bitmap(0); |
155 CFbsBitmap* bitmapMask(0); |
155 CFbsBitmap* bitmapMask(0); |
156 CArrayPtrFlat<CFbsBitmap>* array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 2 ); |
156 CArrayPtrFlat<CFbsBitmap>* array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 2 ); |
157 CleanupStack::PushL( array ); // +2 array |
157 CleanupStack::PushL( array ); // +2 array |
158 array->SetReserveL( 2 ); // AppendLs will not LEAVE |
158 array->SetReserveL( 2 ); // AppendLs will not LEAVE |
159 |
159 |
160 CGulIcon* brandedIcon( NULL ); |
160 CGulIcon* brandedIcon( NULL ); |
161 TInt err; |
161 TInt err; |
162 |
162 |
163 if ( i < mailboxes.Count() ) // Do not execute for the last round |
163 if ( i < mailboxes.Count() ) // Do not execute for the last round |
164 { |
164 { |
165 TRAP( err, brandedIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailboxes[i]->GetId() ) ); |
165 TRAP( err, brandedIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailboxes[i]->GetId() ) ); |
166 } |
|
167 if ( err == KErrNone && brandedIcon ) |
|
168 { |
|
169 bitmap = brandedIcon->Bitmap(); |
|
170 bitmapMask = brandedIcon->Mask(); |
|
171 brandedIcon->SetBitmapsOwnedExternally( ETrue ); |
|
172 CleanupStack::PushL( bitmap ); |
|
173 array->AppendL( bitmap ); |
|
174 CleanupStack::Pop( bitmap ); |
|
175 bitmap = 0; |
|
176 CleanupStack::PushL( bitmapMask ); |
|
177 array->AppendL( bitmapMask ); |
|
178 CleanupStack::Pop( bitmapMask ); |
|
179 bitmapMask = 0; |
|
180 iIconArrays->AppendL( array ); |
|
181 iMailboxIds.Append( (mailboxes[i]->GetId()).Id() ); |
|
182 } |
166 } |
183 else |
167 if ( err == KErrNone && brandedIcon ) |
184 { |
168 { |
185 // Icon was not found from the branding manager or last round for the default icon |
169 bitmap = brandedIcon->Bitmap(); |
186 TRAPD( err, AknIconUtils::CreateIconL( bitmap, bitmapMask, bitmapFileName, |
170 bitmapMask = brandedIcon->Mask(); |
187 EMbmFsuidatamtmQgn_prop_cmail_inbox_small, EMbmFsuidatamtmQgn_prop_cmail_inbox_small + 1 )); |
171 brandedIcon->SetBitmapsOwnedExternally( ETrue ); |
188 if( err != KErrNone ) |
172 CleanupStack::PushL( bitmap ); |
189 { |
173 array->AppendL( bitmap ); |
190 } |
174 CleanupStack::Pop( bitmap ); |
191 CleanupStack::PushL( bitmap ); |
175 bitmap = 0; |
192 array->AppendL( bitmap ); |
176 CleanupStack::PushL( bitmapMask ); |
193 CleanupStack::Pop( bitmap ); |
177 array->AppendL( bitmapMask ); |
194 bitmap = 0; |
178 CleanupStack::Pop( bitmapMask ); |
195 CleanupStack::PushL( bitmapMask ); |
179 bitmapMask = 0; |
196 array->AppendL( bitmapMask ); |
180 iIconArrays->AppendL( array ); |
197 CleanupStack::Pop( bitmapMask ); |
181 iMailboxIds.Append( (mailboxes[i]->GetId()).Id() ); |
198 bitmapMask = 0; |
182 } |
199 // INFO: This is not working for some reason, otherwise above code is not required. |
183 else |
200 // CreateBitmapsL(2, KFsUiDataMtmUdBitmapFile, EMbmFsuidatamtmFsmailbox, |
184 { |
201 // EMbmFsuidatamtmLastElement); |
185 // Icon was not found from the branding manager or last round for the default icon |
202 iIconArrays->AppendL( array ); |
186 TRAPD( err, AknIconUtils::CreateIconL( bitmap, bitmapMask, bitmapFileName, |
203 iMailboxIds.Append(0); |
187 EMbmFsuidatamtmQgn_prop_cmail_inbox_small, EMbmFsuidatamtmQgn_prop_cmail_inbox_small + 1 )); |
204 } |
188 if( err != KErrNone ) |
205 if ( brandedIcon ) |
189 { |
206 { |
190 } |
207 delete brandedIcon; |
191 CleanupStack::PushL( bitmap ); |
208 } |
192 array->AppendL( bitmap ); |
209 CleanupStack::Pop( array ); |
193 CleanupStack::Pop( bitmap ); |
210 } |
194 bitmap = 0; |
211 |
195 CleanupStack::PushL( bitmapMask ); |
212 CleanupStack::PopAndDestroy( &mailboxes ); |
196 array->AppendL( bitmapMask ); |
|
197 CleanupStack::Pop( bitmapMask ); |
|
198 bitmapMask = 0; |
|
199 // INFO: This is not working for some reason, otherwise above code is not required. |
|
200 // CreateBitmapsL(2, KFsUiDataMtmUdBitmapFile, EMbmFsuidatamtmFsmailbox, |
|
201 // EMbmFsuidatamtmLastElement); |
|
202 iIconArrays->AppendL( array ); |
|
203 iMailboxIds.Append(0); |
|
204 } |
|
205 if ( brandedIcon ) |
|
206 { |
|
207 delete brandedIcon; |
|
208 } |
|
209 CleanupStack::Pop( array ); |
|
210 } |
|
211 |
|
212 CleanupStack::PopAndDestroy( &mailboxes ); |
213 CleanupStack::PopAndDestroy( mailClient ); |
213 CleanupStack::PopAndDestroy( mailClient ); |
214 |
214 |
215 } |
215 } |
216 |
216 |
217 // --------------------------------------------------------------------------- |
217 // --------------------------------------------------------------------------- |