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