|
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: Custom command for checking user drive |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cmdcheckuserdrive.h" |
|
19 #include "ssmuiproviderdll.h" |
|
20 #include "ssmdebug.h" |
|
21 #include <f32file.h> |
|
22 |
|
23 CCustomCmdCheckUserDrive* CCustomCmdCheckUserDrive::NewL() |
|
24 { |
|
25 return new (ELeave) CCustomCmdCheckUserDrive(); |
|
26 } |
|
27 |
|
28 CCustomCmdCheckUserDrive::~CCustomCmdCheckUserDrive() |
|
29 { |
|
30 } |
|
31 |
|
32 CCustomCmdCheckUserDrive::CCustomCmdCheckUserDrive() |
|
33 { |
|
34 } |
|
35 |
|
36 TInt CCustomCmdCheckUserDrive::Initialize(CSsmCustomCommandEnv* aCmdEnv) |
|
37 { |
|
38 iCmdEnv = aCmdEnv; |
|
39 return KErrNone; |
|
40 } |
|
41 |
|
42 void CCustomCmdCheckUserDrive::Execute(const TDesC8& /*aParams*/, TRequestStatus& aRequest) |
|
43 { |
|
44 aRequest = KRequestPending; |
|
45 TInt driveid = CSsmUiSpecific::PhoneMemoryRootDriveId(); |
|
46 DEBUGPRINT2A("CCustomCmdCheckUserDrive drive id is %d", driveid); |
|
47 |
|
48 TDriveInfo info; |
|
49 TInt errorCode = iCmdEnv->Rfs().Drive(info, driveid); |
|
50 if (KErrNone == errorCode) |
|
51 { |
|
52 DEBUGPRINT2A("CCustomCmdCheckUserDrive: User drive type %d", info.iType); |
|
53 if (info.iType == EMediaRam) |
|
54 { |
|
55 errorCode = KErrNotFound; |
|
56 } |
|
57 } |
|
58 DEBUGPRINT2A("CCustomCmdCheckUserDrive completed with %d", errorCode); |
|
59 TRequestStatus* request = &aRequest; |
|
60 User::RequestComplete( request, errorCode ); |
|
61 } |
|
62 |
|
63 void CCustomCmdCheckUserDrive::ExecuteCancel() |
|
64 { |
|
65 //Nothing to cancel |
|
66 } |
|
67 |
|
68 void CCustomCmdCheckUserDrive::Close() |
|
69 { |
|
70 } |
|
71 |
|
72 void CCustomCmdCheckUserDrive::Release() |
|
73 { |
|
74 delete this; |
|
75 } |