1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
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 * |
8 * |
16 */ |
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
17 |
17 |
18 // INCLUDE FILES |
18 // INCLUDE FILES |
19 #include "widgetscannerutils.h" |
19 #include "widgetscannerutils.h" |
20 #include "cainnerentry.h" |
20 #include "cainnerentry.h" |
21 #include "cadef.h" |
21 #include "cadef.h" |
22 |
22 |
23 // ----------------------------------------------------------------------------- |
23 // ----------------------------------------------------------------------------- |
24 // |
24 // |
25 // ----------------------------------------------------------------------------- |
25 // ----------------------------------------------------------------------------- |
26 // |
26 // |
27 TBool WidgetScannerUtils::IsFileOnDrive(const TDesC& aFileName, |
27 TBool WidgetScannerUtils::IsFileOnDrive( const TDesC& aFileName, |
28 const DriveInfo::TDefaultDrives& aDefaultDrive) |
28 const DriveInfo::TDefaultDrives& aDefaultDrive ) |
29 { |
29 { |
30 if (aFileName.Length()) { |
30 TBool result = EFalse; |
|
31 if ( aFileName.Length() ) |
|
32 { |
31 TInt drive; |
33 TInt drive; |
32 TInt err = DriveInfo::GetDefaultDrive(aDefaultDrive, drive); |
34 TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, drive ); |
33 if (!err) { |
35 if ( !err ) |
|
36 { |
34 TInt fileDrive; |
37 TInt fileDrive; |
35 err = RFs::CharToDrive(aFileName[0], fileDrive); |
38 err = RFs::CharToDrive( aFileName[0], fileDrive ); |
36 if (!err && fileDrive == drive) { |
39 if ( !err && fileDrive == drive ) |
37 return ETrue; |
40 { |
|
41 result = ETrue; |
|
42 } |
38 } |
43 } |
39 } |
44 } |
|
45 return result; |
40 } |
46 } |
41 return EFalse; |
|
42 } |
|
43 |
|
44 |
47 |
45 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
46 // |
49 // |
47 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
48 // |
51 // |
49 void WidgetScannerUtils::CurrentMmcId( const RFs& aFs, TDes& aMmcId ) |
52 void WidgetScannerUtils::CurrentMmcId( const RFs& aFs, TDes& aMmcId ) |
50 { |
53 { |
51 TInt mmcDrive; |
54 TInt mmcDrive; |
52 if ( DriveInfo::GetDefaultDrive( |
55 if ( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, |
53 DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) == KErrNone ) |
56 mmcDrive ) == KErrNone ) |
54 { |
57 { |
55 TVolumeInfo volumeInfo; |
58 TVolumeInfo volumeInfo; |
56 if( aFs.Volume( volumeInfo, mmcDrive ) == KErrNone ) |
59 if ( aFs.Volume( volumeInfo, mmcDrive ) == KErrNone ) |
57 { |
60 { |
58 aMmcId.Zero(); |
61 aMmcId.Zero(); |
59 aMmcId.AppendNum( volumeInfo.iUniqueID ); |
62 aMmcId.AppendNum( volumeInfo.iUniqueID ); |
60 } |
63 } |
61 } |
64 } |