|
1 /* |
|
2 * Copyright (c) 2007-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: Implementation of auto setting default for voice call |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMSSETVOICECALLDEFAULT_H_ |
|
19 #define CMSSETVOICECALLDEFAULT_H_ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <mvpbksinglecontactoperationobserver.h> |
|
23 #include <mvpbkcontactattributemanager.h> |
|
24 #include <mvpbkcontactstoreobserver.h> |
|
25 #include <vpbkfieldtype.hrh> |
|
26 #include <mvpbkcontactobserver.h> |
|
27 #include <mvpbkbatchoperationobserver.h> |
|
28 |
|
29 class CmsSetVoiceCallDefault: |
|
30 public CBase, |
|
31 public MVPbkSetAttributeObserver, |
|
32 public MVPbkContactObserver |
|
33 { |
|
34 public: |
|
35 |
|
36 enum TCmsVoiceCallPriority |
|
37 { |
|
38 ECCACommLauncherCallMobile = 0, |
|
39 ECCACommLauncherCallMobileHome, |
|
40 ECCACommLauncherCallMobileWork, |
|
41 ECCACommLauncherCallTelephone, |
|
42 ECCACommLauncherCallTelephoneWork, |
|
43 ECCACommLauncherCallTelephoneHome, |
|
44 ECCACommLauncherCallCarPhone, |
|
45 ECCACommLauncherCallAssistant, |
|
46 ECCACommLauncherCallLast |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Two phased constructor. |
|
51 */ |
|
52 static CmsSetVoiceCallDefault* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CmsSetVoiceCallDefault(); |
|
58 |
|
59 |
|
60 private: // From MVPbkSetAttributeObserver |
|
61 |
|
62 void AttributeOperationComplete( |
|
63 MVPbkContactOperationBase& aOperation ); |
|
64 void AttributeOperationFailed( |
|
65 MVPbkContactOperationBase& aOperation, |
|
66 TInt aError ); |
|
67 |
|
68 public: |
|
69 |
|
70 void SetVoiceCallDefaultL( MVPbkStoreContact* aContact, CVPbkContactManager* aContactManager ); |
|
71 |
|
72 private: // From MVPbkContactObserver |
|
73 |
|
74 void ContactOperationCompleted( |
|
75 TContactOpResult aResult ); |
|
76 |
|
77 void ContactOperationFailed( |
|
78 TContactOp aOpCode, |
|
79 TInt aErrorCode, |
|
80 TBool aErrorNotified ); |
|
81 |
|
82 private: |
|
83 |
|
84 /** |
|
85 * ConstructL |
|
86 */ |
|
87 void ConstructL(); |
|
88 |
|
89 CmsSetVoiceCallDefault(); |
|
90 |
|
91 private: // New implemetations |
|
92 |
|
93 /* Lock contact before setting default |
|
94 * @param - none |
|
95 * @return - none |
|
96 */ |
|
97 void LockContactL(); |
|
98 |
|
99 |
|
100 /* Do set default atrribut |
|
101 * @param: aDefaultType - default type |
|
102 * @return: aIndex - the field index which will be set default attribute |
|
103 */ |
|
104 void DoSetDefaultL( TVPbkDefaultType aDefaultType, TInt aIndex ); |
|
105 |
|
106 |
|
107 /* |
|
108 * Check if default setting is needed |
|
109 * if the contact has no call field |
|
110 * or call default has been set, then the setting doesn't need. |
|
111 * @return: True for setting needed, otherwize return false. |
|
112 */ |
|
113 TBool IsSettingDefaultNeededL(); |
|
114 |
|
115 /* Get call field resource id |
|
116 * @param: aPriority - setting priority |
|
117 * @return: field resource id |
|
118 */ |
|
119 TInt GetCallFieldResourceId( TInt aPriority ); |
|
120 |
|
121 /* |
|
122 * Get field index from field resource id |
|
123 * @param: aResourceId - field resource id |
|
124 * @param: aIndex - the field index |
|
125 * @return: Ture for find the specified field, otherwize return false. |
|
126 */ |
|
127 TBool FieldIndex( TInt aResourceId, TInt& aIndex ); |
|
128 |
|
129 /* Default setting complete |
|
130 * @param - none |
|
131 * @return - none |
|
132 */ |
|
133 void DefaultSettingCompleteL(); |
|
134 |
|
135 /* Process finished |
|
136 * @param:aError - error id |
|
137 * @return - none |
|
138 */ |
|
139 void ProcessFinished( TInt aError ); |
|
140 |
|
141 /* Handle error |
|
142 * @param:aError - error id |
|
143 * @return - none |
|
144 */ |
|
145 void HandleError( TInt aError ); |
|
146 |
|
147 /* Check if the contact is phone memory contact |
|
148 * @param: aContact - the contact to be check |
|
149 * @return: true for phone memory contact, otherwise return false |
|
150 */ |
|
151 TBool IsPhoneMemoryContact( |
|
152 const MVPbkStoreContact& aContact) const; |
|
153 |
|
154 /* |
|
155 * To set voice call default |
|
156 */ |
|
157 void ToSetVoiceCallDefaultL(); |
|
158 |
|
159 private: // Member variables |
|
160 |
|
161 // Not own: store contact |
|
162 MVPbkStoreContact* iStoreContact; |
|
163 |
|
164 // Not own: contact manager |
|
165 CVPbkContactManager* iContactManager; |
|
166 |
|
167 // Own: attribut operation |
|
168 MVPbkContactOperationBase* iSetAttributeOperation; |
|
169 |
|
170 // Own: filed index array |
|
171 RArray<TInt> iFieldIndexArray; |
|
172 |
|
173 }; |
|
174 |
|
175 #endif /* CMSSETVOICECALLDEFAULT_H_ */ |