summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns
diff options
context:
space:
mode:
authorAapo Haapanen <aapo.haapanen@nokia.com>2011-09-26 11:47:50 (GMT)
committerAapo Haapanen <aapo.haapanen@nokia.com>2011-09-26 11:47:50 (GMT)
commit7c626d2a9152a20f965d877c2de92e04bdfe3571 (patch)
treed664285f087fcd586da82cba79e06d4533481555 /src/xmlpatterns
parent8d9e63130767858287331d7e19d732919d620607 (diff)
parent26341f6060434b6cbc08d98df34c2d2aee56a70c (diff)
downloadQt-7c626d2a9152a20f965d877c2de92e04bdfe3571.zip
Qt-7c626d2a9152a20f965d877c2de92e04bdfe3571.tar.gz
Qt-7c626d2a9152a20f965d877c2de92e04bdfe3571.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-symbian-flex
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r--src/xmlpatterns/api/qxmlquery.cpp5
-rw-r--r--src/xmlpatterns/functions/qsequencegeneratingfns.cpp20
2 files changed, 23 insertions, 2 deletions
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp
index e69fe50..e5e901d 100644
--- a/src/xmlpatterns/api/qxmlquery.cpp
+++ b/src/xmlpatterns/api/qxmlquery.cpp
@@ -988,7 +988,12 @@ bool setFocusHelper(QXmlQuery *const queryInstance,
const QXmlItem focusItem(focusResult.next());
if(focusItem.isNull() || focusResult.hasError())
+ {
+ /* The previous focus must be cleared in error situations.
+ * Otherwise the query may be left in an inconsistent state. */
+ queryInstance->setFocus(QXmlItem());
return false;
+ }
else
{
queryInstance->setFocus(focusItem);
diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
index 6215f3d..3f3dbbb 100644
--- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
+++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
@@ -41,6 +41,7 @@
#include <QStack>
#include <QStringList>
+#include <QFileInfo>
#include "qanyuri_p.h"
#include "qboolean_p.h"
@@ -207,6 +208,21 @@ Item::Iterator::Ptr IdrefFN::evaluateSequence(const DynamicContext::Ptr &context
return CommonValues::emptyIterator; /* TODO Haven't implemented further. */
}
+/*!
+ * Attemps to resolve scheme if URL does not have scheme defined.
+ */
+static QUrl resolveScheme(const QUrl &url)
+{
+ // On Windows and Symbian the drive letter is detected as the scheme.
+ if (url.scheme().isEmpty() || (url.scheme().length() == 1)) {
+ QString filename = url.toString();
+ QFileInfo file(filename);
+ if (file.exists())
+ return QUrl::fromLocalFile(filename);
+ }
+ return url;
+}
+
Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
const Item itemURI(m_operands.first()->evaluateSingleton(context));
@@ -219,7 +235,7 @@ Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const
* as part of a workaround for solaris-cc-64. DocFN::typeCheck() is in qsequencefns.cpp
* as part of that workaround. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
- const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
+ const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI())));
Q_ASSERT(uri.isValid());
Q_ASSERT(!uri.isRelative());
@@ -251,7 +267,7 @@ bool DocAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
/* These two lines are duplicated in DocFN::evaluateSingleton(), as part
* of a workaround for solaris-cc-64. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
- const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
+ const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI())));
Q_ASSERT(!uri.isRelative());
return context->resourceLoader()->isDocumentAvailable(uri);