author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 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 USIM Thin UI extension plugin. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "CPsu2ThinUIExtensionPlugin.h" |
|
21 |
||
22 |
// Phonebook 2 |
|
23 |
#include "CPsu2CopySimContactsCmd.h" |
|
24 |
#include <Pbk2USimUI.hrh> |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
25 |
#include <pbk2usimuires.rsg> |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
26 |
#include <pbk2commands.rsg> |
20 | 27 |
#include <MPbk2ContactUiControl.h> |
28 |
#include <MPbk2StartupMonitor.h> |
|
29 |
#include "CPsu2CheckAvailabeSimStore.h" |
|
30 |
||
31 |
// Virtual Phonebook |
|
32 |
#include <VPbkSimStoreFactory.h> |
|
33 |
#include <MVPbkSimPhone.h> |
|
34 |
#include <VPbkContactStoreUris.h> |
|
35 |
||
36 |
// System includes |
|
37 |
#include <eikmenup.h> |
|
38 |
||
39 |
#include <Pbk2Debug.h> |
|
40 |
||
41 |
/// Unnamed namespace for local definitions |
|
42 |
namespace { |
|
43 |
||
44 |
/// All stores in "SIM Memory" cascade menu |
|
45 |
const TUint32 KAllSimStores= |
|
46 |
MVPbkSimPhone::KVPbkCapsSDNSupported | |
|
47 |
MVPbkSimPhone::KVPbkCapsFDNSupported | |
|
48 |
MVPbkSimPhone::KVPbkCapsONSupported; |
|
49 |
||
50 |
/** |
|
51 |
* Dims given menu item from given menu pane. |
|
52 |
* |
|
53 |
* @param aMenuPane Menu pane where menu item resides. |
|
54 |
* @param aCommandId Id of the menu item to dim. |
|
55 |
*/ |
|
56 |
void DimMenuItem( CEikMenuPane& aMenuPane, TInt aCommandId ) |
|
57 |
{ |
|
58 |
TInt pos = KErrNotFound; |
|
59 |
if ( aMenuPane.MenuItemExists( aCommandId, pos ) ) |
|
60 |
{ |
|
61 |
aMenuPane.SetItemDimmed( aCommandId, ETrue ); |
|
62 |
} |
|
63 |
} |
|
64 |
||
65 |
} /// namespace |
|
66 |
||
67 |
||
68 |
// -------------------------------------------------------------------------- |
|
69 |
// CPsu2CopySimContactsCmd::CPsu2CopySimContactsCmd |
|
70 |
// -------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
CPsu2ThinUIExtensionPlugin::CPsu2ThinUIExtensionPlugin() |
|
73 |
{ |
|
74 |
} |
|
75 |
||
76 |
// -------------------------------------------------------------------------- |
|
77 |
// CPsu2ThinUIExtensionPlugin::~CPsu2ThinUIExtensionPlugin |
|
78 |
// -------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
CPsu2ThinUIExtensionPlugin::~CPsu2ThinUIExtensionPlugin() |
|
81 |
{ |
|
82 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
83 |
("CPsu2ThinUIExtensionPlugin::~CPsu2ThinUIExtensionPlugin(0x%x)"), this); |
|
84 |
||
85 |
delete iStoreChecker; |
|
86 |
delete iCopySimContactsCmd; |
|
87 |
delete iPhone; |
|
88 |
} |
|
89 |
||
90 |
// -------------------------------------------------------------------------- |
|
91 |
// CPsu2ThinUIExtensionPlugin::NewL |
|
92 |
// -------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
CPsu2ThinUIExtensionPlugin* CPsu2ThinUIExtensionPlugin::NewL() |
|
95 |
{ |
|
96 |
CPsu2ThinUIExtensionPlugin* self = |
|
97 |
new( ELeave ) CPsu2ThinUIExtensionPlugin; |
|
98 |
CleanupStack::PushL( self ); |
|
99 |
self->ConstructL(); |
|
100 |
CleanupStack::Pop( self ); |
|
101 |
return self; |
|
102 |
} |
|
103 |
||
104 |
// -------------------------------------------------------------------------- |
|
105 |
// CPsu2ThinUIExtensionPlugin::ConstructL |
|
106 |
// -------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
void CPsu2ThinUIExtensionPlugin::ConstructL() |
|
109 |
{ |
|
110 |
iServiceTable.Reset(); |
|
111 |
iPhone = VPbkSimStoreFactory::CreatePhoneL(); |
|
112 |
iPhone->OpenL( *this ); |
|
113 |
} |
|
114 |
||
115 |
// -------------------------------------------------------------------------- |
|
116 |
// CPsu2ThinUIExtensionPlugin::DynInitMenuPaneL |
|
117 |
// -------------------------------------------------------------------------- |
|
118 |
// |
|
119 |
void CPsu2ThinUIExtensionPlugin::DynInitMenuPaneL |
|
120 |
( TInt aResourceId, CEikMenuPane* aMenuPane, |
|
121 |
MPbk2ContactUiControl& aControl ) |
|
122 |
{ |
|
123 |
switch (aResourceId) |
|
124 |
{ |
|
125 |
case R_PHONEBOOK2_NAMESLIST_OTHER_MEMORIES_MENU_PLACEHOLDER: |
|
126 |
{ |
|
127 |
if ( iServiceTable.IsOff( KAllSimStores ) || |
|
128 |
aControl.ContactsMarked() || |
|
129 |
( iStoreChecker && |
|
130 |
!iStoreChecker->IsContactsAvailabe( |
|
131 |
VPbkContactStoreUris::SimGlobalOwnNumberUri()) && |
|
132 |
//SDN not shown in sim menu anymore (in ECE) |
|
133 |
// !iStoreChecker->IsContactsAvailabe( |
|
134 |
// VPbkContactStoreUris::SimGlobalSdnUri()) && |
|
135 |
iServiceTable.IsOff( MVPbkSimPhone::KVPbkCapsFDNSupported ) |
|
136 |
) |
|
137 |
) |
|
138 |
{ |
|
139 |
// Dim "SIM Memory" cascading menu if there are no |
|
140 |
// SIM stores to launch, or there are marked items |
|
141 |
DimMenuItem(*aMenuPane, EPsu2CmdCascadingSimMemory); |
|
142 |
} |
|
143 |
break; |
|
144 |
} |
|
145 |
||
146 |
case R_PSU2_CASCADING_SIM_MEMORY_MENU_PANE: |
|
147 |
{ |
|
148 |
// My number dimmed until index bug is corrected in SIM server |
|
149 |
if ( iServiceTable.IsOff |
|
150 |
( MVPbkSimPhone::KVPbkCapsONSupported ) || |
|
151 |
( iStoreChecker && |
|
152 |
!iStoreChecker->IsContactsAvailabe( |
|
153 |
VPbkContactStoreUris::SimGlobalOwnNumberUri() ) ) ) |
|
154 |
{ |
|
155 |
// "My Number" item |
|
156 |
DimMenuItem( *aMenuPane, EPsu2CmdLaunchOwnNumberView ); |
|
157 |
} |
|
158 |
//SDN not shown in sim menu anymore so dim it always (in ECE) |
|
159 |
// if ( iServiceTable.IsOff |
|
160 |
// ( MVPbkSimPhone::KVPbkCapsSDNSupported ) || |
|
161 |
// ( iStoreChecker && |
|
162 |
// !iStoreChecker->IsContactsAvailabe( |
|
163 |
// VPbkContactStoreUris::SimGlobalSdnUri() ) ) ) |
|
164 |
{ |
|
165 |
// "Service Dialing" item |
|
166 |
DimMenuItem( *aMenuPane, EPsu2CmdLaunchServiceDialingView ); |
|
167 |
} |
|
168 |
if ( iServiceTable.IsOff |
|
169 |
( MVPbkSimPhone::KVPbkCapsFDNSupported ) ) |
|
170 |
{ |
|
171 |
// "Fixed Dialing" item |
|
172 |
DimMenuItem( *aMenuPane, EPsu2CmdLaunchFixedDialingView ); |
|
173 |
} |
|
174 |
if ( iStoreChecker && |
|
175 |
!iStoreChecker->IsContactsAvailabe( |
|
176 |
VPbkContactStoreUris::SimGlobalAdnUri()) && |
|
177 |
!iStoreChecker->IsContactsAvailabe( |
|
178 |
VPbkContactStoreUris::SimGlobalSdnUri()) ) |
|
179 |
{ |
|
180 |
DimMenuItem( *aMenuPane, EPsu2CmdCopyToContacts ); |
|
181 |
} |
|
182 |
break; |
|
183 |
} |
|
184 |
default: |
|
185 |
{ |
|
186 |
// Do nothing |
|
187 |
break; |
|
188 |
} |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
// -------------------------------------------------------------------------- |
|
193 |
// CPsu2ThinUIExtensionPlugin::ExtensionStartupL |
|
194 |
// -------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
void CPsu2ThinUIExtensionPlugin::ExtensionStartupL |
|
197 |
( MPbk2StartupMonitor& aStartupMonitor) |
|
198 |
{ |
|
199 |
aStartupMonitor.RegisterEventsL( *this ); |
|
200 |
} |
|
201 |
||
202 |
// -------------------------------------------------------------------------- |
|
203 |
// CPsu2ThinUIExtensionPlugin::PhoneOpened |
|
204 |
// -------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
void CPsu2ThinUIExtensionPlugin::PhoneOpened( MVPbkSimPhone& aPhone ) |
|
207 |
{ |
|
208 |
iServiceTable.SetServiceTable( aPhone.ServiceTable() ); |
|
209 |
} |
|
210 |
||
211 |
// -------------------------------------------------------------------------- |
|
212 |
// CPsu2ThinUIExtensionPlugin::PhoneError |
|
213 |
// -------------------------------------------------------------------------- |
|
214 |
// |
|
215 |
void CPsu2ThinUIExtensionPlugin::PhoneError |
|
216 |
( MVPbkSimPhone& /*aPhone*/, TErrorIdentifier /*aIdentifier*/, |
|
217 |
TInt /*aError*/ ) |
|
218 |
{ |
|
219 |
iServiceTable.Reset(); |
|
220 |
} |
|
221 |
||
222 |
// -------------------------------------------------------------------------- |
|
223 |
// CPsu2ThinUIExtensionPlugin::ServiceTableUpdated |
|
224 |
// -------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
void CPsu2ThinUIExtensionPlugin::ServiceTableUpdated( TUint32 aServiceTable ) |
|
227 |
{ |
|
228 |
iServiceTable.SetServiceTable( aServiceTable ); |
|
229 |
} |
|
230 |
||
231 |
// -------------------------------------------------------------------------- |
|
232 |
// CPsu2ThinUIExtensionPlugin::FixedDiallingStatusChanged |
|
233 |
// -------------------------------------------------------------------------- |
|
234 |
// |
|
235 |
void CPsu2ThinUIExtensionPlugin::FixedDiallingStatusChanged |
|
236 |
( TInt /*aFDNStatus*/ ) |
|
237 |
{ |
|
238 |
// Do nothing |
|
239 |
} |
|
240 |
||
241 |
// -------------------------------------------------------------------------- |
|
242 |
// CPsu2ThinUIExtensionPlugin::ContactUiReadyL |
|
243 |
// -------------------------------------------------------------------------- |
|
244 |
// |
|
245 |
void CPsu2ThinUIExtensionPlugin::ContactUiReadyL |
|
246 |
( MPbk2StartupMonitor& aStartupMonitor ) |
|
247 |
{ |
|
248 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
249 |
("CPsu2ThinUIExtensionPlugin::ContactUiReadyL(0x%x) (0x%x) (0x%x)"), this, iStoreChecker, iCopySimContactsCmd); |
|
250 |
||
251 |
aStartupMonitor.DeregisterEvents( *this ); |
|
252 |
||
253 |
if ( !iCopySimContactsCmd ) |
|
254 |
{ |
|
255 |
MPbk2Command* cmd = CPsu2CopySimContactsCmd::NewL( aStartupMonitor ); |
|
256 |
cmd->ExecuteLD(); |
|
257 |
iCopySimContactsCmd = cmd; |
|
258 |
iCopySimContactsCmd->AddObserver( *this ); |
|
259 |
} |
|
260 |
||
261 |
delete iStoreChecker; //needed when alwaysOn enabled |
|
262 |
iStoreChecker = NULL; |
|
263 |
iStoreChecker = CPsu2CheckAvailabeSimStore::NewL(); |
|
264 |
} |
|
265 |
||
266 |
// -------------------------------------------------------------------------- |
|
267 |
// CPsu2ThinUIExtensionPlugin::CommandFinished |
|
268 |
// -------------------------------------------------------------------------- |
|
269 |
// |
|
270 |
void CPsu2ThinUIExtensionPlugin::CommandFinished |
|
271 |
( const MPbk2Command& /*aCommand*/ ) |
|
272 |
{ |
|
273 |
delete iCopySimContactsCmd; |
|
274 |
iCopySimContactsCmd = NULL; |
|
275 |
} |
|
276 |
||
277 |
// End of File |