QList<Qt4ProFileNode *> nodes = pro->leafProFiles();
m_workingDirectories.clear();
- foreach (Qt4ProFileNode *node, nodes)
+ QStringList projectCapabilities;
+ foreach (Qt4ProFileNode *node, nodes) {
+ projectCapabilities += node->symbianCapabilities();
m_workingDirectories << node->buildDir();
+ }
+ projectCapabilities.removeDuplicates();
m_makeCmd = qt4BuildConfiguration()->makeCommand();
if (!QFileInfo(m_makeCmd).isAbsolute()) {
m_makeCmd = tmp;
}
- if (signingMode() == SignCustom && !validateCustomSigningResources())
+ if (signingMode() == SignCustom && !validateCustomSigningResources(projectCapabilities))
return false;
m_environment = qt4BuildConfiguration()->environment();
return true;
}
-bool S60CreatePackageStep::validateCustomSigningResources()
+bool S60CreatePackageStep::validateCustomSigningResources(const QStringList &capabilitiesInPro)
{
Q_ASSERT(signingMode() == SignCustom);
"Please define certificate file in the project's options.").arg(customKeyPath());
if (!errorString.isEmpty()) {
- emit addOutput(errorString, BuildStep::ErrorMessageOutput);
- emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error,
- errorString,
- QString(), -1,
- ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ reportPackageStepIssue(errorString, true);
return false;
}
QScopedPointer<S60CertificateInfo> certInfoPtr(new S60CertificateInfo(customSignaturePath()));
S60CertificateInfo::CertificateState certState = certInfoPtr.data()->validateCertificate();
switch (certState) {
case S60CertificateInfo::CertificateError:
- emit addOutput(certInfoPtr.data()->errorString(), BuildStep::ErrorMessageOutput);
- emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error,
- certInfoPtr.data()->errorString(),
- QString(), -1,
- ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ reportPackageStepIssue(certInfoPtr.data()->errorString(), true);
return false;
case S60CertificateInfo::CertificateWarning:
- emit addOutput(certInfoPtr.data()->errorString(), BuildStep::MessageOutput);
- emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Warning,
- certInfoPtr.data()->errorString(),
- QString(), -1,
- ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ reportPackageStepIssue(certInfoPtr.data()->errorString(), false);
break;
default:
break;
}
+
+ QStringList unsupportedCaps;
+ if (certInfoPtr.data()->compareCapabilities(capabilitiesInPro, unsupportedCaps)) {
+ if (!unsupportedCaps.isEmpty()) {
+ QString message = tr("The created package will not install on a "
+ "device as some of the defined capabilities "
+ "are not supported by the certificate: %1")
+ .arg(unsupportedCaps.join(" "));
+ reportPackageStepIssue(message, true);
+ return false;
+ }
+
+ } else
+ reportPackageStepIssue(certInfoPtr.data()->errorString(), false);
return true;
}
-
+void S60CreatePackageStep::reportPackageStepIssue(const QString &message, bool isError )
+{
+ emit addOutput(message, isError?
+ BuildStep::ErrorMessageOutput:
+ BuildStep::MessageOutput);
+ emit addTask(ProjectExplorer::Task(isError?
+ ProjectExplorer::Task::Error:
+ ProjectExplorer::Task::Warning,
+ message,
+ QString(), -1,
+ ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+}
void S60CreatePackageStep::packageWarningDialogDone()
{
return m_varValues[Makefile].first();
}
+QStringList Qt4ProFileNode::symbianCapabilities() const
+{
+ QStringList lowerCasedResult;
+
+ QStringList all;
+ all << "LocalServices" << "UserEnvironment" << "NetworkServices"
+ << "ReadUserData" << "WriteUserData" << "Location" << "SwEvent"
+ << "SurroundingsDD" << "ProtServ" << "PowerMgmt" << "ReadDeviceData"
+ << "WriteDeviceData" << "TrustedUI" << "NetworkControl"
+ << "MultimediaDD"<< "CommDD" << "DiskAdmin" << "AllFiles" << "DRM" << "TCB";
+
+ foreach (const QString &cap, m_varValues[SymbianCapabilities]) {
+ QString capability = cap.toLower();
+ if (capability.startsWith("-")) {
+ lowerCasedResult.removeAll(capability.mid(1));
+ } else if (capability == "all") {
+ foreach (const QString &a, all)
+ if (!lowerCasedResult.contains(a, Qt::CaseInsensitive))
+ lowerCasedResult << a.toLower();
+ } else {
+ lowerCasedResult << cap;
+ }
+ }
+ QStringList result; //let's make the result pretty
+ int index;
+ foreach (QString lowerCase, lowerCasedResult) {
+ index = all.indexOf(lowerCase);
+ if (index != -1)
+ result << all.at(index);
+ else
+ result << lowerCase; //strange capability!
+ }
+ return result;
+}
+
/*!
\class Qt4ProFileNode
Implements abstract ProjectNode class
newVarValues[QmlImportPathVar] = m_readerExact->absolutePathValues(
QLatin1String("QML_IMPORT_PATH"), m_projectDir);
newVarValues[Makefile] = m_readerExact->values("MAKEFILE");
+ // We use the cumulative parse so that we get the capabilities for symbian even if
+ // a different target is selected and the capabilities are set in a symbian scope
+
+ newVarValues[SymbianCapabilities] = m_readerCumulative->values("TARGET.CAPABILITY");
+
if (m_varValues != newVarValues) {
m_varValues = newVarValues;
+
foreach (NodesWatcher *watcher, watchers())
if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher))
emit qt4Watcher->variablesChanged(this, m_varValues, newVarValues);