|
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: Icon loader |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "impsbuilddefinitions.h" |
|
21 #include "CCAIconLoader.h" |
|
22 #include "CAExternalInterface.h" |
|
23 #include "ChatDefinitions.h" |
|
24 #include "CCAApp.h" |
|
25 #include "CCAAppUi.h" |
|
26 #include "CCAVariantFactory.h" |
|
27 #include "CCAUISessionManager.h" |
|
28 #include "MCASkinVariant.h" |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <gulicon.h> |
|
32 #include <chatNG.mbg> |
|
33 #include <akntabgrp.h> |
|
34 #include <akniconarray.h> |
|
35 |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CCAIconLoader::CCAIconLoader |
|
39 // Constructor |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 CCAIconLoader::CCAIconLoader( const TDesC& aMbmFullPath, |
|
43 MCASkinVariant& aSkinVariant ) |
|
44 : iMbmFullPath( aMbmFullPath ), iSkinVariant( aSkinVariant ) |
|
45 { |
|
46 iAppUi = static_cast <CCAAppUi*> ( CCoeEnv::Static()->AppUi() ); |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CCAIconLoader::NewL |
|
51 // Symbian style constructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CCAIconLoader* CCAIconLoader::NewL( const TDesC& aMbmFullPath, |
|
55 MCASkinVariant& aSkinVariant ) |
|
56 { |
|
57 CCAIconLoader* self = new ( ELeave ) CCAIconLoader( aMbmFullPath, |
|
58 aSkinVariant ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CCAIconLoader::LoadIconsLC |
|
64 // Load all needed icons identified by view id. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CArrayPtr<CGulIcon>* CCAIconLoader::LoadIconsLC( TUid aViewIdentifier ) |
|
68 { |
|
69 // Create array for listbox graphics |
|
70 CArrayPtr<CGulIcon>* icons = |
|
71 new ( ELeave ) CAknIconArray( KArrayGranularity ); |
|
72 CleanupStack::PushL( icons ); |
|
73 |
|
74 if ( aViewIdentifier == KUidMainView ) |
|
75 { |
|
76 CGulIcon* ibox = iSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_ibox, |
|
77 EMbmChatngQgn_prop_im_ibox_mask, |
|
78 iMbmFullPath ); |
|
79 |
|
80 CleanupStack::PushL( ibox ); |
|
81 icons->AppendL( ibox ); |
|
82 CleanupStack::Pop( ibox ); |
|
83 |
|
84 CGulIcon* friends = iSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_friends, |
|
85 EMbmChatngQgn_prop_im_friends_mask, |
|
86 iMbmFullPath ); |
|
87 |
|
88 CleanupStack::PushL( friends ); |
|
89 icons->AppendL( friends ); |
|
90 CleanupStack::Pop( friends ); |
|
91 |
|
92 CGulIcon* imList = iSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_list, |
|
93 EMbmChatngQgn_prop_im_list_mask, |
|
94 iMbmFullPath ); |
|
95 CleanupStack::PushL( imList ); |
|
96 icons->AppendL( imList ); |
|
97 CleanupStack::Pop( imList ); |
|
98 |
|
99 CGulIcon* recList = iSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_saved, |
|
100 EMbmChatngQgn_prop_im_saved_mask, |
|
101 iMbmFullPath ); |
|
102 |
|
103 CleanupStack::PushL( recList ); |
|
104 icons->AppendL( recList ); |
|
105 CleanupStack::Pop( recList ); |
|
106 |
|
107 CGulIcon* iboxNew = iSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_ibox_new, |
|
108 EMbmChatngQgn_prop_im_ibox_new_mask, |
|
109 iMbmFullPath ); |
|
110 |
|
111 CleanupStack::PushL( iboxNew ); |
|
112 icons->AppendL( iboxNew ); |
|
113 CleanupStack::Pop( iboxNew ); |
|
114 |
|
115 #ifdef RD_CHAT_GROUP_MESSAGE_INDICATION_NEW |
|
116 CGulIcon* imListNew = iSkinVariant.LoadBitmapL( |
|
117 EMbmChatngQgn_prop_im_list_unread, |
|
118 EMbmChatngQgn_prop_im_list_unread_mask, |
|
119 iMbmFullPath ); |
|
120 CleanupStack::PushL( imListNew ); |
|
121 icons->AppendL( imListNew ); |
|
122 CleanupStack::Pop( imListNew ); |
|
123 #endif // RD_CHAT_GROUP_MESSAGE_INDICATION_NEW |
|
124 } |
|
125 else |
|
126 { |
|
127 User::Leave( KErrNotFound ); |
|
128 } |
|
129 |
|
130 return icons; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CCAIconLoader::LoadStatusPaneIconsL |
|
135 // Load status pane icons. |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void CCAIconLoader::LoadStatusPaneIconsL( CAknTabGroup& aTabGroup ) |
|
139 { |
|
140 CCAUISessionManager* session = &( iAppUi->UISessionManager() ); |
|
141 TBool groups( session ? session->IsSupported( |
|
142 CCAUISessionManager::EGroup ) : EFalse ); |
|
143 |
|
144 // load icons |
|
145 CGulIcon* friendsList = NULL; |
|
146 CGulIcon* privateChatList = NULL; |
|
147 CGulIcon* chatList = NULL; |
|
148 CGulIcon* recordedList = NULL; |
|
149 |
|
150 if ( groups ) |
|
151 { |
|
152 friendsList = iSkinVariant.LoadBitmapL( |
|
153 EMbmChatngQgn_prop_im_friend_tab4, |
|
154 EMbmChatngQgn_prop_im_friend_tab4_mask, iMbmFullPath ); |
|
155 CleanupStack::PushL( friendsList ); |
|
156 |
|
157 privateChatList = iSkinVariant.LoadBitmapL( |
|
158 EMbmChatngQgn_prop_im_ibox_tab4, |
|
159 EMbmChatngQgn_prop_im_ibox_tab4_mask, iMbmFullPath ); |
|
160 CleanupStack::PushL( privateChatList ); |
|
161 |
|
162 chatList = iSkinVariant.LoadBitmapL( |
|
163 EMbmChatngQgn_prop_im_list_tab4, |
|
164 EMbmChatngQgn_prop_im_list_tab4_mask, iMbmFullPath ); |
|
165 CleanupStack::PushL( chatList ); |
|
166 |
|
167 recordedList = iSkinVariant.LoadBitmapL( |
|
168 EMbmChatngQgn_prop_im_saved_chat_tab4, |
|
169 EMbmChatngQgn_prop_im_saved_chat_tab4_mask, iMbmFullPath ); |
|
170 CleanupStack::PushL( recordedList ); |
|
171 } |
|
172 else |
|
173 { |
|
174 friendsList = iSkinVariant.LoadBitmapL( |
|
175 EMbmChatngQgn_prop_im_friend_tab3, |
|
176 EMbmChatngQgn_prop_im_friend_tab3_mask, iMbmFullPath ); |
|
177 CleanupStack::PushL( friendsList ); |
|
178 |
|
179 privateChatList = iSkinVariant.LoadBitmapL( |
|
180 EMbmChatngQgn_prop_im_ibox_tab3, |
|
181 EMbmChatngQgn_prop_im_ibox_tab3_mask, iMbmFullPath ); |
|
182 CleanupStack::PushL( privateChatList ); |
|
183 |
|
184 CleanupStack::PushL( chatList ); |
|
185 |
|
186 recordedList = iSkinVariant.LoadBitmapL( |
|
187 EMbmChatngQgn_prop_im_saved_chat_tab3, |
|
188 EMbmChatngQgn_prop_im_saved_chat_tab3_mask, iMbmFullPath ); |
|
189 CleanupStack::PushL( recordedList ); |
|
190 } |
|
191 |
|
192 aTabGroup.SetTabFixedWidthL( |
|
193 groups ? KTabWidthWithFourTabs : KTabWidthWithThreeTabs ); |
|
194 |
|
195 aTabGroup.AddTabL( KUidChatPrivateChatListView.iUid, |
|
196 privateChatList->Bitmap(), privateChatList->Mask() ); |
|
197 privateChatList->SetBitmapsOwnedExternally( ETrue ); |
|
198 |
|
199 aTabGroup.AddTabL( KUidFriendsListView.iUid, |
|
200 friendsList->Bitmap(), friendsList->Mask() ); |
|
201 friendsList->SetBitmapsOwnedExternally( ETrue ); |
|
202 |
|
203 if ( groups ) |
|
204 { |
|
205 aTabGroup.AddTabL( KUidChatListView.iUid, |
|
206 chatList->Bitmap(), chatList->Mask() ); |
|
207 chatList->SetBitmapsOwnedExternally( ETrue ); |
|
208 } |
|
209 |
|
210 aTabGroup.AddTabL( KUidRecordedChatListView.iUid, recordedList->Bitmap(), |
|
211 recordedList->Mask() ); |
|
212 recordedList->SetBitmapsOwnedExternally( ETrue ); |
|
213 |
|
214 // recorded, chatList, privateChatlist, friendsList |
|
215 CleanupStack::PopAndDestroy( 4, friendsList ); |
|
216 } |
|
217 |
|
218 // end of file |