25
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 classes CESMRNcsPopupListBox, CESMRNcsListItemDrawer
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CESMRNCSPOPUPLISTBOX_H
|
|
19 |
#define CESMRNCSPOPUPLISTBOX_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <fbs.h>
|
|
24 |
#include <aknlists.h>
|
|
25 |
|
|
26 |
#include "mesmrcontacthandlerobserver.h"
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CESMRNcsEmailAddressObject;
|
|
30 |
class CAknsBasicBackgroundControlContext;
|
|
31 |
class CESMRContactHandler;
|
|
32 |
class CFSMailBox;
|
|
33 |
|
|
34 |
// CLASS DECLARATION
|
|
35 |
|
|
36 |
/**
|
|
37 |
* CESMRNcsPopupListBox is the litbox that is displayed when user types
|
|
38 |
* text to attendee and field and contacts are searched. this class handles
|
|
39 |
* displaying and updating the list of contacts email addresses
|
|
40 |
*/
|
|
41 |
NONSHARABLE_CLASS( CESMRNcsPopupListBox ) : public CEikTextListBox,
|
|
42 |
public MESMRContactHandlerObserver
|
|
43 |
{
|
|
44 |
public: // Constructors and destructor
|
|
45 |
/**
|
|
46 |
* Creates new CESMRNcsPopupListBox object. Ownership
|
|
47 |
* is transferred to caller.
|
|
48 |
* @param aParent set parent control of this class
|
|
49 |
* @param aContactHandler pointer to contact handles class
|
|
50 |
* @return Pointer to created object,
|
|
51 |
*/
|
|
52 |
static CESMRNcsPopupListBox* NewL( const CCoeControl* aParent,
|
|
53 |
CESMRContactHandler& aContactHandler );
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Second phase constructor
|
|
57 |
* @param aParent set parent control of this class
|
|
58 |
*/
|
|
59 |
void ConstructL( const CCoeControl* aParent );
|
|
60 |
|
|
61 |
/**
|
|
62 |
* C++ Destructor.
|
|
63 |
*/
|
|
64 |
virtual ~CESMRNcsPopupListBox();
|
|
65 |
|
|
66 |
public: // from CCoeControl
|
|
67 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
68 |
virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
|
69 |
void SizeChanged();
|
|
70 |
|
|
71 |
public: // from ContactHandlerObserver
|
|
72 |
void OperationCompleteL(
|
|
73 |
TContactHandlerCmd aCmd,
|
|
74 |
const RPointerArray<CESMRClsItem>* aMatchingItems );
|
|
75 |
void OperationErrorL( TContactHandlerCmd aCmd, TInt aError );
|
|
76 |
|
|
77 |
public: // new methods for the header container
|
|
78 |
/**
|
|
79 |
* Start searching contacts for teh email addresses using a string
|
|
80 |
* @param aText start contacts database search with this string
|
|
81 |
*/
|
|
82 |
void InitAndSearchL( const TDesC& aText );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Start searching contacts for teh email addresses using a string
|
|
86 |
* @param aText start contacts database search with this string
|
|
87 |
*/
|
|
88 |
void SetSearchTextL( const TDesC& aText );
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Get the currently selected email/contact address object
|
|
92 |
* @return current selected email/contact address object
|
|
93 |
*/
|
|
94 |
CESMRNcsEmailAddressObject* ReturnCurrentEmailAddressLC();
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Set maximum area on screen for displaying the popuplistbox
|
|
98 |
* @param aPopupMaxRect area rectangle
|
|
99 |
*/
|
|
100 |
void SetPopupMaxRectL( const TRect& aPopupMaxRect );
|
|
101 |
|
|
102 |
/**
|
|
103 |
* check if popup has any items
|
|
104 |
* @return check if it's empty
|
|
105 |
*/
|
|
106 |
TBool IsPopupEmpty() const;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Test if remote look up item is selected
|
|
110 |
*/
|
|
111 |
TBool IsRemoteLookupItemSelected() const;
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Returs reference to current cls items array
|
|
115 |
* @return RPointerArray<CFSEmailUiClsItem>& reference to current cls items array
|
|
116 |
*/
|
|
117 |
const RPointerArray<CESMRClsItem>& CurrentPopupClsItemsArray() const;
|
|
118 |
|
|
119 |
/**
|
|
120 |
* @return iRMLUItemPosition value;
|
|
121 |
*/
|
|
122 |
TInt RMLUItemPosition() const;
|
|
123 |
|
|
124 |
private: // Implementation
|
|
125 |
enum TRemoteLookupItemMoveDirection
|
|
126 |
{
|
|
127 |
ERemoteLookupItemUp,
|
|
128 |
ERemoteLookupItemDown
|
|
129 |
};
|
|
130 |
void SetListItemsFromArrayL();
|
|
131 |
void SetPopupHeightL();
|
|
132 |
void SetRemoteLookupItemLastToTheListL();
|
|
133 |
void CreateTextArrayAndSetToTheListboxL();
|
|
134 |
|
|
135 |
private:
|
|
136 |
CESMRNcsPopupListBox( CESMRContactHandler& aContactHandler );
|
|
137 |
virtual void CreateItemDrawerL();
|
|
138 |
|
|
139 |
private: // data
|
|
140 |
CAknsBasicBackgroundControlContext* iBaseBackroundContext; //own
|
|
141 |
RPointerArray<CESMRClsItem> iMatchingArray; //own
|
|
142 |
CDesCArray* iItemTextsArray;//own
|
|
143 |
HBufC* iCurrentSearchText;//own
|
|
144 |
CFSMailBox* iMailBox;//not own
|
|
145 |
CESMRContactHandler& iContactHandler;//not own
|
|
146 |
TRect iPopupMaxRect;
|
|
147 |
TInt iRMLUItemPosition;
|
|
148 |
TBool iRemoteLookupSupported;
|
|
149 |
};
|
|
150 |
|
|
151 |
// CLASS DECLARATION
|
|
152 |
|
|
153 |
/**
|
|
154 |
* CESMRNcsListItemDrawer handles drawing a single contact/address
|
|
155 |
* item on the CESMRNcsPopupListBox
|
|
156 |
*/
|
|
157 |
NONSHARABLE_CLASS( CESMRNcsListItemDrawer ) : public CListItemDrawer
|
|
158 |
{
|
|
159 |
public:
|
|
160 |
/**
|
|
161 |
* Constructor
|
|
162 |
* @param aListBox reference to the list box where the object is located
|
|
163 |
*/
|
|
164 |
CESMRNcsListItemDrawer( CESMRNcsPopupListBox& aListBox );
|
|
165 |
|
|
166 |
private: // from CListItemDrawer
|
|
167 |
void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
|
|
168 |
TBool aItemIsCurrent, TBool aViewIsEmphasized,
|
|
169 |
TBool aViewIsDimmed, TBool aItemIsSelected ) const;
|
|
170 |
|
|
171 |
private:
|
|
172 |
void DoDrawActualItemL( TInt aItemIndex, const TRect& aActualItemRect,
|
|
173 |
TBool aItemIsCurrent, TBool aViewIsEmphasized,
|
|
174 |
TBool aViewIsDimmed, TBool aItemIsSelected ) const;
|
|
175 |
|
|
176 |
void DrawPartOfItem( const TRect& aItemRect, const CFont& aFont,
|
|
177 |
TInt aStartPos, TInt aLength, const TDesC& aDes,
|
|
178 |
TBool aUnderlined, TInt aBaseline ) const;
|
|
179 |
|
|
180 |
private: // Implementation
|
|
181 |
void DrawPopUpBackGroundL( const TRect& aActualItemRect ) const;
|
|
182 |
void DrawPopUpSelectorL( const TRect& aActualItemRect ) const;
|
|
183 |
void DrawPopUpTextL( TInt aItemIndex, const TRect& aActualItemRect ) const;
|
|
184 |
|
|
185 |
private: //data
|
|
186 |
|
|
187 |
CESMRNcsPopupListBox& iListBox;
|
|
188 |
};
|
|
189 |
|
|
190 |
|
|
191 |
#endif // CESMRNCSPOPUPLISTBOX_H
|
|
192 |
|
|
193 |
|
|
194 |
// End of File
|