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 defines class CNcsPopupListBox.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CNCSPOPUPLISTBOX_H
|
|
21 |
#define CNCSPOPUPLISTBOX_H
|
|
22 |
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <aknlists.h>
|
|
26 |
#include "FreestyleEmailUiContactHandlerObserver.h"
|
|
27 |
|
|
28 |
// FORWARD DECLARATION
|
|
29 |
class CNcsEmailAddressObject;
|
|
30 |
class CAknsFrameBackgroundControlContext;
|
|
31 |
class CFSEmailUiContactHandler;
|
|
32 |
class CFSMailBox;
|
|
33 |
class CNcsHeaderContainer;
|
|
34 |
class CFSEmailUiLayoutHandler;
|
|
35 |
class CFreestyleEmailUiAppUi; //<cmail>
|
|
36 |
|
|
37 |
// CLASS DECLARATION
|
|
38 |
|
|
39 |
/**
|
|
40 |
* CNcsPopupListBox
|
|
41 |
*/
|
|
42 |
class CNcsPopupListBox : public CEikTextListBox,
|
|
43 |
public MEikListBoxObserver,
|
|
44 |
public MFSEmailUiContactHandlerObserver
|
|
45 |
{
|
|
46 |
public: // Constructors and destructor
|
|
47 |
|
|
48 |
/*
|
|
49 |
* @param aMailBox reference to current mailbox item
|
|
50 |
*/
|
|
51 |
static CNcsPopupListBox* NewL( const CCoeControl* aParent, CFSMailBox& aMailBox,
|
|
52 |
CNcsHeaderContainer& aHeaderContainer,
|
|
53 |
TBool aRemoteLookupSupported );
|
|
54 |
|
|
55 |
/*
|
|
56 |
* @param aMailBox reference to current mailbox item
|
|
57 |
*/
|
|
58 |
void ConstructL( const CCoeControl* aParent );
|
|
59 |
|
|
60 |
/*
|
|
61 |
*
|
|
62 |
*
|
|
63 |
* @param aText
|
|
64 |
*/
|
|
65 |
void InitAndSearchL( const TDesC& aText, TInt aMode = -1 );
|
|
66 |
|
|
67 |
// Destructor
|
|
68 |
virtual ~CNcsPopupListBox();
|
|
69 |
|
|
70 |
public: // from CEikTextListBox
|
|
71 |
|
|
72 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
73 |
|
|
74 |
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
|
|
75 |
|
|
76 |
void SizeChanged();
|
|
77 |
void HandleResourceChange( TInt aType );
|
|
78 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
79 |
|
|
80 |
public: // from MEikListBoxObserver
|
|
81 |
|
|
82 |
void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
|
|
83 |
|
|
84 |
public: // from MFSEmailUiContactHandlerObserver
|
|
85 |
|
|
86 |
void OperationCompleteL( TContactHandlerCmd aCmd,
|
|
87 |
const RPointerArray<CFSEmailUiClsItem>& aMatchingItems );
|
|
88 |
void OperationErrorL( TContactHandlerCmd aCmd, TInt aError );
|
|
89 |
|
|
90 |
public: // new methods for the header container
|
|
91 |
|
|
92 |
/*
|
|
93 |
*
|
|
94 |
* @param aText
|
|
95 |
*/
|
|
96 |
void SetSearchTextL( const TDesC& aText, TInt aMode = -1 );
|
|
97 |
|
|
98 |
/*
|
|
99 |
*
|
|
100 |
* @param
|
|
101 |
*/
|
|
102 |
CNcsEmailAddressObject* ReturnCurrentEmailAddressLC();
|
|
103 |
|
|
104 |
/*
|
|
105 |
*
|
|
106 |
*
|
|
107 |
*/
|
|
108 |
void SetPopupMaxRect( const TRect& aPopupMaxRect );
|
|
109 |
|
|
110 |
/*
|
|
111 |
*
|
|
112 |
*
|
|
113 |
*/
|
|
114 |
TBool IsPopupEmpty() const;
|
|
115 |
|
|
116 |
|
|
117 |
/*
|
|
118 |
*
|
|
119 |
*
|
|
120 |
*/
|
|
121 |
TBool IsRemoteLookupItemSelected() const;
|
|
122 |
|
|
123 |
/*
|
|
124 |
* Returs reference to current cls items array
|
|
125 |
*
|
|
126 |
* @return RPointerArray<CFSEmailUiClsItem>& reference to current cls items array
|
|
127 |
*/
|
|
128 |
const RPointerArray<CFSEmailUiClsItem>& CurrentPopupClsItemsArray() const;
|
|
129 |
|
|
130 |
/*
|
|
131 |
* Return index of the "Search from remote" item in the list
|
|
132 |
*
|
|
133 |
* @return iRemoteLookupItemPos value;
|
|
134 |
*/
|
|
135 |
TInt RemoteLookupItemPos() const;
|
|
136 |
|
|
137 |
/*
|
|
138 |
* Conveniency method to get Layout handler reference.
|
|
139 |
*/
|
|
140 |
CFSEmailUiLayoutHandler& LayoutHandler() const;
|
|
141 |
|
|
142 |
private: // to populate new list
|
|
143 |
|
|
144 |
void SetListItemsFromArrayL();
|
|
145 |
|
|
146 |
TInt RoundToItemHeight(const TInt aPopupHeight) const;
|
|
147 |
|
|
148 |
void SetPopupRect();
|
|
149 |
|
|
150 |
void SetScrollBarVisibilityL();
|
|
151 |
|
|
152 |
void SetRemoteLookupItemFirstToTheListL();
|
|
153 |
|
|
154 |
enum TRemoteLookupItemMoveDirection
|
|
155 |
{
|
|
156 |
ERemoteLookupItemUp,
|
|
157 |
ERemoteLookupItemDown
|
|
158 |
};
|
|
159 |
|
|
160 |
void MoveRemoteLookupItemL( TRemoteLookupItemMoveDirection aDirection );
|
|
161 |
|
|
162 |
void CreateTextArrayAndSetToTheListboxL( const TBool& aResetIfExists );
|
|
163 |
|
|
164 |
private:
|
|
165 |
|
|
166 |
CNcsPopupListBox( CNcsHeaderContainer& aHeaderContainer,
|
|
167 |
TBool aRemoteLookupSupported, CFSMailBox& aMailbox );
|
|
168 |
|
|
169 |
virtual void CreateItemDrawerL();
|
|
170 |
|
|
171 |
void UpdateListL();
|
|
172 |
|
|
173 |
void UpdateTextColors();
|
|
174 |
|
|
175 |
// From CCoeControl.
|
|
176 |
void Draw( const TRect& aRect ) const;
|
|
177 |
|
|
178 |
private: // data
|
|
179 |
|
|
180 |
CNcsHeaderContainer& iHeaderContainer;
|
|
181 |
|
|
182 |
CAknsFrameBackgroundControlContext* iBackgroundContext;
|
|
183 |
|
|
184 |
RPointerArray<CFSEmailUiClsItem> iMatchingItems;
|
|
185 |
|
|
186 |
CFSEmailUiContactHandler* iContactHandler; // Owned
|
|
187 |
CFSMailBox& iMailBox;
|
|
188 |
|
|
189 |
TRect iPopupMaxRect;
|
|
190 |
|
|
191 |
CDesCArray* iItemTextsArray;
|
|
192 |
HBufC* iCurrentSearchText;
|
|
193 |
TInt iRemoteLookupItemPos;
|
|
194 |
|
|
195 |
TBool iRemoteLookupSupported;
|
|
196 |
TBool iCachingInProgress;
|
|
197 |
|
|
198 |
CFreestyleEmailUiAppUi* iAppUi; //<cmail> not owned
|
|
199 |
};
|
|
200 |
|
|
201 |
|
|
202 |
/**
|
|
203 |
* CNcsListItemDrawer
|
|
204 |
*/
|
|
205 |
class CNcsListItemDrawer: public CListItemDrawer
|
|
206 |
{
|
|
207 |
public: // constructor
|
|
208 |
CNcsListItemDrawer( const CNcsPopupListBox& aListBox );
|
|
209 |
|
|
210 |
protected: // from CListItemDrawer
|
|
211 |
void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
|
|
212 |
TBool aItemIsCurrent, TBool aViewIsEmphasized,
|
|
213 |
TBool aViewIsDimmed, TBool aItemIsSelected ) const;
|
|
214 |
|
|
215 |
private: // new methods
|
|
216 |
void DrawPartOfItem( const TRect& aItemRect, const CFont& aFont,
|
|
217 |
TInt aStartPos, TInt aLength, const TDesC& aDes,
|
|
218 |
TBool aUnderlined, TInt aBaselineOffsetFromTop ) const;
|
|
219 |
|
|
220 |
private: // data
|
|
221 |
const CNcsPopupListBox& iListBox;
|
|
222 |
};
|
|
223 |
|
|
224 |
|
|
225 |
#endif // CNCSPOPUPLISTBOX_H
|
|
226 |
|
|
227 |
|
|
228 |
// End of File
|