|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 memory entry defaults dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2MEMORYENTRYDEFAULTSDLG_H |
|
20 #define CPBK2MEMORYENTRYDEFAULTSDLG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknPopup.h> // CAknPopupList |
|
24 #include <MPbk2DefaultAttributeProcessObserver.h> |
|
25 #include <VPbkFieldTypeSelectorFactory.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CEikColumnListBox; |
|
29 class CPbk2PresentationContact; |
|
30 class CVPbkContactManager; |
|
31 class CPbk2DefaultAttributeProcess; |
|
32 class MVPbkStoreContactField; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Phonebook 2 memory entry defaults dialog. |
|
38 * This is a custom popup for Phonebook 2 application's |
|
39 * contacts' default settings. |
|
40 * |
|
41 * Responsible for: |
|
42 * - populating the list box with correct content, this |
|
43 * is difficult since supported defaults are heavily variated |
|
44 * - setting or removing the default attributes to/from the contact |
|
45 * by driving default attribute processor |
|
46 */ |
|
47 class CPbk2MemoryEntryDefaultsDlg : |
|
48 public CAknPopupList, |
|
49 public MPbk2DefaultAttributeProcessObserver |
|
50 { |
|
51 public: // Construction and destruction |
|
52 |
|
53 /** |
|
54 * Creates a new instance of this class. |
|
55 * |
|
56 * @param aContact Contact whose defaults are chosen. |
|
57 * @param aManager Virtual Phonebook contact manager. |
|
58 * @return A new instance of this class. |
|
59 */ |
|
60 IMPORT_C static CPbk2MemoryEntryDefaultsDlg* NewL( |
|
61 CPbk2PresentationContact& aContact, |
|
62 CVPbkContactManager& aManager ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 * Also cancels and dismisses this popup list, in other words makes |
|
67 * ExecuteLD return as if cancel was pressed. |
|
68 */ |
|
69 ~CPbk2MemoryEntryDefaultsDlg(); |
|
70 |
|
71 public: // Interface |
|
72 |
|
73 /** |
|
74 * Runs the dialog. |
|
75 */ |
|
76 IMPORT_C void ExecuteLD(); |
|
77 |
|
78 private: // From CAknPopupList |
|
79 void ProcessCommandL( |
|
80 TInt aCommandId ); |
|
81 void HandleListBoxEventL( |
|
82 CEikListBox* aListBox, |
|
83 TListBoxEvent aEventType ); |
|
84 |
|
85 private: // From MPbk2DefaultAttributeProcessObserver |
|
86 void AttributeProcessCompleted(); |
|
87 void AttributeProcessFailed( |
|
88 TInt aErrorCode ); |
|
89 |
|
90 private: // Implementation |
|
91 CPbk2MemoryEntryDefaultsDlg( |
|
92 CPbk2PresentationContact& aContact, |
|
93 CVPbkContactManager& aManager ); |
|
94 void ConstructL(); |
|
95 void CreateLinesL() const; |
|
96 TBool DefaultsAssignPopupL( |
|
97 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ); |
|
98 void FixIndex( |
|
99 TInt& aIndex ) const; |
|
100 TBool IsSupported( |
|
101 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const; |
|
102 TBool IsAvailableL( |
|
103 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const; |
|
104 void SetDefaultL( |
|
105 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID, |
|
106 MVPbkStoreContactField& aField ); |
|
107 void RemoveDefaultL( |
|
108 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ); |
|
109 void CreateTableOfDefaultsL(); |
|
110 void ReadDefaultsFromRepositoryL(); |
|
111 |
|
112 private: // Data |
|
113 /// Ref: The contact |
|
114 CPbk2PresentationContact& iContact; |
|
115 /// Ref: Virtual Phonebook contact manager |
|
116 CVPbkContactManager& iManager; |
|
117 /// Own: Default selection listbox |
|
118 CEikFormattedCellListBox* iListBox; |
|
119 /// Ref: Referred TBool is set ETrue in destructor |
|
120 TBool* iDestroyedPtr; |
|
121 /// Own: Contact field the default is assigned to |
|
122 MVPbkStoreContactField* iField; |
|
123 /// Own: Attribute set/remove process |
|
124 CPbk2DefaultAttributeProcess* iAttributeProcess; |
|
125 /// Own: Local variation flags |
|
126 TInt iLVFlags; |
|
127 /// Own: Table of used Defaults item |
|
128 CArrayFixFlat<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>* iDefaultsTable; |
|
129 /// Own: Indicates if focus has been dragged around the list, helps with single tap launching |
|
130 TBool iHasBeenDragged; |
|
131 }; |
|
132 |
|
133 #endif // CPBK2MEMORYENTRYDEFAULTSDLG_H |
|
134 |
|
135 // End of File |