author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:53:46 +0300 | |
branch | RCL_3 |
changeset 130 | 67f2ed48ad91 |
parent 122 | 6cadd6867c17 |
permissions | -rw-r--r-- |
114 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
#include <mcsmenuutils.h> |
|
18 |
#include <e32property.h> |
|
19 |
#include <widgetregistryclient.h> |
|
20 |
#include "menusrvappscanner.h" |
|
21 |
#include "menusrvmmchistory.h" |
|
22 |
#include "menueng.h" |
|
23 |
#include "menuengobject.h" |
|
24 |
#include "pathinfo.h" |
|
25 |
#include "menulogger.h" |
|
26 |
#include "centralrepository.h" |
|
27 |
#include "mcssathandler.h" |
|
28 |
#include "menusrvengutils.h" |
|
29 |
#include "bautils.h" |
|
30 |
#include "menuutil.h" |
|
31 |
||
32 |
_LIT( KMenuOne, "1" ); |
|
33 |
_LIT( KMenuAttrMmcId, "mmc_id" ); |
|
34 |
_LIT( KMenuMassStorage, "mass_storage" ); |
|
35 |
_LIT( KMenuMmcHistoryFname, "mmchistory" ); |
|
36 |
||
37 |
// ==================== LOCAL FUNCTIONS ==================== |
|
38 |
||
39 |
/** |
|
40 |
* Identity function to search in an array of TMenuItems. |
|
41 |
* Identity is the ID. |
|
42 |
* @param aLeft Search term. |
|
43 |
* @param aRight Array item. |
|
44 |
* @return ETrue if ID-s match. |
|
45 |
*/ |
|
46 |
LOCAL_C TBool IdMatch( const TMenuItem& aLeft, const TMenuItem& aRight ) |
|
47 |
{ |
|
48 |
return aLeft.Id() == aRight.Id(); |
|
49 |
} |
|
50 |
||
51 |
// ==================== MEMBER FUNCTIONS ==================== |
|
52 |
||
53 |
// --------------------------------------------------------- |
|
54 |
// CMenuSrvAppScanner::NewL |
|
55 |
// --------------------------------------------------------- |
|
56 |
// |
|
57 |
CMenuSrvAppScanner* CMenuSrvAppScanner::NewL( |
|
58 |
CMenuEng& aEng, CMenuSrvEngUtils& aSrvEngUtils ) |
|
59 |
{ |
|
60 |
CMenuSrvAppScanner* scanner = new (ELeave) CMenuSrvAppScanner( |
|
61 |
aEng, aSrvEngUtils ); |
|
62 |
CleanupStack::PushL( scanner ); |
|
63 |
scanner->ConstructL(); |
|
64 |
CleanupStack::Pop( scanner ); |
|
65 |
return scanner; |
|
66 |
} |
|
67 |
||
68 |
// --------------------------------------------------------- |
|
69 |
// CMenuSrvAppScanner::~CMenuSrvAppScanner |
|
70 |
// --------------------------------------------------------- |
|
71 |
// |
|
72 |
CMenuSrvAppScanner::~CMenuSrvAppScanner() |
|
73 |
{ |
|
74 |
Cancel(); |
|
75 |
delete iMcsSatNotifier; |
|
76 |
delete iNotifier; |
|
77 |
iEng.DequeueOperation( *this ); |
|
78 |
delete iMmcHistory; |
|
79 |
iFs.Close(); |
|
80 |
||
81 |
if( iCenRepNotifyHandlerHiddenApps ) |
|
82 |
{ |
|
83 |
iCenRepNotifyHandlerHiddenApps->StopListening(); |
|
84 |
} |
|
85 |
delete iCenRepNotifyHandlerHiddenApps; |
|
86 |
||
87 |
if( iCenRepNotifyHandlerCPHiddenApps ) |
|
88 |
{ |
|
89 |
iCenRepNotifyHandlerCPHiddenApps->StopListening(); |
|
90 |
} |
|
91 |
delete iCenRepNotifyHandlerCPHiddenApps; |
|
92 |
||
93 |
if( iCenRepNotifyHandlerCPHiddenFolders ) |
|
94 |
{ |
|
95 |
iCenRepNotifyHandlerCPHiddenFolders->StopListening(); |
|
96 |
} |
|
97 |
delete iCenRepNotifyHandlerCPHiddenFolders; |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
98 |
delete iCenRepSession; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
99 |
delete iFreeSpaceObserver; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
100 |
|
114 | 101 |
} |
102 |
||
103 |
// --------------------------------------------------------- |
|
104 |
// CMenuSrvAppScanner::CMenuSrvAppScanner |
|
105 |
// --------------------------------------------------------- |
|
106 |
// |
|
107 |
CMenuSrvAppScanner::CMenuSrvAppScanner( |
|
108 |
CMenuEng& aEng, CMenuSrvEngUtils& aSrvEngUtils ) |
|
109 |
: CActive( CActive::EPriorityStandard ), iEng( aEng ), |
|
110 |
iSrvEngUtils( aSrvEngUtils ) |
|
111 |
{ |
|
112 |
CActiveScheduler::Add( this ); |
|
113 |
} |
|
114 |
||
115 |
// --------------------------------------------------------- |
|
116 |
// CMenuSrvAppScanner::ConstructL |
|
117 |
// --------------------------------------------------------- |
|
118 |
// |
|
119 |
void CMenuSrvAppScanner::ConstructL() |
|
120 |
{ |
|
121 |
iOpStatus = EFalse; |
|
122 |
User::LeaveIfError( iFs.Connect() ); |
|
123 |
TFileName path; |
|
124 |
User::LeaveIfError( iFs.PrivatePath( path ) ); |
|
125 |
TUint attribute; |
|
126 |
if( iFs.Att( path, attribute) == KErrNotFound ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
127 |
{ |
114 | 128 |
TInt mdRes = iFs.MkDirAll( path ); |
129 |
if ( mdRes != KErrNone ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
130 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
131 |
User::Leave( mdRes ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
132 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
133 |
} |
114 | 134 |
|
135 |
iMmcHistory = new (ELeave) CMenuSrvMmcHistory(); |
|
136 |
iMmcHistory->LoadL( iFs, KMenuMmcHistoryFname() ); |
|
137 |
// The notifier has its own session to apparc, instead of taking |
|
138 |
// it as argument... :( |
|
139 |
iNotifier = CApaAppListNotifier::NewL( this, CActive::EPriorityStandard ); |
|
140 |
||
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
141 |
iCenRepSession = CRepository::NewL( KCRUidMenu ); |
114 | 142 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
143 |
iCenRepNotifyHandlerHiddenApps = CCenRepNotifyHandler::NewL( |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
144 |
*this, *iCenRepSession, |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
145 |
CCenRepNotifyHandler::EStringKey, KMenuHideApplication ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
146 |
iCenRepNotifyHandlerCPHiddenApps = CCenRepNotifyHandler::NewL( |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
147 |
*this, *iCenRepSession, |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
148 |
CCenRepNotifyHandler::EStringKey, KMenuHideCPApplication ); |
114 | 149 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
150 |
iCenRepNotifyHandlerCPHiddenFolders = CCenRepNotifyHandler::NewL( |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
151 |
*this, *iCenRepSession, |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
152 |
CCenRepNotifyHandler::EStringKey, KMenuHideCPFolder ); |
114 | 153 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
154 |
iCenRepNotifyHandlerHiddenApps->StartListeningL(); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
155 |
iCenRepNotifyHandlerCPHiddenApps->StartListeningL(); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
156 |
iCenRepNotifyHandlerCPHiddenFolders->StartListeningL(); |
114 | 157 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
158 |
iMcsSatNotifier = CMcsSatNotifier::NewL( |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
159 |
this, KCRUidMenu, KMenuShowSatUI ); |
114 | 160 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
161 |
iFreeSpaceObserver = CMcsFreeSpaceObserver::NewL( *this ); |
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
162 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
163 |
//SetActive(); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
164 |
ScheduleScan(); |
114 | 165 |
//iOpStatus = ETrue; |
166 |
} |
|
167 |
||
168 |
// --------------------------------------------------------- |
|
169 |
// CMenuSrvAppScanner::RunL |
|
170 |
// --------------------------------------------------------- |
|
171 |
// |
|
172 |
void CMenuSrvAppScanner::RunL() |
|
173 |
{ |
|
174 |
User::LeaveIfError( iStatus.Int() ); // Handle errors in RunL. |
|
175 |
// AppArc app scan complete, we have the app list. |
|
176 |
// Now queue this operation to be executed by the Engine. |
|
177 |
if ( !MenuUtil::BackupInProgressL() ) |
|
178 |
{ |
|
179 |
iEng.QueueOperationL( *this ); |
|
180 |
} |
|
181 |
else |
|
182 |
{ |
|
183 |
iOpStatus = EFalse; |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
// --------------------------------------------------------- |
|
188 |
// CMenuSrvAppScanner::DoCancel |
|
189 |
// --------------------------------------------------------- |
|
190 |
// |
|
191 |
void CMenuSrvAppScanner::DoCancel() |
|
192 |
{ |
|
193 |
} |
|
194 |
||
195 |
// --------------------------------------------------------- |
|
196 |
// CMenuSrvAppScanner::RunError |
|
197 |
// --------------------------------------------------------- |
|
198 |
// |
|
199 |
TInt CMenuSrvAppScanner::RunError( TInt /*aError*/ ) |
|
200 |
{ |
|
201 |
// Ignore the error (what else could we do?). |
|
202 |
// When next AppArc update occurs, we will run again. |
|
203 |
return KErrNone; |
|
204 |
} |
|
205 |
||
206 |
// --------------------------------------------------------- |
|
207 |
// CMenuSrvAppScanner::UpdateApplicationWithHideIfInstalledItemsL |
|
208 |
// --------------------------------------------------------- |
|
209 |
// |
|
210 |
void CMenuSrvAppScanner::UpdateApplicationWithHideIfInstalledItemsL() |
|
211 |
{ |
|
212 |
TInt root; |
|
213 |
iEng.RootFolderL( root ); |
|
214 |
||
215 |
TMenuSrvAttrExistsFilter appFilter; |
|
216 |
appFilter.SetAttr( KMenuAttrHideIfInstalledUid() ); |
|
217 |
||
218 |
RArray<TMenuItem> items; |
|
219 |
CleanupClosePushL( items ); |
|
220 |
iEng.GetItemsL( items, root, &appFilter, ETrue ); |
|
221 |
||
222 |
for (TInt i=0; i < items.Count(); i++) |
|
223 |
{ |
|
224 |
TBool wasHidden; |
|
225 |
TPtrC uidTmp; |
|
226 |
||
227 |
GetHiddenFlagAndUidL( items[i].Id(), wasHidden, uidTmp ); |
|
228 |
||
229 |
HideItemIfPresentL( root, items[i].Id(), uidTmp, wasHidden ); |
|
230 |
} |
|
231 |
CleanupStack::PopAndDestroy( &items ); |
|
232 |
} |
|
233 |
||
234 |
// --------------------------------------------------------- |
|
235 |
// CMenuSrvAppScanner::GetHiddenFlagAndUidL |
|
236 |
// --------------------------------------------------------- |
|
237 |
// |
|
238 |
void CMenuSrvAppScanner::GetHiddenFlagAndUidL( TInt aId, TBool& aHidden, TPtrC& aUidStr ) |
|
239 |
{ |
|
240 |
const CMenuEngObject& object = iEng.ObjectL( aId ); |
|
241 |
aHidden = (0 != (object.Flags() & TMenuItem::EHidden)); |
|
242 |
||
243 |
TBool tmp; |
|
244 |
object.FindAttribute( KMenuAttrHideIfInstalledUid(), aUidStr, tmp); |
|
245 |
} |
|
246 |
||
247 |
// --------------------------------------------------------- |
|
248 |
// CMenuSrvAppScanner::HideAppIfExists |
|
249 |
// --------------------------------------------------------- |
|
250 |
// |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
251 |
void CMenuSrvAppScanner::HideItemIfPresentL( TInt aFolder, TInt aId, const TDesC& aUid, TBool aWasHidden ) |
114 | 252 |
{ |
253 |
TBool hideItem = EFalse; |
|
254 |
TMenuSrvAttrFilter uidAppFilter; |
|
255 |
uidAppFilter.SetAttr( KMenuAttrUid(), aUid ); |
|
256 |
||
257 |
RArray<TMenuItem> appItems; |
|
258 |
CleanupClosePushL( appItems ); |
|
259 |
iEng.GetItemsL( appItems, aFolder, &uidAppFilter, ETrue ); |
|
260 |
||
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
261 |
for (TInt i=0; i < appItems.Count(); i++) |
114 | 262 |
{ |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
263 |
if(appItems[i].Type() != KMenuTypeLink()) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
264 |
{ |
114 | 265 |
const TMenuItem& item = appItems[i]; |
266 |
||
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
267 |
TBool itemHidden = (0 != (item.Flags() & TMenuItem::EHidden)); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
268 |
TBool itemMissing = (0 != (item.Flags() & TMenuItem::EMissing)); |
114 | 269 |
if ( !itemHidden && !itemMissing ) |
270 |
{ |
|
271 |
hideItem = ETrue; |
|
272 |
} |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
273 |
} |
114 | 274 |
} |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
275 |
|
114 | 276 |
SetHiddenFlagL( aId, aWasHidden, hideItem ); |
277 |
||
278 |
CleanupStack::PopAndDestroy( &appItems ); |
|
279 |
} |
|
280 |
||
281 |
// --------------------------------------------------------- |
|
282 |
// CMenuSrvAppScanner::SetHiddenFlagL |
|
283 |
// --------------------------------------------------------- |
|
284 |
// |
|
285 |
void CMenuSrvAppScanner::SetHiddenFlagL( TInt aId, TBool aWasHidden, TBool aHide ) |
|
286 |
{ |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
287 |
if ( aWasHidden ^ aHide ) |
114 | 288 |
{ |
289 |
iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ). |
|
290 |
SetFlags( TMenuItem::EHidden, aHide ); |
|
291 |
} |
|
292 |
} |
|
293 |
||
294 |
// --------------------------------------------------------- |
|
295 |
// CMenuSrvAppScanner::ValidateLinkUidL |
|
296 |
// --------------------------------------------------------- |
|
297 |
// |
|
298 |
void CMenuSrvAppScanner::ValidateLinkUidL( TInt aFolder, TInt aId, const TDesC& aUidStr ) |
|
299 |
{ |
|
300 |
TMenuSrvAttrFilter uidAppFilter; |
|
301 |
uidAppFilter.SetAttr( KMenuAttrUid(), aUidStr ); |
|
302 |
||
303 |
RArray<TMenuItem> appItems; |
|
304 |
CleanupClosePushL( appItems ); |
|
305 |
iEng.GetItemsL( appItems, aFolder, &uidAppFilter, ETrue ); |
|
306 |
||
307 |
TBool showItem = EFalse; |
|
308 |
TBool exists = EFalse; |
|
309 |
TBool itemMissing = EFalse; |
|
310 |
for (TInt i=0; i < appItems.Count(); i++) |
|
311 |
{ |
|
312 |
if(appItems[i].Id() != aId) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
313 |
{ |
114 | 314 |
exists = ETrue; |
315 |
const TMenuItem& item = appItems[i]; |
|
316 |
||
317 |
TBool itemHidden = (0 != (item.Flags() & TMenuItem::EHidden)); |
|
318 |
itemMissing = (0 != (item.Flags() & TMenuItem::EMissing)); |
|
319 |
if ( !itemHidden && !itemMissing ) |
|
320 |
{ |
|
321 |
showItem = ETrue; |
|
322 |
} |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
323 |
} |
114 | 324 |
} |
325 |
||
326 |
UpdateLinkL( aId, exists, showItem, itemMissing ); |
|
327 |
||
328 |
CleanupStack::PopAndDestroy( &appItems ); |
|
329 |
} |
|
330 |
||
331 |
// --------------------------------------------------------- |
|
332 |
// CMenuSrvAppScanner::UpdateLinkL |
|
333 |
// --------------------------------------------------------- |
|
334 |
// |
|
335 |
void CMenuSrvAppScanner::UpdateLinkL( |
|
336 |
TInt aId, |
|
337 |
TBool aExists, |
|
338 |
TBool aShowItem, |
|
339 |
TBool aMissingItem ) |
|
340 |
{ |
|
341 |
if (!aExists) |
|
342 |
{ |
|
343 |
iEng.ModifiableObjectL( aId ).SetFlags( TMenuItem::ELockDelete, EFalse ); |
|
344 |
iEng.RemoveL( aId ); |
|
345 |
} |
|
346 |
else if ( !aMissingItem ) |
|
347 |
{ |
|
348 |
const CMenuEngObject& object = iEng.ObjectL( aId ); |
|
349 |
TBool itemHidden = (0 != (object.Flags() & TMenuItem::EHidden)); |
|
350 |
TBool itemMissing = (0 != (object.Flags() & TMenuItem::EMissing)); |
|
351 |
if ( itemHidden == aShowItem ) |
|
352 |
{ |
|
353 |
iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ). |
|
354 |
SetFlags( TMenuItem::EHidden, !aShowItem ); |
|
355 |
} |
|
356 |
if ( itemMissing != aMissingItem ) |
|
357 |
{ |
|
358 |
iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ). |
|
359 |
SetFlags( TMenuItem::EMissing, aMissingItem ); |
|
360 |
} |
|
361 |
} |
|
362 |
else |
|
363 |
{ |
|
364 |
const CMenuEngObject& object = iEng.ObjectL( aId ); |
|
365 |
TBool itemMissing = (0 != (object.Flags() & TMenuItem::EMissing)); |
|
366 |
if ( itemMissing != aMissingItem ) |
|
367 |
{ |
|
368 |
iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ). |
|
369 |
SetFlags( TMenuItem::EMissing, aMissingItem ); |
|
370 |
} |
|
371 |
} |
|
372 |
} |
|
373 |
||
374 |
// --------------------------------------------------------- |
|
375 |
// CMenuSrvAppScanner::ValidateLinkRefIdL |
|
376 |
// --------------------------------------------------------- |
|
377 |
// |
|
378 |
void CMenuSrvAppScanner::ValidateLinkRefIdL( TInt aId, const TDesC& refIdStr ) |
|
379 |
{ |
|
380 |
TUint refItemId; |
|
381 |
MenuUtils::GetTUint( refIdStr, refItemId ); |
|
382 |
||
383 |
TMenuItem refItem; |
|
384 |
||
385 |
TBool showItem = EFalse; |
|
386 |
TBool exists = EFalse; |
|
387 |
||
388 |
TRAPD( err, iEng.GetItemL( refItemId, refItem ) ); |
|
389 |
||
390 |
if (err == KErrNone) |
|
391 |
{ |
|
392 |
exists = ETrue; |
|
393 |
} |
|
394 |
||
395 |
TBool itemHidden = (0 != (refItem.Flags() & TMenuItem::EHidden)); |
|
396 |
TBool itemMissing = (0 != (refItem.Flags() & TMenuItem::EMissing)); |
|
397 |
if ( !itemHidden && !itemMissing ) |
|
398 |
{ |
|
399 |
showItem = ETrue; |
|
400 |
} |
|
401 |
||
402 |
UpdateLinkL( aId, exists, showItem, itemMissing ); |
|
403 |
} |
|
404 |
||
405 |
// --------------------------------------------------------- |
|
406 |
// CMenuSrvAppScanner::ValidateLinkL |
|
407 |
// --------------------------------------------------------- |
|
408 |
// |
|
409 |
void CMenuSrvAppScanner::ValidateLinkL( TInt aFolder, TInt aId ) |
|
410 |
{ |
|
411 |
const CMenuEngObject& object = iEng.ObjectL( aId ); |
|
412 |
||
413 |
TBool tmp; |
|
414 |
TPtrC refIdStr; |
|
415 |
TPtrC uidStr; |
|
416 |
if ( object.FindAttribute( KMenuAttrRefId(), refIdStr, tmp) ) |
|
417 |
{ |
|
418 |
ValidateLinkRefIdL( aId, refIdStr ); |
|
419 |
} |
|
420 |
else if ( object.FindAttribute( KMenuAttrUid(), uidStr, tmp) ) |
|
421 |
{ |
|
422 |
ValidateLinkUidL( aFolder, aId, uidStr ); |
|
423 |
} |
|
424 |
else |
|
425 |
{ |
|
426 |
UpdateLinkL( aId, EFalse, EFalse, EFalse ); |
|
427 |
} |
|
428 |
} |
|
429 |
||
430 |
// --------------------------------------------------------- |
|
431 |
// CMenuSrvAppScanner::UpdateLinkItemsL |
|
432 |
// --------------------------------------------------------- |
|
433 |
// |
|
434 |
void CMenuSrvAppScanner::UpdateLinkItemsL() |
|
435 |
{ |
|
436 |
TInt root; |
|
437 |
iEng.RootFolderL( root ); |
|
438 |
||
439 |
TMenuSrvTypeFilter linkFilter; |
|
440 |
linkFilter.SetType( KMenuTypeLink() ); |
|
441 |
||
442 |
RArray<TMenuItem> items; |
|
443 |
CleanupClosePushL( items ); |
|
444 |
iEng.GetItemsL( items, root, &linkFilter, ETrue ); |
|
445 |
||
446 |
for (TInt i=0; i < items.Count(); i++) |
|
447 |
{ |
|
448 |
ValidateLinkL( root, items[i].Id() ); |
|
449 |
} |
|
450 |
CleanupStack::PopAndDestroy( &items ); |
|
451 |
} |
|
452 |
||
453 |
// --------------------------------------------------------- |
|
454 |
// CMenuSrvAppScanner::HandleFreeSpaceEventL |
|
455 |
// --------------------------------------------------------- |
|
456 |
// |
|
457 |
void CMenuSrvAppScanner::HandleFreeSpaceEventL() |
|
458 |
{ |
|
459 |
if ( !IsActive() && !iOpStatus ) |
|
460 |
{ |
|
461 |
iOpStatus = ETrue; |
|
462 |
TRequestStatus* ownStatus = &iStatus; |
|
463 |
*ownStatus = KRequestPending; |
|
464 |
SetActive(); |
|
465 |
User::RequestComplete( ownStatus, KErrNone ); |
|
466 |
} |
|
467 |
} |
|
468 |
// --------------------------------------------------------- |
|
469 |
// CMenuSrvAppScanner::RunMenuEngOperationL |
|
470 |
// --------------------------------------------------------- |
|
471 |
// |
|
472 |
void CMenuSrvAppScanner::RunMenuEngOperationL() |
|
473 |
{ |
|
474 |
UpdateApplicationItemsL(); |
|
475 |
UpdateApplicationWithHideIfInstalledItemsL(); |
|
476 |
UpdateLinkItemsL(); |
|
477 |
iOpStatus = EFalse; |
|
478 |
} |
|
479 |
||
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
480 |
|
114 | 481 |
// --------------------------------------------------------- |
482 |
// CMenuSrvAppScanner::UpdateApplicationItemL |
|
483 |
// --------------------------------------------------------- |
|
484 |
// |
|
485 |
void CMenuSrvAppScanner::UpdateApplicationItemL( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
486 |
RArray<TMenuItem>& aMcsItems, const CMenuSrvAppAttributes& aApaItem, |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
487 |
TUint aMmcId, TBool isLegacy) |
114 | 488 |
{ |
489 |
RArray<TMenuItem> mcsUidItems; |
|
490 |
CleanupClosePushL( mcsUidItems ); |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
491 |
TUid appuid = aApaItem.GetUid(); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
492 |
GetMcsAppItemsL( isLegacy, appuid.iUid, mcsUidItems ); |
114 | 493 |
TBool isApaItemHidden( aApaItem.IsHidden() ); |
494 |
||
495 |
// This app is not in the menu, add it now. |
|
496 |
// We don't add hidden items, there are too many of them! |
|
497 |
// do not display Menu app |
|
498 |
if ( !mcsUidItems.Count() |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
499 |
&& !isApaItemHidden |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
500 |
&& appuid != KMmUid3 ) |
114 | 501 |
{ |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
502 |
if( appuid == KSatUid ) |
114 | 503 |
{ |
504 |
if( CMcsSatHandler::CheckVisibility() ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
505 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
506 |
AddAppItemL( aApaItem, aMmcId ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
507 |
} |
114 | 508 |
} |
509 |
else |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
510 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
511 |
AddAppItemL( aApaItem, aMmcId ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
512 |
GetMcsAppItemsL( isLegacy, appuid.iUid, mcsUidItems ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
513 |
} |
114 | 514 |
}//if |
515 |
||
516 |
// if there are any items with legacy UID format |
|
517 |
// update them to new uid format |
|
518 |
else if ( mcsUidItems.Count() && isLegacy ) |
|
519 |
{ |
|
520 |
//for every item with matching UID |
|
521 |
for (TInt j=0; j < mcsUidItems.Count(); j++) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
522 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
523 |
CMenuEngObject& object = |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
524 |
iEng.ModifiableObjectL( mcsUidItems[j].Id() ); |
114 | 525 |
TBuf<KUidChars> uidString; |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
526 |
MenuSrvUtil::UidToStringL( appuid.iUid, uidString, EFalse, EHex ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
527 |
object.SetAttributeL( KMenuAttrUid(), uidString, EFalse ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
528 |
}//for |
114 | 529 |
}//else if |
530 |
// "hidden", "missing" and "lock_delete" flags update |
|
531 |
for ( TInt j = 0; j < mcsUidItems.Count(); j++ ) |
|
532 |
{ |
|
533 |
const TMenuItem& item = mcsUidItems[j]; |
|
534 |
||
535 |
//we need to handle first run of appscanner, |
|
536 |
//there might be some incorrect data in content xml file |
|
537 |
//if this will have impact on performance we may run this methods only at start up |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
538 |
HandleMmcAttrUpdateL( item, aApaItem, aMmcId ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
539 |
HandleNativeAttrUpdateL( item, aApaItem ); |
114 | 540 |
|
541 |
// "hidden" flag handling. |
|
542 |
HandleHiddenFlagUpdateL( item, aApaItem ); |
|
543 |
||
544 |
// "missing" flag handling |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
545 |
HandleMissingFlagUpdateL( item ); |
114 | 546 |
|
547 |
//"lock_delete" flag handling |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
548 |
HandleLockDeleteFlagUpdateL(item, aApaItem ); |
114 | 549 |
// if item was just added to MCS it is not present in aMcsItems |
550 |
// so we cannot remove it |
|
551 |
TInt index = aMcsItems.Find( item, TIdentityRelation<TMenuItem>( IdMatch ) ); |
|
552 |
if ( index != KErrNotFound ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
553 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
554 |
aMcsItems.Remove( index ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
555 |
} |
114 | 556 |
}//for |
557 |
CleanupStack::PopAndDestroy( &mcsUidItems ); |
|
558 |
} |
|
559 |
||
560 |
// --------------------------------------------------------- |
|
561 |
// CMenuSrvAppScanner::HandleHiddenFlagUpdateL |
|
562 |
// --------------------------------------------------------- |
|
563 |
// |
|
564 |
void CMenuSrvAppScanner::HandleHiddenFlagUpdateL( const TMenuItem & aItem, |
|
565 |
const CMenuSrvAppAttributes& aApaItem ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
566 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
567 |
TBool itemHidden = (0 != (aItem.Flags() & TMenuItem::EHidden)); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
568 |
if ( aApaItem.GetUid() == KSatUid ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
569 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
570 |
if (itemHidden == CMcsSatHandler::CheckVisibility()) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
571 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
572 |
iEng.ModifiableObjectL(aItem.Id(), RMenuNotifier::EItemsAddedRemoved). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
573 |
SetFlags( TMenuItem::EHidden, !CMcsSatHandler::CheckVisibility()); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
574 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
575 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
576 |
else if ( itemHidden != aApaItem.IsHidden() ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
577 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
578 |
iEng.ModifiableObjectL(aItem.Id(), RMenuNotifier::EItemsAddedRemoved). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
579 |
SetFlags( TMenuItem::EHidden, aApaItem.IsHidden() ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
580 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
581 |
} |
114 | 582 |
|
583 |
// --------------------------------------------------------- |
|
584 |
// CMenuSrvAppScanner::HandleNativeAttrUpdateL |
|
585 |
// --------------------------------------------------------- |
|
586 |
// |
|
587 |
void CMenuSrvAppScanner::HandleNativeAttrUpdateL( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
588 |
const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
589 |
{ |
114 | 590 |
//we need this to delete uninstalled java app item |
591 |
if( aApaItem.GetAppType() != iEng.ObjectL( aItem.Id() ).GetAppType() ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
592 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
593 |
iEng.ModifiableObjectL( aItem.Id(), |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
594 |
RMenuNotifier::EItemsNone ).SetAppType( aApaItem.GetAppType() ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
595 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
596 |
} |
114 | 597 |
|
598 |
||
599 |
// --------------------------------------------------------- |
|
600 |
// CMenuSrvAppScanner::HandleMmcAttrUpdateL |
|
601 |
// --------------------------------------------------------- |
|
602 |
// |
|
603 |
void CMenuSrvAppScanner::HandleMmcAttrUpdateL( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
604 |
const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem, TUint aMmcId ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
605 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
606 |
if ( IsInMmc( aApaItem ) ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
607 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
608 |
//app is instaled on mmc - KMenuAttrMmcId attribute update |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
609 |
TBuf<KUidChars> uidString; |
114 | 610 |
uidString.Format( KHexFormat, aMmcId ); |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
611 |
iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
612 |
SetAttributeL( KMenuAttrMmcId, uidString, EFalse ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
613 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
614 |
else if ( IsInMassStorage( aApaItem ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
615 |
&& aApaItem.GetAppType() == CMenuEngObject::EWidgetApp ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
616 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
617 |
//its java app installed on mass storage, we need to leave it in xml |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
618 |
//in case of connecting usb in mass storage mode |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
619 |
iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
620 |
SetAttributeL( KMenuAttrMmcId, KMenuMassStorage, EFalse ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
621 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
622 |
else |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
623 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
624 |
//its installed on c: drive - remove attribute |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
625 |
iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
626 |
RemoveAttribute( KMenuAttrMmcId ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
627 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
628 |
} |
114 | 629 |
// --------------------------------------------------------- |
630 |
// CMenuSrvAppScanner::UpdateApplicationItemsL |
|
631 |
// --------------------------------------------------------- |
|
632 |
// |
|
633 |
void CMenuSrvAppScanner::UpdateApplicationItemsL() |
|
634 |
{ |
|
635 |
TUint currentMmcId = UpdateMmcHistoryL(); |
|
636 |
// get all MCS items |
|
637 |
RArray<TMenuItem> mcsItems; |
|
638 |
CleanupClosePushL( mcsItems ); |
|
639 |
GetMcsAppItemsL( mcsItems ); |
|
640 |
iSrvEngUtils.ReloadApaItemsL(); |
|
641 |
GetCrItemsL( iSrvEngUtils.GetAppItemsL() ); |
|
642 |
TBool isLegacy = iEng.GetOnceLegacyFormat(); |
|
643 |
||
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
644 |
|
114 | 645 |
//for every item in apaAndCrItems array |
646 |
for ( TInt i = ( iSrvEngUtils.GetAppItemsL().Count() - 1 ); i >= 0 ; i-- ) |
|
647 |
{ |
|
648 |
// if there was leave for any item we ignore it |
|
649 |
// and proceed to the next one |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
650 |
TRAP_IGNORE(UpdateApplicationItemL( |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
651 |
mcsItems, *iSrvEngUtils.GetAppItemsL()[i], currentMmcId, isLegacy)); |
114 | 652 |
} |
653 |
// Here the big list contains menu items that refer to missing apps. |
|
654 |
HandleMissingItemsL( mcsItems ); |
|
655 |
CleanupStack::PopAndDestroy( &mcsItems ); |
|
656 |
} |
|
657 |
||
658 |
// --------------------------------------------------------- |
|
659 |
// CMenuSrvAppScanner::HandleLockDeleteFlagUpdateL |
|
660 |
// --------------------------------------------------------- |
|
661 |
// |
|
662 |
void CMenuSrvAppScanner::HandleLockDeleteFlagUpdateL( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
663 |
const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
664 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
665 |
TBool isHidden = ( ( iEng.ObjectL( aItem.Id() ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
666 |
.Flags() & TMenuItem::EHidden ) != 0 ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
667 |
if ( !isHidden && IsInRomL( aApaItem ) ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
668 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
669 |
if ( ( aItem.Flags() & TMenuItem::ELockDelete ) == 0 ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
670 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
671 |
iEng.ModifiableObjectL(aItem.Id()) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
672 |
.SetFlags( TMenuItem::ELockDelete, ETrue ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
673 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
674 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
675 |
else |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
676 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
677 |
if ( ( aItem.Flags() & TMenuItem::ELockDelete ) != 0 ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
678 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
679 |
iEng.ModifiableObjectL(aItem.Id()) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
680 |
.SetFlags( TMenuItem::ELockDelete, EFalse ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
681 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
682 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
683 |
} |
114 | 684 |
|
685 |
// --------------------------------------------------------- |
|
686 |
// CMenuSrvAppScanner::HandleMissingFlagUpdateL |
|
687 |
// --------------------------------------------------------- |
|
688 |
// |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
689 |
void CMenuSrvAppScanner::HandleMissingFlagUpdateL( const TMenuItem& aItem ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
690 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
691 |
if ( aItem.Flags() & TMenuItem::EMissing ) |
114 | 692 |
{ |
693 |
CLOG_WRITE_FORMAT8( "Unsetting flag EMissing on %d", item.Id() ); |
|
694 |
//application found so we unset "missing" flag |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
695 |
iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
696 |
SetFlags( TMenuItem::EMissing, EFalse ); |
114 | 697 |
} |
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
698 |
} |
114 | 699 |
|
700 |
// --------------------------------------------------------- |
|
701 |
// CMenuSrvAppScanner::GetCrItemsL |
|
702 |
// --------------------------------------------------------- |
|
703 |
// |
|
704 |
void CMenuSrvAppScanner::GetCrItemsL( RPointerArray<CMenuSrvAppAttributes>& aArray ) |
|
705 |
{ |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
706 |
TBuf<KCenRepBufferSize> buf; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
707 |
iCenRepSession->Get( KMenuHideCPApplication, buf ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
708 |
ParseUidsL( buf, aArray );// parses UIDs from buf and appends them to array |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
709 |
iCenRepSession->Get( KMenuHideApplication, buf ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
710 |
ParseUidsL( buf, aArray );// parses UIDs from buf and appends them to array |
114 | 711 |
} |
712 |
||
713 |
// --------------------------------------------------------- |
|
714 |
// CMenuSrvAppScanner::ParseUidsL |
|
715 |
// --------------------------------------------------------- |
|
716 |
// |
|
717 |
void CMenuSrvAppScanner::ParseUidsL( const TDesC& aHiddenApplications, |
|
718 |
RPointerArray<CMenuSrvAppAttributes>& aArray ) |
|
719 |
{ |
|
720 |
TLex input( aHiddenApplications ); |
|
721 |
TLexMark startMark; |
|
722 |
input.Mark( startMark ); |
|
723 |
TBool notEmpty = EFalse; |
|
724 |
while ( !input.Eos() ) |
|
725 |
{ |
|
726 |
if( input.Peek() == ',') |
|
727 |
{ |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
728 |
SetHidden(input.MarkedToken( startMark ), aArray); |
114 | 729 |
input.Inc(); |
730 |
input.Mark( startMark ); |
|
731 |
} |
|
732 |
input.Inc(); |
|
733 |
notEmpty = ETrue; |
|
734 |
} |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
735 |
if ( notEmpty ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
736 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
737 |
SetHidden(input.MarkedToken( startMark ), aArray); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
738 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
739 |
|
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
740 |
|
114 | 741 |
} |
742 |
||
743 |
// --------------------------------------------------------- |
|
744 |
// CMenuSrvAppScanner::SetHidden |
|
745 |
// --------------------------------------------------------- |
|
746 |
// |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
747 |
void CMenuSrvAppScanner::SetHidden( |
114 | 748 |
const TDesC& aHiddenAppUid, RPointerArray<CMenuSrvAppAttributes>& aArray ) |
749 |
{ |
|
750 |
TLex appUidDescriptor(aHiddenAppUid); |
|
751 |
TUint hiddenAppUid( 0 ); |
|
752 |
appUidDescriptor.Val( hiddenAppUid, EHex ); |
|
753 |
if ( hiddenAppUid ) |
|
754 |
{ |
|
755 |
TApaAppCapabilityBuf capability; |
|
756 |
TApaAppInfo appInfo; |
|
757 |
appInfo.iUid = TUid::Uid( hiddenAppUid ); |
|
758 |
CMenuSrvAppAttributes* attribute = CMenuSrvAppAttributes::NewLC( capability, appInfo ); |
|
759 |
TInt index = aArray.Find( attribute, |
|
760 |
TIdentityRelation<CMenuSrvAppAttributes>( CMenuSrvAppAttributes::MatchItems ) ); |
|
761 |
if( index >= 0 && !aArray[index]->IsHidden() ) |
|
762 |
{ |
|
763 |
aArray[index]->SetHidden( ETrue ); |
|
764 |
} |
|
765 |
CleanupStack::PopAndDestroy( attribute ); |
|
766 |
} |
|
767 |
} |
|
768 |
||
769 |
||
770 |
// --------------------------------------------------------- |
|
771 |
// CMenuSrvAppScanner::GetMcsItemsL |
|
772 |
// --------------------------------------------------------- |
|
773 |
// |
|
774 |
void CMenuSrvAppScanner::GetMcsAppItemsL( RArray<TMenuItem>& aArray ) |
|
775 |
{ |
|
776 |
TInt root; |
|
777 |
iEng.RootFolderL( root ); |
|
778 |
TMenuSrvTypeFilter appFilter; |
|
779 |
appFilter.SetType( KMenuTypeApp() ); |
|
780 |
iEng.GetItemsL( aArray, root, &appFilter, ETrue ); |
|
781 |
} |
|
782 |
||
783 |
// --------------------------------------------------------- |
|
784 |
// CMenuSrvAppScanner::GetMcsItemsL |
|
785 |
// --------------------------------------------------------- |
|
786 |
// |
|
787 |
void CMenuSrvAppScanner::GetMcsAppItemsL( TBool aLegacy, |
|
788 |
const TUint aUid, RArray<TMenuItem>& aArray ) |
|
789 |
{ |
|
790 |
TInt root; |
|
791 |
iEng.RootFolderL( root ); |
|
792 |
TMenuSrvTypeAttrFilter appFilter; |
|
793 |
appFilter.SetType( KMenuTypeApp() ); |
|
794 |
TBuf<KUidChars> uidString; |
|
795 |
MenuSrvUtil::UidToStringL( aUid, uidString, aLegacy, EHex ); |
|
796 |
appFilter.SetAttr( KMenuAttrUid(), uidString ); |
|
797 |
iEng.GetItemsL( aArray, root, &appFilter, ETrue ); |
|
798 |
//if not found in mcs try with UID in decimal format |
|
799 |
if (!aArray.Count()) |
|
800 |
{ |
|
801 |
MenuSrvUtil::UidToStringL( aUid, uidString, aLegacy, EDecimal ); |
|
802 |
appFilter.SetAttr( KMenuAttrUid(), uidString ); |
|
803 |
iEng.GetItemsL( aArray, root, &appFilter, ETrue ); |
|
804 |
} |
|
805 |
} |
|
806 |
||
807 |
||
808 |
// --------------------------------------------------------- |
|
809 |
// CMenuSrvAppScanner::CompletedMenuEngOperation |
|
810 |
// --------------------------------------------------------- |
|
811 |
// |
|
812 |
void CMenuSrvAppScanner::CompletedMenuEngOperation( TInt /*aErr*/ ) |
|
813 |
{ |
|
814 |
iOpStatus = EFalse; |
|
815 |
} |
|
816 |
||
817 |
// --------------------------------------------------------- |
|
818 |
// CMenuSrvAppScanner::HandleAppListEvent |
|
819 |
// --------------------------------------------------------- |
|
820 |
// |
|
821 |
void CMenuSrvAppScanner::HandleAppListEvent( TInt /*aEvent*/ ) |
|
822 |
{ |
|
823 |
// We only have one event, EAppListChanged. |
|
824 |
// Call back RunL async, to requeue and initiate rescan. |
|
825 |
if ( !IsActive() && !iOpStatus) |
|
826 |
{ |
|
827 |
iOpStatus = ETrue; |
|
828 |
TRequestStatus* ownStatus = &iStatus; |
|
829 |
*ownStatus = KRequestPending; |
|
830 |
SetActive(); |
|
831 |
User::RequestComplete( ownStatus, KErrNone ); |
|
832 |
} |
|
833 |
} |
|
834 |
||
835 |
// ----------------------------------------------------------------------------- |
|
836 |
// CMenuSrvAppScanner::HandleNotifyString |
|
837 |
// ----------------------------------------------------------------------------- |
|
838 |
// |
|
839 |
void CMenuSrvAppScanner::HandleNotifyString( TUint32 aKey, |
|
840 |
const TDesC16& /*aNewValue*/ ) |
|
841 |
{ |
|
842 |
if((aKey == KMenuHideApplication )||(aKey == KMenuHideCPApplication)) |
|
843 |
{ |
|
844 |
if ( !IsActive() && !iOpStatus ) |
|
845 |
{ |
|
846 |
iOpStatus = ETrue; |
|
847 |
TRequestStatus* ownStatus = &iStatus; |
|
848 |
*ownStatus = KRequestPending; |
|
849 |
SetActive(); |
|
850 |
User::RequestComplete( ownStatus, KErrNone ); |
|
851 |
} |
|
852 |
} |
|
853 |
} |
|
854 |
||
855 |
// ----------------------------------------------------------------------------- |
|
856 |
// CMenuSrvAppScanner::SATChangeL |
|
857 |
// ----------------------------------------------------------------------------- |
|
858 |
// |
|
859 |
void CMenuSrvAppScanner::SATChangeL() |
|
860 |
{ |
|
861 |
ScheduleScan(); |
|
862 |
} |
|
863 |
||
864 |
// --------------------------------------------------------- |
|
865 |
// CMenuSrvAppScanner::ScheduleScan |
|
866 |
// --------------------------------------------------------- |
|
867 |
// |
|
868 |
void CMenuSrvAppScanner::ScheduleScan() |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
869 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
870 |
if ( !IsActive() && !iOpStatus ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
871 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
872 |
iOpStatus = ETrue; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
873 |
TRequestStatus* ownStatus = &iStatus; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
874 |
*ownStatus = KRequestPending; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
875 |
SetActive(); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
876 |
User::RequestComplete( ownStatus, KErrNone ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
877 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
878 |
} |
114 | 879 |
|
880 |
// --------------------------------------------------------- |
|
881 |
// CMenuSrvAppScanner::CreateInstallFolderL |
|
882 |
// --------------------------------------------------------- |
|
883 |
// |
|
884 |
TInt CMenuSrvAppScanner::CreateInstallFolderL( const CMenuSrvAppAttributes& aApaItem ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
885 |
{ |
114 | 886 |
// Find a folder for this app. |
887 |
TInt folder(0); |
|
888 |
if ( aApaItem.GetGroupName().Length() ) |
|
889 |
{ |
|
890 |
// appgroup_name is defined for this app. Find or create folder. |
|
891 |
AppGroupFolderL( aApaItem.GetGroupName(), folder ); |
|
892 |
} |
|
893 |
else |
|
894 |
{ |
|
895 |
// No appgroup_name, use default folder, if any. |
|
896 |
DefaultFolderL( folder ); |
|
897 |
} |
|
898 |
if ( !folder ) |
|
899 |
{ |
|
900 |
// Last resort: it goes to the root. |
|
901 |
iEng.RootFolderL( folder ); |
|
902 |
} |
|
903 |
return folder; |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
904 |
} |
114 | 905 |
|
906 |
// --------------------------------------------------------- |
|
907 |
// CMenuSrvAppScanner::AddAppItemL |
|
908 |
// --------------------------------------------------------- |
|
909 |
// |
|
910 |
void CMenuSrvAppScanner::AddAppItemL( |
|
911 |
const CMenuSrvAppAttributes& aApaItem, |
|
912 |
TUint aCurrentMmcId ) |
|
913 |
{ |
|
914 |
TInt folder = CreateInstallFolderL( aApaItem ); |
|
915 |
// Now add the app item. |
|
916 |
CMenuEngObject* object = iEng.NewObjectL( KMenuTypeApp() ); |
|
917 |
CleanupStack::PushL( object ); |
|
918 |
TBuf<KUidChars> uidString; |
|
919 |
_LIT(KHexFormat, "0x%X"); |
|
920 |
uidString.Format( KHexFormat, aApaItem.GetUid().iUid ); |
|
921 |
||
922 |
object->SetAttributeL( KMenuAttrUid(), uidString, EFalse ); |
|
923 |
if ( aCurrentMmcId && IsInMmc( aApaItem ) ) |
|
924 |
{ |
|
925 |
// This app is on the MMC, set the "mmc_id" attribute. |
|
926 |
uidString.Format( KHexFormat, aCurrentMmcId ); |
|
927 |
object->SetAttributeL( KMenuAttrMmcId, uidString, EFalse ); |
|
928 |
} |
|
929 |
if( aApaItem.GetAppType() == CMenuEngObject::EWidgetApp ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
930 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
931 |
//we need this to delete uninstalled java or wrt widget app item |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
932 |
if ( !IsInMmc( aApaItem ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
933 |
&& IsInMassStorage( aApaItem ) ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
934 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
935 |
object->SetAttributeL( KMenuAttrMmcId, KMenuMassStorage, EFalse ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
936 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
937 |
} |
114 | 938 |
object->SetAppType( aApaItem.GetAppType() ); |
939 |
EnsureFolderWritableL( folder ); |
|
940 |
iEng.AddL( *object, folder, 0 ); |
|
941 |
CleanupStack::Pop( object ); |
|
942 |
} |
|
943 |
||
944 |
// --------------------------------------------------------- |
|
945 |
// CMenuSrvAppScanner::AppGroupFolderL |
|
946 |
// --------------------------------------------------------- |
|
947 |
// |
|
948 |
void CMenuSrvAppScanner::AppGroupFolderL( const TDesC& aAppGroupName, TInt& aFolderId ) |
|
949 |
{ |
|
950 |
__ASSERT_DEBUG( aAppGroupName.Length(), User::Invariant() ); |
|
951 |
||
952 |
TInt folder = 0; |
|
953 |
TInt defaultFolderId( 0 ); |
|
954 |
iEng.RootFolderL( defaultFolderId ); |
|
955 |
const CMenuEngObject& rootObject = iEng.ObjectL( defaultFolderId ); |
|
956 |
TPtrC groupName; |
|
957 |
TBool localized; |
|
958 |
||
959 |
if ( rootObject.FindAttribute( KMenuAttrAppGroupName, groupName, localized ) && |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
960 |
groupName.Compare( aAppGroupName )==0 ) |
114 | 961 |
{ |
962 |
folder = defaultFolderId; |
|
963 |
} |
|
964 |
else |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
965 |
{ |
114 | 966 |
TMenuSrvTypeAttrFilter filter; |
967 |
filter.SetType( KMenuTypeFolder() ); |
|
968 |
filter.SetAttr( KMenuAttrAppGroupName(), aAppGroupName ); |
|
969 |
RArray<TMenuItem> items; |
|
970 |
CleanupClosePushL( items ); |
|
971 |
||
972 |
iEng.GetItemsL( items, defaultFolderId, &filter, ETrue ); |
|
973 |
if ( items.Count() ) |
|
974 |
{ |
|
975 |
folder = items[0].Id(); |
|
976 |
} |
|
977 |
CleanupStack::PopAndDestroy( &items ); |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
978 |
} |
114 | 979 |
if ( !folder ) |
980 |
{ |
|
981 |
// No such folder, create it now. |
|
982 |
CMenuEngObject* object = iEng.NewObjectL( KMenuTypeFolder() ); |
|
983 |
CleanupStack::PushL( object ); |
|
984 |
object->SetAttributeL |
|
985 |
( KMenuAttrAppGroupName(), aAppGroupName, EFalse ); |
|
986 |
EnsureFolderWritableL( defaultFolderId ); |
|
987 |
iEng.AddL( *object, defaultFolderId, 0 ); |
|
988 |
||
989 |
CleanupStack::Pop( object ); |
|
990 |
folder = object->Id(); |
|
991 |
} |
|
992 |
__ASSERT_DEBUG( folder, User::Invariant() ); |
|
993 |
aFolderId = folder; |
|
994 |
} |
|
995 |
||
996 |
// --------------------------------------------------------- |
|
997 |
// CMenuSrvAppScanner::DefaultFolderL |
|
998 |
// --------------------------------------------------------- |
|
999 |
// |
|
1000 |
void CMenuSrvAppScanner::DefaultFolderL( TInt& aFolderId ) |
|
1001 |
{ |
|
1002 |
TInt folder = 0; |
|
1003 |
TMenuSrvTypeAttrFilter filter; |
|
1004 |
filter.SetType( KMenuTypeFolder() ); |
|
1005 |
filter.SetAttr( KMenuAttrDefault(), KMenuOne() ); |
|
1006 |
RArray<TMenuItem> items; |
|
1007 |
CleanupClosePushL( items ); |
|
1008 |
TInt rootId; |
|
1009 |
iEng.RootFolderL( rootId ); |
|
1010 |
iEng.GetItemsL( items, rootId, &filter, ETrue ); |
|
1011 |
if ( items.Count() ) |
|
1012 |
{ |
|
1013 |
folder = items[0].Id(); |
|
1014 |
} |
|
1015 |
CleanupStack::PopAndDestroy( &items ); |
|
1016 |
aFolderId = folder; |
|
1017 |
} |
|
1018 |
||
1019 |
// --------------------------------------------------------- |
|
1020 |
// CMenuSrvAppScanner::EnsureFolderWritableL |
|
1021 |
// --------------------------------------------------------- |
|
1022 |
// |
|
1023 |
void CMenuSrvAppScanner::EnsureFolderWritableL( TInt aFolder ) |
|
1024 |
{ |
|
1025 |
// This folder should not be read-only! Remove the protection. |
|
1026 |
// Otherwise we can't add the items to it. |
|
1027 |
if ( iEng.ObjectL( aFolder ).Flags() & TMenuItem::ELockMoveInto ) |
|
1028 |
{ |
|
1029 |
iEng.ModifiableObjectL( aFolder ). |
|
1030 |
SetFlags( TMenuItem::ELockMoveInto, EFalse ); |
|
1031 |
} |
|
1032 |
} |
|
1033 |
||
1034 |
// --------------------------------------------------------- |
|
1035 |
// CMenuSrvAppScanner::HandleMissingItemsL |
|
1036 |
// --------------------------------------------------------- |
|
1037 |
// |
|
1038 |
TMenuItem::TFlags CMenuSrvAppScanner::GetProperFlagL( const TMenuItem& aItem ) |
|
1039 |
{ |
|
1040 |
TMenuItem::TFlags flags = TMenuItem::ENoFlag; |
|
1041 |
||
1042 |
TUint mmcId = 0; |
|
1043 |
TPtrC val; |
|
1044 |
TBool dummy; |
|
1045 |
if( iEng.ObjectL( aItem.Id() ).FindAttribute( KMenuAttrMmcId(), val, dummy ) ) |
|
1046 |
{ |
|
1047 |
MenuUtils::GetTUint( val, mmcId ); |
|
1048 |
if ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId ) ) |
|
1049 |
{ |
|
1050 |
// This item is on an MMC which is currently in the MMC history. |
|
1051 |
// Set it "missing" but keep it. |
|
1052 |
flags = TMenuItem::EMissing; |
|
1053 |
} |
|
1054 |
else if ( val == KMenuMassStorage() |
|
1055 |
&& IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) |
|
1056 |
{ |
|
1057 |
flags = TMenuItem::EMissing; |
|
1058 |
} |
|
1059 |
else if ( iEng.ObjectL( aItem.Id() ).FindAttribute( |
|
1060 |
KMenuAttrPredefined(), val, dummy ) ) |
|
1061 |
{ |
|
1062 |
flags = TMenuItem::EMissing; |
|
1063 |
} |
|
1064 |
} |
|
1065 |
else if( iEng.ObjectL( aItem.Id() ).GetAppType() |
|
1066 |
!= CMenuEngObject::EWidgetApp |
|
1067 |
|| iEng.ObjectL( aItem.Id() ).FindAttribute( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1068 |
KMenuAttrPredefined(), val, dummy ) ) |
114 | 1069 |
{ |
1070 |
flags = TMenuItem::EHidden; |
|
1071 |
} |
|
1072 |
return flags; |
|
1073 |
} |
|
1074 |
||
1075 |
// --------------------------------------------------------- |
|
1076 |
// CMenuSrvAppScanner::HandleMissingItemsL |
|
1077 |
// --------------------------------------------------------- |
|
1078 |
// |
|
1079 |
void CMenuSrvAppScanner::HandleMissingItemsL( |
|
1080 |
const RArray<TMenuItem>& aItems ) |
|
1081 |
{ |
|
1082 |
for ( TInt i = 0; i < aItems.Count(); i++ ) |
|
1083 |
{ |
|
1084 |
TMenuItem::TFlags flags = GetProperFlagL( aItems[i] ); |
|
1085 |
if( flags == TMenuItem::ENoFlag ) |
|
1086 |
{ |
|
1087 |
iEng.RemoveL( aItems[i].Id() ); |
|
1088 |
} |
|
1089 |
else |
|
1090 |
{ |
|
1091 |
SetObjectFlagsL( ETrue, aItems[i], flags, |
|
1092 |
RMenuNotifier::EItemsAddedRemoved ); |
|
1093 |
} |
|
1094 |
} |
|
1095 |
} |
|
1096 |
||
1097 |
// --------------------------------------------------------- |
|
1098 |
// CMenuSrvAppScanner::SetObjectFlagsL |
|
1099 |
// --------------------------------------------------------- |
|
1100 |
// |
|
1101 |
void CMenuSrvAppScanner::SetObjectFlagsL( TBool aFlagValue, const TMenuItem& aItem, |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1102 |
const TMenuItem::TFlags& aFlag, const RMenuNotifier::TEvent& aEvent ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1103 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1104 |
TBool itemFlagPresent = (0 != (aItem.Flags() & aFlag)); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1105 |
if( aFlagValue != itemFlagPresent ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1106 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1107 |
iEng.ModifiableObjectL( aItem.Id(), aEvent ). |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1108 |
SetFlags( aFlag, aFlagValue ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1109 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1110 |
} |
114 | 1111 |
|
1112 |
// --------------------------------------------------------- |
|
1113 |
// CMenuSrvAppScanner::UpdateMmcHistoryL |
|
1114 |
// --------------------------------------------------------- |
|
1115 |
// |
|
1116 |
TUint CMenuSrvAppScanner::UpdateMmcHistoryL() |
|
1117 |
{ |
|
1118 |
TUint mmcId = CurrentMmcId(); |
|
1119 |
if( mmcId ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1120 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1121 |
iMmcHistory->InsertL( mmcId ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1122 |
iMmcHistory->SaveL( iFs, KMenuMmcHistoryFname() ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1123 |
} |
114 | 1124 |
return mmcId; |
1125 |
} |
|
1126 |
||
1127 |
// --------------------------------------------------------- |
|
1128 |
// CMenuSrvAppScanner::CurrentMmcId |
|
1129 |
// --------------------------------------------------------- |
|
1130 |
// |
|
1131 |
TUint CMenuSrvAppScanner::CurrentMmcId() const |
|
1132 |
{ |
|
1133 |
// Get mmc id. Errors are ignored. |
|
1134 |
TUint mmcId = 0; |
|
1135 |
TInt mmcDrive; |
|
1136 |
TInt err; |
|
1137 |
err = DriveInfo::GetDefaultDrive( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1138 |
DriveInfo::EDefaultRemovableMassStorage, mmcDrive ); |
114 | 1139 |
if ( !err ) |
1140 |
{ |
|
1141 |
TVolumeInfo volumeInfo; |
|
1142 |
err = iFs.Volume( volumeInfo, mmcDrive ); |
|
1143 |
if( !err ) |
|
1144 |
{ |
|
1145 |
mmcId = volumeInfo.iUniqueID; |
|
1146 |
} |
|
1147 |
} |
|
1148 |
return mmcId; |
|
1149 |
} |
|
1150 |
||
1151 |
// --------------------------------------------------------- |
|
1152 |
// CMenuSrvAppScanner::IsFileInDrive |
|
1153 |
// --------------------------------------------------------- |
|
1154 |
// |
|
1155 |
TBool CMenuSrvAppScanner::IsFileInDrive( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1156 |
const TDesC& aFileName, |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1157 |
const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
114 | 1158 |
{ |
1159 |
if ( aFileName.Length() ) |
|
1160 |
{ |
|
1161 |
TInt mmcDrive; |
|
1162 |
TInt err = DriveInfo::GetDefaultDrive( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1163 |
aDefaultDrive, mmcDrive ); |
114 | 1164 |
if ( !err ) |
1165 |
{ |
|
1166 |
TInt fileDrive; |
|
1167 |
err = RFs::CharToDrive( aFileName[0], fileDrive ); |
|
1168 |
if ( !err && fileDrive == mmcDrive ) |
|
1169 |
{ |
|
1170 |
return ETrue; |
|
1171 |
} |
|
1172 |
} |
|
1173 |
} |
|
1174 |
return EFalse; |
|
1175 |
} |
|
1176 |
||
1177 |
// --------------------------------------------------------- |
|
1178 |
// CMenuSrvAppScanner::IsAppInDrive |
|
1179 |
// --------------------------------------------------------- |
|
1180 |
// |
|
1181 |
TBool CMenuSrvAppScanner::IsAppInDrive( |
|
1182 |
const CMenuSrvAppAttributes& aApaItem, |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1183 |
const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
114 | 1184 |
{ |
1185 |
TBool ret( EFalse ); |
|
1186 |
if ( IsFileInDrive( aApaItem.GetFullName(), aDefaultDrive ) ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1187 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1188 |
ret = ETrue; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1189 |
} |
114 | 1190 |
return ret; |
1191 |
} |
|
1192 |
||
1193 |
// --------------------------------------------------------- |
|
1194 |
// CMenuSrvAppScanner::IsInMmc |
|
1195 |
// --------------------------------------------------------- |
|
1196 |
// |
|
1197 |
TBool CMenuSrvAppScanner::IsInMmc( const CMenuSrvAppAttributes& aApaItem ) const |
|
1198 |
{ |
|
1199 |
return IsAppInDrive( aApaItem, DriveInfo::EDefaultRemovableMassStorage ); |
|
1200 |
} |
|
1201 |
||
1202 |
// --------------------------------------------------------- |
|
1203 |
// CMenuSrvAppScanner::IsInMassStorage |
|
1204 |
// --------------------------------------------------------- |
|
1205 |
// |
|
1206 |
TBool CMenuSrvAppScanner::IsInMassStorage( const CMenuSrvAppAttributes& aApaItem ) const |
|
1207 |
{ |
|
1208 |
return IsAppInDrive( aApaItem, DriveInfo::EDefaultMassStorage ); |
|
1209 |
} |
|
1210 |
||
1211 |
// --------------------------------------------------------- |
|
1212 |
// CMenuSrvAppScanner::IsInRomL |
|
1213 |
// --------------------------------------------------------- |
|
1214 |
// |
|
1215 |
TBool CMenuSrvAppScanner::IsInRomL( const CMenuSrvAppAttributes& aApaItem ) const |
|
1216 |
{ |
|
1217 |
return IsAppInDrive( aApaItem, DriveInfo::EDefaultRom ); |
|
1218 |
} |
|
1219 |
||
1220 |
// --------------------------------------------------------- |
|
1221 |
// CMenuSrvAppScanner::IsDriveInUse |
|
1222 |
// --------------------------------------------------------- |
|
1223 |
// |
|
1224 |
TBool CMenuSrvAppScanner::IsDriveInUse( |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1225 |
const DriveInfo::TDefaultDrives& aDefaultDrive ) |
114 | 1226 |
{ |
1227 |
TBool inUse( EFalse ); |
|
1228 |
TInt drive; |
|
1229 |
||
1230 |
TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, drive ); |
|
1231 |
if( err == KErrNone ) |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1232 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1233 |
TUint status; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1234 |
err = DriveInfo::GetDriveStatus( iFs, drive, status ); |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1235 |
if( err == KErrNone |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1236 |
&& ( status & DriveInfo::EDriveInUse ) ) |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1237 |
{ |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1238 |
inUse = ETrue; |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1239 |
} |
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1240 |
} |
114 | 1241 |
|
130
67f2ed48ad91
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
122
diff
changeset
|
1242 |
return inUse; |
114 | 1243 |
} |
1244 |
||
1245 |
// End of File |