|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Methods for Server Profiles View |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "NSmlDMSyncAppUi.h" |
|
21 #include "NSmlDMProfilesView.h" |
|
22 #include "NSmlDMProfilesContainer.h" |
|
23 #include <NSmlDMSync.rsg> |
|
24 #include <featmgr.h> |
|
25 #include "NSmlDMSyncDebug.h" |
|
26 |
|
27 #include <centralrepository.h> |
|
28 #include "NSmlDMSyncPrivateCRKeys.h" |
|
29 |
|
30 #include <e32property.h> |
|
31 #include "nsmldmsyncinternalpskeys.h" |
|
32 #include "NSmlDMFotaView.h" |
|
33 // ========================== MEMBER FUNCTIONS ================================= |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CNSmlDMProfilesView::ConstructL |
|
37 // Symbian 2nd phase constructor can leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CNSmlDMProfilesView::ConstructL() |
|
41 { |
|
42 FLOG( "[OMADM]\t CNSmlDMProfilesView::ConstructL()" ); |
|
43 |
|
44 BaseConstructL( R_SMLSYNC_PROFILES_VIEW ); |
|
45 |
|
46 FLOG( "[OMADM]\t CNSmlDMProfilesView::ConstructL() completed" ); |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Destructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CNSmlDMProfilesView::~CNSmlDMProfilesView() |
|
55 { |
|
56 FLOG( "[OMADM] CNSmlDMProfilesView::~CNSmlDMProfilesView" ); |
|
57 if ( iContainer ) |
|
58 { |
|
59 AppUi()->RemoveFromStack( iContainer ); |
|
60 } |
|
61 delete iContainer; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CNSmlDMProfilesView::RefreshL |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CNSmlDMProfilesView::RefreshL() |
|
69 { |
|
70 FLOG( "[OMADM]\t CNSmlDMProfilesView::RefreshListBox()" ); |
|
71 |
|
72 if ( iContainer ) |
|
73 { |
|
74 iContainer->RefreshL(); |
|
75 } |
|
76 FLOG( "[OMADM]\t CNSmlDMProfilesView::RefreshListBox() completed" ); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CNSmlDMProfilesView::Id |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 TUid CNSmlDMProfilesView::Id() const |
|
84 { |
|
85 return KNSmlDMProfilesViewId; |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CNSmlDMProfilesView::HandleCommandL |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CNSmlDMProfilesView::HandleCommandL( TInt aCommand ) |
|
93 { |
|
94 FLOG( "[OMADM]\t CNSmlDMProfilesView::HandleCommandL()" ); |
|
95 |
|
96 switch ( aCommand ) |
|
97 { |
|
98 |
|
99 case EAknSoftkeyBack: |
|
100 { |
|
101 TInt value = EFalse; //IAD: Making DM Idle |
|
102 TInt r1 = RProperty::Set(KPSUidNSmlDMSyncApp,KDMIdle,value); |
|
103 AppUi()->ActivateLocalViewL( KNSmlDMFotaViewId ); |
|
104 break; |
|
105 } |
|
106 |
|
107 case EAknCmdExit: |
|
108 case EEikCmdExit: |
|
109 { |
|
110 STATIC_CAST( CNSmlDMSyncAppUi*, iEikonEnv->EikAppUi() )->CloseGs(); |
|
111 break; |
|
112 } |
|
113 |
|
114 default: |
|
115 { |
|
116 AppUi()->HandleCommandL( aCommand ); |
|
117 break; |
|
118 } |
|
119 } |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CNSmlDMProfilesView::DoActivateL |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 void CNSmlDMProfilesView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
127 TUid /*aCustomMessageId*/, |
|
128 const TDesC8& /*aCustomMessage*/) |
|
129 { |
|
130 FLOG( "[OMADM]\t CNSmlDMProfilesView::DoActivateL()" ); |
|
131 |
|
132 MenuBar()->SetContextMenuTitleResourceId( |
|
133 R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW ); |
|
134 |
|
135 iContainer = CNSmlDMProfilesContainer::NewL( this, ClientRect() ); |
|
136 AppUi()->AddToStackL( *this, iContainer ); |
|
137 |
|
138 CAknTitlePane* titlePane = |
|
139 (CAknTitlePane*)(AppUi()->StatusPane())->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
140 HBufC* titleText = iEikonEnv->AllocReadResourceLC( R_SML_PROFILES_TITLE ); |
|
141 titlePane->SetTextL( titleText->Des() ); |
|
142 CleanupStack::PopAndDestroy(titleText); |
|
143 |
|
144 |
|
145 FLOG( "[OMADM]\t CNSmlDMProfilesView::DoActivateL() completed" ); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CNSmlDMProfilesView::DoDeactivate |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void CNSmlDMProfilesView::DoDeactivate() |
|
153 { |
|
154 FLOG( "[OMADM]\t CNSmlDMProfilesView::DoDeactivate()" ); |
|
155 |
|
156 if ( iContainer ) |
|
157 { |
|
158 AppUi()->RemoveFromStack( iContainer ); |
|
159 } |
|
160 |
|
161 delete iContainer; |
|
162 iContainer = NULL; |
|
163 |
|
164 FLOG( "[OMADM]\t CNSmlDMProfilesView::DoDeactivate() completed" ); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CNSmlDMProfilesView::DynInitMenuPaneL |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CNSmlDMProfilesView::DynInitMenuPaneL( TInt aResourceID, |
|
172 CEikMenuPane* aMenuPane) |
|
173 { |
|
174 FLOG( "[OMADM] CNSmlDMProfilesView::DynInitMenuPaneL" ); |
|
175 TInt configFlags( 0 ); |
|
176 TInt retval( -1 ); |
|
177 CRepository* centrep = NULL; |
|
178 TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); |
|
179 if ( centrep ) |
|
180 { |
|
181 retval = centrep->Get( KNSmlDMEnableConnectMenuKey, configFlags ); |
|
182 delete centrep; |
|
183 } |
|
184 if ( err == KErrNone ) |
|
185 { |
|
186 if ( retval != KErrNone ) |
|
187 User::Leave( retval ); |
|
188 } |
|
189 else |
|
190 { |
|
191 User::Leave( err ); |
|
192 } |
|
193 if ( aResourceID == R_SMLSYNC_MENU_COMMON && |
|
194 ! FeatureManager::FeatureSupported( KFeatureIdHelp )) |
|
195 { |
|
196 aMenuPane->SetItemDimmed( EAknCmdHelp , ETrue ); |
|
197 } |
|
198 if ( aResourceID == R_SMLSYNC_MENU_PROFILES_VIEW |
|
199 || aResourceID == R_SMLSYNC_CONTXT_MENU_PROFILES_VIEW ) |
|
200 { |
|
201 CNSmlDMSyncDocument* doc = STATIC_CAST( CNSmlDMSyncDocument*, |
|
202 AppUi()->Document() ); |
|
203 if ( iContainer->iProfilesListBox->Model()->NumberOfItems() == 0 ) |
|
204 { |
|
205 aMenuPane->DeleteMenuItem( ENSmlMenuCmdStartSync ); |
|
206 aMenuPane->DeleteMenuItem( ENSmlMenuCmdOpenLog ); |
|
207 aMenuPane->DeleteMenuItem( ENSmlMenuCmdOpenSettings ); |
|
208 |
|
209 if ( aResourceID == R_SMLSYNC_MENU_PROFILES_VIEW ) |
|
210 { |
|
211 aMenuPane->DeleteMenuItem( ENSmlMenuCmdEraseProfile ); |
|
212 } |
|
213 } |
|
214 else |
|
215 { |
|
216 doc->SetCurrentIndex( |
|
217 iContainer->iProfilesListBox->CurrentItemIndex()); |
|
218 if((doc->ProfileItem()->iProfileLocked)) |
|
219 { |
|
220 aMenuPane->SetItemDimmed( ENSmlMenuCmdOpenSettings , ETrue); |
|
221 if(aResourceID == R_SMLSYNC_MENU_PROFILES_VIEW) |
|
222 aMenuPane->SetItemDimmed( ENSmlMenuCmdEraseProfile , ETrue); |
|
223 } |
|
224 if(!(doc->ProfileItem()->iDeleteAllowed)&& |
|
225 aResourceID == R_SMLSYNC_MENU_PROFILES_VIEW) |
|
226 { |
|
227 aMenuPane->SetItemDimmed( ENSmlMenuCmdEraseProfile , ETrue); |
|
228 } |
|
229 if ( !(doc->ProfileItem()->iSynced) ) |
|
230 { |
|
231 aMenuPane->SetItemDimmed( ENSmlMenuCmdOpenLog, ETrue ); |
|
232 if ( configFlags != 1) |
|
233 aMenuPane->SetItemDimmed( ENSmlMenuCmdStartSync, ETrue ); |
|
234 } |
|
235 if ( configFlags != 1) |
|
236 { |
|
237 aMenuPane->SetItemDimmed( ENSmlMenuCmdStartSync, ETrue ); |
|
238 } |
|
239 } |
|
240 } |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CNSmlDMProfilesView::HandleForegroundEventL |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 void CNSmlDMProfilesView::HandleForegroundEventL(TBool aForeground) |
|
248 { |
|
249 FLOG( "CNSmlDMProfilesView::HandleForegroundEventL():Begin" ); |
|
250 if( !aForeground ) |
|
251 { |
|
252 FLOG("CNSmlDMProfilesView::HandleForegroundEventL() not i n FG :end"); |
|
253 return; |
|
254 } |
|
255 else |
|
256 { |
|
257 STATIC_CAST( CNSmlDMSyncAppUi*, iEikonEnv->EikAppUi())->CheckFotaDlL(); |
|
258 } |
|
259 |
|
260 |
|
261 // For Application Management View switching |
|
262 |
|
263 if(aForeground) |
|
264 { |
|
265 FLOG("CNSmlDMProfilesView::HandleForegroundEventL() For AM View Start"); |
|
266 STATIC_CAST( CNSmlDMSyncAppUi*, iEikonEnv->EikAppUi())->CheckAMDlL(); |
|
267 FLOG("CNSmlDMProfilesView::HandleForegroundEventL() For AM View End"); |
|
268 } |
|
269 CAknView::HandleForegroundEventL(aForeground); |
|
270 FLOG( "[OMADM]\t CNSmlDMProfilesView::HandleForegroundEventL():completed" ); |
|
271 } |
|
272 |
|
273 // End of File |