Commit dc921cc5 authored by Pawel Polanski's avatar Pawel Polanski
Browse files

Symbian: small change in cert's capabilities

parent e414335f
......@@ -38,6 +38,7 @@
#include <QCoreApplication>
#include <QTextStream>
#include <QHash>
#include <QMutableHashIterator>
#include "s60symbiancertificate.h"
......@@ -90,17 +91,7 @@ static const CapabilitySet capabilitySet[] =
{ "red", S60CertificateInfo::ManufacturerCapabilities }
};
QStringList createCapabilityList(uint capabilities)
{
const int capabilityCount = sizeof(capability)/sizeof(capability[0]);
QStringList capabilityList;
for(int i = 0; i < capabilityCount; ++i)
if (capabilities&capability[i].value)
capabilityList << QLatin1String(capability[i].name);
return capabilityList;
}
QStringList createHtmlCapabilityList(uint capabilities)
QHash<int, QStringList> createCapabilityMap(uint capabilities)
{
const int capabilityCount = sizeof(capability)/sizeof(capability[0]);
const int capabilitySetCount = sizeof(capabilitySet)/sizeof(capabilitySet[0]);
......@@ -110,20 +101,52 @@ QStringList createHtmlCapabilityList(uint capabilities)
if (capabilities&capability[i].value) {
for (int j = 0; j < capabilitySetCount; ++j)
if (capability[i].value&capabilitySet[j].value) {
capabilityMap[capabilitySet[j].value]
<< QString("<font color=\"%1\">%2</font>")
.arg(QLatin1String(capabilitySet[j].color))
.arg(QLatin1String(capability[i].name));
capabilityMap[capabilitySet[j].value] << capability[i].name;
break;
}
}
QMutableHashIterator<int, QStringList> i(capabilityMap);
while (i.hasNext()) {
i.next();
i.value().sort();
}
return capabilityMap;
}
QStringList createCapabilityList(uint capabilities)
{
QHash<int, QStringList> capabilityMap(createCapabilityMap(capabilities));
return capabilityMap[S60CertificateInfo::UserCapabilities]
+ capabilityMap[S60CertificateInfo::SystemCapabilities]
+ capabilityMap[S60CertificateInfo::RestrictedCapabilities]
+ capabilityMap[S60CertificateInfo::ManufacturerCapabilities];
}
QStringList createHtmlCapabilityList(uint capabilities)
{
const int capabilitySetCount = sizeof(capabilitySet)/sizeof(capabilitySet[0]);
QHash<int, QStringList> capabilityMap(createCapabilityMap(capabilities));
QStringList result;
for (int j = 0; j < capabilitySetCount; ++j) {
QHashIterator<int, QStringList> i(capabilityMap);
while (i.hasNext()) {
i.next();
if (i.key() == capabilitySet[j].value) {
foreach (QString capability, i.value()) {
result << QString("<font color=\"%1\">%2</font>")
.arg(capabilitySet[j].color).arg(capability);
}
break;
}
}
}
return result;
}
S60CertificateInfo::S60CertificateInfo(const QString &filePath, QObject* parent)
: QObject(parent),
m_certificate(new S60SymbianCertificate(filePath)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment