130 |
130 |
131 // Constants for drawing header text |
131 // Constants for drawing header text |
132 const TReal KFSHeaderTextBackgroundOpacity = 0.3f; |
132 const TReal KFSHeaderTextBackgroundOpacity = 0.3f; |
133 const TAlfTimedValue KFSVisible( 1 ); |
133 const TAlfTimedValue KFSVisible( 1 ); |
134 const TAlfTimedValue KFSInvisible( 0 ); |
134 const TAlfTimedValue KFSInvisible( 0 ); |
135 // Considering that there are 99999 unread emails + ( + ) + SPACE size should be 5+1+1+1 =8 |
|
136 static const TInt KFmtUnRdCntMaxLength( 8 ); |
|
137 _LIT(KFormatUnreadCnt, " (%d)"); |
|
138 |
135 |
139 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
140 // NewL |
137 // NewL |
141 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
142 // |
139 // |
2202 // |
2199 // |
2203 void CFSEmailUiFolderListVisualiser::AppendSeparatorLineL() |
2200 void CFSEmailUiFolderListVisualiser::AppendSeparatorLineL() |
2204 { |
2201 { |
2205 FUNC_LOG; |
2202 FUNC_LOG; |
2206 CFsSeparatorData* data = CFsSeparatorData::NewL(); |
2203 CFsSeparatorData* data = CFsSeparatorData::NewL(); |
2207 |
2204 CleanupStack::PushL(data); |
2208 CFsSeparatorVisualizer* visualizer( NULL ); |
2205 CFsSeparatorVisualizer* visualizer( NULL ); |
2209 visualizer = CFsSeparatorVisualizer::NewL(*iTreeList->TreeControl()); |
2206 visualizer = CFsSeparatorVisualizer::NewL(*iTreeList->TreeControl()); |
2210 |
2207 CleanupStack::Pop(data); |
2211 // We use the default size of the separator, but we need to save it |
2208 // We use the default size of the separator, but we need to save it |
2212 // here to have it available later when calculating the list height |
2209 // here to have it available later when calculating the list height |
2213 iListSeparatorHeight = visualizer->Size().iHeight; |
2210 iListSeparatorHeight = visualizer->Size().iHeight; |
2214 |
2211 |
2215 // This should never be the last item in the list, so disable the refresh |
2212 // This should never be the last item in the list, so disable the refresh |
2256 { |
2253 { |
2257 FUNC_LOG; |
2254 FUNC_LOG; |
2258 CFsTreePlainOneLineNodeData* plainItemData; |
2255 CFsTreePlainOneLineNodeData* plainItemData; |
2259 CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer; |
2256 CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer; |
2260 |
2257 |
2261 HBufC* itemDispName = HBufC::NewLC(aItemData->Length() + KFmtUnRdCntMaxLength); |
2258 TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt ); |
2262 itemDispName->Des().Copy(*aItemData); |
|
2263 if( aUnreadCnt > 0 ) |
|
2264 { |
|
2265 itemDispName->Des().AppendFormat(KFormatUnreadCnt, aUnreadCnt); |
|
2266 } |
|
2267 CreatePlainNodeLC2( itemDispName, plainItemData, plainNodeVisualizer, aIcon ); |
2259 CreatePlainNodeLC2( itemDispName, plainItemData, plainNodeVisualizer, aIcon ); |
2268 |
2260 |
2269 // We assume that node can never be the last item to be drawn, there will |
2261 // We assume that node can never be the last item to be drawn, there will |
2270 // always be leaf folder under it. So we can always deny scroll bar update. |
2262 // always be leaf folder under it. So we can always deny scroll bar update. |
2271 TFsTreeItemId nodeId = iTreeList->InsertNodeL( *plainItemData, *plainNodeVisualizer, aParentNode, KErrNotFound, EFalse); |
2263 TFsTreeItemId nodeId = iTreeList->InsertNodeL( *plainItemData, *plainNodeVisualizer, aParentNode, KErrNotFound, EFalse); |
2312 { |
2304 { |
2313 FUNC_LOG; |
2305 FUNC_LOG; |
2314 CFsTreePlainOneLineItemData* plainItemData; |
2306 CFsTreePlainOneLineItemData* plainItemData; |
2315 CFsTreePlainOneLineItemVisualizer* plainItemVisualizer; |
2307 CFsTreePlainOneLineItemVisualizer* plainItemVisualizer; |
2316 |
2308 |
2317 HBufC* itemDispName = HBufC::NewLC(aItemData->Length() + KFmtUnRdCntMaxLength); |
2309 TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt ); |
2318 itemDispName->Des().Copy(*aItemData); |
|
2319 if( aUnreadCnt > 0 ) |
|
2320 { |
|
2321 itemDispName->Des().AppendFormat(KFormatUnreadCnt, aUnreadCnt); |
|
2322 } |
|
2323 CreatePlainItemLC2( itemDispName, plainItemData, plainItemVisualizer, aIcon ); |
2310 CreatePlainItemLC2( itemDispName, plainItemData, plainItemVisualizer, aIcon ); |
2324 |
2311 |
2325 |
2312 |
2326 TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, aAllowRefresh); |
2313 TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, aAllowRefresh); |
2327 CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer |
2314 CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer |
2330 { |
2317 { |
2331 iListItemVisulizers.Append( plainItemVisualizer ); |
2318 iListItemVisulizers.Append( plainItemVisualizer ); |
2332 } |
2319 } |
2333 |
2320 |
2334 return itemId; |
2321 return itemId; |
|
2322 } |
|
2323 |
|
2324 // --------------------------------------------------------------------------- |
|
2325 // Get the display name for a folder |
|
2326 // --------------------------------------------------------------------------- |
|
2327 TDesC* CFSEmailUiFolderListVisualiser::GetItemDisplayNameLC( TDesC& aItemData, TUint aUnreadCnt ) |
|
2328 { |
|
2329 TDesC* itemDispName = NULL; |
|
2330 if( aUnreadCnt > 0 ) |
|
2331 { |
|
2332 CDesCArray* descArray = new (ELeave) CDesCArrayFlat( 1 ); |
|
2333 CleanupStack::PushL( descArray ); |
|
2334 descArray->AppendL( aItemData ); |
|
2335 CArrayFix<TInt>* intArray = new (ELeave) CArrayFixFlat<TInt>( 1 ); |
|
2336 CleanupStack::PushL( intArray ); |
|
2337 intArray->AppendL( aUnreadCnt ); |
|
2338 itemDispName = StringLoader::LoadL( |
|
2339 R_FREESTYLE_EMAIL_UI_FOLDER_LIST_FOLDER_WITH_UNREAD, |
|
2340 *descArray, *intArray ); |
|
2341 CleanupStack::PopAndDestroy( intArray ); |
|
2342 CleanupStack::PopAndDestroy( descArray ); |
|
2343 CleanupStack::PushL( itemDispName ); |
|
2344 } |
|
2345 else |
|
2346 { |
|
2347 itemDispName = aItemData.AllocLC(); |
|
2348 } |
|
2349 return itemDispName; |
2335 } |
2350 } |
2336 |
2351 |
2337 // --------------------------------------------------------------------------- |
2352 // --------------------------------------------------------------------------- |
2338 // Create plain leaf item |
2353 // Create plain leaf item |
2339 // --------------------------------------------------------------------------- |
2354 // --------------------------------------------------------------------------- |