diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:36:19 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:36:19 (GMT) |
commit | f0bb9bc5b0f4c20536d6c77624bd148389b78c06 (patch) | |
tree | 9088a173de4bfbeea29bc9464d4cb46257df67cd /src | |
parent | 60be72310c0f9469b3201b250b257473184ccf2a (diff) | |
parent | 1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd (diff) | |
download | Qt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.zip Qt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.tar.gz Qt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.tar.bz2 |
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'src')
43 files changed, 464 insertions, 136 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 28328e7..a6fb2f8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -39,10 +39,12 @@ win32-* { contains(JAVASCRIPTCORE_JIT,yes) { DEFINES+=ENABLE_JIT=1 DEFINES+=ENABLE_YARR_JIT=1 + DEFINES+=ENABLE_YARR=1 } contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_JIT=0 DEFINES+=ENABLE_YARR_JIT=0 + DEFINES+=ENABLE_YARR=0 } # In debug mode JIT disabled until crash fixed diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 26dbaf7..1e89d1e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,13 @@ +2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + Include os-win32 for stdint.h since MS does not ship that in their PSDK. + + * WebKit.pri: + 2009-10-30 Adam Barth <abarth@webkit.org> Reviewed by Mark Rowe. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 382a8c7..d7d2d57 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,39 @@ +2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + The Intel compiler does not support the __has_trivial_constructor type + trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The + reason for that is that the Intel Compiler depends on the Microsoft + Platform SDK, and in order to try to be "fully" MS compatible it will + "pretend" to be the same MS compiler as was shipped with the MS PSDK. + (Thus, compiling with win32-icc with VC8 SDK will make the source code + "think" the compiler at hand supports this type trait). + + * wtf/TypeTraits.h: + +2009-11-28 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows + https://bugs.webkit.org/show_bug.cgi?id=31943 + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + +2009-11-18 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Darin Adler. + + Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=31631 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + 2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 5c43eeb..9ca62c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -203,7 +203,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast<char*>(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #elif PLATFORM(SYMBIAN) static void cacheFlush(void* code, size_t size) @@ -224,7 +224,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast<char*>(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #else #error "The cacheFlush support is missing on this platform." diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h index ea09f54..a114ae0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h @@ -153,7 +153,7 @@ namespace JSC { ASSERT(0 == (size % MarkStack::pageSize())); if (size == m_allocated) return; -#if PLATFORM(WIN) || PLATFORM(SYMBIAN) +#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN) // We cannot release a part of a region with VirtualFree. To get around this, // we'll release the entire region and reallocate the size that we want. releaseStack(m_data, m_allocated); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 5818e83..62acbdf 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - efa69b6181ce5c045097351cdcf6c158da3f4888 + 9de63cde0ac8aa08e207d4ffce2846df1a44a364 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 9644470..4f6146f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,44 @@ +2009-11-23 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Before using a cached instance, verify that its wrapped QObject is + still alive. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtInstance::getQtInstance): + * bridge/qt/qt_instance.h: + (JSC::Bindings::QtInstance::hashKey): + +2009-11-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix crash of QtWebKit on any page with Flash when compiled with MinGW. + + Fix inline assembly, don't dereference the function pointer twice. + + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::hookedBeginPaint): + (WebCore::PluginView::hookedEndPaint): + +2009-11-22 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Adam Barth. + + [Qt] Remove the Referer header when redirecting to a non-secure site + https://bugs.webkit.org/show_bug.cgi?id=31785 + + This makes Qt pass two tests introduced in r50226. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + 2009-11-19 Olivier Goffart <ogoffart@trolltech.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 0546014..ec362ec 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -111,10 +111,17 @@ PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObje { JSLock lock(SilenceAssertionsOnly); - foreach(QtInstance* instance, cachedInstances.values(o)) { - if (instance->rootObject() == rootObject) - return instance; - } + foreach(QtInstance* instance, cachedInstances.values(o)) + if (instance->rootObject() == rootObject) { + // The garbage collector removes instances, but it may happen that the wrapped + // QObject dies before the gc kicks in. To handle that case we have to do an additional + // check if to see if the instance's wrapped object is still alive. If it isn't, then + // we have to create a new wrapper. + if (!instance->getObject()) + cachedInstances.remove(instance->hashKey()); + else + return instance; + } RefPtr<QtInstance> ret = QtInstance::create(o, rootObject, ownership); cachedInstances.insert(o, ret.get()); diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 00aaa5b..0afc6c7 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -59,6 +59,7 @@ public: JSValue booleanValue() const; QObject* getObject() const { return m_object; } + QObject* hashKey() const { return m_hashkey; } static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>, QScriptEngine::ValueOwnership ownership); diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 2f4722f..1ac80f6 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -325,6 +325,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded() newRequest.setHTTPMethod("GET"); } + // Should not set Referer after a redirect from a secure resource to non-secure one. + if (!newRequest.url().protocolIs("https") && protocolIs(newRequest.httpReferrer(), "https")) + newRequest.clearHTTPReferrer(); + client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 8922150..441bec7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -99,6 +99,14 @@ public: It is possible to replace the contents of child elements using setPlainText() and setInnerXml(). To replace the element itself and its contents, use setOuterXml(). + + \section1 Examples + + The \l{DOM Traversal Example} shows one way to traverse documents in a running + example. + + The \l{Simple Selector Example} can be used to experiment with the searching + features of this class and provides sample code you can start working with. */ /*! @@ -195,8 +203,7 @@ bool QWebElement::isNull() const \a selectorQuery. If there are no matching elements, an empty list is returned. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. @@ -211,8 +218,7 @@ QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const Returns the first child element that matches the given CSS selector \a selectorQuery. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index aedf95a..1bdc3ed 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -864,7 +864,12 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + Frame* frame = page->focusController()->focusedFrame(); + if (!frame) + return; + if (client && client->inputMethodEnabled() + && frame->document()->focusedNode() && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 2408dd4..2f0bf17 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,47 @@ +2009-11-28 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page + + https://bugs.webkit.org/show_bug.cgi?id=31401 + + Don't set the event unless there is a focused node we can use + for editing afterwards. + + * Api/qwebpage.cpp: + (QWebPagePrivate::handleSoftwareInputPanel): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-11-23 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Updated the QWebElement documentation with links to examples and + external resources. + Fixed the project file for the webelement snippet and tidied up the + markers used for quoting the code. + + * Api/qwebelement.cpp: + * docs/webkitsnippets/webelement/main.cpp: + (findAll): + * docs/webkitsnippets/webelement/webelement.pro: + +2009-11-23 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Added a unit-test to verify that wrapping a QObject with the + same identity as a previously but now dead object works. + + * tests/qwebframe/tst_qwebframe.cpp: + 2009-11-19 Olivier Goffart <ogoffart@trolltech.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp index d437a6f..2707ffb 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp @@ -22,7 +22,6 @@ #include <qwebview.h> #include <qwebframe.h> #include <qwebelement.h> -#include <qdebug.h> static QWebFrame *frame; @@ -53,9 +52,10 @@ static void findAll() </p> */ +//! [FindAll intro] QList<QWebElement> allSpans = document.findAll("span"); QList<QWebElement> introSpans = document.findAll("p.intro span"); -//! [FindAll] +//! [FindAll intro] //! [FindAll] } int main(int argc, char *argv[]) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro index f9b403b..8ca4b59 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro @@ -1,5 +1,8 @@ TEMPLATE = app CONFIG -= app_bundle +CONFIG(QTDIR_build) { + QT += webkit +} SOURCES = main.cpp include(../../../../../WebKit.pri) QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index d88d905..8cc7953 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -605,6 +605,7 @@ private slots: void render(); void scrollPosition(); void evaluateWillCauseRepaint(); + void qObjectWrapperWithSameIdentity(); private: QString evalJS(const QString&s) { @@ -2785,6 +2786,43 @@ void tst_QWebFrame::evaluateWillCauseRepaint() QTest::qWait(2000); } +class TestFactory : public QObject +{ + Q_OBJECT +public: + TestFactory() + : obj(0), counter(0) + {} + + Q_INVOKABLE QObject* getNewObject() + { + delete obj; + obj = new QObject(this); + obj->setObjectName(QLatin1String("test") + QString::number(++counter)); + return obj; + + } + + QObject* obj; + int counter; +}; + +void tst_QWebFrame::qObjectWrapperWithSameIdentity() +{ + m_view->setHtml("<script>function triggerBug() { document.getElementById('span1').innerText = test.getNewObject().objectName; }</script>" + "<body><span id='span1'>test</span></body>"); + + QWebFrame* mainFrame = m_view->page()->mainFrame(); + QCOMPARE(mainFrame->toPlainText(), QString("test")); + + mainFrame->addToJavaScriptWindowObject("test", new TestFactory, QScriptEngine::ScriptOwnership); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test1")); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test2")); +} QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 32002e7..ee1969d 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1487,6 +1487,21 @@ void tst_QWebPage::inputMethods() QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText)); #endif + page->mainFrame()->setHtml("<html><body><p>nothing to input here"); + viewEventSpy.clear(); + + QWebElement para = page->mainFrame()->findFirstElement("p"); + { + QMouseEvent evpres(QEvent::MouseButtonPress, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evpres); + QMouseEvent evrel(QEvent::MouseButtonRelease, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evrel); + } + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); +#endif + delete container; } diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 8c4cc82..0fb78d5 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -378,7 +378,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } int invalidCount = 0; - do { + while (inBytesLeft != 0) { if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { if (errno == EINVAL && convState) { // buffer ends in a surrogate @@ -418,7 +418,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } } } - } while (inBytesLeft != 0); + } // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 17ac9c6..c70232c 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -269,8 +269,11 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, } } - fd = ::dirfd(d); - int parentFd = parent?::dirfd(parent):0; + fd = qt_safe_dup(::dirfd(d)); + int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0; + + ::closedir(d); + if(parent) ::closedir(parent); Q_ASSERT(fd); if(::fcntl(fd, F_SETSIG, SIGIO) || @@ -279,10 +282,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, (parent && ::fcntl(parentFd, F_SETSIG, SIGIO)) || (parent && ::fcntl(parentFd, F_NOTIFY, DN_DELETE | DN_RENAME | DN_MULTISHOT))) { - - ::closedir(d); - if(parent) ::closedir(parent); - continue; // Could not set appropriate flags } diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 3cf9b7e..37b0ea1 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -55,6 +55,7 @@ #include "private/qcore_unix_p.h" #endif #include <stdio.h> +#include <stdlib.h> QT_BEGIN_NAMESPACE @@ -137,6 +138,21 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if (path.isEmpty()) return path; + // FIXME let's see if this stuff works, then we might be able to remove some of the other code. +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) + if (path.size() == 1 && path.at(0) == QLatin1Char('/')) + return path; +#endif + // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) || defined(Q_OS_SYMBIAN) + char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); + if (ret) { + QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); + free(ret); + return canonicalPath; + } +#endif + QFileInfo fi; const QChar slash(QLatin1Char('/')); QString tmpPath = path; diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 87f0737..41a6a1b 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE #define Q_USE_DEPRECATED_MAP_API 1 #endif -class QFSFileEnginePrivate : public QAbstractFileEnginePrivate +class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate { Q_DECLARE_PUBLIC(QFSFileEngine) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 8cbf6a3..71414ce 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -191,12 +191,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fd, &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - QT_CLOSE(fd); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fd, &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + QT_CLOSE(fd); + return false; + } } } @@ -230,12 +234,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fileno(fh), &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - fclose(fh); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fileno(fh), &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + fclose(fh); + return false; + } } } diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b197b9d..c6eef5e 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -336,6 +336,7 @@ public: // internal window handle used for socketnotifiers/timers/etc HWND internalHwnd; + HHOOK getMessageHook; // for controlling when to send posted events QAtomicInt serialNumber; @@ -363,7 +364,7 @@ public: }; QEventDispatcherWin32Private::QEventDispatcherWin32Private() - : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) + : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) { resolveTimerAPI(); } @@ -471,37 +472,11 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == SendPostedEventsTimerId) { - KillTimer(d->internalHwnd, wp); - int localSerialNumber = d->serialNumber; - (void) d->wakeUps.fetchAndStoreRelease(0); - if (localSerialNumber != d->lastSerialNumber) { - PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); - } - } else { - Q_ASSERT(d != 0); - d->sendTimerEvent(wp); - } + Q_ASSERT(d != 0); + d->sendTimerEvent(wp); return 0; } else if (message == WM_QT_SENDPOSTEDEVENTS) { int localSerialNumber = d->serialNumber; - - if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { - // delay the next pass of sendPostedEvents() until we get the special - // WM_TIMER, which allows all pending Windows messages to be processed - if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) { - // failed to start the timer, oops, clear wakeUps in an attempt to keep things running - qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer"); - d->wakeUps.fetchAndStoreRelease(0); - } else { - // SetTimer() succeeded, nothing to do now - ; - } - } else { - // nothing pending in the queue, let sendPostedEvents go through - d->wakeUps.fetchAndStoreRelease(0); - } - if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); @@ -512,6 +487,31 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) return DefWindowProc(hwnd, message, wp, lp); } +LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) +{ + if (wp == PM_REMOVE) { + QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance()); + Q_ASSERT(q != 0); + if (q) { + QEventDispatcherWin32Private *d = q->d_func(); + int localSerialNumber = d->serialNumber; + if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) { + // no more input or timer events in the message queue, we can allow posted events to be + // sent now + (void) d->wakeUps.fetchAndStoreRelease(0); + MSG *msg = (MSG *) lp; + if (localSerialNumber != d->lastSerialNumber + // if this message IS the one that triggers sendPostedEvents(), no need to post it again + && msg->hwnd != d->internalHwnd + && msg->message != WM_QT_SENDPOSTEDEVENTS) { + PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); + } + } + } + } + return CallNextHookEx(0, code, wp, lp); +} + static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher) { // make sure that multiple Qt's can coexist in the same process @@ -636,6 +636,12 @@ void QEventDispatcherWin32::createInternalHwnd() return; d->internalHwnd = qt_create_internal_window(this); + // setup GetMessage hook needed to drive our posted events + d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); + if (!d->getMessageHook) { + qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook"); + } + // register all socket notifiers QList<int> sockets = (d->sn_read.keys().toSet() + d->sn_write.keys().toSet() @@ -1058,6 +1064,10 @@ void QEventDispatcherWin32::closingDown() d->unregisterTimer(d->timerVec.at(i), true); d->timerVec.clear(); d->timerDict.clear(); + + if (d->getMessageHook) + UnhookWindowsHookEx(d->getMessageHook); + d->getMessageHook = 0; } bool QEventDispatcherWin32::event(QEvent *e) diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index a5ef4d4..7f0e87d 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -102,6 +102,7 @@ public: private: friend LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); + friend LRESULT CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 201e7b3..e00cf3f 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -219,7 +219,7 @@ public: inline const_iterator &operator--() { i--; return *this; } inline const_iterator operator--(int) { T *n = i; i--; return n; } inline const_iterator &operator+=(int j) { i+=j; return *this; } - inline const_iterator &operator-=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i-=j; return *this; } inline const_iterator operator+(int j) const { return const_iterator(i+j); } inline const_iterator operator-(int j) const { return const_iterator(i-j); } inline int operator-(const_iterator j) const { return i - j.i; } diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b54596b..f93ffdf 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9713,7 +9713,7 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } QWidget *widget = event->widget(); - if (widget) { + if (widget && (dd->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) { qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), dd->clickCausedFocus); } dd->clickCausedFocus = 0; diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e3af683..2361dd0 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End - \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none) - \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none) + \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none) + \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none) \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none) @@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac} }; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0d9f9ee..1907cca 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2617,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) releaseMouse(); if(mac_keyboard_grabber == this) releaseKeyboard(); - if(acceptDrops()) - setAcceptDrops(false); if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index ac1c3de..e923e90 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -82,7 +82,7 @@ horizontal and vertical resolution of the device in dots per inch. The physicalDpiX() and physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if - the logical and vertical resolution differ, the corresponding + the logical and physical resolution differ, the corresponding QPaintEngine must handle the mapping. Finally, the colorCount() function returns the number of different colors available for the paint device. diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index 5f4ebae..22dfc62 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -202,8 +202,12 @@ Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); +QT_END_NAMESPACE + Q_DECLARE_METATYPE(QGtkStylePrivate*); +QT_BEGIN_NAMESPACE + static void gtkStyleSetCallback(GtkWidget*) { qRegisterMetaType<QGtkStylePrivate *>(); diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 87975c3..117c550 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1586,16 +1586,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } } #endif //QT_NO_CLIPBOARD - else if (event == QKeySequence::MoveToStartOfLine) { + else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { home(0); } - else if (event == QKeySequence::MoveToEndOfLine) { + else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) { end(0); } - else if (event == QKeySequence::SelectStartOfLine) { + else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) { home(1); } - else if (event == QKeySequence::SelectEndOfLine) { + else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) { end(1); } else if (event == QKeySequence::MoveToNextChar) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 785b2bd..2c1acdb 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -383,6 +383,38 @@ void QLineEdit::setText(const QString& text) d->control->setText(text); } +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) +/*! + \since 4.7 + + \property QLineEdit::placeholderText + \brief the line edit's placeholder text + + Setting this property makes the line edit display a grayed-out + placeholder text as long as the text() is empty and the widget doesn't + have focus. + + By default, this property contains an empty string. + + \sa text() +*/ +QString QLineEdit::placeholderText() const +{ + Q_D(const QLineEdit); + return d->placeholderText; +} + +void QLineEdit::setPlaceholderText(const QString& placeholderText) +{ + Q_D(QLineEdit); + if (d->placeholderText != placeholderText) { + d->placeholderText = placeholderText; + if (!hasFocus()) + update(); + } +} +#endif /*! \property QLineEdit::displayText @@ -1517,7 +1549,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) } #endif - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } @@ -1829,6 +1861,18 @@ void QLineEdit::paintEvent(QPaintEvent *) } QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height()); + if (d->control->text().isEmpty()) { + if (!hasFocus() && !d->placeholderText.isEmpty()) { + QColor col = pal.text().color(); + col.setAlpha(128); + QPen oldpen = p.pen(); + p.setPen(col); + p.drawText(lineRect, va, d->placeholderText); + p.setPen(oldpen); + return; + } + } + int cix = qRound(d->control->cursorToX()); // horizontal scrolling. d->hscroll is the left indent from the beginning diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index ac918c7..594e488 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -83,6 +83,10 @@ class Q_GUI_EXPORT QLineEdit : public QWidget Q_PROPERTY(bool undoAvailable READ isUndoAvailable) Q_PROPERTY(bool redoAvailable READ isRedoAvailable) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) +#endif public: explicit QLineEdit(QWidget* parent=0); @@ -98,6 +102,12 @@ public: QString displayText() const; +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + QString placeholderText() const; + void setPlaceholderText(const QString &); +#endif + int maxLength() const; void setMaxLength(int); diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 244d2be..dc648e8 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -142,6 +142,8 @@ public: int topTextMargin; int rightTextMargin; int bottomTextMargin; + + QString placeholderText; }; #endif // QT_NO_LINEEDIT diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index eae8b7d..89fe7b8 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1969,7 +1969,7 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->ensureCursorVisible(); } - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 1c49ef0..1bc0bf1 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1578,7 +1578,7 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); ensureCursorVisible(); } - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 6a4cdbd..89fa76f 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -2556,7 +2556,7 @@ EXPORTS _ZNK14QObjectPrivate10senderListEv @ 2555 NONAME _ZNK14QObjectPrivate11signalIndexEPKc @ 2556 NONAME _ZNK14QObjectPrivate12receiverListEPKc @ 2557 NONAME - _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME + _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME ABSENT _ZNK14QObjectPrivate8isSenderEPK7QObjectPKc @ 2559 NONAME _ZNK14QStringMatcher7indexInEPK5QCharii @ 2560 NONAME _ZNK14QStringMatcher7indexInERK7QStringi @ 2561 NONAME diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index dc0e0d0..b6aa872 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1101,16 +1101,6 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) } } -#ifndef QT_NO_QOBJECT - { - QHash<QObject*, QScript::QObjectData*>::const_iterator it; - for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { - QScript::QObjectData *qdata = it.value(); - qdata->mark(markStack); - } - } -#endif - { QHash<int, QScriptTypeInfo*>::const_iterator it; for (it = m_typeInfos.constBegin(); it != m_typeInfos.constEnd(); ++it) { @@ -1134,6 +1124,17 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) context = context->parentContext(); } } + +#ifndef QT_NO_QOBJECT + markStack.drain(); // make sure everything is marked before marking qobject data + { + QHash<QObject*, QScript::QObjectData*>::const_iterator it; + for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { + QScript::QObjectData *qdata = it.value(); + qdata->mark(markStack); + } + } +#endif } bool QScriptEnginePrivate::isCollecting() const diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 559fcd3..63ba9ec 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -83,22 +83,23 @@ struct QObjectConnection void mark(JSC::MarkStack& markStack) { - // ### need to find out if senderWrapper is marked if (senderWrapper) { - // see if the sender should be marked or not + // see if the sender should be marked or not; + // if the C++ object is owned by script, we don't want + // it to stay alive due to a script connection. Q_ASSERT(senderWrapper.inherits(&QScriptObject::info)); QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(senderWrapper)); - QScriptObjectDelegate *delegate = scriptObject->delegate(); - Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); - QObjectDelegate *inst = static_cast<QObjectDelegate*>(delegate); - if ((inst->ownership() == QScriptEngine::ScriptOwnership) - || ((inst->ownership() == QScriptEngine::AutoOwnership) - && inst->value() && !inst->value()->parent())) { - // #### don't mark if not marked otherwise - //senderWrapper = JSC::JSValue(); - markStack.append(senderWrapper); - } else { - markStack.append(senderWrapper); + if (!JSC::Heap::isCellMarked(scriptObject)) { + QScriptObjectDelegate *delegate = scriptObject->delegate(); + Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); + QObjectDelegate *inst = static_cast<QObjectDelegate*>(delegate); + if ((inst->ownership() == QScriptEngine::ScriptOwnership) + || ((inst->ownership() == QScriptEngine::AutoOwnership) + && inst->value() && !inst->value()->parent())) { + senderWrapper = JSC::JSValue(); + } else { + markStack.append(senderWrapper); + } } } if (receiver) diff --git a/src/script/script.pro b/src/script/script.pro index 008c556..771047a 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -1,7 +1,7 @@ TARGET = QtScript QPRO_PWD = $$PWD QT = core -DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror +DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF DEFINES += QT_BUILD_SCRIPT_LIB DEFINES += QT_NO_USING_NAMESPACE DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 3f13405..5d039cf 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -1025,7 +1025,6 @@ QVariant QDB2Result::data(int field) break; case QVariant::Double: { - QString value=qGetStringData(d->hStmt, field, info.length() + 1, isNull); switch(numericalPrecisionPolicy()) { case QSql::LowPrecisionInt32: v = new QVariant(qGetIntData(d->hStmt, field, isNull)); diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 17f2c92..f130087 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2200,26 +2200,34 @@ bool QOCIDriver::rollbackTransaction() QStringList QOCIDriver::tables(QSql::TableType type) const { QStringList tl; + QStringList sysUsers = QStringList() << QLatin1String("MDSYS") + << QLatin1String("LBACSYS") + << QLatin1String("SYS") + << QLatin1String("SYSTEM") + << QLatin1String("WKSYS") + << QLatin1String("CTXSYS") + << QLatin1String("WMSYS"); + + QString user = d->user; + if ( isIdentifierEscaped(user, QSqlDriver::TableName)) + user = stripDelimiters(user, QSqlDriver::TableName); + else + user = user.toUpper(); + + if(sysUsers.contains(user)) + sysUsers.removeAll(user);; + if (!isOpen()) return tl; QSqlQuery t(createResult()); t.setForwardOnly(true); if (type & QSql::Tables) { - t.exec(QLatin1String("select owner, table_name from all_tables " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); - - QString user = d->user; - if ( isIdentifierEscaped(user, QSqlDriver::TableName)) - user = stripDelimiters(user, QSqlDriver::TableName); - else - user = user.toUpper(); + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != user.toUpper()) @@ -2229,30 +2237,21 @@ QStringList QOCIDriver::tables(QSql::TableType type) const } // list all table synonyms as well - t.exec(QLatin1String("select owner, synonym_name from all_synonyms " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString() != d->user) - tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); else tl.append(t.value(1).toString()); } } if (type & QSql::Views) { - t.exec(QLatin1String("select owner, view_name from all_views " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + QString query = QLatin1String("select owner, view_name from all_views where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != d->user.toUpper()) tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); @@ -2265,6 +2264,28 @@ QStringList QOCIDriver::tables(QSql::TableType type) const while (t.next()) { tl.append(t.value(0).toString()); } + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner = '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" or "))); + + while (t.next()) { + if (t.value(0).toString().toUpper() != user.toUpper()) + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } + + // list all table synonyms as well + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" or "))); + while (t.next()) { + if (t.value(0).toString() != d->user) + tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } } return tl; } diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 5f0a35d..aec54d6 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -563,7 +563,7 @@ QString QSqlRelationalTableModel::selectStatement() const // If there are duplicate field names they must be aliased if (fieldNames.value(fieldList[i]) > 1) { - QString relTableName = relation.tableName(); + QString relTableName = relation.tableName().section(QChar::fromLatin1('.'), -1, -1); if (d->db.driver()->isIdentifierEscaped(relTableName, QSqlDriver::TableName)) relTableName = d->db.driver()->stripDelimiters(relTableName, QSqlDriver::TableName); QString displayColumn = relation.displayColumn(); |