94
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include <QtGlobal>
|
|
18 |
#include <QString>
|
98
|
19 |
#include <QStringList>
|
94
|
20 |
|
107
|
21 |
#include "cauninstallnotifier.h"
|
94
|
22 |
#include "casoftwareregistry.h"
|
|
23 |
#include "casoftwareregistry_p.h"
|
|
24 |
|
|
25 |
|
|
26 |
// ======== MEMBER FUNCTIONS ========
|
|
27 |
|
|
28 |
/*!
|
|
29 |
|
|
30 |
\class CaSoftwareRegistry.
|
|
31 |
\brief This class provides access to USIF provided data and converting
|
|
32 |
them from Symbian to Qt types.
|
|
33 |
|
|
34 |
CaSoftwareRegistry class provides a factory method which returns smart pointer
|
|
35 |
to CaSoftwareRegistry instnce to ensure
|
|
36 |
automatical memory cleanup once the reference count drops to 0.
|
|
37 |
|
|
38 |
\code
|
|
39 |
QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
|
|
40 |
\endcode
|
|
41 |
|
|
42 |
Subsequent calls to CaSoftwareRegistry::create() may return pointers to different
|
|
43 |
instances. It is a case when between the calls instance counter of the created
|
|
44 |
object dropped to 0 and it was deleted.
|
102
|
45 |
|
94
|
46 |
*/
|
|
47 |
|
|
48 |
/*! \typedef typedef QHash<QString, QString> DetailMap;
|
|
49 |
* Defines map type for component details.
|
102
|
50 |
*
|
94
|
51 |
*/
|
|
52 |
|
|
53 |
/*!
|
|
54 |
\var CaSoftwareRegistryPrivate::m_q
|
|
55 |
Points to the CaSoftwareRegistry instance that uses this private implementation.
|
|
56 |
*/
|
|
57 |
|
|
58 |
|
|
59 |
// Initialization of a static member variable.
|
102
|
60 |
QWeakPointer<CaSoftwareRegistry> CaSoftwareRegistry::m_instance =
|
94
|
61 |
QWeakPointer<CaSoftwareRegistry>();
|
|
62 |
|
|
63 |
|
|
64 |
/*!
|
|
65 |
Constructor.
|
|
66 |
\param parent pointer to a parent. It defaults to NULL.
|
|
67 |
*/
|
|
68 |
CaSoftwareRegistry::CaSoftwareRegistry(QObject *parent) :
|
|
69 |
QObject(parent), m_d(new CaSoftwareRegistryPrivate(this))
|
|
70 |
{
|
|
71 |
|
|
72 |
}
|
|
73 |
|
|
74 |
/*!
|
|
75 |
Returns a pointer to an instance of the CaSoftwareRegistry class.
|
|
76 |
\retval A pointer to an instance of the CaSoftwareRegistry class.
|
|
77 |
*/
|
|
78 |
QSharedPointer<CaSoftwareRegistry> CaSoftwareRegistry::create()
|
|
79 |
{
|
|
80 |
QSharedPointer<CaSoftwareRegistry> service(m_instance);
|
|
81 |
if (!service) {
|
|
82 |
service = QSharedPointer<CaSoftwareRegistry>(new CaSoftwareRegistry);
|
|
83 |
m_instance = service.toWeakRef();
|
|
84 |
}
|
|
85 |
return service;
|
|
86 |
}
|
|
87 |
|
|
88 |
/*!
|
|
89 |
Destructor.
|
|
90 |
*/
|
|
91 |
CaSoftwareRegistry::~CaSoftwareRegistry()
|
|
92 |
{
|
|
93 |
delete m_d;
|
|
94 |
}
|
|
95 |
|
|
96 |
/*!
|
98
|
97 |
Provides details needed for uninstalling process of Java applications.
|
|
98 |
\code
|
|
99 |
QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
|
|
100 |
int componentId(20);
|
|
101 |
QString &componentName,
|
|
102 |
QStringList applicationsUids;
|
|
103 |
QString confirmationMessage;
|
|
104 |
CaSoftwareRegistry::DetailMap detailMap = service->getUninstallDetails(
|
|
105 |
componentId,
|
|
106 |
componentName,
|
|
107 |
applicationsUids,
|
|
108 |
confirmationMessage);
|
|
109 |
\endcode
|
|
110 |
\param[in] componentId component id of an application to be uninstalled.
|
|
111 |
\param[out] componentName a name of the component.
|
|
112 |
\param[out] applicationsUids a list of uids of applications in the package
|
|
113 |
of the given component id.
|
|
114 |
\param[out] confirmationMessage optional deletion confirmation message,
|
|
115 |
null string means the lack of the message.
|
|
116 |
\retval true if there is no error.
|
|
117 |
*/
|
|
118 |
bool CaSoftwareRegistry::getUninstallDetails(int componentId,
|
|
119 |
QString &componentName,
|
|
120 |
QStringList &applicationsUids,
|
|
121 |
QString &confirmationMessage)
|
|
122 |
{
|
|
123 |
return m_d->getUninstallDetails(componentId,
|
|
124 |
componentName,
|
|
125 |
applicationsUids,
|
|
126 |
confirmationMessage);
|
|
127 |
}
|
|
128 |
|
|
129 |
/*!
|
|
130 |
Provides a list of uids of applications installed by the given package.
|
|
131 |
\param[in] componentId component id of an application to be uninstalled.
|
|
132 |
\param[out] applicationsUids a list of uids of applications in the package
|
|
133 |
of the given component id.
|
|
134 |
\retval true if there is no error.
|
|
135 |
*/
|
|
136 |
|
|
137 |
bool CaSoftwareRegistry::getApplicationsUids(int componentId,
|
|
138 |
QStringList &applicationsUids)
|
|
139 |
{
|
|
140 |
return m_d->getApplicationsUids(componentId, applicationsUids);
|
|
141 |
}
|
|
142 |
|
|
143 |
/*!
|
94
|
144 |
The method provides component details from USIF for a given component id.
|
|
145 |
\code
|
|
146 |
QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
|
|
147 |
CaSoftwareRegistry::DetailMap detailMap = service->entryDetails(5);
|
|
148 |
QString appName = detailMap[CaSoftwareRegistry::componentNameKey()];
|
|
149 |
\endcode
|
|
150 |
\param componentId Component id of the entry details are requested for.
|
|
151 |
\return Map of the component details if component id was greater than 0 or
|
102
|
152 |
empty map otherwise.
|
94
|
153 |
|
|
154 |
*/
|
|
155 |
CaSoftwareRegistry::DetailMap CaSoftwareRegistry::entryDetails(
|
|
156 |
int componentId) const
|
|
157 |
{
|
|
158 |
return m_d->entryDetails(componentId);
|
|
159 |
}
|
|
160 |
|
|
161 |
/*!
|
102
|
162 |
The method provides installation details from USIF.
|
|
163 |
\return QList of DetailMap.
|
|
164 |
*/
|
|
165 |
QList<CaSoftwareRegistry::DetailMap>
|
|
166 |
CaSoftwareRegistry::retrieveLogEntries() const
|
|
167 |
{
|
|
168 |
return m_d->retrieveLogEntries();
|
|
169 |
}
|
|
170 |
|
|
171 |
/*!
|
107
|
172 |
Creates uninstall notifier.
|
|
173 |
\retval pointer to created CaUninstallNotifier instance.
|
|
174 |
*/
|
|
175 |
CaUninstallNotifier *CaSoftwareRegistry::createUninstallNotifier() const
|
|
176 |
{
|
|
177 |
return m_d->createUninstallNotifier();
|
|
178 |
}
|
|
179 |
|
|
180 |
/*!
|
94
|
181 |
* \return Component name key in CaSoftwareRegistry::DetailMap.
|
|
182 |
*/
|
|
183 |
QString CaSoftwareRegistry::componentNameKey()
|
|
184 |
{
|
|
185 |
static const QString key("name");
|
|
186 |
return key;
|
|
187 |
}
|
|
188 |
|
|
189 |
/*!
|
|
190 |
* \return Component version key in CaSoftwareRegistry::DetailMap.
|
|
191 |
*/
|
|
192 |
QString CaSoftwareRegistry::componentVersionKey()
|
|
193 |
{
|
|
194 |
static const QString key("version");
|
|
195 |
return key;
|
|
196 |
}
|
|
197 |
|
|
198 |
/*!
|
|
199 |
* \return Component vendor key in CaSoftwareRegistry::DetailMap.
|
|
200 |
*/
|
|
201 |
QString CaSoftwareRegistry::componentVendorKey()
|
|
202 |
{
|
|
203 |
static const QString key("vendor");
|
|
204 |
return key;
|
|
205 |
}
|
|
206 |
|
|
207 |
/*!
|
|
208 |
* \return Component drive info key in CaSoftwareRegistry::DetailMap.
|
|
209 |
*/
|
|
210 |
QString CaSoftwareRegistry::componentDriveInfoKey()
|
|
211 |
{
|
|
212 |
static const QString key("driveInfo");
|
|
213 |
return key;
|
|
214 |
}
|
|
215 |
|
|
216 |
/*!
|
102
|
217 |
* \return Component protection domainkey in CaSoftwareRegistry::DetailMap.
|
|
218 |
*/
|
|
219 |
QString CaSoftwareRegistry::componentProtectionDomainKey()
|
|
220 |
{
|
|
221 |
static const QString key("protectiondomain");
|
|
222 |
return key;
|
|
223 |
}
|
|
224 |
|
|
225 |
/*!
|
94
|
226 |
* \return Component size info key in CaSoftwareRegistry::DetailMap.
|
|
227 |
*/
|
|
228 |
QString CaSoftwareRegistry::componentSizeKey()
|
|
229 |
{
|
|
230 |
static const QString key("size");
|
|
231 |
return key;
|
|
232 |
}
|
|
233 |
|
|
234 |
/*!
|
|
235 |
* \return Component type key in CaSoftwareRegistry::DetailMap.
|
|
236 |
*/
|
|
237 |
QString CaSoftwareRegistry::componentTypeKey()
|
|
238 |
{
|
|
239 |
static const QString key("type");
|
|
240 |
return key;
|
|
241 |
}
|
|
242 |
|
102
|
243 |
/*!
|
|
244 |
* \return Component description key in CaSoftwareRegistry::DetailMap.
|
|
245 |
*/
|
|
246 |
QString CaSoftwareRegistry::componentDescriptionKey()
|
|
247 |
{
|
|
248 |
static const QString key("description");
|
|
249 |
return key;
|
|
250 |
}
|
|
251 |
|
|
252 |
/*!
|
|
253 |
* \return Component instalation/uninstallation
|
|
254 |
* time key in CaSoftwareRegistry::DetailMap.
|
|
255 |
*/
|
|
256 |
QString CaSoftwareRegistry::componentTimeKey()
|
|
257 |
{
|
|
258 |
static const QString key("time");
|
|
259 |
return key;
|
|
260 |
}
|
|
261 |
|
|
262 |
/*!
|
|
263 |
* \return Component instalation/uninstallation/upgrade/hidden
|
|
264 |
* operation type key in CaSoftwareRegistry::DetailMap.
|
|
265 |
*/
|
|
266 |
QString CaSoftwareRegistry::componentOperationTypeKey()
|
|
267 |
{
|
|
268 |
static const QString key("operationType");
|
|
269 |
return key;
|
|
270 |
}
|
|
271 |
|
|
272 |
/*!
|
|
273 |
* \return Component instalation
|
|
274 |
* operation value in CaSoftwareRegistry::DetailMap.
|
|
275 |
*/
|
|
276 |
QString CaSoftwareRegistry::componentInstallValue()
|
|
277 |
{
|
|
278 |
static const QString value("install");
|
|
279 |
return value;
|
|
280 |
}
|
|
281 |
|
|
282 |
/*!
|
|
283 |
* \return Component uninstallation
|
|
284 |
* operation value in CaSoftwareRegistry::DetailMap.
|
|
285 |
*/
|
|
286 |
QString CaSoftwareRegistry::componentUninstallValue()
|
|
287 |
{
|
|
288 |
static const QString value("uninstall");
|
|
289 |
return value;
|
|
290 |
}
|
|
291 |
|
|
292 |
/*!
|
|
293 |
* \return Component upgrade
|
|
294 |
* operation value in CaSoftwareRegistry::DetailMap.
|
|
295 |
*/
|
|
296 |
QString CaSoftwareRegistry::componentUpgradeValue()
|
|
297 |
{
|
|
298 |
static const QString value("upgrade");
|
|
299 |
return value;
|
|
300 |
}
|
|
301 |
|
|
302 |
/*!
|
|
303 |
* \return Component hidden
|
|
304 |
* operation value in CaSoftwareRegistry::DetailMap.
|
|
305 |
*/
|
|
306 |
QString CaSoftwareRegistry::componentHiddenValue()
|
|
307 |
{
|
|
308 |
static const QString value("hidden");
|
|
309 |
return value;
|
|
310 |
}
|
|
311 |
|