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 |
|
|
21 |
|
|
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.
|
|
45 |
|
|
46 |
*/
|
|
47 |
|
|
48 |
/*! \typedef typedef QHash<QString, QString> DetailMap;
|
|
49 |
* Defines map type for component details.
|
|
50 |
*
|
|
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.
|
|
60 |
QWeakPointer<CaSoftwareRegistry> CaSoftwareRegistry::m_instance =
|
|
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
|
|
152 |
empty map otherwise.
|
|
153 |
|
|
154 |
*/
|
|
155 |
CaSoftwareRegistry::DetailMap CaSoftwareRegistry::entryDetails(
|
|
156 |
int componentId) const
|
|
157 |
{
|
|
158 |
return m_d->entryDetails(componentId);
|
|
159 |
}
|
|
160 |
|
|
161 |
/*!
|
|
162 |
* \return Component name key in CaSoftwareRegistry::DetailMap.
|
|
163 |
*/
|
|
164 |
QString CaSoftwareRegistry::componentNameKey()
|
|
165 |
{
|
|
166 |
static const QString key("name");
|
|
167 |
return key;
|
|
168 |
}
|
|
169 |
|
|
170 |
/*!
|
|
171 |
* \return Component version key in CaSoftwareRegistry::DetailMap.
|
|
172 |
*/
|
|
173 |
QString CaSoftwareRegistry::componentVersionKey()
|
|
174 |
{
|
|
175 |
static const QString key("version");
|
|
176 |
return key;
|
|
177 |
}
|
|
178 |
|
|
179 |
/*!
|
|
180 |
* \return Component vendor key in CaSoftwareRegistry::DetailMap.
|
|
181 |
*/
|
|
182 |
QString CaSoftwareRegistry::componentVendorKey()
|
|
183 |
{
|
|
184 |
static const QString key("vendor");
|
|
185 |
return key;
|
|
186 |
}
|
|
187 |
|
|
188 |
/*!
|
|
189 |
* \return Component drive info key in CaSoftwareRegistry::DetailMap.
|
|
190 |
*/
|
|
191 |
QString CaSoftwareRegistry::componentDriveInfoKey()
|
|
192 |
{
|
|
193 |
static const QString key("driveInfo");
|
|
194 |
return key;
|
|
195 |
}
|
|
196 |
|
|
197 |
/*!
|
|
198 |
* \return Component size info key in CaSoftwareRegistry::DetailMap.
|
|
199 |
*/
|
|
200 |
QString CaSoftwareRegistry::componentSizeKey()
|
|
201 |
{
|
|
202 |
static const QString key("size");
|
|
203 |
return key;
|
|
204 |
}
|
|
205 |
|
|
206 |
/*!
|
|
207 |
* \return Component type key in CaSoftwareRegistry::DetailMap.
|
|
208 |
*/
|
|
209 |
QString CaSoftwareRegistry::componentTypeKey()
|
|
210 |
{
|
|
211 |
static const QString key("type");
|
|
212 |
return key;
|
|
213 |
}
|
|
214 |
|