|
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 "CdlUserPackageExplorer.h" |
|
18 |
|
19 #include <bautils.h> |
|
20 |
|
21 |
|
22 EXPORT_C CCdlUserPackageExplorer::~CCdlUserPackageExplorer() |
|
23 { |
|
24 iLanguageDowngradePath.Close(); |
|
25 } |
|
26 |
|
27 EXPORT_C void CCdlUserPackageExplorer::ConstructL() |
|
28 { |
|
29 RFs fs; |
|
30 User::LeaveIfError(fs.Connect()); |
|
31 CleanupClosePushL(fs); |
|
32 BaflUtils::GetDowngradePathL(fs, User::Language(), iLanguageDowngradePath); |
|
33 CleanupStack::PopAndDestroy(); // fs |
|
34 } |
|
35 |
|
36 EXPORT_C TCdlInstanceComparison CCdlUserPackageExplorer::Compare(const CDL_User_Package::CInstance& aFirst, |
|
37 const CDL_User_Package::CInstance& aSecond) const |
|
38 { |
|
39 if (aFirst.uid() != aSecond.uid()) |
|
40 return ECdlInstancesNotComparable; |
|
41 |
|
42 if (LanguageRank(aFirst.language()) <= LanguageRank(aSecond.language())) |
|
43 return EFirstCdlInstanceBetter; |
|
44 else |
|
45 return ESecondCdlInstanceBetter; |
|
46 } |
|
47 |
|
48 TInt CCdlUserPackageExplorer::LanguageRank(TLanguage aLang) const |
|
49 { |
|
50 TInt rank = iLanguageDowngradePath.Find(aLang); |
|
51 if (rank == KErrNotFound) |
|
52 rank = iLanguageDowngradePath.Count(); |
|
53 return rank; |
|
54 } |