|
1 /* |
|
2 * Copyright (c) 2008 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: Declaration of the class CFscAddressSelect. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFSCADDRESSSELECT_H |
|
20 #define CFSCADDRESSSELECT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <coedef.h> // TKeyResponse |
|
25 #include <w32std.h> // TKeyEvent, TEventCode |
|
26 #include "MFscDialogEliminator.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MVPbkStoreContactField; |
|
30 class CVPbkFieldTypeSelector; |
|
31 class CVPbkFieldFilter; |
|
32 class CFscSelectFieldDlg; |
|
33 class TFscAddressSelectParams; |
|
34 class MVPbkContactAttributeManager; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Address selection. |
|
40 * Responsible for selecting an appropriate contact field |
|
41 * from given contact. The selection is based on the |
|
42 * given parameters. |
|
43 */ |
|
44 class CFscAddressSelect : public CBase, public MFscDialogEliminator |
|
45 { |
|
46 public: |
|
47 // Construction and destruction |
|
48 |
|
49 /** |
|
50 * Creates a new instance of this class. |
|
51 * |
|
52 * @param aParams Address select parameters. |
|
53 * @return A new instance of this class. |
|
54 */ |
|
55 static CFscAddressSelect* NewL( |
|
56 TFscAddressSelectParams& aParams ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 * Cancels address selection query if active. |
|
61 */ |
|
62 ~CFscAddressSelect(); |
|
63 |
|
64 public: // Interface |
|
65 |
|
66 /** |
|
67 * Runs an address selection query (if necessary). |
|
68 * Note! The caller is responsible for the contact field |
|
69 * object returned. |
|
70 * |
|
71 * @return NULL if query was cancelled, selected field if |
|
72 * query was accepted. Caller takes the ownership |
|
73 * of the returned field. |
|
74 */ |
|
75 MVPbkStoreContactField* ExecuteLD(); |
|
76 |
|
77 /** |
|
78 * Exit any address selection query. Makes ExecuteLD return |
|
79 * which means this object is destroyed after this function returns! |
|
80 * |
|
81 * @param aAccept ETrue means the query selection is accepted and |
|
82 * EFalse that query is canceled. |
|
83 */ |
|
84 void AttemptExitL(TBool aAccept ); |
|
85 |
|
86 /** |
|
87 * Override to handle key events in the list query. |
|
88 * |
|
89 * @param aKeyEvent Key event. |
|
90 * @param aType Key event type. |
|
91 * @return EKeyWasConsumed if the key event was consumed, |
|
92 * EKeyWasNotConsumed otherwise. |
|
93 */ |
|
94 virtual TKeyResponse FscControlKeyEventL( |
|
95 const TKeyEvent& aKeyEvent, |
|
96 TEventCode aType ); |
|
97 |
|
98 public: // From MFscDialogEliminator |
|
99 void RequestExitL( |
|
100 TInt aCommandId ); |
|
101 void ForceExit(); |
|
102 void ResetWhenDestroyed( |
|
103 MFscDialogEliminator** aSelfPtr ); |
|
104 |
|
105 private: // Implementation |
|
106 CFscAddressSelect( |
|
107 TFscAddressSelectParams& aParams ); |
|
108 void ConstructL(); |
|
109 TBool AddressField( |
|
110 const MVPbkStoreContactField& aField ) const; |
|
111 void NoAddressesL( |
|
112 TFscAddressSelectParams aParams ) const; |
|
113 void SelectFieldL(); |
|
114 void SelectFromApplicableFieldsL(); |
|
115 TInt IndexOfDefaultFieldL(); |
|
116 TBool SelectFromDefaultFieldsL(); |
|
117 MVPbkStoreContactField* FindDefaultFieldLC(); |
|
118 void SetSelectedFieldL( |
|
119 const MVPbkStoreContactField* aField ); |
|
120 |
|
121 private: // Friends |
|
122 /// Field selection dialog for this class |
|
123 class CSelectFieldDlg; |
|
124 friend class CSelectFieldDlg; |
|
125 |
|
126 private: // Data |
|
127 /// Ref: Address select parameters |
|
128 TFscAddressSelectParams& iParams; |
|
129 /// Own: Field type selector |
|
130 CVPbkFieldTypeSelector* iFieldTypeSelector; |
|
131 /// Own: Field filter |
|
132 CVPbkFieldFilter* iFieldFilter; |
|
133 /// Own: Field selection dialog |
|
134 CFscSelectFieldDlg* iFieldDlg; |
|
135 /// Ref: Set to ETrue when the execution enters destructor |
|
136 TBool* iDestroyedPtr; |
|
137 /// Ref: The selected field |
|
138 MVPbkStoreContactField* iSelectedField; |
|
139 /// Ref: Virtual Phonebook attribute manager |
|
140 MVPbkContactAttributeManager* iAttributeManager; |
|
141 /// Own: No addresses for a name prompt text resource id |
|
142 TInt iNoAddressesForNamePromptResource; |
|
143 /// Own: No address prompt text resource id |
|
144 TInt iNoAddressesPromptResource; |
|
145 /// Own: Soft key resource id |
|
146 TInt iSoftKeyResource; |
|
147 /// Ref: Set to NULL when the execution enters destructor |
|
148 MFscDialogEliminator** iSelfPtr; |
|
149 }; |
|
150 |
|
151 #endif // CFSCADDRESSSELECT_H |
|
152 // End of File |