From 49ab6e1a4c960912ea2fa631cc26cebf70560713 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 15 Jun 2009 11:29:35 +0200 Subject: Ported the FormExtractor example to use the new QWebElement Reviewed-by: Tor Arne --- examples/webkit/formextractor/form.html | 24 +++----------------- examples/webkit/formextractor/formextractor.cpp | 29 ++++++++++++++++++------- examples/webkit/formextractor/formextractor.h | 4 +--- 3 files changed, 25 insertions(+), 32 deletions(-) (limited to 'examples/webkit') diff --git a/examples/webkit/formextractor/form.html b/examples/webkit/formextractor/form.html index 18ddff1e87..6b0bbde976 100755 --- a/examples/webkit/formextractor/form.html +++ b/examples/webkit/formextractor/form.html @@ -1,22 +1,4 @@ - +

The Green People Book Club

@@ -24,7 +6,7 @@ The Green People Book Club

Welcome to The Green People Book Club. Please register to obtain a membership with us.

-
+
@@ -61,4 +43,4 @@ Welcome to The Green People Book Club. Please register to obtain a membership wi - \ No newline at end of file + diff --git a/examples/webkit/formextractor/formextractor.cpp b/examples/webkit/formextractor/formextractor.cpp index d5ecc29cb6..9bb3d9e35a 100644 --- a/examples/webkit/formextractor/formextractor.cpp +++ b/examples/webkit/formextractor/formextractor.cpp @@ -41,6 +41,8 @@ #include "formextractor.h" +#include + FormExtractor::FormExtractor(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) { @@ -55,17 +57,28 @@ FormExtractor::~FormExtractor() { } -void FormExtractor::setValues(const QString &firstName, const QString &lastName, - const QString &gender, bool updates) +void FormExtractor::submit() { - ui.firstNameEdit->setText(firstName); - ui.lastNameEdit->setText(lastName); - ui.genderEdit->setText(gender); + QWebFrame *frame = ui.webView->page()->mainFrame(); - if (updates == false) - ui.updatesEdit->setText("No"); - else + QWebElement firstName = frame->findFirstElement("#firstname"); + QWebElement lastName = frame->findFirstElement("#lastname"); + QWebElement maleGender = frame->findFirstElement("#genderMale"); + QWebElement femaleGender = frame->findFirstElement("#genderFemale"); + QWebElement updates = frame->findFirstElement("#updates"); + + ui.firstNameEdit->setText(firstName.scriptableProperty("value").toString()); + ui.lastNameEdit->setText(lastName.scriptableProperty("value").toString()); + + if (maleGender.scriptableProperty("checked").toBool()) + ui.genderEdit->setText(maleGender.scriptableProperty("value").toString()); + else if (femaleGender.scriptableProperty("checked").toBool()) + ui.genderEdit->setText(femaleGender.scriptableProperty("value").toString()); + + if (updates.scriptableProperty("checked").toBool()) ui.updatesEdit->setText("Yes"); + else + ui.updatesEdit->setText("No"); } void FormExtractor::populateJavaScriptWindowObject() diff --git a/examples/webkit/formextractor/formextractor.h b/examples/webkit/formextractor/formextractor.h index 5b11565dc6..017d6450ca 100644 --- a/examples/webkit/formextractor/formextractor.h +++ b/examples/webkit/formextractor/formextractor.h @@ -55,9 +55,7 @@ public: ~FormExtractor(); public slots: - void setValues(const QString &firstName, const QString &lastName, - const QString &gender, bool updates); - + void submit(); void populateJavaScriptWindowObject(); private: -- cgit v1.2.3 From 858c70f768eeb2d65cefd4115f4e9089b588b2d0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 16 Jun 2009 22:08:09 +1000 Subject: Update license headers as requested by the marketing department. Reviewed-by: Trust Me --- examples/webkit/fancybrowser/main.cpp | 4 ++-- examples/webkit/fancybrowser/mainwindow.cpp | 4 ++-- examples/webkit/fancybrowser/mainwindow.h | 4 ++-- examples/webkit/formextractor/formextractor.cpp | 4 ++-- examples/webkit/formextractor/formextractor.h | 4 ++-- examples/webkit/formextractor/main.cpp | 4 ++-- examples/webkit/formextractor/mainwindow.cpp | 4 ++-- examples/webkit/formextractor/mainwindow.h | 4 ++-- examples/webkit/googlechat/googlechat.cpp | 4 ++-- examples/webkit/googlechat/googlechat.h | 4 ++-- examples/webkit/googlechat/main.cpp | 4 ++-- examples/webkit/previewer/main.cpp | 4 ++-- examples/webkit/previewer/mainwindow.cpp | 4 ++-- examples/webkit/previewer/mainwindow.h | 4 ++-- examples/webkit/previewer/previewer.cpp | 4 ++-- examples/webkit/previewer/previewer.h | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) (limited to 'examples/webkit') diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp index 59364693f8..fafbbb2aa7 100644 --- a/examples/webkit/fancybrowser/main.cpp +++ b/examples/webkit/fancybrowser/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index e24f6cfb52..9f899b4bef 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 2e1068c45c..0e880cde8f 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/formextractor/formextractor.cpp b/examples/webkit/formextractor/formextractor.cpp index d5ecc29cb6..a1c2df3ca8 100644 --- a/examples/webkit/formextractor/formextractor.cpp +++ b/examples/webkit/formextractor/formextractor.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/formextractor/formextractor.h b/examples/webkit/formextractor/formextractor.h index 5b11565dc6..e39cf8af18 100644 --- a/examples/webkit/formextractor/formextractor.h +++ b/examples/webkit/formextractor/formextractor.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/formextractor/main.cpp b/examples/webkit/formextractor/main.cpp index aa7847d3fd..792386de40 100644 --- a/examples/webkit/formextractor/main.cpp +++ b/examples/webkit/formextractor/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/formextractor/mainwindow.cpp b/examples/webkit/formextractor/mainwindow.cpp index 222d9b208d..4b3ab0c0ac 100644 --- a/examples/webkit/formextractor/mainwindow.cpp +++ b/examples/webkit/formextractor/mainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/formextractor/mainwindow.h b/examples/webkit/formextractor/mainwindow.h index 7918870f41..9a6dcd74db 100644 --- a/examples/webkit/formextractor/mainwindow.h +++ b/examples/webkit/formextractor/mainwindow.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/googlechat/googlechat.cpp b/examples/webkit/googlechat/googlechat.cpp index 9ac2cd2a70..20bcc54f39 100644 --- a/examples/webkit/googlechat/googlechat.cpp +++ b/examples/webkit/googlechat/googlechat.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/googlechat/googlechat.h b/examples/webkit/googlechat/googlechat.h index c92632c067..2a1df08961 100644 --- a/examples/webkit/googlechat/googlechat.h +++ b/examples/webkit/googlechat/googlechat.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp index 26feeead61..c0265e582b 100644 --- a/examples/webkit/googlechat/main.cpp +++ b/examples/webkit/googlechat/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/previewer/main.cpp b/examples/webkit/previewer/main.cpp index 87612e2c01..de137ee3b7 100644 --- a/examples/webkit/previewer/main.cpp +++ b/examples/webkit/previewer/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/previewer/mainwindow.cpp b/examples/webkit/previewer/mainwindow.cpp index abe7941f03..32ce01cdf6 100644 --- a/examples/webkit/previewer/mainwindow.cpp +++ b/examples/webkit/previewer/mainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/previewer/mainwindow.h b/examples/webkit/previewer/mainwindow.h index 3a0a4b15b7..5ff6cedd4e 100644 --- a/examples/webkit/previewer/mainwindow.h +++ b/examples/webkit/previewer/mainwindow.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/previewer/previewer.cpp b/examples/webkit/previewer/previewer.cpp index 51419d7869..f3aa9cec03 100644 --- a/examples/webkit/previewer/previewer.cpp +++ b/examples/webkit/previewer/previewer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webkit/previewer/previewer.h b/examples/webkit/previewer/previewer.h index ae70f9f598..2fa872238f 100644 --- a/examples/webkit/previewer/previewer.h +++ b/examples/webkit/previewer/previewer.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.3 From 578dd524b62b0f76fdd205e30102b374c48f21e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Thu, 18 Jun 2009 11:07:55 +0200 Subject: Use the unified toolbar on Mac. --- examples/webkit/fancybrowser/mainwindow.cpp | 1 + examples/webkit/formextractor/mainwindow.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'examples/webkit') diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 9f899b4bef..6d477db19a 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -94,6 +94,7 @@ MainWindow::MainWindow() toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements())); setCentralWidget(view); + setUnifiedTitleAndToolBarOnMac(true); } //! [3] diff --git a/examples/webkit/formextractor/mainwindow.cpp b/examples/webkit/formextractor/mainwindow.cpp index bc92f85c16..f774737419 100644 --- a/examples/webkit/formextractor/mainwindow.cpp +++ b/examples/webkit/formextractor/mainwindow.cpp @@ -48,6 +48,7 @@ MainWindow::MainWindow() createMenus(); centralWidget = new FormExtractor(this); setCentralWidget(centralWidget); + setUnifiedTitleAndToolBarOnMac(true); } void MainWindow::createActions() -- cgit v1.2.3