From 27888400bffdf033f4df48d29fde429efdf2b51c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 19 Nov 2009 09:35:40 +1000 Subject: Pass error messages through to WebView users. --- demos/declarative/webbrowser/webbrowser.qml | 2 ++ .../graphicsitems/qmlgraphicswebview.cpp | 29 ++++++++++++++++++++++ .../graphicsitems/qmlgraphicswebview_p.h | 7 ++++++ 3 files changed, 38 insertions(+) diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 0f6ed25..345c9af 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -196,6 +196,8 @@ Item { fillColor: "white" focus: true + onAlert: print(message) + function doZoom(zoom,centerX,centerY) { if (centerX) { diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index da6c00d..e165e59 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -1192,6 +1192,35 @@ QmlGraphicsWebPage::~QmlGraphicsWebPage() { } +void QmlGraphicsWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) +{ + qWarning() << sourceID << ":" << lineNumber << ":" << message; +} + +QString QmlGraphicsWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) +{ + // Not supported (it's modal) + return oldFile; +} + +void QmlGraphicsWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) +{ + emit viewItem()->alert(msg); +} + +bool QmlGraphicsWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) +{ + // Not supported (it's modal) + return false; +} + +bool QmlGraphicsWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) +{ + // Not supported (it's modal) + return false; +} + + /* Qt WebKit does not understand non-QWidget plugins, so dummy widgets are created, parented to a single dummy tool window. diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index e2e4888..fa7d19d 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -69,6 +69,11 @@ public: protected: QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); QWebPage *createWindow(WebWindowType type); + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); private: QmlGraphicsWebView *viewItem(); @@ -195,6 +200,8 @@ Q_SIGNALS: void zoomTo(qreal zoom, int centerX, int centerY); + void alert(const QString& message); + public Q_SLOTS: QVariant evaluateJavaScript(const QString&); -- cgit v0.12 From aba0e4689a14fd5c42c7a420072a464a850a119e Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 19 Nov 2009 09:36:18 +1000 Subject: Fix headers. --- .../graphicsitems/qmlgraphicsrectangle_p_p.h | 32 +++++++++--------- src/declarative/util/qmlanimation_p_p.h | 32 +++++++++--------- .../qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp | 38 +++++++++++++++++++--- 3 files changed, 66 insertions(+), 36 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h index cb914d6..c4bbbe4 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -9,8 +10,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -20,21 +21,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 27c0cd7..cb1c642 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -9,8 +10,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -20,21 +21,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 71eefdd..92b2c1a 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1,11 +1,41 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v0.12 From 6366969eaac962338424c49619a8664b03428985 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 19 Nov 2009 12:29:00 +1000 Subject: Fix doc typo. --- doc/src/declarative/scope.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc index 14efa59..fc678d1 100644 --- a/doc/src/declarative/scope.qdoc +++ b/doc/src/declarative/scope.qdoc @@ -215,7 +215,7 @@ Item { // Scope object for Script block 1 \endcode One notable characteristic of the scope object is its interaction with \l {Attached Properties}. -As attached properties exist on all object, an attached property reference that is not +As attached properties exist on all objects, an attached property reference that is not explicitly prefixed by an id will \e always resolve to the attached property on the scope object. -- cgit v0.12 From 8ca9ca77884229b04f3b48bb7fe085e56e3a9023 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 19 Nov 2009 12:41:19 +1000 Subject: Make sure we restore the base state correctly after the base state changes. This worked correctly as long as there was a transition between the states. Now it works correctly with no transition as well. --- src/declarative/util/qmltransitionmanager.cpp | 6 ++++-- tests/auto/declarative/states/tst_states.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index d1db9ec..ba726db 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -236,8 +236,11 @@ void QmlTransitionManager::transition(const QList &list, action.property.write(action.toValue); } } - if (!transition) + if (!transition) { d->applyBindings(); + if (d->state) + static_cast(QObjectPrivate::get(d->state))->complete(); + } } void QmlTransitionManager::cancel() @@ -262,7 +265,6 @@ void QmlTransitionManager::cancel() } d->bindingsList.clear(); d->completeList.clear(); - } QT_END_NAMESPACE diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index 92d278a..a4da1f1 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -68,6 +68,7 @@ private slots: void restoreEntryValues(); void explicitChanges(); void propertyErrors(); + void incorrectRestoreBug(); }; void tst_states::basicChanges() @@ -711,6 +712,32 @@ void tst_states::propertyErrors() rect->setState("blue"); } +void tst_states::incorrectRestoreBug() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QmlGraphicsRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + // make sure if we change the base state value, we then restore to it correctly + rect->setColor(QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("green")); +} + QTEST_MAIN(tst_states) #include "tst_states.moc" -- cgit v0.12