From 60c5b81f88202da49782ede6be3d778923334345 Mon Sep 17 00:00:00 2001 From: nowrep Date: Thu, 15 Mar 2012 19:35:37 +0100 Subject: [PATCH] Improved source viewer, it now shows lines and fixed go to line. - plugins can now register scheme handlers - tweaked javascript alert window - initial support for Geolocation & Notifications API * question to ask user for permission needs not implemented yet --- COPYRIGHT | 43 +++++ src/lib/app/qupzilla.cpp | 14 +- src/lib/bookmarks/bookmarksmanager.cpp | 2 +- src/lib/data/html/copyright | 43 +++++ src/lib/lib.pro | 14 +- src/lib/network/networkmanager.cpp | 29 +++- src/lib/network/networkmanager.h | 6 +- src/lib/network/qupzillaschemehandler.cpp | 3 +- src/lib/network/qupzillaschemehandler.h | 4 +- src/lib/network/schemehandler.cpp | 22 +++ src/lib/network/schemehandler.h | 33 ++++ src/lib/other/aboutdialog.cpp | 2 +- src/lib/other/aboutdialog.ui | 2 +- src/lib/other/checkboxdialog.cpp | 57 +++++++ src/lib/other/checkboxdialog.h | 51 ++++++ src/lib/other/checkboxdialog.ui | 98 +++++++++++ src/lib/other/closedialog.ui | 88 ---------- src/lib/other/databasewriter.cpp | 2 +- src/lib/other/sourceviewer.cpp | 11 +- src/lib/other/sourceviewer.h | 7 +- src/lib/other/sourceviewersearch.cpp | 2 +- src/lib/plugins/pluginproxy.h | 2 + src/lib/plugins/plugins.cpp | 4 +- src/lib/tools/closedtabsmanager.h | 2 +- src/lib/tools/globalfunctions.cpp | 2 + src/lib/tools/plaineditwithlines.cpp | 199 ++++++++++++++++++++++ src/lib/tools/plaineditwithlines.h | 116 +++++++++++++ src/lib/webview/tabbar.cpp | 2 +- src/lib/webview/tabbar.h | 2 +- src/lib/webview/webpage.cpp | 40 +++-- src/lib/webview/webpage.h | 4 + src/lib/webview/webtab.h | 2 +- 32 files changed, 758 insertions(+), 150 deletions(-) create mode 100644 src/lib/network/schemehandler.cpp create mode 100644 src/lib/network/schemehandler.h create mode 100644 src/lib/other/checkboxdialog.cpp create mode 100644 src/lib/other/checkboxdialog.h create mode 100644 src/lib/other/checkboxdialog.ui delete mode 100644 src/lib/other/closedialog.ui create mode 100644 src/lib/tools/plaineditwithlines.cpp create mode 100644 src/lib/tools/plaineditwithlines.h diff --git a/COPYRIGHT b/COPYRIGHT index c79abc5e2..df9c7a79e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -91,6 +91,49 @@ ** If you are unsure which license is appropriate for your use, please ** contact Nokia at qt-info@nokia.com. ** +----------------------------------------------------------------------------- + HtmlHighlighter and PlainTextEditorWithLines classes: +----------------------------------------------------------------------------- +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the examples of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** You may use this file under the terms of the BSD license as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + ** the names of its contributors may be used to endorse or promote + ** products derived from this software without specific prior written + ** permission. + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + --------------------------------------------------------------------------- Click2Flash plugin: --------------------------------------------------------------------------- diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 00d8eaac6..51f034b94 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -42,7 +42,7 @@ #include "aboutdialog.h" #include "pluginproxy.h" #include "qtwin.h" -#include "ui_closedialog.h" +#include "checkboxdialog.h" #include "adblockmanager.h" #include "clickablelabel.h" #include "docktitlebarwidget.h" @@ -1809,15 +1809,15 @@ bool QupZilla::quitApp() settings.endGroup(); if (askOnClose && afterLaunch != 3 && m_tabWidget->count() > 1) { - QDialog dialog(this); - Ui_CloseDialog* ui = new Ui_CloseDialog(); - ui->setupUi(&dialog); - ui->textLabel->setText(tr("There are still %1 open tabs and your session won't be stored. Are you sure to quit QupZilla?").arg(m_tabWidget->count())); - ui->iconLabel->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxWarning)); + CheckBoxDialog dialog(QDialogButtonBox::Yes | QDialogButtonBox::No, this); + dialog.setText(tr("There are still %1 open tabs and your session won't be stored. \nAre you sure to quit QupZilla?").arg(m_tabWidget->count())); + dialog.setCheckBoxText(tr("Don't ask again")); + dialog.setWindowTitle(tr("There are still open tabs")); + dialog.setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxWarning)); if (dialog.exec() != QDialog::Accepted) { return false; } - if (ui->dontAskAgain->isChecked()) { + if (dialog.isChecked()) { settings.setValue("Browser-Tabs-Settings/AskOnClosing", false); } } diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index e13cd5024..cbbcfc7b1 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -439,7 +439,7 @@ void BookmarksManager::removeBookmark(const BookmarksModel::Bookmark &bookmark) QTreeWidgetItem* item = list.at(0); int id = item->data(0, Qt::UserRole + 10).toInt(); - if (item && id == bookmark.id) { + if (id == bookmark.id) { ui->bookmarksTree->deleteItem(item); } } diff --git a/src/lib/data/html/copyright b/src/lib/data/html/copyright index b36bb1e7c..52a7f05e8 100644 --- a/src/lib/data/html/copyright +++ b/src/lib/data/html/copyright @@ -91,6 +91,49 @@ ** If you are unsure which license is appropriate for your use, please ** contact Nokia at qt-info@nokia.com. ** +----------------------------------------------------------------------------- + HtmlHighlighter and PlainTextEditorWithLines classes: +----------------------------------------------------------------------------- +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the examples of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** You may use this file under the terms of the BSD license as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + ** the names of its contributors may be used to endorse or promote + ** products derived from this software without specific prior written + ** permission. + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + --------------------------------------------------------------------------- Click2Flash plugin: --------------------------------------------------------------------------- diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 8e1f8e1c3..178b3ede6 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -165,7 +165,10 @@ SOURCES += \ preferences/pluginlistdelegate.cpp \ popupwindow/popupstatusbarmessage.cpp \ other/licenseviewer.cpp \ - bookmarksimport/bookmarksimporticonfetcher.cpp + bookmarksimport/bookmarksimporticonfetcher.cpp \ + other/checkboxdialog.cpp \ + network/schemehandler.cpp \ + tools/plaineditwithlines.cpp HEADERS += \ 3rdparty/qtwin.h \ @@ -302,7 +305,10 @@ HEADERS += \ preferences/pluginlistdelegate.h \ popupwindow/popupstatusbarmessage.h \ other/licenseviewer.h \ - bookmarksimport/bookmarksimporticonfetcher.h + bookmarksimport/bookmarksimporticonfetcher.h \ + other/checkboxdialog.h \ + network/schemehandler.h \ + tools/plaineditwithlines.h FORMS += \ preferences/autofillmanager.ui \ @@ -325,7 +331,6 @@ FORMS += \ preferences/sslmanager.ui \ other/clearprivatedata.ui \ other/sourceviewersearch.ui \ - other/closedialog.ui \ adblock/adblockdialog.ui \ tools/docktitlebarwidget.ui \ sidebar/bookmarkssidebar.ui \ @@ -343,7 +348,8 @@ FORMS += \ preferences/addacceptlanguage.ui \ opensearch/searchenginesdialog.ui \ opensearch/editsearchengine.ui \ - bookmarksimport/bookmarksimportdialog.ui + bookmarksimport/bookmarksimportdialog.ui \ + other/checkboxdialog.ui RESOURCES += \ data/icons.qrc \ diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index 27c17fc1d..9c65bed8a 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -61,7 +61,6 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent) : NetworkManagerProxy(parent) , m_adblockNetwork(0) , p_QupZilla(mainClass) - , m_qupzillaSchemeHandler(new QupZillaSchemeHandler) , m_ignoreAllWarnings(false) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(authentication(QNetworkReply*, QAuthenticator*))); @@ -69,6 +68,8 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent) connect(this, SIGNAL(sslErrors(QNetworkReply*, QList)), this, SLOT(sslError(QNetworkReply*, QList))); connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*))); + m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler; + m_proxyFactory = new NetworkProxyFactory(); setProxyFactory(m_proxyFactory); loadSettings(); @@ -322,6 +323,14 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op QNetworkRequest req = request; QNetworkReply* reply = 0; + //SchemeHandlers + if (m_schemeHandlers.contains(req.url().scheme())) { + reply = m_schemeHandlers[req.url().scheme()]->createRequest(op, req, outgoingData); + if (reply) { + return reply; + } + } + if (m_doNotTrack) { req.setRawHeader("DNT", QByteArray("1")); } @@ -332,14 +341,6 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op req.setRawHeader("Accept-Language", m_acceptLanguage); - //SchemeHandlers - if (req.url().scheme() == "qupzilla") { - reply = m_qupzillaSchemeHandler->createRequest(op, req, outgoingData); - if (reply) { - return reply; - } - } - req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); if (req.attribute(QNetworkRequest::CacheLoadControlAttribute).toInt() == QNetworkRequest::PreferNetwork) { req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); @@ -418,6 +419,16 @@ void NetworkManager::addLocalCertificate(const QSslCertificate &cert) } } +bool NetworkManager::registerSchemeHandler(const QString &scheme, SchemeHandler* handler) +{ + if (m_schemeHandlers.contains(scheme)) { + return false; + } + + m_schemeHandlers[scheme] = handler; + return true; +} + void NetworkManager::saveCertificates() { Settings settings; diff --git a/src/lib/network/networkmanager.h b/src/lib/network/networkmanager.h index 274c9e83d..62ff52edb 100644 --- a/src/lib/network/networkmanager.h +++ b/src/lib/network/networkmanager.h @@ -30,6 +30,7 @@ class QupZilla; class AdBlockNetwork; class NetworkProxyFactory; class QupZillaSchemeHandler; +class SchemeHandler; class QT_QUPZILLA_EXPORT NetworkManager : public NetworkManagerProxy { @@ -54,6 +55,8 @@ public: void setIgnoreAllWarnings(bool state) { m_ignoreAllWarnings = state; } bool isIgnoringAllWarnings() { return m_ignoreAllWarnings; } + bool registerSchemeHandler(const QString &scheme, SchemeHandler* handler); + void disconnectObjects(); signals: @@ -71,14 +74,13 @@ private: QupZilla* p_QupZilla; QNetworkDiskCache* m_diskCache; NetworkProxyFactory* m_proxyFactory; - QupZillaSchemeHandler* m_qupzillaSchemeHandler; QStringList m_certPaths; QList m_caCerts; QList m_localCerts; - QList m_ignoredCerts; + QHash m_schemeHandlers; QByteArray m_acceptLanguage; bool m_ignoreAllWarnings; diff --git a/src/lib/network/qupzillaschemehandler.cpp b/src/lib/network/qupzillaschemehandler.cpp index c76e40af6..a69e506bb 100644 --- a/src/lib/network/qupzillaschemehandler.cpp +++ b/src/lib/network/qupzillaschemehandler.cpp @@ -60,7 +60,8 @@ QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* pa setUrl(req.url()); m_pageName = req.url().path(); - if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || m_pageName == "speeddial" || m_pageName == "config") { + if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || + m_pageName == "speeddial" || m_pageName == "config") { m_buffer.open(QIODevice::ReadWrite); setError(QNetworkReply::NoError, tr("No Error")); diff --git a/src/lib/network/qupzillaschemehandler.h b/src/lib/network/qupzillaschemehandler.h index 99d94e57d..0c322f48c 100644 --- a/src/lib/network/qupzillaschemehandler.h +++ b/src/lib/network/qupzillaschemehandler.h @@ -18,13 +18,13 @@ #ifndef QUPZILLASCHEMEHANDLER_H #define QUPZILLASCHEMEHANDLER_H -#include #include #include +#include "schemehandler.h" #include "qz_namespace.h" -class QupZillaSchemeHandler +class QT_QUPZILLA_EXPORT QupZillaSchemeHandler : public SchemeHandler { public: explicit QupZillaSchemeHandler(); diff --git a/src/lib/network/schemehandler.cpp b/src/lib/network/schemehandler.cpp new file mode 100644 index 000000000..7e4b93780 --- /dev/null +++ b/src/lib/network/schemehandler.cpp @@ -0,0 +1,22 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "schemehandler.h" + +SchemeHandler::SchemeHandler() +{ +} diff --git a/src/lib/network/schemehandler.h b/src/lib/network/schemehandler.h new file mode 100644 index 000000000..5f8cdf973 --- /dev/null +++ b/src/lib/network/schemehandler.h @@ -0,0 +1,33 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#ifndef SCHEMEHANDLER_H +#define SCHEMEHANDLER_H + +#include + +#include "qz_namespace.h" + +class QT_QUPZILLA_EXPORT SchemeHandler +{ +public: + SchemeHandler(); + + virtual QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData) = 0; +}; + +#endif // SCHEMEHANDLER_H diff --git a/src/lib/other/aboutdialog.cpp b/src/lib/other/aboutdialog.cpp index 7fe1acdc4..c0df4e28e 100644 --- a/src/lib/other/aboutdialog.cpp +++ b/src/lib/other/aboutdialog.cpp @@ -62,7 +62,7 @@ void AboutDialog::showAbout() #endif )); m_aboutHtml.append(tr("WebKit version %1

").arg(QupZilla::WEBKITVERSION)); - m_aboutHtml.append(tr("

© %1 %2
All rights reserved.
").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR)); + m_aboutHtml.append(tr("

© %1 %2
").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR)); m_aboutHtml.append(tr("Build time: %1

").arg(QupZilla::BUILDTIME)); m_aboutHtml.append(QString("

%1

").arg(QupZilla::WWWADDRESS)); m_aboutHtml.append("

" + mApp->getWindow()->weView()->webPage()->userAgentForUrl(QUrl()) + "

"); diff --git a/src/lib/other/aboutdialog.ui b/src/lib/other/aboutdialog.ui index da4c99088..c515b9589 100644 --- a/src/lib/other/aboutdialog.ui +++ b/src/lib/other/aboutdialog.ui @@ -7,7 +7,7 @@ 0 0 381 - 440 + 416 diff --git a/src/lib/other/checkboxdialog.cpp b/src/lib/other/checkboxdialog.cpp new file mode 100644 index 000000000..4376adc76 --- /dev/null +++ b/src/lib/other/checkboxdialog.cpp @@ -0,0 +1,57 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "checkboxdialog.h" +#include "ui_checkboxdialog.h" + +CheckBoxDialog::CheckBoxDialog(const QDialogButtonBox::StandardButtons &buttons, QWidget* parent) + : QDialog(parent) + , ui(new Ui::CheckBoxDialog) +{ + ui->setupUi(this); + + ui->buttonBox->setStandardButtons(buttons); +} + +void CheckBoxDialog::setPixmap(const QPixmap &pixmap) +{ + ui->iconLabel->setPixmap(pixmap); + ui->iconLabel->setFixedWidth(pixmap.width()); +} + +void CheckBoxDialog::setText(const QString &text) +{ + ui->textLabel->setText(text); +} + +void CheckBoxDialog::setCheckBoxText(const QString &text) +{ + ui->checkBox->setText(text); +} + +bool CheckBoxDialog::isChecked() const +{ + return ui->checkBox->isChecked(); +} + +int CheckBoxDialog::exec() +{ + ui->buttonBox->setFocus(); + setMaximumSize(size()); + + return QDialog::exec(); +} diff --git a/src/lib/other/checkboxdialog.h b/src/lib/other/checkboxdialog.h new file mode 100644 index 000000000..3852ab9ea --- /dev/null +++ b/src/lib/other/checkboxdialog.h @@ -0,0 +1,51 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#ifndef CHECKBOXDIALOG_H +#define CHECKBOXDIALOG_H + +#include +#include + +#include "qz_namespace.h" + +namespace Ui +{ +class CheckBoxDialog; +} + +class QT_QUPZILLA_EXPORT CheckBoxDialog : public QDialog +{ + Q_OBJECT +public: + explicit CheckBoxDialog(const QDialogButtonBox::StandardButtons &buttons, QWidget* parent = 0); + + void setPixmap(const QPixmap &pixmap); + void setText(const QString &text); + void setCheckBoxText(const QString &text); + + bool isChecked() const; + +public slots: + int exec(); + +private: + Ui::CheckBoxDialog* ui; + +}; + +#endif // CHECKBOXDIALOG_H diff --git a/src/lib/other/checkboxdialog.ui b/src/lib/other/checkboxdialog.ui new file mode 100644 index 000000000..544785053 --- /dev/null +++ b/src/lib/other/checkboxdialog.ui @@ -0,0 +1,98 @@ + + + CheckBoxDialog + + + + 0 + 0 + 409 + 94 + + + + + + + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + buttonBox + accepted() + CheckBoxDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + CheckBoxDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/lib/other/closedialog.ui b/src/lib/other/closedialog.ui deleted file mode 100644 index 56e251b02..000000000 --- a/src/lib/other/closedialog.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - CloseDialog - - - - 0 - 0 - 208 - 98 - - - - There are still open tabs - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::No|QDialogButtonBox::Yes - - - - - - - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - - - Don't ask again - - - - - - - - - buttonBox - accepted() - CloseDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - CloseDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/lib/other/databasewriter.cpp b/src/lib/other/databasewriter.cpp index 7bfe4f349..c62791363 100644 --- a/src/lib/other/databasewriter.cpp +++ b/src/lib/other/databasewriter.cpp @@ -19,7 +19,7 @@ #include -DatabaseWriter::DatabaseWriter(QObject *parent) +DatabaseWriter::DatabaseWriter(QObject* parent) : QObject(parent) { } diff --git a/src/lib/other/sourceviewer.cpp b/src/lib/other/sourceviewer.cpp index 8eea13b9f..82543bab2 100644 --- a/src/lib/other/sourceviewer.cpp +++ b/src/lib/other/sourceviewer.cpp @@ -22,10 +22,10 @@ #include "globalfunctions.h" #include "iconprovider.h" #include "enhancedmenu.h" +#include "plaineditwithlines.h" #include #include -#include #include #include #include @@ -39,7 +39,7 @@ SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml) setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Source of ") + frame->url().toString()); m_layout = new QBoxLayout(QBoxLayout::TopToBottom, this); - m_sourceEdit = new QTextEdit(this); + m_sourceEdit = new PlainEditWithLines(this); m_sourceEdit->setObjectName("sourceviewer-textedit"); m_statusBar = new QStatusBar(this); @@ -175,10 +175,5 @@ void SourceViewer::goToLine() return; } - m_sourceEdit->setUpdatesEnabled(false); - m_sourceEdit->moveCursor(QTextCursor::Start); - for (int i = 0; i < line; i++) { - m_sourceEdit->moveCursor(QTextCursor::Down); - } - m_sourceEdit->setUpdatesEnabled(true); + m_sourceEdit->goToLine(line); } diff --git a/src/lib/other/sourceviewer.h b/src/lib/other/sourceviewer.h index e6136421b..f598a0543 100644 --- a/src/lib/other/sourceviewer.h +++ b/src/lib/other/sourceviewer.h @@ -23,7 +23,8 @@ #include "qz_namespace.h" -class QTextEdit; +class PlainEditWithLines; + class QBoxLayout; class QStatusBar; class QWebFrame; @@ -33,7 +34,7 @@ class QT_QUPZILLA_EXPORT SourceViewer : public QWidget Q_OBJECT public: explicit SourceViewer(QWebFrame* frame, const QString &selectedHtml); - QTextEdit* sourceEdit() { return m_sourceEdit; } + PlainEditWithLines* sourceEdit() { return m_sourceEdit; } signals: @@ -49,7 +50,7 @@ private slots: private: QBoxLayout* m_layout; - QTextEdit* m_sourceEdit; + PlainEditWithLines* m_sourceEdit; QWeakPointer m_frame; QStatusBar* m_statusBar; }; diff --git a/src/lib/other/sourceviewersearch.cpp b/src/lib/other/sourceviewersearch.cpp index badea08c4..d4f364711 100644 --- a/src/lib/other/sourceviewersearch.cpp +++ b/src/lib/other/sourceviewersearch.cpp @@ -19,8 +19,8 @@ #include "ui_sourceviewersearch.h" #include "sourceviewer.h" #include "iconprovider.h" +#include "plaineditwithlines.h" -#include #include #include diff --git a/src/lib/plugins/pluginproxy.h b/src/lib/plugins/pluginproxy.h index cd14e1806..e5c9d5316 100644 --- a/src/lib/plugins/pluginproxy.h +++ b/src/lib/plugins/pluginproxy.h @@ -19,6 +19,7 @@ #define PLUGINPROXY_H #include "mainapplication.h" +#include "networkmanager.h" #include "plugins.h" #include "qz_namespace.h" @@ -74,5 +75,6 @@ private: }; #define QZ_REGISTER_EVENT_HANDLER(Type) mApp->plugins()->registerAppEventHandler(Type, this); +#define QZ_REGISTER_SCHEME_HANDLER(Scheme, Object) mApp->networkManager()->registerSchemeHandler(Scheme, Object); #endif // PLUGINPROXY_H diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 66b3a1826..58d69eb47 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -152,9 +152,9 @@ void Plugins::loadAvailablePlugins() QStringList dirs; dirs << mApp->DATADIR + "plugins/" - #ifdef Q_WS_X11 +#ifdef Q_WS_X11 << "/usr/lib/qupzilla/" - #endif +#endif << mApp->PROFILEDIR + "plugins/"; foreach(const QString & dir, dirs) { diff --git a/src/lib/tools/closedtabsmanager.h b/src/lib/tools/closedtabsmanager.h index 56ce5ac29..3bb3e1306 100644 --- a/src/lib/tools/closedtabsmanager.h +++ b/src/lib/tools/closedtabsmanager.h @@ -42,7 +42,7 @@ public: explicit ClosedTabsManager(); - void saveView(WebTab *tab, int position); + void saveView(WebTab* tab, int position); ClosedTabsManager::Tab getFirstClosedTab(); ClosedTabsManager::Tab getTabAt(int index); diff --git a/src/lib/tools/globalfunctions.cpp b/src/lib/tools/globalfunctions.cpp index 9e120f8b7..9540ed1dd 100644 --- a/src/lib/tools/globalfunctions.cpp +++ b/src/lib/tools/globalfunctions.cpp @@ -173,6 +173,8 @@ QString qz_urlEncodeQueryString(const QUrl &url) returnString.append(url.encodedFragment()); } + returnString.replace(" ", "%20"); + return returnString; } diff --git a/src/lib/tools/plaineditwithlines.cpp b/src/lib/tools/plaineditwithlines.cpp new file mode 100644 index 000000000..6d9e2b0ce --- /dev/null +++ b/src/lib/tools/plaineditwithlines.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "plaineditwithlines.h" + +#include +#include + +PlainEditWithLines::PlainEditWithLines(QWidget* parent) + : QPlainTextEdit(parent) + , m_lineNumberArea(new LineNumberArea(this)) + , m_countCache(-1, -1) +{ + connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); + connect(this, SIGNAL(updateRequest(QRect, int)), this, SLOT(updateLineNumberArea(QRect, int))); + connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); + + updateLineNumberAreaWidth(0); + highlightCurrentLine(); +} + +int PlainEditWithLines::lineNumberAreaWidth() +{ + int digits = 1; + int max = qMax(1, blockCount()); + while (max >= 10) { + max /= 10; + ++digits; + } + + int space = 5 + fontMetrics().width(QLatin1Char('9')) * digits; + + return space; +} + +void PlainEditWithLines::setReadOnly(bool ro) +{ + QPlainTextEdit::setReadOnly(ro); + + highlightCurrentLine(); +} + +void PlainEditWithLines::goToLine(int line) +{ + setUpdatesEnabled(false); + + moveCursor(QTextCursor::Start); + + QTextCursor cursor = textCursor(); + cursor.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor, line - 1); + + setTextCursor(cursor); + + setUpdatesEnabled(true); +} + +void PlainEditWithLines::updateLineNumberAreaWidth(int /* newBlockCount */) +{ + setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); +} + +void PlainEditWithLines::updateLineNumberArea(const QRect &rect, int dy) +{ + if (dy) { + m_lineNumberArea->scroll(0, dy); + } + else if (m_countCache.first != blockCount() || m_countCache.second != textCursor().block().lineCount()) { + m_lineNumberArea->update(0, rect.y(), m_lineNumberArea->width(), rect.height()); + m_countCache.first = blockCount(); + m_countCache.second = textCursor().block().lineCount(); + } + + if (rect.contains(viewport()->rect())) { + updateLineNumberAreaWidth(0); + } +} + +void PlainEditWithLines::resizeEvent(QResizeEvent* e) +{ + QPlainTextEdit::resizeEvent(e); + + QRect cr = contentsRect(); + m_lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); +} + +void PlainEditWithLines::highlightCurrentLine() +{ + QList extraSelections; + QTextEdit::ExtraSelection selection; + QColor lineColor = palette().color(QPalette::Highlight).lighter(); + + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + + setExtraSelections(extraSelections); +} + +void PlainEditWithLines::lineNumberAreaPaintEvent(QPaintEvent* event) +{ + const QRect &eventRect = event->rect(); + + QPainter painter(m_lineNumberArea); + painter.fillRect(eventRect, QColor(235, 235, 235)); + painter.fillRect(QRect(eventRect.width() - 1, 0, 1, viewport()->height()), QColor(175, 175, 175)); + + QTextBlock block = firstVisibleBlock(); + int blockNumber = block.blockNumber(); + int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); + int bottom = top + (int) blockBoundingRect(block).height(); + + QColor textColor(175, 175, 175); + + while (block.isValid() && top <= eventRect.bottom()) { + if (block.isVisible() && bottom >= eventRect.top()) { + QString number = QString::number(blockNumber + 1); + painter.setPen(textColor); + + painter.drawText(0, top, m_lineNumberArea->width() - 3, fontMetrics().height(), + Qt::AlignRight, number); + } + + block = block.next(); + top = bottom; + bottom = top + (int) blockBoundingRect(block).height(); + ++blockNumber; + } +} + +LineNumberArea::LineNumberArea(PlainEditWithLines* editor) + : QWidget(editor) + , m_codeEditor(editor) +{ +} + +QSize LineNumberArea::sizeHint() const +{ + return QSize(m_codeEditor->lineNumberAreaWidth(), 0); +} + +void LineNumberArea::paintEvent(QPaintEvent* event) +{ + m_codeEditor->lineNumberAreaPaintEvent(event); +} diff --git a/src/lib/tools/plaineditwithlines.h b/src/lib/tools/plaineditwithlines.h new file mode 100644 index 000000000..fdfa369e3 --- /dev/null +++ b/src/lib/tools/plaineditwithlines.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2012 David Rosca +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#ifndef PLAINEDITWITHLINES_H +#define PLAINEDITWITHLINES_H + +#include + +#include "qz_namespace.h" + +class QPaintEvent; +class QResizeEvent; +class QSize; +class QWidget; + +class LineNumberArea; + + +class QT_QUPZILLA_EXPORT PlainEditWithLines : public QPlainTextEdit +{ + Q_OBJECT + +public: + explicit PlainEditWithLines(QWidget* parent = 0); + + void lineNumberAreaPaintEvent(QPaintEvent* event); + int lineNumberAreaWidth(); + + void setReadOnly(bool ro); + +public slots: + void goToLine(int line); + +protected: + void resizeEvent(QResizeEvent* event); + +private slots: + void updateLineNumberAreaWidth(int newBlockCount); + void highlightCurrentLine(); + void updateLineNumberArea(const QRect &, int); + +private: + QWidget* m_lineNumberArea; + + QPair m_countCache; +}; + + +class QT_QUPZILLA_EXPORT LineNumberArea : public QWidget +{ +public: + explicit LineNumberArea(PlainEditWithLines* editor); + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent* event); + +private: + PlainEditWithLines* m_codeEditor; +}; + +#endif // PLAINEDITWITHLINES_H diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 34ba8d0f1..77e4b8f38 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -411,7 +411,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event) QTabBar::mouseReleaseEvent(event); } -void TabBar::wheelEvent(QWheelEvent *event) +void TabBar::wheelEvent(QWheelEvent* event) { if (mApp->plugins()->processWheelEvent(Qz::ON_TabBar, this, event)) { return; diff --git a/src/lib/webview/tabbar.h b/src/lib/webview/tabbar.h index a6046f386..cc121c68f 100644 --- a/src/lib/webview/tabbar.h +++ b/src/lib/webview/tabbar.h @@ -79,7 +79,7 @@ private: void mousePressEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); - void wheelEvent(QWheelEvent *event); + void wheelEvent(QWheelEvent* event); void dragEnterEvent(QDragEnterEvent* event); void dropEvent(QDropEvent* event); diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index f311c5286..7c0d7a0f0 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -27,7 +27,7 @@ #include "ui_jsalert.h" #include "ui_jsprompt.h" #endif -#include "ui_closedialog.h" +#include "checkboxdialog.h" #include "widget.h" #include "globalfunctions.h" #include "pluginproxy.h" @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,10 @@ WebPage::WebPage(QupZilla* mainClass) connect(this, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject())); + +#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0)) + connect(this, SIGNAL(featurePermissionRequested(QWebFrame*, QWebPage::Feature)), this, SLOT(featurePermissionRequested(QWebFrame*, QWebPage::Feature))); +#endif } QUrl WebPage::url() const @@ -281,6 +286,13 @@ void WebPage::windowCloseRequested() webView->closeView(); } +#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0)) +void WebPage::featurePermissionRequested(QWebFrame* frame, const QWebPage::Feature &feature) +{ + // We should probably ask user here ... -,- + setFeaturePermission(frame, feature, PermissionGrantedByUser); +} +#endif void WebPage::setSSLCertificate(const QSslCertificate &cert) { @@ -645,22 +657,20 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg) } #ifndef NONBLOCK_JS_DIALOGS - QDialog* dialog = new QDialog(view()); - Ui_CloseDialog* ui = new Ui_CloseDialog(); - ui->setupUi(dialog); - ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok); - ui->dontAskAgain->setText(tr("Prevent this page from creating additional dialogs")); - ui->textLabel->setText(msg); - ui->iconLabel->setPixmap(mApp->style()->standardPixmap(QStyle::SP_MessageBoxInformation)); - ui->buttonBox->setFocus(); - dialog->setWindowTitle(tr("JavaScript alert - %1").arg(url().host())); - dialog->exec(); - - if (ui->dontAskAgain->isChecked()) { - m_blockAlerts = true; + QString title = tr("JavaScript alert"); + if (!url().host().isEmpty()) { + title.append(QString(" - %1").arg(url().host())); } - delete dialog; + CheckBoxDialog dialog(QDialogButtonBox::Ok, view()); + dialog.setWindowTitle(title); + dialog.setText(msg); + dialog.setCheckBoxText(tr("Prevent this page from creating additional dialogs")); + dialog.setPixmap(mApp->style()->standardPixmap(QStyle::SP_MessageBoxInformation)); + dialog.exec(); + + m_blockAlerts = dialog.isChecked(); + #else WebView* webView = qobject_cast(originatingFrame->page()->view()); ResizableFrame* widget = new ResizableFrame(webView->overlayForJsAlert()); diff --git a/src/lib/webview/webpage.h b/src/lib/webview/webpage.h index fc30395aa..74162fd6c 100644 --- a/src/lib/webview/webpage.h +++ b/src/lib/webview/webpage.h @@ -91,6 +91,10 @@ private slots: void downloadRequested(const QNetworkRequest &request); void windowCloseRequested(); +#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0)) + void featurePermissionRequested(QWebFrame* frame, const QWebPage::Feature &feature); +#endif + private: virtual bool supportsExtension(Extension extension) const; virtual bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output = 0); diff --git a/src/lib/webview/webtab.h b/src/lib/webview/webtab.h index 876cd3fde..c00f15578 100644 --- a/src/lib/webview/webtab.h +++ b/src/lib/webview/webtab.h @@ -62,7 +62,7 @@ public: QUrl url() const; QString title() const; QIcon icon() const; - QWebHistory *history() const; + QWebHistory* history() const; void setHistoryData(const QByteArray &data); QByteArray historyData() const;