59 CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate() |
61 CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate() |
60 { |
62 { |
61 } |
63 } |
62 |
64 |
63 /*! |
65 /*! |
|
66 Provides details needed for uninstalling process of Java applications. |
|
67 \param[in] componentId component id of an application to be uninstalled. |
|
68 \param[out] componentName a name of the component. |
|
69 \param[out] applicationsUids a list of uids of applications in the package |
|
70 of the given component id. |
|
71 \param[out] confirmationMessage optional deletion confirmation message, |
|
72 null string means the lack of the message. |
|
73 \retval true if there is no error. |
|
74 */ |
|
75 |
|
76 bool CaSoftwareRegistryPrivate::getUninstallDetails(int componentId, |
|
77 QString &componentName, |
|
78 QStringList &applicationsUids, |
|
79 QString &confirmationMessage) |
|
80 { |
|
81 TRAPD(error, getUninstallDetailsL(componentId, |
|
82 componentName, |
|
83 applicationsUids, |
|
84 confirmationMessage) |
|
85 ); |
|
86 return error == KErrNone; |
|
87 } |
|
88 |
|
89 /*! |
|
90 Provides a list of uids of applications installed by the given package. |
|
91 \param[in] componentId component id of an application to be uninstalled. |
|
92 \param[out] applicationsUids a list of uids of applications in the package |
|
93 of the given component id. |
|
94 \retval true if there is no error. |
|
95 */ |
|
96 |
|
97 bool CaSoftwareRegistryPrivate::getApplicationsUids(int componentId, |
|
98 QStringList &applicationsUids) |
|
99 { |
|
100 TRAPD(error, getApplicationsUidsL(componentId, applicationsUids)); |
|
101 return error == KErrNone; |
|
102 } |
|
103 |
|
104 /*! |
|
105 Provides details needed for uninstalling process of Java applications |
|
106 (leaving version). |
|
107 \param[in] componentId component id of an application to be uninstalled. |
|
108 \param[out] componentName a name of the component. |
|
109 \param[out] applicationsUids a list of uids of applications in the package |
|
110 of the given component id. |
|
111 \param[out] confirmationMessage optional deletion confirmation message, |
|
112 null string means the lack of the message. |
|
113 */ |
|
114 void CaSoftwareRegistryPrivate::getUninstallDetailsL(int componentId, |
|
115 QString &componentName, |
|
116 QStringList &appUids, |
|
117 QString &confirmationMessage) |
|
118 { |
|
119 componentName.clear(); |
|
120 appUids.clear(); |
|
121 confirmationMessage.clear(); |
|
122 |
|
123 if (componentId >= 1) { |
|
124 TComponentId componentIdValue(componentId); |
|
125 RArray<TUid> appUidsArray; |
|
126 CleanupClosePushL(appUidsArray); |
|
127 CLocalizablePropertyEntry *confirmationMessageProperty = NULL; |
|
128 |
|
129 RSoftwareComponentRegistry softwareComponentRegistry; |
|
130 CleanupClosePushL(softwareComponentRegistry); |
|
131 User::LeaveIfError(softwareComponentRegistry.Connect()); |
|
132 |
|
133 CComponentEntry *entry = CComponentEntry::NewLC(); |
|
134 softwareComponentRegistry.GetComponentL(componentId, *entry); |
|
135 softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue, |
|
136 appUidsArray); |
|
137 |
|
138 CPropertyEntry *confirmationProperty = |
|
139 softwareComponentRegistry.GetComponentPropertyL(componentId, |
|
140 KConfirmMessageKey); |
|
141 if (confirmationProperty && |
|
142 confirmationProperty->PropertyType() == |
|
143 CPropertyEntry::ELocalizedProperty) { |
|
144 confirmationMessageProperty = |
|
145 static_cast<CLocalizablePropertyEntry *>( |
|
146 confirmationProperty); |
|
147 } else { |
|
148 delete confirmationProperty; |
|
149 confirmationProperty = NULL; |
|
150 } |
|
151 |
|
152 QT_TRYCATCH_LEAVING(componentName = |
|
153 XQConversions::s60DescToQString(entry->Name()); |
|
154 for (TInt i = 0; i<appUidsArray.Count(); i++) { |
|
155 appUids.append(QString::number(appUidsArray[i].iUid)); |
|
156 } |
|
157 if (confirmationMessageProperty) { |
|
158 confirmationMessage = XQConversions::s60DescToQString( |
|
159 confirmationMessageProperty->StrValue()); |
|
160 } |
|
161 ); |
|
162 |
|
163 CleanupStack::PopAndDestroy(3, &appUidsArray); |
|
164 } |
|
165 } |
|
166 |
|
167 /*! |
|
168 Provides details needed for uninstalling process of Java applications |
|
169 (leaving version). |
|
170 \param[in] componentId component id of an application to be uninstalled. |
|
171 \param[out] applicationsUids a list of uids of applications in the package |
|
172 of the given component id. |
|
173 */ |
|
174 void CaSoftwareRegistryPrivate::getApplicationsUidsL(int componentId, |
|
175 QStringList &appUids) |
|
176 { |
|
177 appUids.clear(); |
|
178 if (componentId >= 1) { |
|
179 TComponentId componentIdValue(componentId); |
|
180 RArray<TUid> appUidsArray; |
|
181 CleanupClosePushL(appUidsArray); |
|
182 |
|
183 RSoftwareComponentRegistry softwareComponentRegistry; |
|
184 CleanupClosePushL(softwareComponentRegistry); |
|
185 User::LeaveIfError(softwareComponentRegistry.Connect()); |
|
186 |
|
187 softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue, |
|
188 appUidsArray); |
|
189 |
|
190 QT_TRYCATCH_LEAVING( |
|
191 for (TInt i = 0; i<appUidsArray.Count(); i++) { |
|
192 appUids.append(QString::number(appUidsArray[i].iUid)); |
|
193 } |
|
194 ); |
|
195 CleanupStack::PopAndDestroy(2, &appUidsArray); |
|
196 } |
|
197 } |
|
198 |
|
199 /*! |
64 \param componentId Component id of the entry which details are requested for. |
200 \param componentId Component id of the entry which details are requested for. |
65 \return Map of component details if component id was greater than 0 or |
201 \return Map of component details if component id was greater than 0 or |
66 empty map otherwise. |
202 empty map otherwise. |
67 */ |
203 */ |
68 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails( |
204 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails( |
71 CaSoftwareRegistry::DetailMap result; |
207 CaSoftwareRegistry::DetailMap result; |
72 |
208 |
73 if (componentId >= 1) { |
209 if (componentId >= 1) { |
74 RSoftwareComponentRegistry softwareComponentRegistry; |
210 RSoftwareComponentRegistry softwareComponentRegistry; |
75 ScrScopedPointer scr(&softwareComponentRegistry); |
211 ScrScopedPointer scr(&softwareComponentRegistry); |
76 QT_TRAP_THROWING(User::LeaveIfError(scr->Connect())); |
212 if (scr->Connect() == KErrNone) { |
77 |
213 |
78 QScopedPointer<CComponentEntry> entry; |
214 QScopedPointer<CComponentEntry> entry; |
79 |
215 |
80 QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL())); |
216 QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL())); |
81 QT_TRAP_THROWING(scr->GetComponentL(componentId, *entry)); |
217 |
82 result = entryDetails(*entry); |
218 TBool resultCode = EFalse; |
|
219 TRAPD(leaveCode, resultCode = scr->GetComponentL(componentId, *entry)); |
|
220 if (leaveCode == KErrNone && resultCode) { |
|
221 result = entryDetails(*entry); |
|
222 } |
|
223 } |
83 } |
224 } |
84 |
225 |
85 return result; |
226 return result; |
86 } |
227 } |
87 |
228 |
102 |
243 |
103 detailMap[CaSoftwareRegistry::componentVendorKey()] = |
244 detailMap[CaSoftwareRegistry::componentVendorKey()] = |
104 XQConversions::s60DescToQString(entry.Vendor()); |
245 XQConversions::s60DescToQString(entry.Vendor()); |
105 |
246 |
106 QString drives; |
247 QString drives; |
107 TChar drive; |
248 QString drv; |
|
249 TChar drive; |
108 |
250 |
109 const TInt driveListLen(entry.InstalledDrives().Length()); |
251 const TInt driveListLen(entry.InstalledDrives().Length()); |
110 for (TInt i( 0 ); i < driveListLen; ++i) { |
252 for (TInt i( 0 ); i < driveListLen; ++i) { |
111 if (entry.InstalledDrives()[i] != '\0') { |
253 if (entry.InstalledDrives()[i] != '\0') { |
112 |
254 |
113 if (!drives.isEmpty()) { |
255 if (!drives.isEmpty()) { |
114 drives = drives.append(","); |
256 drives = drives.append(","); |
115 } |
257 } |
116 |
258 drv = QString(QChar('A'+ i)).append(":"); |
117 if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone |
259 if(DriveInfo::GetDefaultDrive( |
|
260 DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone |
118 && QChar('A'+ i) == QChar(drive)) |
261 && QChar('A'+ i) == QChar(drive)) |
119 { |
262 { |
120 drives = drives.append(QChar('A'+ i)).append(":").append( |
263 drives = drives.append( |
121 " txt_applib_dialog_1_device_memory"); |
264 HbParameterLengthLimiter("txt_applib_dialog_1_device_memory").arg( |
|
265 QString(QChar('A'+ i)).append(":"))); |
122 } |
266 } |
123 else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) == KErrNone |
267 else if(DriveInfo::GetDefaultDrive( |
|
268 DriveInfo::EDefaultMassStorage, drive ) == KErrNone |
124 && QChar('A'+ i) == QChar(drive)) |
269 && QChar('A'+ i) == QChar(drive)) |
125 { |
270 { |
126 drives = drives.append(QChar('A'+ i)).append(":").append( |
271 drives = drives.append( |
127 " txt_applib_dialog_1_mass_storage"); |
272 HbParameterLengthLimiter("txt_applib_dialog_1_mass_storage").arg( |
|
273 QString(QChar('A'+ i)).append(":"))); |
128 } |
274 } |
129 else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone |
275 else if(DriveInfo::GetDefaultDrive( |
|
276 DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone |
130 && QChar('A'+ i) == QChar(drive)) |
277 && QChar('A'+ i) == QChar(drive)) |
131 { |
278 { |
132 RFs fs; |
279 RFs fs; |
133 RFSScopedPointer fSPointer(&fs); |
280 RFSScopedPointer fSPointer(&fs); |
134 qt_symbian_throwIfError(fs.Connect()); |
281 if (fs.Connect() == KErrNone) { |
135 |
282 TInt driveNumber; |
136 TInt driveNumber; |
283 TVolumeInfo tv; |
137 TVolumeInfo tv; |
284 DriveInfo::GetDefaultDrive( |
138 DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, driveNumber ); |
285 DriveInfo::EDefaultRemovableMassStorage, driveNumber ); |
139 |
286 qt_symbian_throwIfError(fs.Volume(tv, driveNumber)); |
140 qt_symbian_throwIfError(fs.Volume(tv, driveNumber)); |
287 if(tv.iName.Length()) { |
141 if(tv.iName.Length()) { |
288 drives = drives.append( |
142 drives = drives.append(QChar('A'+ i)).append(": ").append( |
289 HbParameterLengthLimiter("txt_applib_dialog_1_2").arg( |
143 XQConversions::s60DescToQString(tv.iName)); |
290 QString(QChar('A'+ i)).append(":")).arg( |
|
291 XQConversions::s60DescToQString(tv.iName))); |
|
292 } |
|
293 else { |
|
294 drives = drives.append( |
|
295 HbParameterLengthLimiter("txt_applib_dialog_1_memory_card").arg( |
|
296 QString(QChar('A'+ i)).append(":"))); |
|
297 } |
144 } |
298 } |
145 else { |
299 } else { |
146 drives = drives.append(QChar('A'+ i)).append(":").append( |
|
147 " txt_applib_dialog_1_memory_card"); |
|
148 } |
|
149 } |
|
150 else { |
|
151 drives = drives.append(QChar('A'+ i)).append(":"); |
300 drives = drives.append(QChar('A'+ i)).append(":"); |
152 } |
301 } |
153 } |
302 } |
154 } |
303 } |
155 |
304 |
156 detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives; |
305 detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives; |
157 detailMap[CaSoftwareRegistry::componentSizeKey()].setNum( |
306 |
158 entry.ComponentSize() / 1024); |
307 |
|
308 static const TInt64 KKilo = 1024; |
|
309 static const TInt64 KMega = KKilo * KKilo; |
|
310 if(entry.ComponentSize() >= KMega) { |
|
311 detailMap[CaSoftwareRegistry::componentSizeKey()] = |
|
312 HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg(QString().setNum( |
|
313 static_cast<double>(entry.ComponentSize() / KMega))); |
|
314 } |
|
315 else { |
|
316 detailMap[CaSoftwareRegistry::componentSizeKey()] = |
|
317 HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg(QString().setNum( |
|
318 static_cast<double>(entry.ComponentSize() / KKilo))); |
|
319 } |
|
320 |
159 |
321 |
160 detailMap[CaSoftwareRegistry::componentTypeKey()] = |
322 detailMap[CaSoftwareRegistry::componentTypeKey()] = |
161 XQConversions::s60DescToQString(entry.SoftwareType()); |
323 XQConversions::s60DescToQString(entry.SoftwareType()); |
162 |
324 |
163 return detailMap; |
325 return detailMap; |