|
1 /* |
|
2 * Copyright (c) 2002-2008 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 CAppMngr2SisxInfoIterator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmngr2sisxinfoiterator.h" // CAppMngr2SisxInfoIterator |
|
20 #include "appmngr2sisxappinfo.h" // CAppMngr2SisxAppInfo |
|
21 #include <StringLoader.h> // StringLoader |
|
22 #include <SWInstCommonUI.rsg> // Resource IDs |
|
23 #include <AknUtils.h> // AknTextUtils |
|
24 |
|
25 _LIT( KSymbian, "Symbian OS\x2122" ); |
|
26 _LIT( KLRE, "\x202A" ); |
|
27 _LIT( KPDF, "\x202C" ); |
|
28 _LIT( KLeftParenthes, "(" ); |
|
29 |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CAppMngr2SisxInfoIterator::NewL() |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CAppMngr2SisxInfoIterator* CAppMngr2SisxInfoIterator::NewL( |
|
38 CAppMngr2InfoBase& aSisx, TAppMngr2InfoType aInfoType ) |
|
39 { |
|
40 CAppMngr2SisxInfoIterator* self = |
|
41 new ( ELeave ) CAppMngr2SisxInfoIterator( aSisx, aInfoType ); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CAppMngr2SisxInfoIterator::~CAppMngr2SisxInfoIterator() |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CAppMngr2SisxInfoIterator::~CAppMngr2SisxInfoIterator() |
|
53 { |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CAppMngr2SisxInfoIterator::ConstructL() |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 void CAppMngr2SisxInfoIterator::ConstructL() |
|
61 { |
|
62 BaseConstructL(); |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CAppMngr2SisxInfoIterator::SetAllFieldsL() |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 void CAppMngr2SisxInfoIterator::SetAllFieldsL() |
|
70 { |
|
71 SetFieldL( R_SWCOMMON_DETAIL_NAME, iInfo.Name() ); |
|
72 |
|
73 if( iInfoType == EAppMngr2StatusInstalled ) |
|
74 { |
|
75 SetVersionL(); |
|
76 SetSupplierL(); |
|
77 } |
|
78 |
|
79 SetStatusL(); |
|
80 SetLocationL(); |
|
81 SetFieldL( R_SWCOMMON_DETAIL_APPSIZE, iInfo.Details() ); |
|
82 |
|
83 // Technology |
|
84 HBufC* tmpBuf = HBufC::NewLC( KLRE().Length() + KSymbian().Length() + KPDF().Length() ); |
|
85 tmpBuf->Des() = KLRE(); |
|
86 tmpBuf->Des() += KSymbian(); |
|
87 tmpBuf->Des() += KPDF(); |
|
88 SetFieldL( R_SWCOMMON_DETAIL_TECHNOLOGY, *tmpBuf ); |
|
89 CleanupStack::PopAndDestroy( tmpBuf ); |
|
90 |
|
91 SetTypeL(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CAppMngr2SisxInfoIterator::SetVersionL() |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CAppMngr2SisxInfoIterator::SetVersionL() |
|
99 { |
|
100 CAppMngr2SisxAppInfo* sisxInfo = reinterpret_cast<CAppMngr2SisxAppInfo*>( &iInfo ); |
|
101 HBufC* version = sisxInfo->Version().Name().AllocLC(); |
|
102 |
|
103 TPtr versionPtr = version->Des(); |
|
104 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( versionPtr ); |
|
105 HBufC* tmpBuf = HBufC::NewLC( KLRE().Length() + version->Length() + KPDF().Length() ); |
|
106 TInt position = version->Find( KLeftParenthes() ); |
|
107 if( position >= 0 ) |
|
108 { |
|
109 TPtr bufferPtr = tmpBuf->Des(); |
|
110 bufferPtr.Copy( version->Mid( 0, position ) ); |
|
111 bufferPtr.Append( KLRE() ); |
|
112 bufferPtr.Append( version->Mid( position, version->Length() - position ) ); |
|
113 bufferPtr.Append( KPDF() ); |
|
114 } |
|
115 else |
|
116 { |
|
117 tmpBuf->Des() = *version; |
|
118 } |
|
119 SetFieldL( R_SWCOMMON_DETAIL_VERSION, *tmpBuf ); |
|
120 |
|
121 CleanupStack::PopAndDestroy( 2, version ); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CAppMngr2SisxInfoIterator::SetSupplierL() |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CAppMngr2SisxInfoIterator::SetSupplierL() |
|
129 { |
|
130 CAppMngr2SisxAppInfo* sisxInfo = reinterpret_cast<CAppMngr2SisxAppInfo*>( &iInfo ); |
|
131 if( sisxInfo->IsTrusted() ) |
|
132 { |
|
133 SetFieldL( R_SWCOMMON_DETAIL_SUPPLIER, sisxInfo->Vendor() ); |
|
134 } |
|
135 else |
|
136 { |
|
137 HBufC* unknown = StringLoader::LoadLC( R_SWCOMMON_DETAIL_VALUE_UNKNOWN_SUPPLIER ); |
|
138 SetFieldL( R_SWCOMMON_DETAIL_SUPPLIER, *unknown ); |
|
139 CleanupStack::PopAndDestroy( unknown ); |
|
140 } |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CAppMngr2SisxInfoIterator::SetTypeL() |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void CAppMngr2SisxInfoIterator::SetTypeL() |
|
148 { |
|
149 HBufC* type = NULL; |
|
150 type = StringLoader::LoadLC( R_SWCOMMON_DETAIL_VALUE_APPLICATION ); |
|
151 SetFieldL( R_SWCOMMON_DETAIL_TYPE , *type); |
|
152 CleanupStack::PopAndDestroy( type ); |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CAppMngr2SisxInfoIterator::CAppMngr2SisxInfoIterator() |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 CAppMngr2SisxInfoIterator::CAppMngr2SisxInfoIterator( |
|
160 CAppMngr2InfoBase& aSisx, TAppMngr2InfoType aInfoType ) : |
|
161 CAppMngr2InfoIterator( aSisx, aInfoType ) |
|
162 { |
|
163 } |
|
164 |