diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 04:45:22 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 04:45:22 (GMT) |
commit | fbacd0fb2eb41470b090a3cbca7535f78689a382 (patch) | |
tree | 4f6ca32958fd9c5c95ae9ca2f599bf56067d2c45 /tools/assistant/lib/qhelpprojectdata.cpp | |
parent | 3e94b3a77affeef80544e48949e018ced4e0d96e (diff) | |
parent | 9f0884773a451a4feef80812e015266bd487dcdc (diff) | |
download | Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.zip Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.gz Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (61 commits)
Revert Merge Request 551. This introduces regressions to Qt.
Fixed scroll area size calculation on Mac.
Fix a race where QThread::exit() is "lost" when called after start()
make a partial build of linguist in no-gui config
make the code less of a trap
fix build from top level
Partially revert MR 543 changes to Linguist.
Apply f176759fc41abc4cb901c2cbaa15264f2a9ac85b to stdout too.
Autotest: add some debugging, just in case there's something wrong
Autotest: fix the fix for the rounding error.
Fix compile error with QT_NO_LIBRARY in QtMultimedia
the _setmode() prototype is different on win ce
qdoc: Changed qdoc to output the new doc format.
Doc: update 'developing on mac'
fcntl.h doesn't seem to exist, either - contrary to an example on msdn
Autotest: fix paths on the test server after update.
Force the repaint during a window resize.
fix compile on wince
remove CONFIG += ordered again
Assistant: Check namespace and virtual folder syntax of help projects.
...
Diffstat (limited to 'tools/assistant/lib/qhelpprojectdata.cpp')
-rw-r--r-- | tools/assistant/lib/qhelpprojectdata.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/assistant/lib/qhelpprojectdata.cpp b/tools/assistant/lib/qhelpprojectdata.cpp index 83491a0..b0faf0c 100644 --- a/tools/assistant/lib/qhelpprojectdata.cpp +++ b/tools/assistant/lib/qhelpprojectdata.cpp @@ -47,6 +47,7 @@ #include <QtCore/QStack> #include <QtCore/QMap> #include <QtCore/QRegExp> +#include <QtCore/QUrl> #include <QtCore/QVariant> #include <QtXml/QXmlStreamReader> @@ -77,6 +78,7 @@ private: void readFiles(); void raiseUnknownTokenError(); void addMatchingFiles(const QString &pattern); + bool hasValidSyntax(const QString &nameSpace, const QString &vFolder) const; QMap<QString, QStringList> dirEntriesCache; }; @@ -115,16 +117,14 @@ void QHelpProjectDataPrivate::readProject() if (isStartElement()) { if (name() == QLatin1String("virtualFolder")) { virtualFolder = readElementText(); - if (virtualFolder.contains(QLatin1String("/"))) + if (!hasValidSyntax(QLatin1String("test"), virtualFolder)) raiseError(QCoreApplication::translate("QHelpProject", - "A virtual folder must not contain " - "a \'/\' character!")); + "Virtual folder has invalid syntax.")); } else if (name() == QLatin1String("namespace")) { namespaceName = readElementText(); - if (namespaceName.contains(QLatin1String("/"))) + if (!hasValidSyntax(namespaceName, QLatin1String("test"))) raiseError(QCoreApplication::translate("QHelpProject", - "A namespace must not contain a " - "\'/\' character!")); + "Namespace has invalid syntax.")); } else if (name() == QLatin1String("customFilter")) { readCustomFilter(); } else if (name() == QLatin1String("filterSection")) { @@ -318,6 +318,22 @@ void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern) filterSectionList.last().addFile(pattern); } +bool QHelpProjectDataPrivate::hasValidSyntax(const QString &nameSpace, + const QString &vFolder) const +{ + const QLatin1Char slash('/'); + if (nameSpace.contains(slash) || vFolder.contains(slash)) + return false; + QUrl url; + const QLatin1String scheme("qthelp"); + url.setScheme(scheme); + url.setHost(nameSpace); + url.setPath(vFolder); + + const QString expectedUrl(scheme + QLatin1String("://") + nameSpace + slash + vFolder); + return url.isValid() && url.toString() == expectedUrl; +} + /*! \internal \class QHelpProjectData |