diff options
Diffstat (limited to 'examples/webkit')
31 files changed, 74 insertions, 46 deletions
diff --git a/examples/webkit/domtraversal/domtraversal.pro b/examples/webkit/domtraversal/domtraversal.pro index 49400de..ba5f2d8 100644 --- a/examples/webkit/domtraversal/domtraversal.pro +++ b/examples/webkit/domtraversal/domtraversal.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/webkit/domtraversal sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/domtraversal INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7CB + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/domtraversal/main.cpp b/examples/webkit/domtraversal/main.cpp index c8a1aec..9341d05 100644 --- a/examples/webkit/domtraversal/main.cpp +++ b/examples/webkit/domtraversal/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/domtraversal/window.cpp b/examples/webkit/domtraversal/window.cpp index 704a6e1..8b15669 100644 --- a/examples/webkit/domtraversal/window.cpp +++ b/examples/webkit/domtraversal/window.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/domtraversal/window.h b/examples/webkit/domtraversal/window.h index 2795976..c47d0b2 100644 --- a/examples/webkit/domtraversal/window.h +++ b/examples/webkit/domtraversal/window.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/fancybrowser/fancybrowser.pro b/examples/webkit/fancybrowser/fancybrowser.pro index e496241..3786d9c 100644 --- a/examples/webkit/fancybrowser/fancybrowser.pro +++ b/examples/webkit/fancybrowser/fancybrowser.pro @@ -10,4 +10,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/fancybrowser INSTALLS += target sources -symbian:TARGET.UID3 = 0xA000CF6C +symbian { + TARGET.UID3 = 0xA000CF6C + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp index 7ca862d..cf98b51 100644 --- a/examples/webkit/fancybrowser/main.cpp +++ b/examples/webkit/fancybrowser/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 844106f..852d981 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 214d84b..08439c1 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/formextractor/formextractor.cpp b/examples/webkit/formextractor/formextractor.cpp index 4b181e8..6b8f511 100644 --- a/examples/webkit/formextractor/formextractor.cpp +++ b/examples/webkit/formextractor/formextractor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/formextractor/formextractor.h b/examples/webkit/formextractor/formextractor.h index 86a8ad5..b31716c 100644 --- a/examples/webkit/formextractor/formextractor.h +++ b/examples/webkit/formextractor/formextractor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/formextractor/main.cpp b/examples/webkit/formextractor/main.cpp index b16ec12..69cc67a 100644 --- a/examples/webkit/formextractor/main.cpp +++ b/examples/webkit/formextractor/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/formextractor/mainwindow.cpp b/examples/webkit/formextractor/mainwindow.cpp index 5764dc9..ea16c17 100644 --- a/examples/webkit/formextractor/mainwindow.cpp +++ b/examples/webkit/formextractor/mainwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/formextractor/mainwindow.h b/examples/webkit/formextractor/mainwindow.h index b28ec98..23a9887 100644 --- a/examples/webkit/formextractor/mainwindow.h +++ b/examples/webkit/formextractor/mainwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/framecapture/framecapture.cpp b/examples/webkit/framecapture/framecapture.cpp index ef49e93..e3ffdb8 100644 --- a/examples/webkit/framecapture/framecapture.cpp +++ b/examples/webkit/framecapture/framecapture.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/framecapture/framecapture.h b/examples/webkit/framecapture/framecapture.h index 7a6d5f3..a096584 100644 --- a/examples/webkit/framecapture/framecapture.h +++ b/examples/webkit/framecapture/framecapture.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/framecapture/main.cpp b/examples/webkit/framecapture/main.cpp index 65c0026..58b9234 100644 --- a/examples/webkit/framecapture/main.cpp +++ b/examples/webkit/framecapture/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/googlechat/form.ui b/examples/webkit/googlechat/form.ui index 3b9fb82..4939ea1 100644 --- a/examples/webkit/googlechat/form.ui +++ b/examples/webkit/googlechat/form.ui @@ -48,6 +48,9 @@ <property name="alignment"> <set>Qt::AlignCenter</set> </property> + <property name="wordWrap"> + <bool>true</bool> + </property> </widget> </item> <item> @@ -160,6 +163,9 @@ <property name="text"> <string>Login</string> </property> + <property name="default"> + <bool>true</bool> + </property> </widget> </item> <item> diff --git a/examples/webkit/googlechat/googlechat.cpp b/examples/webkit/googlechat/googlechat.cpp index d2307d9..8eb033c 100644 --- a/examples/webkit/googlechat/googlechat.cpp +++ b/examples/webkit/googlechat/googlechat.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -80,9 +80,8 @@ void GoogleChat::showError(const QString &msg) { showStatus(QString("Error: %1").arg(msg)); } -QString GoogleChat::evalJS(const QString &js) { - QWebFrame *frame = form.webView->page()->mainFrame(); - return frame->evaluateJavaScript(js).toString(); +QWebElement GoogleChat::document() const { + return form.webView->page()->mainFrame()->documentElement(); } void GoogleChat::adjustLoginButton() { @@ -112,9 +111,11 @@ void GoogleChat::doLogin() { showStatus("Logging in..."); QString userEmail = userName + "@gmail.com"; - evalJS(QString("document.getElementById('Email').value = \"%1\";").arg(userEmail)); - evalJS(QString("document.getElementById('Passwd').value = \"%1\";").arg(password)); - evalJS("document.getElementById('gaia_loginform').submit();"); + + document().findFirst("#Email").setAttribute("value", userEmail); + document().findFirst("#Passwd").setAttribute("value", password); + document().findFirst("#gaia_loginform").evaluateJavaScript("this.submit();"); + } void GoogleChat::initialPage(bool ok) { @@ -124,11 +125,12 @@ void GoogleChat::initialPage(bool ok) { } if (ok) { - QString s1 = evalJS("document.getElementById('Email').name"); - QString s2 = evalJS("document.getElementById('Passwd').name"); - QString s3 = evalJS("document.getElementById('gaia_loginform').id"); - if (s1 == "Email" && s2 == "Passwd" && s3 == "gaia_loginform") { + QWebElement email = document().findFirst("#Email"); + QWebElement passwd = document().findFirst("#Passwd"); + QWebElement loginForm = document().findFirst("#gaia_loginform"); + if (!email.isNull() && !passwd.isNull() && !loginForm.isNull()) { form.stackedWidget->setCurrentIndex(1); + form.userNameEdit->setFocus(); form.webView->disconnect(); return; } @@ -139,8 +141,8 @@ void GoogleChat::initialPage(bool ok) { void GoogleChat::hideElements() { - evalJS("var e = document.getElementsByClassName('footer-footer')[0]; e.parentElement.removeChild(e)"); - evalJS("var e = document.getElementsByClassName('title-bar-bg title-bar')[0]; e.parentElement.removeChild(e)"); + document().findFirst(".footer-footer").removeFromDocument(); + document().findFirst(".title-bar-bg .title-bar").removeFromDocument(); QTimer::singleShot(2000, this, SLOT(hideElements())); } @@ -152,16 +154,18 @@ void GoogleChat::loginPage(bool ok) { showError("Service unavailable"); } else { // check for any error message - QString c = evalJS("document.getElementsByClassName('errormsg').length"); - if (c == "0") { + + QWebElement e = document().findFirst(".errormsg"); + if (e.isNull()) { form.stackedWidget->setCurrentIndex(2); QTimer::singleShot(500, this, SLOT(hideElements())); return; } - QString err = "Unknown login failure."; - if (c == "1") { - err = evalJS("document.getElementsByClassName('errormsg')[0].textContent"); + QString err = "Unknown login failure."; + const QString errorMessage = e.toPlainText(); + if (!errorMessage.isEmpty()) { + err = errorMessage; err = err.simplified(); } showError(err); diff --git a/examples/webkit/googlechat/googlechat.h b/examples/webkit/googlechat/googlechat.h index b51e2c4..617587a 100644 --- a/examples/webkit/googlechat/googlechat.h +++ b/examples/webkit/googlechat/googlechat.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,6 +40,7 @@ ****************************************************************************/ #include <QWidget> +#include <QWebElement> #include "ui_form.h" @@ -53,7 +54,7 @@ public: protected: void showStatus(const QString &msg); void showError(const QString &msg); - QString evalJS(const QString &js); + QWebElement document() const; private slots: diff --git a/examples/webkit/googlechat/googlechat.pro b/examples/webkit/googlechat/googlechat.pro index 8e4f9a6..3d32c1b 100644 --- a/examples/webkit/googlechat/googlechat.pro +++ b/examples/webkit/googlechat/googlechat.pro @@ -10,4 +10,7 @@ sources.files = $$SOURCES $$HEADERS $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlechat INSTALLS += target sources -symbian:TARGET.UID3 = 0xA000CF6E +symbian { + TARGET.UID3 = 0xA000CF6E + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp index ca94131..4e74acdc 100644 --- a/examples/webkit/googlechat/main.cpp +++ b/examples/webkit/googlechat/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/previewer/main.cpp b/examples/webkit/previewer/main.cpp index 1c80c19..d18ce26 100644 --- a/examples/webkit/previewer/main.cpp +++ b/examples/webkit/previewer/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/previewer/mainwindow.cpp b/examples/webkit/previewer/mainwindow.cpp index ab93afe..42b6fa7 100644 --- a/examples/webkit/previewer/mainwindow.cpp +++ b/examples/webkit/previewer/mainwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/previewer/mainwindow.h b/examples/webkit/previewer/mainwindow.h index 8fdc93a..5bbdbd7 100644 --- a/examples/webkit/previewer/mainwindow.h +++ b/examples/webkit/previewer/mainwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/previewer/previewer.cpp b/examples/webkit/previewer/previewer.cpp index 0ec6b93..f9fbab4 100644 --- a/examples/webkit/previewer/previewer.cpp +++ b/examples/webkit/previewer/previewer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/previewer/previewer.h b/examples/webkit/previewer/previewer.h index 1d33be1..77b2709 100644 --- a/examples/webkit/previewer/previewer.h +++ b/examples/webkit/previewer/previewer.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/simpleselector/main.cpp b/examples/webkit/simpleselector/main.cpp index 74c5469..b63e5eb 100644 --- a/examples/webkit/simpleselector/main.cpp +++ b/examples/webkit/simpleselector/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/simpleselector/simpleselector.pro b/examples/webkit/simpleselector/simpleselector.pro index 3f3037f..acd0ae7 100644 --- a/examples/webkit/simpleselector/simpleselector.pro +++ b/examples/webkit/simpleselector/simpleselector.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/webkit/simpleselector sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/simpleselector INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7CC + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/simpleselector/window.cpp b/examples/webkit/simpleselector/window.cpp index ad54487..578a806 100644 --- a/examples/webkit/simpleselector/window.cpp +++ b/examples/webkit/simpleselector/window.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/simpleselector/window.h b/examples/webkit/simpleselector/window.h index 9f9344a..e79a25f 100644 --- a/examples/webkit/simpleselector/window.h +++ b/examples/webkit/simpleselector/window.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro index c985ed5..76c8801 100644 --- a/examples/webkit/webkit.pro +++ b/examples/webkit/webkit.pro @@ -3,7 +3,8 @@ SUBDIRS += domtraversal \ formextractor \ previewer \ fancybrowser \ - simpleselector + simpleselector \ + framecapture contains(QT_CONFIG, openssl):SUBDIRS += googlechat |