1 /* |
|
2 * Copyright (c) 2008-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: Implementation of Metadata dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // CLASS HEADER |
|
22 #include "glxresourceutilities.h" |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <bautils.h> |
|
26 #include <AknUtils.h> |
|
27 #include <f32file.h> |
|
28 #include <glxuistd.h> |
|
29 #include <data_caging_path_literals.hrh> |
|
30 // INTERNAL INCLUDES |
|
31 #include <glxtracer.h> |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // GetResourceFilenameL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile ) |
|
38 { |
|
39 TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile)"); |
|
40 |
|
41 RFs fs; |
|
42 User::LeaveIfError( fs.Connect() ); |
|
43 CleanupClosePushL( fs ); |
|
44 CGlxResourceUtilities::GetResourceFilenameL( aResFile, fs ); |
|
45 CleanupStack::PopAndDestroy( &fs ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // GetResourceFilenameL |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs ) |
|
53 { |
|
54 TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs )"); |
|
55 |
|
56 // don't use AknUtils CompleteWithAppPath |
|
57 aResFile.Insert( 0, TDriveUnit( EDriveC).Name() ); |
|
58 // try to locate the localised resource |
|
59 BaflUtils::NearestLanguageFile( aFs, aResFile ); |
|
60 // if the localised resource is found, the file name is changed to |
|
61 // the localised name (z:\apps\resources\xxx.r001) |
|
62 if( !BaflUtils::FileExists( aFs, aResFile ) ) |
|
63 { |
|
64 // not found on c drive, try z |
|
65 aResFile.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); |
|
66 // try to locate the localised resource again |
|
67 BaflUtils::NearestLanguageFile( aFs, aResFile ); |
|
68 // if file was not found this time, there is no localised |
|
69 // resource with the name |
|
70 if (!BaflUtils::FileExists( aFs, aResFile ) ) |
|
71 { |
|
72 User::Leave( KErrNotFound ); |
|
73 } |
|
74 } |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // GetUiUtilitiesResourceFilenameL |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C TFileName CGlxResourceUtilities::GetUiUtilitiesResourceFilenameL() |
|
82 |
|
83 { |
|
84 TParse parse; |
|
85 parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); |
|
86 TFileName resourceFile(parse.FullName()); |
|
87 GetResourceFilenameL(resourceFile); |
|
88 return resourceFile; |
|
89 } |
|
90 |
|