author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:52:37 +0300 | |
branch | RCL_3 |
changeset 73 | c8382f7b54ef |
parent 64 | 3533d4323edc |
child 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2007 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: This file implements classes CNcsPopupListBox, CNcsListItemDrawer. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "emailtrace.h" |
|
21 |
#include <eikclbd.h> |
|
22 |
#include <AknsFrameBackgroundControlContext.h> |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
23 |
#include <FreestyleEmailUi.rsg> |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
24 |
#include <StringLoader.h> |
64 | 25 |
#include <CPbkContactEngine.h> |
26 |
#include <AknsDrawUtils.h> |
|
27 |
#include <AknsUtils.h> |
|
28 |
#include <aknlayoutscalable_apps.cdl.h> |
|
29 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
30 |
||
31 |
#include "ncspopuplistbox.h" |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
32 |
#include "ncsemailaddressobject.h" |
64 | 33 |
#include "ncsconstants.h" |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
34 |
#include "ncsheadercontainer.h" |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
35 |
#include "FreestyleEmailUiContactHandler.h" |
64 | 36 |
#include "ncsutility.h" |
37 |
#include "FreestyleEmailUiUtilities.h" |
|
38 |
#include "FreestyleEmailUiAppui.h" |
|
39 |
#include "FreestyleEmailUiLayoutHandler.h" |
|
40 |
#include "FSDelayedLoader.h" |
|
41 |
#include "FreestyleEmailUiCLSItem.h" |
|
42 |
||
43 |
const TInt KHighlightFrameWidth = 2; |
|
44 |
||
45 |
// ========================= MEMBER FUNCTIONS ================================== |
|
46 |
||
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// CNcsPopupListBox::NewL |
|
49 |
// ----------------------------------------------------------------------------- |
|
50 |
CNcsPopupListBox* CNcsPopupListBox::NewL( const CCoeControl* aParent, |
|
51 |
CFSMailBox& aMailBox, |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
52 |
MNcsPopupListBoxObserver& aObserver, |
64 | 53 |
TBool aRemoteLookupSupported ) |
54 |
{ |
|
55 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
56 |
CNcsPopupListBox* self = new (ELeave) CNcsPopupListBox( aMailBox, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
57 |
aObserver, aRemoteLookupSupported ); |
64 | 58 |
CleanupStack::PushL( self ); |
59 |
self->ConstructL( aParent ); |
|
60 |
CleanupStack::Pop( self ); |
|
61 |
return self; |
|
62 |
} |
|
63 |
||
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// CNcsPopupListBox::CNcsPopupListBox |
|
66 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
67 |
CNcsPopupListBox::CNcsPopupListBox( CFSMailBox& aMailBox, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
68 |
MNcsPopupListBoxObserver& aObserver, TBool aRemoteLookupSupported ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
69 |
: iMailBox( aMailBox ), |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
70 |
iObserver( aObserver ), |
64 | 71 |
iRemoteLookupSupported( aRemoteLookupSupported ), |
72 |
iCachingInProgress( EFalse ), |
|
73 |
iAppUi( static_cast<CFreestyleEmailUiAppUi*>( iEikonEnv->AppUi() ) ) |
|
74 |
{ |
|
75 |
FUNC_LOG; |
|
76 |
iPopupMaxRect = TRect( 100, 100, 100, 100 ); |
|
77 |
} |
|
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// CNcsPopupListBox::ConstructL |
|
81 |
// ----------------------------------------------------------------------------- |
|
82 |
void CNcsPopupListBox::ConstructL( const CCoeControl* aParent ) |
|
83 |
{ |
|
84 |
FUNC_LOG; |
|
85 |
CEikTextListBox::ConstructL( NULL, CEikListBox::EPopout ); |
|
86 |
SetMopParent( const_cast<CCoeControl*>( aParent ) ); |
|
87 |
User::LeaveIfError( SetParent( const_cast<CCoeControl*>( aParent ) ) ); |
|
88 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
89 |
CreateScrollBarFrameL( EFalse, EFalse, ETrue ); |
64 | 90 |
|
91 |
CEikTextListBox::SetBorder( TGulBorder::ENone ); |
|
92 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
93 |
const CFont* font = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
94 |
AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont ); |
64 | 95 |
CEikTextListBox::SetItemHeightL( font->FontMaxHeight() + 12 ); |
96 |
||
97 |
iBackgroundContext = CAknsFrameBackgroundControlContext::NewL( |
|
98 |
KAknsIIDQsnFrPopupSub, Rect(), Rect(), EFalse ); |
|
99 |
UpdateTextColors(); |
|
100 |
||
101 |
iContactHandler = CFsDelayedLoader::InstanceL()->GetContactHandlerL(); |
|
102 |
if ( !iContactHandler->IsLanguageSupportedL() ) |
|
103 |
{ |
|
104 |
iContactHandler = NULL; |
|
105 |
} |
|
106 |
||
107 |
SetListBoxObserver( this ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
108 |
MakeVisible( EFalse ); |
64 | 109 |
} |
110 |
||
111 |
// ----------------------------------------------------------------------------- |
|
112 |
// CNcsPopupListBox::InitAndSearchL |
|
113 |
// ----------------------------------------------------------------------------- |
|
114 |
void CNcsPopupListBox::InitAndSearchL( const TDesC& aText, TInt aMode ) |
|
115 |
{ |
|
116 |
FUNC_LOG; |
|
117 |
SetSearchTextL( aText, aMode ); |
|
118 |
RPointerArray<CFSEmailUiClsItem> emptyArray; |
|
119 |
CleanupClosePushL( emptyArray ); |
|
120 |
OperationCompleteL( ESearchContacts, emptyArray ); |
|
121 |
CleanupStack::PopAndDestroy( &emptyArray ); |
|
122 |
} |
|
123 |
||
124 |
// --------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
125 |
// Hides the popup window. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
126 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
127 |
void CNcsPopupListBox::ClosePopupL() |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
128 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
129 |
UpdateVisibilityL( EFalse ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
130 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
131 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
132 |
// --------------------------------------------------------------------------- |
64 | 133 |
// CNcsPopupListBox::~CNcsPopupListBox |
134 |
// --------------------------------------------------------------------------- |
|
135 |
CNcsPopupListBox::~CNcsPopupListBox() |
|
136 |
{ |
|
137 |
FUNC_LOG; |
|
138 |
delete iBackgroundContext; |
|
139 |
delete iItemTextsArray; |
|
140 |
delete iCurrentSearchText; |
|
141 |
iMatchingItems.ResetAndDestroy(); |
|
142 |
} |
|
143 |
||
144 |
// ----------------------------------------------------------------------------- |
|
145 |
// CNcsPopupListBox::CreateItemDrawerL |
|
146 |
// ----------------------------------------------------------------------------- |
|
147 |
void CNcsPopupListBox::CreateItemDrawerL() |
|
148 |
{ |
|
149 |
FUNC_LOG; |
|
150 |
iItemDrawer = new (ELeave) CNcsListItemDrawer( *this ); |
|
151 |
} |
|
152 |
||
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// CNcsPopupListBox::MopSupplyObject |
|
155 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
156 |
TTypeUid::Ptr CNcsPopupListBox::MopSupplyObject( TTypeUid aId ) |
64 | 157 |
{ |
158 |
FUNC_LOG; |
|
159 |
if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
160 |
{ |
|
161 |
return MAknsControlContext::SupplyMopObject( aId, iBackgroundContext ); |
|
162 |
} |
|
163 |
return CCoeControl::MopSupplyObject( aId ); |
|
164 |
} |
|
165 |
||
166 |
// ----------------------------------------------------------------------------- |
|
167 |
// CNcsPopupListBox::SizeChanged |
|
168 |
// ----------------------------------------------------------------------------- |
|
169 |
void CNcsPopupListBox::SizeChanged() |
|
170 |
{ |
|
171 |
FUNC_LOG; |
|
172 |
const TRect outerRect = Rect(); |
|
173 |
||
174 |
TAknLayoutRect subpane; |
|
175 |
subpane.LayoutRect( outerRect, |
|
176 |
AknLayoutScalable_Avkon::bg_popup_sub_pane_g1() ); |
|
177 |
const TRect innerRect = subpane.Rect(); |
|
178 |
||
179 |
iBackgroundContext->SetFrameRects( outerRect, innerRect ); |
|
180 |
||
181 |
SetViewRectFromClientRect( innerRect ); |
|
182 |
TRAP_IGNORE( HandleViewRectSizeChangeL() ); |
|
183 |
} |
|
184 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
185 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
186 |
// CNcsPopupListBox::HandleResourceChange |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
187 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
188 |
// |
64 | 189 |
void CNcsPopupListBox::HandleResourceChange( TInt aType ) |
190 |
{ |
|
191 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
192 |
CEikTextListBox::HandleResourceChange( aType ); |
64 | 193 |
if ( aType == KAknsMessageSkinChange ) |
194 |
{ |
|
195 |
UpdateTextColors(); |
|
196 |
} |
|
197 |
} |
|
198 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
199 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
200 |
// CNcsPopupListBox::HandlePointerEventL |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
201 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
202 |
// |
64 | 203 |
void CNcsPopupListBox::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
204 |
{ |
|
205 |
CEikTextListBox::HandlePointerEventL( aPointerEvent ); |
|
206 |
} |
|
207 |
||
208 |
// ----------------------------------------------------------------------------- |
|
209 |
// CNcsPopupListBox::OfferKeyEventL |
|
210 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
211 |
// |
64 | 212 |
TKeyResponse CNcsPopupListBox::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
213 |
TEventCode aType ) |
|
214 |
{ |
|
215 |
FUNC_LOG; |
|
216 |
TKeyResponse ret( EKeyWasNotConsumed ); |
|
217 |
if( aKeyEvent.iCode == EKeyDownArrow ) |
|
218 |
{ |
|
219 |
MoveRemoteLookupItemL( ERemoteLookupItemDown ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
220 |
iView->MoveCursorL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
221 |
CListBoxView::ECursorNextItem, CListBoxView::ENoSelection ); |
64 | 222 |
ret = EKeyWasConsumed; |
223 |
} |
|
224 |
else if( aKeyEvent.iCode == EKeyUpArrow ) |
|
225 |
{ |
|
226 |
TBool stay = EFalse; |
|
227 |
// Move cursor separator line over |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
228 |
if ( CurrentItemIndex() - 1 > 0 && |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
229 |
CurrentItemIndex() - 1 == iRemoteLookupItemPos ) |
64 | 230 |
{ |
231 |
MoveRemoteLookupItemL( ERemoteLookupItemUp ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
232 |
iView->MoveCursorL( CListBoxView::ECursorPreviousItem, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
233 |
CListBoxView::ENoSelection ); |
64 | 234 |
stay = ETrue; |
235 |
} |
|
236 |
||
237 |
MoveRemoteLookupItemL( ERemoteLookupItemUp ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
238 |
iView->MoveCursorL( CListBoxView::ECursorPreviousItem, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
239 |
CListBoxView::ENoSelection ); |
64 | 240 |
if( stay ) |
241 |
{ |
|
242 |
MoveRemoteLookupItemL( ERemoteLookupItemDown ); |
|
243 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
244 |
iView->MoveCursorL( CListBoxView::ECursorNextItem, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
245 |
CListBoxView::ENoSelection ); |
64 | 246 |
} |
247 |
||
248 |
||
249 |
ret = EKeyWasConsumed; |
|
250 |
} |
|
251 |
||
252 |
if( ret == EKeyWasNotConsumed ) |
|
253 |
{ |
|
254 |
ret = CEikListBox::OfferKeyEventL( aKeyEvent, aType ); |
|
255 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
256 |
// call HandleItemAdditionL just in case. There might be changes on remote |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
257 |
// lookup item place. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
258 |
// The call is here, because we don't want to have extra redraw events when |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
259 |
// the popuplist is not fully updated. |
64 | 260 |
HandleItemAdditionL(); |
261 |
return ret; |
|
262 |
} |
|
263 |
||
264 |
// --------------------------------------------------------------------------- |
|
265 |
// CNcsPopupListBox::HandleListBoxEventL |
|
266 |
// --------------------------------------------------------------------------- |
|
267 |
// |
|
268 |
void CNcsPopupListBox::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
269 |
TListBoxEvent aEventType ) |
|
270 |
{ |
|
271 |
if ( aEventType == EEventItemClicked || |
|
272 |
aEventType == EEventItemSingleClicked ) |
|
273 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
274 |
iObserver.PopupItemSelectedL(); |
64 | 275 |
} |
276 |
} |
|
277 |
||
278 |
// ----------------------------------------------------------------------------- |
|
279 |
// CNcsPopupListBox::OperationComplete |
|
280 |
// ----------------------------------------------------------------------------- |
|
281 |
// |
|
282 |
void CNcsPopupListBox::OperationCompleteL( TContactHandlerCmd /*aCmd*/, |
|
283 |
const RPointerArray<CFSEmailUiClsItem>& aMatchingItems ) |
|
284 |
{ |
|
285 |
FUNC_LOG; |
|
286 |
iMatchingItems.ResetAndDestroy(); |
|
287 |
// Replace old matcing items. |
|
288 |
||
289 |
for ( TInt ii = 0; ii < aMatchingItems.Count(); ++ii ) |
|
290 |
{ |
|
291 |
if ( aMatchingItems[ii] ) |
|
292 |
{ |
|
293 |
CFSEmailUiClsItem* item = aMatchingItems[ii]->CloneLC(); |
|
294 |
iMatchingItems.AppendL( item ); |
|
295 |
CleanupStack::Pop( item ); |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
UpdateListL(); |
|
300 |
} |
|
301 |
||
302 |
void CNcsPopupListBox::OperationErrorL( TContactHandlerCmd aCmd, TInt aError ) |
|
303 |
{ |
|
304 |
FUNC_LOG; |
|
305 |
||
306 |
if ( aCmd == ESearchContacts ) |
|
307 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
308 |
// KerrNotReady --> caching in progress, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
309 |
// KErrNotFound --> caching not started yet |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
310 |
if ( ( aError == KErrNotReady ) || ( aError == KErrNotFound ) ) |
64 | 311 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
312 |
if( !iAppUi->AppUiExitOngoing() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
313 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
314 |
TFsEmailUiUtility::ShowInfoNoteL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
315 |
R_FSE_EDITOR_INFO_BUILDING_CACHE ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
316 |
} |
64 | 317 |
iCachingInProgress = ETrue; |
318 |
} |
|
319 |
if ( aError == KErrNone && iCachingInProgress ) |
|
320 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
321 |
if ( !iAppUi->AppUiExitOngoing() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
322 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
323 |
TFsEmailUiUtility::ShowInfoNoteL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
324 |
R_FSE_EDITOR_INFO_CACHING_COMPLETED ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
325 |
} |
64 | 326 |
iCachingInProgress = EFalse; |
327 |
} |
|
328 |
} |
|
329 |
} |
|
330 |
||
331 |
// ----------------------------------------------------------------------------- |
|
332 |
// CNcsPopupListBox::SetSearchTextL |
|
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// |
|
335 |
void CNcsPopupListBox::SetSearchTextL( const TDesC& aText, TInt aMode ) |
|
336 |
{ |
|
337 |
FUNC_LOG; |
|
338 |
delete iCurrentSearchText; |
|
339 |
iCurrentSearchText = NULL; |
|
340 |
iCurrentSearchText = aText.AllocL(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
341 |
if ( !iCachingInProgress ) |
64 | 342 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
343 |
if ( iContactHandler ) |
64 | 344 |
{ |
345 |
iContactHandler->SearchMatchesL( aText, this, &iMailBox, aMode ); |
|
346 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
347 |
else |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
348 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
349 |
// update list for languages which don't support PCS |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
350 |
UpdateListL(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
351 |
} |
64 | 352 |
} |
353 |
} |
|
354 |
||
355 |
// ----------------------------------------------------------------------------- |
|
356 |
// CNcsPopupListBox::ReturnCurrentEmailAddressLC |
|
357 |
// ----------------------------------------------------------------------------- |
|
358 |
// |
|
359 |
CNcsEmailAddressObject* CNcsPopupListBox::ReturnCurrentEmailAddressLC() |
|
360 |
{ |
|
361 |
FUNC_LOG; |
|
362 |
CNcsEmailAddressObject* addressObject = NULL; |
|
363 |
||
364 |
if ( iMatchingItems.Count() ) |
|
365 |
{ |
|
366 |
CFSEmailUiClsItem* clsItem = NULL; |
|
367 |
if ( iRemoteLookupSupported ) |
|
368 |
{ |
|
369 |
// calculate index of item |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
370 |
TInt index = ( CurrentItemIndex() > iRemoteLookupItemPos ? |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
371 |
CurrentItemIndex() - 1 : CurrentItemIndex() ); |
64 | 372 |
clsItem = iMatchingItems[index]; |
373 |
} |
|
374 |
else |
|
375 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
376 |
clsItem = iMatchingItems[CurrentItemIndex()]; |
64 | 377 |
} |
378 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
379 |
addressObject= CNcsEmailAddressObject::NewL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
380 |
clsItem->DisplayName(), clsItem->EmailAddress() ); |
64 | 381 |
CleanupStack::PushL( addressObject ); |
382 |
if ( clsItem->MultipleEmails() ) |
|
383 |
{ |
|
384 |
addressObject->SetDisplayFull( ETrue ); |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
return addressObject; |
|
389 |
} |
|
390 |
||
391 |
// ----------------------------------------------------------------------------- |
|
392 |
// CNcsPopupListBox::SetPopupMaxRect |
|
393 |
// ----------------------------------------------------------------------------- |
|
394 |
void CNcsPopupListBox::SetPopupMaxRect( const TRect& aPopupMaxRect ) |
|
395 |
{ |
|
396 |
FUNC_LOG; |
|
397 |
iPopupMaxRect = aPopupMaxRect; |
|
398 |
||
399 |
SetPopupRect(); |
|
400 |
TRAP_IGNORE( UpdateScrollBarsL() ); |
|
401 |
TRAP_IGNORE( SetScrollBarVisibilityL() ); |
|
402 |
} |
|
403 |
||
404 |
// ----------------------------------------------------------------------------- |
|
405 |
// CNcsPopupListBox::IsPopupEmpty |
|
406 |
// ----------------------------------------------------------------------------- |
|
407 |
TBool CNcsPopupListBox::IsPopupEmpty() const |
|
408 |
{ |
|
409 |
FUNC_LOG; |
|
410 |
if ( Model()->NumberOfItems() > 0 ) |
|
411 |
return EFalse; |
|
412 |
else |
|
413 |
return ETrue; |
|
414 |
} |
|
415 |
||
416 |
// ----------------------------------------------------------------------------- |
|
417 |
// CNcsPopupListBox::IsRemoteLookupItemSelected |
|
418 |
// ----------------------------------------------------------------------------- |
|
419 |
TBool CNcsPopupListBox::IsRemoteLookupItemSelected() const |
|
420 |
{ |
|
421 |
FUNC_LOG; |
|
422 |
if ( CurrentItemIndex() == iRemoteLookupItemPos && iRemoteLookupSupported ) |
|
423 |
return ETrue; |
|
424 |
else |
|
425 |
return EFalse; |
|
426 |
} |
|
427 |
||
428 |
// ----------------------------------------------------------------------------- |
|
429 |
// CNcsPopupListBox::CurrentPopupClsItemsArray |
|
430 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
431 |
const RPointerArray<CFSEmailUiClsItem>& |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
432 |
CNcsPopupListBox::CurrentPopupClsItemsArray() const |
64 | 433 |
{ |
434 |
return iMatchingItems; |
|
435 |
} |
|
436 |
||
437 |
// ----------------------------------------------------------------------------- |
|
438 |
// CNcsPopupListBox::RemoteLookupItemPos |
|
439 |
// ----------------------------------------------------------------------------- |
|
440 |
TInt CNcsPopupListBox::RemoteLookupItemPos() const |
|
441 |
{ |
|
442 |
FUNC_LOG; |
|
443 |
return iRemoteLookupItemPos; |
|
444 |
} |
|
445 |
||
446 |
// ----------------------------------------------------------------------------- |
|
447 |
// CNcsPopupListBox::LayoutHandler |
|
448 |
// ----------------------------------------------------------------------------- |
|
449 |
CFSEmailUiLayoutHandler& CNcsPopupListBox::LayoutHandler() const |
|
450 |
{ |
|
451 |
FUNC_LOG; |
|
452 |
return *iAppUi->LayoutHandler(); |
|
453 |
} |
|
454 |
||
455 |
// ----------------------------------------------------------------------------- |
|
456 |
// CNcsPopupListBox::SetListItemsFromArrayL |
|
457 |
// ----------------------------------------------------------------------------- |
|
458 |
void CNcsPopupListBox::SetListItemsFromArrayL() |
|
459 |
{ |
|
460 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
461 |
|
64 | 462 |
Reset(); |
463 |
||
464 |
// Create totally new text array |
|
465 |
CreateTextArrayAndSetToTheListboxL( ETrue ); |
|
466 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
467 |
TInt matchCount = iMatchingItems.Count(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
468 |
// Remote lookup item's index is set as last item by default |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
469 |
// (in case of empty matching items list it is the only item) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
470 |
TInt rmluIndex = matchCount; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
471 |
|
64 | 472 |
// append texts to text array |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
473 |
for( TInt i=0; i < matchCount; i++ ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
474 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
475 |
iItemTextsArray->AppendL( iMatchingItems[i]->FullTextL() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
476 |
if ( iRemoteLookupSupported && |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
477 |
rmluIndex == matchCount && |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
478 |
iMatchingItems[i]->EmailAddress().Compare( KNullDesC ) == 0 ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
479 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
480 |
rmluIndex = i; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
481 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
482 |
} |
64 | 483 |
|
484 |
// Update rmlu item |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
485 |
SetRemoteLookupItemToTheListL( rmluIndex ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
486 |
|
64 | 487 |
SetPopupRect(); |
488 |
SetScrollBarVisibilityL(); |
|
489 |
HandleItemAdditionL(); |
|
490 |
||
491 |
if ( iItemTextsArray && iItemTextsArray->Count() > 0 ) |
|
492 |
{ |
|
493 |
SetCurrentItemIndex( 0 ); |
|
494 |
} |
|
495 |
||
496 |
if ( IsVisible() ) |
|
497 |
{ |
|
498 |
DrawDeferred(); |
|
499 |
} |
|
500 |
} |
|
501 |
||
502 |
// ----------------------------------------------------------------------------- |
|
503 |
// CNcsPopupListBox::RoundToItemHeight |
|
504 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
505 |
TInt CNcsPopupListBox::RoundToItemHeight( const TInt aPopupHeight ) const |
64 | 506 |
{ |
507 |
TReal fullItems; // number of full visible items in window |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
508 |
TInt err = Math::Round( fullItems, ( aPopupHeight / ItemHeight() ), 0 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
509 |
if ( err == KErrNone ) |
64 | 510 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
511 |
return (TInt)( fullItems * ItemHeight() ); |
64 | 512 |
} |
513 |
return aPopupHeight; // in case of error |
|
514 |
} |
|
515 |
||
516 |
// ----------------------------------------------------------------------------- |
|
517 |
// CNcsPopupListBox::SetPopupRect |
|
518 |
// ----------------------------------------------------------------------------- |
|
519 |
void CNcsPopupListBox::SetPopupRect() |
|
520 |
{ |
|
521 |
FUNC_LOG; |
|
522 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
523 |
// The popup height and vertical position is adjusted based on the |
64 | 524 |
// available space below and above the cursor and the number of items |
525 |
// in the list. |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
526 |
TRect newRect = iPopupMaxRect; |
64 | 527 |
TAknLayoutRect subpane; |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
528 |
subpane.LayoutRect( newRect, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
529 |
AknLayoutScalable_Avkon::bg_popup_sub_pane_g1() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
530 |
const TInt frameHeights = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
531 |
iPopupMaxRect.Height() - subpane.Rect().Height(); |
64 | 532 |
|
533 |
// This is the total height in pixels needed to show all items |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
534 |
const TInt minimumHeight = frameHeights + |
64 | 535 |
CalcHeightBasedOnNumOfItems( Model()->NumberOfItems() ); |
536 |
||
537 |
// Get height of one line in Address field |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
538 |
TInt toLineHeight = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
539 |
static_cast<CNcsHeaderContainer*>( Parent() )->GetToLineHeight(); |
64 | 540 |
if ( toLineHeight == 0 ) |
541 |
{ |
|
542 |
toLineHeight = ItemHeight(); |
|
543 |
} |
|
544 |
||
545 |
TInt newHeight = minimumHeight; // default window height |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
546 |
CCoeControl* container = Parent()->Parent(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
547 |
const TInt maxHeight = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
548 |
container->Rect().Height() - |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
549 |
( newRect.iTl.iY - container->PositionRelativeToScreen().iY ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
550 |
newHeight = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
551 |
RoundToItemHeight( maxHeight - frameHeights ) + frameHeights; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
552 |
if ( newHeight > minimumHeight ) |
64 | 553 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
554 |
newHeight = minimumHeight; // shrink window (if needed) |
64 | 555 |
} |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
556 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
557 |
newRect.SetHeight( newHeight ); |
64 | 558 |
SetRect( newRect ); |
559 |
} |
|
560 |
||
561 |
// ----------------------------------------------------------------------------- |
|
562 |
// CNcsPopupListBox::SetScrollBarVisibilityL |
|
563 |
// ----------------------------------------------------------------------------- |
|
564 |
void CNcsPopupListBox::SetScrollBarVisibilityL() |
|
565 |
{ |
|
566 |
FUNC_LOG; |
|
567 |
// This is the total height in pixels needed to show all items |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
568 |
TInt minimumHeight = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
569 |
CalcHeightBasedOnNumOfItems( Model()->NumberOfItems() ); |
64 | 570 |
|
571 |
// Show scroll bar if there is more items we can show at once. |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
572 |
if( iPopupMaxRect.Height() > minimumHeight ) |
64 | 573 |
{ |
574 |
ScrollBarFrame()->SetScrollBarVisibilityL( |
|
575 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
576 |
} |
|
577 |
else |
|
578 |
{ |
|
579 |
ScrollBarFrame()->SetScrollBarVisibilityL( |
|
580 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
|
581 |
} |
|
582 |
} |
|
583 |
||
584 |
||
585 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
586 |
// CNcsPopupListBox::SetRemoteLookupItemToTheListL |
64 | 587 |
// ----------------------------------------------------------------------------- |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
588 |
void CNcsPopupListBox::SetRemoteLookupItemToTheListL( TInt aIndex ) |
64 | 589 |
{ |
590 |
FUNC_LOG; |
|
591 |
if( iRemoteLookupSupported ) |
|
592 |
{ |
|
593 |
HBufC* rmluText = StringLoader::LoadLC( |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
594 |
R_FSE_EDITOR_ADDRESS_LIST_REMOTE_LOOKUP_SEARCH, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
595 |
*iCurrentSearchText ); |
64 | 596 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
597 |
iItemTextsArray->InsertL( aIndex, *rmluText ); |
64 | 598 |
CleanupStack::PopAndDestroy( rmluText ); |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
599 |
iRemoteLookupItemPos = aIndex; |
64 | 600 |
} |
601 |
else |
|
602 |
{ |
|
603 |
iRemoteLookupItemPos = -1; |
|
604 |
} |
|
605 |
} |
|
606 |
||
607 |
// ----------------------------------------------------------------------------- |
|
608 |
// CNcsPopupListBox::MoveRemoteLookupItemL |
|
609 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
610 |
void CNcsPopupListBox::MoveRemoteLookupItemL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
611 |
TRemoteLookupItemMoveDirection aDirection ) |
64 | 612 |
{ |
613 |
FUNC_LOG; |
|
614 |
if( iRemoteLookupSupported ) |
|
615 |
{ |
|
616 |
TInt newRMLUItemIndex = -1; |
|
617 |
TInt newCurrentItem = -1; |
|
618 |
if( aDirection == ERemoteLookupItemUp && |
|
619 |
iView->CurrentItemIndex() == iView->TopItemIndex() ) |
|
620 |
{ |
|
621 |
newRMLUItemIndex = iRemoteLookupItemPos - 1; |
|
622 |
newCurrentItem = CurrentItemIndex() - 1; |
|
623 |
} |
|
624 |
else if( aDirection == ERemoteLookupItemDown && |
|
625 |
iView->CurrentItemIndex() == iView->BottomItemIndex() ) |
|
626 |
{ |
|
627 |
newRMLUItemIndex = iRemoteLookupItemPos + 1; |
|
628 |
newCurrentItem = CurrentItemIndex() + 1; |
|
629 |
} |
|
630 |
||
631 |
||
632 |
if( ItemExists ( newCurrentItem ) && newRMLUItemIndex != -1 ) |
|
633 |
{ |
|
634 |
iItemTextsArray->Delete( iRemoteLookupItemPos ); |
|
635 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
636 |
HBufC* rmluText = StringLoader::LoadLC( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
637 |
R_FSE_EDITOR_ADDRESS_LIST_REMOTE_LOOKUP_SEARCH, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
638 |
*iCurrentSearchText ); |
64 | 639 |
|
640 |
iItemTextsArray->InsertL( newRMLUItemIndex, *rmluText ); |
|
641 |
CleanupStack::PopAndDestroy( rmluText ); |
|
642 |
iRemoteLookupItemPos = newRMLUItemIndex; |
|
643 |
} |
|
644 |
} |
|
645 |
} |
|
646 |
||
647 |
||
648 |
// ----------------------------------------------------------------------------- |
|
649 |
// CNcsPopupListBox::CreateTextArrayAndSetToTheListboxL |
|
650 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
651 |
void CNcsPopupListBox::CreateTextArrayAndSetToTheListboxL( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
652 |
const TBool& aResetIfExists ) |
64 | 653 |
{ |
654 |
FUNC_LOG; |
|
655 |
if( !iItemTextsArray ) |
|
656 |
{ |
|
657 |
iItemTextsArray = new ( ELeave ) CDesCArraySeg( 8 ); |
|
658 |
// Set the popup list data |
|
659 |
Model()->SetItemTextArray( iItemTextsArray ); |
|
660 |
Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
661 |
} |
|
662 |
||
663 |
if( aResetIfExists ) |
|
664 |
{ |
|
665 |
delete iItemTextsArray; |
|
666 |
iItemTextsArray = NULL; |
|
667 |
CreateTextArrayAndSetToTheListboxL( EFalse ); |
|
668 |
} |
|
669 |
} |
|
670 |
||
671 |
||
672 |
// ----------------------------------------------------------------------------- |
|
673 |
// CNcsListItemDrawer::CNcsListItemDrawer |
|
674 |
// ----------------------------------------------------------------------------- |
|
675 |
CNcsListItemDrawer::CNcsListItemDrawer( const CNcsPopupListBox& aListBox ) |
|
676 |
:CListItemDrawer(), iListBox( aListBox ) |
|
677 |
{ |
|
678 |
FUNC_LOG; |
|
679 |
// Store a GC for later use |
|
680 |
iGc = &CCoeEnv::Static()->SystemGc(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
681 |
SetGc( iGc ); |
64 | 682 |
} |
683 |
||
684 |
// ----------------------------------------------------------------------------- |
|
685 |
// CNcsListItemDrawer::DrawActualItem |
|
686 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
687 |
void CNcsListItemDrawer::DrawActualItem( TInt aItemIndex, |
64 | 688 |
const TRect& aActualItemRect, TBool aItemIsCurrent, |
689 |
TBool /*aViewIsEmphasized*/, TBool /*aViewIsDimmed*/, |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
690 |
TBool /*aItemIsSelected*/ ) const |
64 | 691 |
{ |
692 |
FUNC_LOG; |
|
693 |
iGc->DiscardFont(); |
|
694 |
||
695 |
// Get reference to curren popup cls item list. |
|
696 |
const RPointerArray<CFSEmailUiClsItem>& clsItemArray = |
|
697 |
iListBox.CurrentPopupClsItemsArray(); |
|
698 |
TInt rmluPosition = iListBox.RemoteLookupItemPos(); |
|
699 |
||
700 |
// Sets all the attributes, like font, text color and background color. |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
701 |
const CFont* font = AknLayoutUtils::FontFromId( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
702 |
EAknLogicalFontPrimarySmallFont ); |
64 | 703 |
iGc->UseFont( font ); |
704 |
iGc->SetPenStyle( CGraphicsContext::ESolidPen ); |
|
705 |
iGc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
706 |
||
707 |
TRect itemRect = aActualItemRect; |
|
708 |
{ |
|
709 |
// temporary const_cast to get the scrollbar width |
|
710 |
CNcsPopupListBox& tmpListBox = const_cast<CNcsPopupListBox&>( iListBox ); |
|
711 |
const TInt scrollbarBreadth = tmpListBox.ScrollBarFrame()-> |
|
712 |
ScrollBarBreadth( CEikScrollBar::EVertical ); |
|
713 |
if ( scrollbarBreadth > 0 ) |
|
714 |
{ |
|
715 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
716 |
{ |
|
717 |
itemRect.iTl.iX = iListBox.Rect().iTl.iX + scrollbarBreadth; |
|
718 |
} |
|
719 |
else |
|
720 |
{ |
|
721 |
itemRect.iBr.iX = iListBox.Rect().iBr.iX - scrollbarBreadth; |
|
722 |
} |
|
723 |
} |
|
724 |
} |
|
725 |
||
726 |
TRect textRect = itemRect; |
|
727 |
textRect.Shrink( KHighlightFrameWidth, KHighlightFrameWidth ); |
|
728 |
||
729 |
// Get skin instance. |
|
730 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
731 |
||
732 |
// Draw background using the control context from the list box. |
|
733 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iListBox ); |
|
734 |
if ( cc ) |
|
735 |
{ |
|
736 |
AknsDrawUtils::Background( skin, cc, *iGc, aActualItemRect ); |
|
737 |
} |
|
738 |
else |
|
739 |
{ |
|
740 |
iGc->Clear( aActualItemRect ); |
|
741 |
} |
|
742 |
||
743 |
// Draw the highlight, when necessary. |
|
744 |
if ( aItemIsCurrent ) |
|
745 |
{ |
|
746 |
AknsDrawUtils::DrawFrame( skin, *iGc, itemRect, textRect, |
|
747 |
KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter ); |
|
748 |
} |
|
749 |
||
750 |
// Get text color. |
|
751 |
TRgb textColor = TextColor(); |
|
752 |
if ( aItemIsCurrent ) |
|
753 |
{ |
|
754 |
textColor = HighlightedTextColor(); |
|
755 |
} |
|
756 |
||
757 |
iGc->SetPenColor( textColor ); |
|
758 |
TInt topToBaseline = ( textRect.Height() - font->FontMaxHeight() ) / 2 |
|
759 |
+ font->FontMaxAscent(); |
|
760 |
||
761 |
TPtrC itemText = iListBox.Model()->ItemText( aItemIndex ); |
|
762 |
||
763 |
// Construct bidirectional text object |
|
764 |
// <cmail> Removed leave from non-leaving function. |
|
765 |
TBidiText* bidiText = NULL; |
|
766 |
TRAPD( err, bidiText = TBidiText::NewL( itemText, 1 ) ); |
|
767 |
if ( err == KErrNone ) |
|
768 |
{ |
|
769 |
bidiText->WrapText( textRect.Width(), *font, NULL ); |
|
770 |
} |
|
771 |
||
772 |
TPoint leftBase = textRect.iTl + TPoint( 0, topToBaseline ); |
|
773 |
||
774 |
if ( err != KErrNone ) |
|
775 |
{ |
|
776 |
bidiText = NULL; // to be on the safe side |
|
777 |
} |
|
778 |
||
779 |
// check if we are drawing remote lookup item or contact match |
|
780 |
else if ( rmluPosition == aItemIndex ) |
|
781 |
{ |
|
782 |
iGc->SetUnderlineStyle( EUnderlineOff ); |
|
783 |
bidiText->DrawText( *iGc, leftBase ); |
|
784 |
} |
|
785 |
else |
|
786 |
{ |
|
787 |
// if list has rmlu item change item index right |
|
788 |
if ( rmluPosition >= 0 && aItemIndex > rmluPosition ) |
|
789 |
{ |
|
790 |
aItemIndex--; |
|
791 |
} |
|
792 |
||
793 |
// Change text transparency if match doesn't have email address. |
|
794 |
if ( clsItemArray[aItemIndex]->EmailAddress().Compare( KNullDesC ) == 0 ) |
|
795 |
{ |
|
796 |
const TInt KTransparency = |
|
797 |
iListBox.LayoutHandler().PcsPopupDimmedFontTransparency(); |
|
798 |
textColor.SetAlpha( KTransparency ); |
|
799 |
iGc->SetPenColor( textColor ); |
|
800 |
} |
|
801 |
||
802 |
// For now, we support underlining the matching part only if the |
|
803 |
// text is written completely with left-to-right script |
|
804 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
805 |
// We know the text contains RTL script if the display string is not |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
806 |
// just truncated version of the original string. |
64 | 807 |
TPtrC dispText = bidiText->DisplayText(); |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
808 |
// -1 to omit the truncation character |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
809 |
TInt compLength = dispText.Length() - 1; |
64 | 810 |
TBool textContainsRtl = |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
811 |
( itemText.Left( compLength ) != dispText.Left( compLength ) ); |
64 | 812 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
813 |
const RArray<TPsMatchLocation>& underlines = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
814 |
clsItemArray[aItemIndex]->Highlights(); |
64 | 815 |
|
816 |
if ( underlines.Count() > 0 && !textContainsRtl ) |
|
817 |
{ |
|
818 |
TInt i = 0; |
|
819 |
TBool partsLeft = ETrue; |
|
820 |
TInt currentTextStart = 0; |
|
821 |
TInt currentTextLength = 0; |
|
822 |
||
823 |
while ( partsLeft ) |
|
824 |
{ |
|
825 |
if ( currentTextStart < underlines[i].index ) |
|
826 |
{ |
|
827 |
// draw letters to the start of the underlined part |
|
828 |
currentTextLength = underlines[i].index - currentTextStart; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
829 |
DrawPartOfItem( textRect, *font, currentTextStart, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
830 |
currentTextLength, itemText, |
64 | 831 |
EFalse, topToBaseline ); |
832 |
} |
|
833 |
else if ( currentTextStart == underlines[i].index ) |
|
834 |
{ |
|
835 |
// draw underlined letters |
|
836 |
currentTextLength = underlines[i].length; |
|
837 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
838 |
DrawPartOfItem( textRect, *font, currentTextStart, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
839 |
currentTextLength, itemText, |
64 | 840 |
ETrue, topToBaseline ); |
841 |
i++; |
|
842 |
} |
|
843 |
else |
|
844 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
845 |
// This is here, because PCS Engine might give you |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
846 |
// duplicate match entries, in this case we're not |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
847 |
// advancing text but we'll skip that match |
64 | 848 |
currentTextLength = 0; |
849 |
i++; |
|
850 |
} |
|
851 |
// update text start point |
|
852 |
currentTextStart += currentTextLength; |
|
853 |
||
854 |
if ( i >= underlines.Count() ) |
|
855 |
{ |
|
856 |
partsLeft = EFalse; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
857 |
// draw rest of the letters, if there are any after the |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
858 |
// last underlined part |
64 | 859 |
if ( currentTextStart < itemText.Length() ) |
860 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
861 |
currentTextLength = |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
862 |
itemText.Length() - currentTextStart; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
863 |
DrawPartOfItem( textRect, *font, currentTextStart, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
864 |
currentTextLength, itemText, |
64 | 865 |
EFalse, topToBaseline ); |
866 |
} |
|
867 |
} |
|
868 |
||
869 |
} |
|
870 |
} |
|
871 |
else |
|
872 |
{ |
|
873 |
iGc->SetUnderlineStyle( EUnderlineOff ); |
|
874 |
bidiText->DrawText( *iGc, leftBase ); |
|
875 |
} |
|
876 |
} |
|
877 |
||
878 |
delete bidiText; |
|
879 |
bidiText = NULL; |
|
880 |
} |
|
881 |
||
882 |
// ----------------------------------------------------------------------------- |
|
883 |
// CNcsListItemDrawer::DrawPartOfItem |
|
884 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
885 |
void CNcsListItemDrawer::DrawPartOfItem( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
886 |
const TRect& aItemRect, const CFont& aFont, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
887 |
TInt aStartPos, TInt aLength, const TDesC& aDes, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
888 |
TBool aUnderlined, TInt aBaselineOffsetFromTop ) const |
64 | 889 |
{ |
890 |
FUNC_LOG; |
|
891 |
if( aUnderlined ) |
|
892 |
{ |
|
893 |
iGc->SetUnderlineStyle( EUnderlineOn ); |
|
894 |
} |
|
895 |
else |
|
896 |
{ |
|
897 |
iGc->SetUnderlineStyle( EUnderlineOff ); |
|
898 |
} |
|
899 |
TRect currentTextRect( aItemRect ); |
|
900 |
TInt pixels = aFont.TextWidthInPixels( aDes.Left( aStartPos ) ); |
|
901 |
currentTextRect.iTl.iX = currentTextRect.iTl.iX + pixels; |
|
902 |
iGc->DrawText( aDes.Mid( aStartPos, aLength ), |
|
903 |
currentTextRect, aBaselineOffsetFromTop ); |
|
904 |
} |
|
905 |
||
906 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
907 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
908 |
// Updates popup list content. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
909 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
910 |
// |
64 | 911 |
void CNcsPopupListBox::UpdateListL() |
912 |
{ |
|
913 |
FUNC_LOG; |
|
914 |
SetListItemsFromArrayL(); |
|
915 |
||
916 |
// Close the popup if it's empty and make sure it's visible if it's not empty. |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
917 |
UpdateVisibilityL( !IsPopupEmpty() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
918 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
919 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
920 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
921 |
// Shows or hides popup if necessary. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
922 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
923 |
// |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
924 |
void CNcsPopupListBox::UpdateVisibilityL( TBool aVisible ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
925 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
926 |
if ( IsVisible() != aVisible ) |
64 | 927 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
928 |
if ( iObserver.PopupVisibilityChangingL( aVisible ) ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
929 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
930 |
MakeVisible( aVisible ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
931 |
if ( aVisible ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
932 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
933 |
UpdateScrollBarsL(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
934 |
SetScrollBarVisibilityL(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
935 |
// Popup is always on top (also on top of e.g. toolbar buttons) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
936 |
DrawableWindow()->SetOrdinalPosition( 0 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
937 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
938 |
} |
64 | 939 |
} |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
940 |
else if ( IsVisible() ) |
64 | 941 |
{ |
942 |
UpdateScrollBarsL(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
943 |
SetScrollBarVisibilityL(); |
64 | 944 |
} |
945 |
} |
|
946 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
947 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
948 |
// Updates popup text colors. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
949 |
// --------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
950 |
// |
64 | 951 |
void CNcsPopupListBox::UpdateTextColors() |
952 |
{ |
|
953 |
if ( iItemDrawer ) |
|
954 |
{ |
|
955 |
// Get skin instance. |
|
956 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
957 |
||
958 |
// Get color for popup text from current skin. |
|
959 |
TRgb textColor = KRgbBlack; |
|
960 |
AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, |
|
961 |
EAknsCIQsnTextColorsCG20 ); |
|
962 |
iItemDrawer->SetTextColor( textColor ); |
|
963 |
||
964 |
// Get text color for highlighted list item from current skin. |
|
965 |
AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, |
|
966 |
EAknsCIQsnTextColorsCG10 ); |
|
967 |
iItemDrawer->SetHighlightedTextColor( textColor ); |
|
968 |
} |
|
969 |
} |
|
970 |
||
971 |
void CNcsPopupListBox::Draw( const TRect& /*aRect*/ ) const |
|
972 |
{ |
|
973 |
CWindowGc& gc = SystemGc(); |
|
974 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
975 |
if ( iBackgroundContext ) |
|
976 |
{ |
|
977 |
AknsDrawUtils::DrawBackground( skin, iBackgroundContext, this, gc, |
|
978 |
Rect().iTl, Rect(), KAknsDrawParamNoClearUnderImage ); |
|
979 |
} |
|
980 |
else |
|
981 |
{ |
|
982 |
gc.Clear( Rect() ); |
|
983 |
} |
|
984 |
CEikListBox::Draw( Rect() ); |
|
985 |
} |
|
986 |
||
987 |
// End of File |
|
988 |