diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-19 22:25:52 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-19 22:25:52 (GMT) |
commit | bb382d523710454dadb50214d5a2fad6fd8dd02c (patch) | |
tree | 8f05677400a53b172102d94dbadda57bf71a02d9 /tools/shared | |
parent | 0cfa6daa4776cd78370e644fae3005ae432b83c7 (diff) | |
parent | 7eb9cf865f2b40ca3ca4bf8655b6bb6d40d6fcdd (diff) | |
download | Qt-bb382d523710454dadb50214d5a2fad6fd8dd02c.zip Qt-bb382d523710454dadb50214d5a2fad6fd8dd02c.tar.gz Qt-bb382d523710454dadb50214d5a2fad6fd8dd02c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: (21 commits)
Fixed handling of QInputMethodEvents with nonzero replacementLength.
Fixed namespace issues related to epocroot.cpp
Corrected ASCII comparison and removed extra braces
Add symbian scope for qfiledialog_symbian.cpp
Resolve EPOCROOT in qt.conf using same logic as in .pro
Make epocroot resolving compatible with more build environments
Fix for QtOpenGL RVCT4 compilation error
Removed extra cpp and done changes based on comments
Correct flags for Symbian file dialogs
Fix for WServ 64 crash on Symbian.
Use include(original mkspec) instead of copying of mkspec to default
Fixed code style of d92cbfc5, reported by git push.
Switched qdesktopservices to use SchemeHandler for Symbian^3 and later.
Removed unnecessary Q_OS_SYMBIAN flags from qdesktopservices_s60.cpp.
Documented usage of dialogs on Symbian
Native file dialog on Symbian^3
Add Location as self signable capability in patch_capabilities.pl
Localize .loc and .pkg content based on TRANSLATIONS
Bump Qt version to 4.7.2.
SSL: Fix for systemCaCertificates being called first on symbian
...
Diffstat (limited to 'tools/shared')
-rw-r--r-- | tools/shared/symbian/epocroot.cpp | 115 | ||||
-rw-r--r-- | tools/shared/symbian/epocroot.pri | 11 | ||||
-rw-r--r-- | tools/shared/symbian/epocroot_p.h (renamed from tools/shared/symbian/epocroot.h) | 24 | ||||
-rw-r--r-- | tools/shared/windows/registry.cpp | 15 | ||||
-rw-r--r-- | tools/shared/windows/registry_p.h (renamed from tools/shared/windows/registry.h) | 24 |
5 files changed, 115 insertions, 74 deletions
diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp index ae1dcb1..eabae98 100644 --- a/tools/shared/symbian/epocroot.cpp +++ b/tools/shared/symbian/epocroot.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include <iostream> - #include <QtCore/qdir.h> #include <QtCore/qxmlstream.h> -#include "epocroot.h" -#include "../windows/registry.h" +#include "epocroot_p.h" +#include "../windows/registry_p.h" + +QT_BEGIN_NAMESPACE // Registry key under which the location of the Symbian devices.xml file is // stored. @@ -64,35 +64,26 @@ // Stored as a static value in order to avoid unnecessary re-evaluation. static QString epocRootValue; -#ifdef QT_BUILD_QMAKE -std::ostream &operator<<(std::ostream &s, const QString &val) { - s << val.toLocal8Bit().data(); - return s; -} -#else -// Operator implemented in configureapp.cpp -std::ostream &operator<<(std::ostream &s, const QString &val); -#endif - -QString getDevicesXmlPath() +static QString getDevicesXmlPath() { // Note that the following call will return a null string on platforms other // than Windows. If support is required on other platforms for devices.xml, // an alternative mechanism for retrieving the location of this file will // be required. - return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, SYMBIAN_SDKS_REG_SUBKEY); + return qt_readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY)); } /** * Checks whether epocRootValue points to an existent directory. * If not, epocRootValue is set to an empty string and an error message is printed. */ -void checkEpocRootExists(const QString &source) +static void checkEpocRootExists(const QString &source) { if (!epocRootValue.isEmpty()) { QDir dir(epocRootValue); if (!dir.exists()) { - std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl; + qWarning("Warning: %s is set to an invalid path: '%s'", qPrintable(source), + qPrintable(epocRootValue)); epocRootValue = QString(); } } @@ -103,32 +94,30 @@ void checkEpocRootExists(const QString &source) */ static void fixEpocRoot(QString &path) { - path.replace("\\", "/"); + path.replace(QLatin1Char('\\'), QLatin1Char('/')); - if (!path.size() || path[path.size()-1] != QChar('/')) { - path += QChar('/'); + if (!path.size() || path[path.size()-1] != QLatin1Char('/')) { + path += QLatin1Char('/'); } } /** * Determine the epoc root for the currently active SDK. */ -QString epocRoot() +QString qt_epocRoot() { if (epocRootValue.isEmpty()) { // 1. If environment variable EPOCROOT is set and points to an existent // directory, this is returned. - epocRootValue = qgetenv("EPOCROOT"); - checkEpocRootExists("EPOCROOT"); + epocRootValue = QString::fromLocal8Bit(qgetenv("EPOCROOT").constData()); + checkEpocRootExists(QLatin1String("EPOCROOT environment variable")); if (epocRootValue.isEmpty()) { // 2. The location of devices.xml is specified by a registry key. If this // file exists, it is parsed. QString devicesXmlPath = getDevicesXmlPath(); - if (devicesXmlPath.isEmpty()) { - std::cerr << "Error: Symbian SDK registry key not found" << std::endl; - } else { - devicesXmlPath += "/devices.xml"; + if (!devicesXmlPath.isEmpty()) { + devicesXmlPath += QLatin1String("/devices.xml"); QFile devicesFile(devicesXmlPath); if (devicesFile.open(QIODevice::ReadOnly)) { @@ -138,87 +127,90 @@ QString epocRoot() // 4. If a device element marked as default is found in devices.xml and its // epocroot value points to an existent directory, this is returned. - const QString epocDeviceValue = qgetenv("EPOCDEVICE"); + const QString epocDeviceValue = QString::fromLocal8Bit(qgetenv("EPOCDEVICE").constData()); bool epocDeviceFound = false; QXmlStreamReader xml(&devicesFile); while (!xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "devices") { - if (xml.attributes().value("version") == "1.0") { - while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { + if (xml.isStartElement() && xml.name() == QLatin1String("devices")) { + if (xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0")) { + while (!(xml.isEndElement() && xml.name() == QLatin1String("devices")) && !xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "device") { - const bool isDefault = xml.attributes().value("default") == "yes"; - const QString id = xml.attributes().value("id").toString(); - const QString name = xml.attributes().value("name").toString(); - const QString alias = xml.attributes().value("alias").toString(); - bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue; + if (xml.isStartElement() && xml.name() == QLatin1String("device")) { + const bool isDefault = xml.attributes().value(QLatin1String("default")) == QLatin1String("yes"); + const QString id = xml.attributes().value(QLatin1String("id")).toString(); + const QString name = xml.attributes().value(QLatin1String("name")).toString(); + const QString alias = xml.attributes().value(QLatin1String("alias")).toString(); + bool epocDeviceMatch = QString(id + QLatin1String(":") + name) == epocDeviceValue; if (!alias.isEmpty()) epocDeviceMatch |= alias == epocDeviceValue; epocDeviceFound |= epocDeviceMatch; if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) { // Found a matching device - while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { + while (!(xml.isEndElement() && xml.name() == QLatin1String("device")) && !xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "epocroot") { + if (xml.isStartElement() && xml.name() == QLatin1String("epocroot")) { epocRootValue = xml.readElementText(); const QString deviceSource = epocDeviceValue.isEmpty() - ? "default device" - : "EPOCDEVICE (" + epocDeviceValue + ")"; + ? QLatin1String("default device") + : QString(QLatin1String("EPOCDEVICE (") + epocDeviceValue + QLatin1String(")")); checkEpocRootExists(deviceSource); } } if (epocRootValue.isEmpty()) - xml.raiseError("No epocroot element found"); + xml.raiseError(QLatin1String("No epocroot element found")); } } } } else { - xml.raiseError("Invalid 'devices' element version"); + xml.raiseError(QLatin1String("Invalid 'devices' element version")); } } } if (xml.hasError()) { - std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl; + qWarning("Warning: Error \"%s\" when parsing devices.xml", + qPrintable(xml.errorString())); } else { if (epocRootValue.isEmpty()) { if (!epocDeviceValue.isEmpty()) { if (epocDeviceFound) { - std::cerr << "Error: missing or invalid epocroot attribute " - << "in device '" << epocDeviceValue << "'"; + qWarning("Warning: Missing or invalid epocroot attribute in device '%s' in devices.xml.", + qPrintable(epocDeviceValue)); } else { - std::cerr << "Error: no device matching EPOCDEVICE (" - << epocDeviceValue << ")"; + qWarning("Warning: No device matching EPOCDEVICE (%s) in devices.xml.", + qPrintable(epocDeviceValue)); } } else { if (epocDeviceFound) { - std::cerr << "Error: missing or invalid epocroot attribute " - << "in default device"; + qWarning("Warning: Missing or invalid epocroot attribute in default device in devices.xml."); } else { - std::cerr << "Error: no default device"; + qWarning("Warning: No default device set in devices.xml."); } } - std::cerr << " found in devices.xml file." << std::endl; } } } else { - std::cerr << "Error: could not open file " << devicesXmlPath << std::endl; + qWarning("Warning: Could not open file: '%s'.", qPrintable(devicesXmlPath)); } } } if (epocRootValue.isEmpty()) { // 5. An empty string is returned. - std::cerr << "Error: failed to find epoc root" << std::endl - << "Either" << std::endl - << " 1. Set EPOCROOT environment variable to a valid value" << std::endl - << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY - " registry key is set, and then" << std::endl - << " a. Set EPOCDEVICE environment variable to a valid device" << std::endl - << " or b. Specify a default device in the devices.xml file." << std::endl; + qWarning("Warning: failed to resolve epocroot." +#ifdef Q_OS_WIN32 + "\nEither\n" + " 1. Set EPOCROOT environment variable to a valid value.\n" + " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY + " registry key is set, and then\n" + " a. Set EPOCDEVICE environment variable to a valid device\n" + " or b. Specify a default device in the devices.xml file."); +#else + " Set EPOCROOT environment variable to a valid value."); +#endif } else { fixEpocRoot(epocRootValue); } @@ -227,3 +219,4 @@ QString epocRoot() return epocRootValue; } +QT_END_NAMESPACE diff --git a/tools/shared/symbian/epocroot.pri b/tools/shared/symbian/epocroot.pri new file mode 100644 index 0000000..f0f0dab --- /dev/null +++ b/tools/shared/symbian/epocroot.pri @@ -0,0 +1,11 @@ +# Epocroot resolving is only required for tools, so omit it from all mobile/embedded builds +!symbian:!wince*:!embedded { +HEADERS += \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \ + $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h +SOURCES += \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp +INCLUDEPATH += $$QT_SOURCE_TREE/tools/shared +DEFINES += QLIBRARYINFO_EPOCROOT +} diff --git a/tools/shared/symbian/epocroot.h b/tools/shared/symbian/epocroot_p.h index 9846485..c97b593 100644 --- a/tools/shared/symbian/epocroot.h +++ b/tools/shared/symbian/epocroot_p.h @@ -39,11 +39,24 @@ ** ****************************************************************************/ -#ifndef SYMBIAN_EPOCROOT_H -#define SYMBIAN_EPOCROOT_H +#ifndef QT_SYMBIAN_EPOCROOT_H +#define QT_SYMBIAN_EPOCROOT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include <QtCore/qstring.h> +QT_BEGIN_NAMESPACE + /** * Determine the epoc root for the currently active SDK. * @@ -62,6 +75,9 @@ * Any return value other than the empty string therefore is guaranteed to * point to an existent directory. */ -QString epocRoot(); +QString qt_epocRoot(); + +QT_END_NAMESPACE + +#endif // QT_SYMBIAN_EPOCROOT_H -#endif // EPOCROOT_H diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp index 67d9b56..48e9ae6 100644 --- a/tools/shared/windows/registry.cpp +++ b/tools/shared/windows/registry.cpp @@ -40,8 +40,11 @@ ****************************************************************************/ #include <QtCore/qstringlist.h> -#include "registry.h" +#include "registry_p.h" +QT_BEGIN_NAMESPACE + +#ifdef Q_OS_WIN32 /*! Returns the path part of a registry key. e.g. @@ -73,12 +76,13 @@ static QString keyName(const QString &rKey) return rKey; QString res(rKey.mid(idx + 1)); - if (res == "Default" || res == ".") - res = ""; + if (res == QLatin1String("Default") || res == QLatin1String(".")) + res = QString(); return res; } +#endif -QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey) { QString result; @@ -128,7 +132,7 @@ QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) break; l.append(s); } - result = l.join(", "); + result = l.join(QLatin1String(", ")); break; } @@ -158,4 +162,5 @@ QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) return result; } +QT_END_NAMESPACE diff --git a/tools/shared/windows/registry.h b/tools/shared/windows/registry_p.h index 3896527..4aae5f9 100644 --- a/tools/shared/windows/registry.h +++ b/tools/shared/windows/registry_p.h @@ -39,8 +39,21 @@ ** ****************************************************************************/ -#ifndef WINDOWS_REGISTRY_H -#define WINDOWS_REGISTRY_H +#ifndef QT_WINDOWS_REGISTRY_H +#define QT_WINDOWS_REGISTRY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE #include <QtCore/qglobal.h> @@ -59,6 +72,9 @@ * if this code is compiled for a platform other than Windows), a null * string is returned. */ -QString readRegistryKey(HKEY parentHandle, const QString &rSubkey); +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey); + +QT_END_NAMESPACE + +#endif // QT_WINDOWS_REGISTRY_H -#endif // WINDOWS_REGISTRY_H |