diff options
Diffstat (limited to 'examples/webenginewidgets/demobrowser')
49 files changed, 1192 insertions, 334 deletions
diff --git a/examples/webenginewidgets/demobrowser/autosaver.cpp b/examples/webenginewidgets/demobrowser/autosaver.cpp index 53e89b448..005e291bd 100644 --- a/examples/webenginewidgets/demobrowser/autosaver.cpp +++ b/examples/webenginewidgets/demobrowser/autosaver.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/autosaver.h b/examples/webenginewidgets/demobrowser/autosaver.h index a166e0c5e..be6eeeb4c 100644 --- a/examples/webenginewidgets/demobrowser/autosaver.h +++ b/examples/webenginewidgets/demobrowser/autosaver.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/bookmarks.cpp b/examples/webenginewidgets/demobrowser/bookmarks.cpp index dab6bba51..3d6d9c294 100644 --- a/examples/webenginewidgets/demobrowser/bookmarks.cpp +++ b/examples/webenginewidgets/demobrowser/bookmarks.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/bookmarks.h b/examples/webenginewidgets/demobrowser/bookmarks.h index f9d2e7ec3..922e7ce39 100644 --- a/examples/webenginewidgets/demobrowser/bookmarks.h +++ b/examples/webenginewidgets/demobrowser/bookmarks.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/browserapplication.cpp b/examples/webenginewidgets/demobrowser/browserapplication.cpp index 37bc05c34..0d5c54199 100644 --- a/examples/webenginewidgets/demobrowser/browserapplication.cpp +++ b/examples/webenginewidgets/demobrowser/browserapplication.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -62,7 +72,6 @@ #include <QtNetwork/QLocalServer> #include <QtNetwork/QLocalSocket> #include <QtNetwork/QNetworkProxy> -#include <QtNetwork/QNetworkReply> #include <QtNetwork/QSslSocket> #include <QWebEngineProfile> @@ -289,6 +298,21 @@ void BrowserApplication::loadSettings() defaultProfile->setHttpUserAgent(settings.value(QLatin1String("httpUserAgent")).toString()); defaultProfile->setHttpAcceptLanguage(settings.value(QLatin1String("httpAcceptLanguage")).toString()); + + switch (settings.value(QLatin1String("faviconDownloadMode"), 1).toInt()) { + case 0: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); + break; + case 1: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, false); + break; + case 2: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, true); + break; + } + settings.endGroup(); settings.beginGroup(QLatin1String("cookies")); @@ -490,10 +514,6 @@ QNetworkAccessManager *BrowserApplication::networkAccessManager() { if (!s_networkAccessManager) { s_networkAccessManager = new QNetworkAccessManager(); - connect(s_networkAccessManager, &QNetworkAccessManager::authenticationRequired, - BrowserApplication::instance(), &BrowserApplication::authenticationRequired); - connect(s_networkAccessManager, &QNetworkAccessManager::proxyAuthenticationRequired, - BrowserApplication::instance(), &BrowserApplication::proxyAuthenticationRequired); } return s_networkAccessManager; } @@ -552,68 +572,3 @@ void BrowserApplication::setPrivateBrowsing(bool privateBrowsing) } emit privateBrowsingChanged(privateBrowsing); } - -void BrowserApplication::setLastAuthenticator(QAuthenticator *authenticator) -{ - m_lastAuthenticator = QAuthenticator(*authenticator); -} - -void BrowserApplication::setLastProxyAuthenticator(QAuthenticator *authenticator) -{ - m_lastProxyAuthenticator = QAuthenticator(*authenticator); -} - -void BrowserApplication::authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator) -{ - if (m_lastAuthenticator.isNull()) - return; - - - Q_ASSERT(m_lastAuthenticator.option("key").isValid()); - QByteArray lastKey = m_lastAuthenticator.option("key").toByteArray(); - QByteArray key = BrowserApplication::authenticationKey(reply->url(), authenticator->realm()); - - if (lastKey == key) - *authenticator = m_lastAuthenticator; -} - -void BrowserApplication::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) -{ - if (m_lastProxyAuthenticator.isNull()) - return; - - QNetworkProxy::ProxyType proxyType = proxy.type(); - if (proxyType != QNetworkProxy::HttpProxy || proxyType != QNetworkProxy::HttpCachingProxy) - return; - - Q_ASSERT(m_lastProxyAuthenticator.option("host").isValid()); - QByteArray lastKey = m_lastProxyAuthenticator.option("key").toByteArray(); - QByteArray key = BrowserApplication::proxyAuthenticationKey(proxy, authenticator->realm()); - - if (lastKey == key) - *authenticator = m_lastAuthenticator; -} - -// TODO: Remove these functions (QTBUG-47967) -QByteArray BrowserApplication::authenticationKey(const QUrl &url, const QString &realm) -{ - QUrl copy = url; - copy.setFragment(realm); - return "auth:" + copy.toEncoded(QUrl::RemovePassword | QUrl::RemovePath | QUrl::RemoveQuery); -} - -QByteArray BrowserApplication::proxyAuthenticationKey(const QNetworkProxy &proxy, const QString &realm) -{ - QString host = QString("%1:%2").arg(proxy.hostName()).arg(proxy.port()); - return BrowserApplication::proxyAuthenticationKey(proxy.user(), host, realm); -} - -QByteArray BrowserApplication::proxyAuthenticationKey(const QString &user, const QString &host, const QString &realm) -{ - QUrl key; - key.setScheme(QLatin1String("proxy-http")); - key.setUserName(user); - key.setHost(host); - key.setFragment(realm); - return "auth:" + key.toEncoded(); -} diff --git a/examples/webenginewidgets/demobrowser/browserapplication.h b/examples/webenginewidgets/demobrowser/browserapplication.h index d473d9bc9..f509c67f7 100644 --- a/examples/webenginewidgets/demobrowser/browserapplication.h +++ b/examples/webenginewidgets/demobrowser/browserapplication.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -53,8 +63,6 @@ QT_BEGIN_NAMESPACE class QLocalServer; class QNetworkAccessManager; -class QNetworkProxy; -class QNetworkReply; class QWebEngineProfile; QT_END_NAMESPACE @@ -83,14 +91,6 @@ public: bool canRestoreSession() const; bool privateBrowsing() const { return m_privateBrowsing; } - void setLastAuthenticator(QAuthenticator *); - void setLastProxyAuthenticator(QAuthenticator *); - - // TODO: Remove these functions (QTBUG-47967) - static QByteArray authenticationKey(const QUrl &, const QString &); - static QByteArray proxyAuthenticationKey(const QNetworkProxy &, const QString &); - static QByteArray proxyAuthenticationKey(const QString &, const QString &, const QString &); - static HistoryManager *historyManager(); static CookieJar *cookieJar(); static DownloadManager *downloadManager(); @@ -107,8 +107,6 @@ public slots: void lastWindowClosed(); void quitBrowser(); void setPrivateBrowsing(bool); - void authenticationRequired(QNetworkReply *, QAuthenticator *); - void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *); signals: void privateBrowsingChanged(bool); diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp index 946810cef..0f24de707 100644 --- a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp +++ b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -302,8 +312,12 @@ void BrowserMainWindow::setupMenu() #if defined(QWEBENGINEPAGE_PRINT) fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview())); fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print); - fileMenu->addSeparator(); #endif +#ifndef QT_NO_PRINTER + fileMenu->addAction(tr("&Print to PDF..."), this, SLOT(slotFilePrintToPDF())); +#endif // ifndef QT_NO_PRINTER + fileMenu->addSeparator(); + QAction *action = fileMenu->addAction(tr("Private &Browsing..."), this, SLOT(slotPrivateBrowsing())); action->setCheckable(true); action->setChecked(BrowserApplication::instance()->privateBrowsing()); @@ -687,6 +701,39 @@ void BrowserMainWindow::slotFilePrint() #endif } +void BrowserMainWindow::slotHandlePdfPrinted(const QByteArray& result) +{ + if (!result.size()) + return; + + QFile file(m_printerOutputFileName); + + m_printerOutputFileName.clear(); + if (!file.open(QFile::WriteOnly)) + return; + + file.write(result.data(), result.size()); + file.close(); +} + +void BrowserMainWindow::slotFilePrintToPDF() +{ +#ifndef QT_NO_PRINTER + if (!currentTab()) + return; + QPrinter printer; + QPrintDialog *dialog = new QPrintDialog(&printer, this); + dialog->setWindowTitle(tr("Print Document")); + if (dialog->exec() != QDialog::Accepted || printer.outputFileName().isEmpty() || !m_printerOutputFileName.isEmpty()) + return; + + m_printerOutputFileName = printer.outputFileName(); + + currentTab()->page()->printToPdf(invoke(this, &BrowserMainWindow::slotHandlePdfPrinted), printer.pageLayout()); + +#endif // QT_NO_PRINTER +} + #if defined(QWEBENGINEPAGE_PRINT) void BrowserMainWindow::printRequested(QWebEngineFrame *frame) { diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.h b/examples/webenginewidgets/demobrowser/browsermainwindow.h index 5387b3d8c..9fb6b0851 100644 --- a/examples/webenginewidgets/demobrowser/browsermainwindow.h +++ b/examples/webenginewidgets/demobrowser/browsermainwindow.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -99,6 +109,7 @@ private slots: void slotFileOpen(); void slotFilePrintPreview(); void slotFilePrint(); + void slotFilePrintToPDF(); void slotPrivateBrowsing(); void slotFileSaveAs(); void slotEditFind(); @@ -127,6 +138,7 @@ private slots: void slotOpenActionUrl(QAction *action); void slotShowWindow(); void slotSwapFocus(); + void slotHandlePdfPrinted(const QByteArray&); #if defined(QWEBENGINEPAGE_PRINT) void printRequested(QWebEngineFrame *frame); @@ -169,6 +181,7 @@ private: QIcon m_stopIcon; QString m_lastSearch; + QString m_printerOutputFileName; friend class BrowserApplication; }; diff --git a/examples/webenginewidgets/demobrowser/chasewidget.cpp b/examples/webenginewidgets/demobrowser/chasewidget.cpp index 18f040824..0f066bc73 100644 --- a/examples/webenginewidgets/demobrowser/chasewidget.cpp +++ b/examples/webenginewidgets/demobrowser/chasewidget.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/chasewidget.h b/examples/webenginewidgets/demobrowser/chasewidget.h index 325cd5e19..63a8ff310 100644 --- a/examples/webenginewidgets/demobrowser/chasewidget.h +++ b/examples/webenginewidgets/demobrowser/chasewidget.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/cookiejar.cpp b/examples/webenginewidgets/demobrowser/cookiejar.cpp index 11a8562c3..479601ee3 100644 --- a/examples/webenginewidgets/demobrowser/cookiejar.cpp +++ b/examples/webenginewidgets/demobrowser/cookiejar.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/cookiejar.h b/examples/webenginewidgets/demobrowser/cookiejar.h index 00fb70009..3f8707955 100644 --- a/examples/webenginewidgets/demobrowser/cookiejar.h +++ b/examples/webenginewidgets/demobrowser/cookiejar.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/demobrowser.pro b/examples/webenginewidgets/demobrowser/demobrowser.pro index 113eeb40e..e295cd9dd 100644 --- a/examples/webenginewidgets/demobrowser/demobrowser.pro +++ b/examples/webenginewidgets/demobrowser/demobrowser.pro @@ -16,6 +16,7 @@ FORMS += \ history.ui \ passworddialog.ui \ proxy.ui \ + savepagedialog.ui \ settings.ui HEADERS += \ @@ -31,6 +32,7 @@ HEADERS += \ fullscreennotification.h \ history.h \ modelmenu.h \ + savepagedialog.h \ searchlineedit.h \ settings.h \ squeezelabel.h \ @@ -53,6 +55,7 @@ SOURCES += \ fullscreennotification.cpp \ history.cpp \ modelmenu.cpp \ + savepagedialog.cpp \ searchlineedit.cpp \ settings.cpp \ squeezelabel.cpp \ diff --git a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc index ba61dd79d..dfd7a7a3d 100644 --- a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc +++ b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -11,8 +11,8 @@ ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -20,7 +20,7 @@ ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/webenginewidgets/demobrowser/downloadmanager.cpp b/examples/webenginewidgets/demobrowser/downloadmanager.cpp index 8cfa66e38..33893c912 100644 --- a/examples/webenginewidgets/demobrowser/downloadmanager.cpp +++ b/examples/webenginewidgets/demobrowser/downloadmanager.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/downloadmanager.h b/examples/webenginewidgets/demobrowser/downloadmanager.h index 794f17aef..ea5a7e79d 100644 --- a/examples/webenginewidgets/demobrowser/downloadmanager.h +++ b/examples/webenginewidgets/demobrowser/downloadmanager.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/edittableview.cpp b/examples/webenginewidgets/demobrowser/edittableview.cpp index 8ab5327da..4d237ecd9 100644 --- a/examples/webenginewidgets/demobrowser/edittableview.cpp +++ b/examples/webenginewidgets/demobrowser/edittableview.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/edittableview.h b/examples/webenginewidgets/demobrowser/edittableview.h index 4d23b607d..1acee59f1 100644 --- a/examples/webenginewidgets/demobrowser/edittableview.h +++ b/examples/webenginewidgets/demobrowser/edittableview.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/edittreeview.cpp b/examples/webenginewidgets/demobrowser/edittreeview.cpp index 872191015..763fbec5c 100644 --- a/examples/webenginewidgets/demobrowser/edittreeview.cpp +++ b/examples/webenginewidgets/demobrowser/edittreeview.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/edittreeview.h b/examples/webenginewidgets/demobrowser/edittreeview.h index 5dbb8b5d1..f9dcd5e63 100644 --- a/examples/webenginewidgets/demobrowser/edittreeview.h +++ b/examples/webenginewidgets/demobrowser/edittreeview.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/featurepermissionbar.cpp b/examples/webenginewidgets/demobrowser/featurepermissionbar.cpp index 743542904..4cac05082 100644 --- a/examples/webenginewidgets/demobrowser/featurepermissionbar.cpp +++ b/examples/webenginewidgets/demobrowser/featurepermissionbar.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/featurepermissionbar.h b/examples/webenginewidgets/demobrowser/featurepermissionbar.h index eb5dbf876..63290df3b 100644 --- a/examples/webenginewidgets/demobrowser/featurepermissionbar.h +++ b/examples/webenginewidgets/demobrowser/featurepermissionbar.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/fullscreennotification.cpp b/examples/webenginewidgets/demobrowser/fullscreennotification.cpp index 7b9dcd1db..aadabbadb 100644 --- a/examples/webenginewidgets/demobrowser/fullscreennotification.cpp +++ b/examples/webenginewidgets/demobrowser/fullscreennotification.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/fullscreennotification.h b/examples/webenginewidgets/demobrowser/fullscreennotification.h index b0cba215b..260f8e72f 100644 --- a/examples/webenginewidgets/demobrowser/fullscreennotification.h +++ b/examples/webenginewidgets/demobrowser/fullscreennotification.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/history.cpp b/examples/webenginewidgets/demobrowser/history.cpp index 615582fe2..aaab44ac8 100644 --- a/examples/webenginewidgets/demobrowser/history.cpp +++ b/examples/webenginewidgets/demobrowser/history.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/history.h b/examples/webenginewidgets/demobrowser/history.h index d8d9e6abe..0ae5a7bf7 100644 --- a/examples/webenginewidgets/demobrowser/history.h +++ b/examples/webenginewidgets/demobrowser/history.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/main.cpp b/examples/webenginewidgets/demobrowser/main.cpp index 125d92dc2..4427a446d 100644 --- a/examples/webenginewidgets/demobrowser/main.cpp +++ b/examples/webenginewidgets/demobrowser/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/modelmenu.cpp b/examples/webenginewidgets/demobrowser/modelmenu.cpp index d3ba1e129..9064320f4 100644 --- a/examples/webenginewidgets/demobrowser/modelmenu.cpp +++ b/examples/webenginewidgets/demobrowser/modelmenu.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/modelmenu.h b/examples/webenginewidgets/demobrowser/modelmenu.h index a4b9e0eac..718b1d3cf 100644 --- a/examples/webenginewidgets/demobrowser/modelmenu.h +++ b/examples/webenginewidgets/demobrowser/modelmenu.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/savepagedialog.cpp b/examples/webenginewidgets/demobrowser/savepagedialog.cpp new file mode 100644 index 000000000..8ec21f821 --- /dev/null +++ b/examples/webenginewidgets/demobrowser/savepagedialog.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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$ +** +****************************************************************************/ + +#include "savepagedialog.h" +#include "ui_savepagedialog.h" + +#include <QtCore/QDir> +#include <QtWidgets/QFileDialog> + +const QWebEngineDownloadItem::SavePageFormat SavePageDialog::m_indexToFormatTable[] = { + QWebEngineDownloadItem::SingleHtmlSaveFormat, + QWebEngineDownloadItem::CompleteHtmlSaveFormat, + QWebEngineDownloadItem::MimeHtmlSaveFormat +}; + +SavePageDialog::SavePageDialog(QWidget *parent, QWebEngineDownloadItem::SavePageFormat format, + const QString &filePath) + : QDialog(parent) + , ui(new Ui::SavePageDialog) +{ + ui->setupUi(this); + ui->formatComboBox->setCurrentIndex(formatToIndex(format)); + setFilePath(filePath); +} + +SavePageDialog::~SavePageDialog() +{ + delete ui; +} + +QWebEngineDownloadItem::SavePageFormat SavePageDialog::pageFormat() const +{ + return indexToFormat(ui->formatComboBox->currentIndex()); +} + +QString SavePageDialog::filePath() const +{ + return QDir::fromNativeSeparators(ui->filePathLineEdit->text()); +} + +void SavePageDialog::on_chooseFilePathButton_clicked() +{ + QFileInfo fi(filePath()); + QFileDialog dlg(this, tr("Save Page As"), fi.absolutePath()); + dlg.setAcceptMode(QFileDialog::AcceptSave); + dlg.setDefaultSuffix(suffixOfFormat(pageFormat())); + dlg.selectFile(fi.absoluteFilePath()); + if (dlg.exec() != QDialog::Accepted) + return; + setFilePath(dlg.selectedFiles().first()); + ensureFileSuffix(pageFormat()); +} + +void SavePageDialog::on_formatComboBox_currentIndexChanged(int idx) +{ + ensureFileSuffix(indexToFormat(idx)); +} + +int SavePageDialog::formatToIndex(QWebEngineDownloadItem::SavePageFormat format) +{ + for (auto i : m_indexToFormatTable) { + if (m_indexToFormatTable[i] == format) + return i; + } + Q_UNREACHABLE(); +} + +QWebEngineDownloadItem::SavePageFormat SavePageDialog::indexToFormat(int idx) +{ + Q_ASSERT(idx >= 0 && size_t(idx) < (sizeof(m_indexToFormatTable) + / sizeof(QWebEngineDownloadItem::SavePageFormat))); + return m_indexToFormatTable[idx]; +} + +QString SavePageDialog::suffixOfFormat(QWebEngineDownloadItem::SavePageFormat format) +{ + if (format == QWebEngineDownloadItem::MimeHtmlSaveFormat) + return QStringLiteral(".mhtml"); + return QStringLiteral(".html"); +} + +void SavePageDialog::setFilePath(const QString &filePath) +{ + ui->filePathLineEdit->setText(QDir::toNativeSeparators(filePath)); +} + +void SavePageDialog::ensureFileSuffix(QWebEngineDownloadItem::SavePageFormat format) +{ + QFileInfo fi(filePath()); + setFilePath(fi.absolutePath() + QLatin1Char('/') + fi.completeBaseName() + + suffixOfFormat(format)); +} diff --git a/examples/webenginewidgets/demobrowser/savepagedialog.h b/examples/webenginewidgets/demobrowser/savepagedialog.h new file mode 100644 index 000000000..77095543c --- /dev/null +++ b/examples/webenginewidgets/demobrowser/savepagedialog.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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$ +** +****************************************************************************/ + +#ifndef SAVEPAGEDIALOG_H +#define SAVEPAGEDIALOG_H + +#include <QtWidgets/QDialog> +#include <QtWebEngineWidgets/QWebEngineDownloadItem> + +QT_BEGIN_NAMESPACE +namespace Ui { +class SavePageDialog; +} +QT_END_NAMESPACE + +class SavePageDialog : public QDialog +{ + Q_OBJECT + +public: + explicit SavePageDialog(QWidget *parent, QWebEngineDownloadItem::SavePageFormat format, + const QString &filePath); + ~SavePageDialog(); + + QWebEngineDownloadItem::SavePageFormat pageFormat() const; + QString filePath() const; + +private slots: + void on_chooseFilePathButton_clicked(); + void on_formatComboBox_currentIndexChanged(int idx); + +private: + static int formatToIndex(QWebEngineDownloadItem::SavePageFormat format); + static QWebEngineDownloadItem::SavePageFormat indexToFormat(int idx); + static QString suffixOfFormat(QWebEngineDownloadItem::SavePageFormat format); + void setFilePath(const QString &filePath); + void ensureFileSuffix(QWebEngineDownloadItem::SavePageFormat format); + + static const QWebEngineDownloadItem::SavePageFormat m_indexToFormatTable[]; + Ui::SavePageDialog *ui; +}; + +#endif // SAVEPAGEDIALOG_H diff --git a/examples/webenginewidgets/demobrowser/savepagedialog.ui b/examples/webenginewidgets/demobrowser/savepagedialog.ui new file mode 100644 index 000000000..9aa7cbe55 --- /dev/null +++ b/examples/webenginewidgets/demobrowser/savepagedialog.ui @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SavePageDialog</class> + <widget class="QDialog" name="SavePageDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>121</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>&Format:</string> + </property> + <property name="buddy"> + <cstring>formatComboBox</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="formatComboBox"> + <item> + <property name="text"> + <string>Single HTML</string> + </property> + </item> + <item> + <property name="text"> + <string>Complete HTML</string> + </property> + </item> + <item> + <property name="text"> + <string>MIME HTML</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>&Save to:</string> + </property> + <property name="buddy"> + <cstring>filePathLineEdit</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLineEdit" name="filePathLineEdit"/> + </item> + <item> + <widget class="QToolButton" name="chooseFilePathButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>12</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>formatComboBox</tabstop> + <tabstop>filePathLineEdit</tabstop> + <tabstop>chooseFilePathButton</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>SavePageDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>227</x> + <y>104</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>120</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>SavePageDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>295</x> + <y>110</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>120</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/examples/webenginewidgets/demobrowser/searchlineedit.cpp b/examples/webenginewidgets/demobrowser/searchlineedit.cpp index c322d2489..04f75df91 100644 --- a/examples/webenginewidgets/demobrowser/searchlineedit.cpp +++ b/examples/webenginewidgets/demobrowser/searchlineedit.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/searchlineedit.h b/examples/webenginewidgets/demobrowser/searchlineedit.h index 68d75aa66..9b9587082 100644 --- a/examples/webenginewidgets/demobrowser/searchlineedit.h +++ b/examples/webenginewidgets/demobrowser/searchlineedit.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/settings.cpp b/examples/webenginewidgets/demobrowser/settings.cpp index 9e9a7154c..aa3110ae7 100644 --- a/examples/webenginewidgets/demobrowser/settings.cpp +++ b/examples/webenginewidgets/demobrowser/settings.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -104,6 +114,13 @@ void SettingsDialog::loadDefaults() sessionCookiesCombo->setCurrentIndex(QWebEngineProfile::defaultProfile()->persistentCookiesPolicy()); httpUserAgent->setText(QWebEngineProfile::defaultProfile()->httpUserAgent()); httpAcceptLanguage->setText(defaultAcceptLanguage()); + + if (!defaultSettings->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)) + faviconDownloadMode->setCurrentIndex(0); + else if (!defaultSettings->testAttribute(QWebEngineSettings::TouchIconsEnabled)) + faviconDownloadMode->setCurrentIndex(1); + else + faviconDownloadMode->setCurrentIndex(2); } void SettingsDialog::loadFromSettings() @@ -154,6 +171,7 @@ void SettingsDialog::loadFromSettings() enableScrollAnimator->setChecked(settings.value(QLatin1String("enableScrollAnimator"), enableScrollAnimator->isChecked()).toBool()); httpUserAgent->setText(settings.value(QLatin1String("httpUserAgent"), httpUserAgent->text()).toString()); httpAcceptLanguage->setText(settings.value(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()).toString()); + faviconDownloadMode->setCurrentIndex(settings.value(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()).toInt()); settings.endGroup(); // Privacy @@ -213,6 +231,7 @@ void SettingsDialog::saveToSettings() settings.setValue(QLatin1String("userStyleSheet"), userStyleSheet->toPlainText()); settings.setValue(QLatin1String("httpUserAgent"), httpUserAgent->text()); settings.setValue(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()); + settings.setValue(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()); settings.endGroup(); //Privacy diff --git a/examples/webenginewidgets/demobrowser/settings.h b/examples/webenginewidgets/demobrowser/settings.h index 968f92cb9..ff5795609 100644 --- a/examples/webenginewidgets/demobrowser/settings.h +++ b/examples/webenginewidgets/demobrowser/settings.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/settings.ui b/examples/webenginewidgets/demobrowser/settings.ui index 38a7af344..c78a52dfe 100644 --- a/examples/webenginewidgets/demobrowser/settings.ui +++ b/examples/webenginewidgets/demobrowser/settings.ui @@ -27,13 +27,26 @@ <item row="1" column="0"> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>4</number> + <number>0</number> </property> <widget class="QWidget" name="tab"> <attribute name="title"> <string>General</string> </attribute> <layout class="QGridLayout" name="gridLayout_4"> + <item row="1" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>280</width> + <height>18</height> + </size> + </property> + </spacer> + </item> <item row="0" column="0"> <widget class="QLabel" name="label_3"> <property name="text"> @@ -47,36 +60,63 @@ <item row="0" column="1" colspan="2"> <widget class="QLineEdit" name="homeLineEdit"/> </item> - <item row="1" column="1"> - <widget class="QPushButton" name="setHomeToCurrentPageButton"> - <property name="text"> - <string>Set to current page</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <spacer name="horizontalSpacer"> + <item row="7" column="1" colspan="2"> + <spacer> <property name="orientation"> - <enum>Qt::Horizontal</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>280</width> - <height>18</height> + <width>391</width> + <height>262</height> </size> </property> </spacer> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_4"> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>Remove history items:</string> + <string>Save downloads to:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Open links from applications:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> + <item row="6" column="1" colspan="2"> + <widget class="QCheckBox" name="enableScrollAnimator"> + <property name="text"> + <string>Enable Scroll Animator</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="1" colspan="2"> + <widget class="QComboBox" name="openLinksIn"> + <item> + <property name="text"> + <string>In a tab in the current window</string> + </property> + </item> + <item> + <property name="text"> + <string>In a new window</string> + </property> + </item> + </widget> + </item> <item row="2" column="1" colspan="2"> <widget class="QComboBox" name="expireHistory"> <item> @@ -111,10 +151,10 @@ </item> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_7"> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Save downloads to:</string> + <string>Remove history items:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -124,53 +164,45 @@ <item row="3" column="1" colspan="2"> <widget class="QLineEdit" name="downloadsLocation"/> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_8"> + <item row="1" column="1"> + <widget class="QPushButton" name="setHomeToCurrentPageButton"> <property name="text"> - <string>Open links from applications:</string> + <string>Set to current page</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Favicon download mode:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="4" column="1" colspan="2"> - <widget class="QComboBox" name="openLinksIn"> + <item row="5" column="1" colspan="2"> + <widget class="QComboBox" name="faviconDownloadMode"> + <property name="currentIndex"> + <number>1</number> + </property> <item> <property name="text"> - <string>In a tab in the current window</string> + <string>Disable icons</string> </property> </item> <item> <property name="text"> - <string>In a new window</string> + <string>Enable favicons</string> + </property> + </item> + <item> + <property name="text"> + <string>Enable favicons and touch icons</string> </property> </item> </widget> </item> - <item row="5" column="1" colspan="2"> - <widget class="QCheckBox" name="enableScrollAnimator"> - <property name="text"> - <string>Enable Scroll Animator</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="6" column="1" colspan="2"> - <spacer> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>391</width> - <height>262</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="tab_3"> diff --git a/examples/webenginewidgets/demobrowser/squeezelabel.cpp b/examples/webenginewidgets/demobrowser/squeezelabel.cpp index 2d9061a80..9607bb784 100644 --- a/examples/webenginewidgets/demobrowser/squeezelabel.cpp +++ b/examples/webenginewidgets/demobrowser/squeezelabel.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/squeezelabel.h b/examples/webenginewidgets/demobrowser/squeezelabel.h index e29e9f958..8acd1fb6e 100644 --- a/examples/webenginewidgets/demobrowser/squeezelabel.h +++ b/examples/webenginewidgets/demobrowser/squeezelabel.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp index 3f859c386..3b56d115b 100644 --- a/examples/webenginewidgets/demobrowser/tabwidget.cpp +++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -45,6 +55,7 @@ #include "downloadmanager.h" #include "fullscreennotification.h" #include "history.h" +#include "savepagedialog.h" #include "urllineedit.h" #include "webview.h" @@ -125,6 +136,15 @@ void TabBar::contextMenuRequested(const QPoint &position) action = menu.addAction(tr("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh); action->setData(index); + + // Audio mute / unmute. + action = menu.addAction(tr("Mute tab"), + this, SLOT(muteTab())); + action->setData(index); + + action = menu.addAction(tr("Unmute tab"), + this, SLOT(unmuteTab())); + action->setData(index); } else { menu.addSeparator(); } @@ -218,6 +238,22 @@ void TabBar::reloadTab() } } +void TabBar::muteTab() +{ + if (QAction *action = qobject_cast<QAction*>(sender())) { + int index = action->data().toInt(); + emit muteTab(index, true); + } +} + +void TabBar::unmuteTab() +{ + if (QAction *action = qobject_cast<QAction*>(sender())) { + int index = action->data().toInt(); + emit muteTab(index, false); + } +} + TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent) , m_recentlyClosedTabsAction(0) @@ -243,6 +279,7 @@ TabWidget::TabWidget(QWidget *parent) connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(moveTab(int,int))); connect(m_tabBar, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(handleTabBarDoubleClicked(int))); + connect(m_tabBar, SIGNAL(muteTab(int,bool)), this, SLOT(setAudioMutedForTab(int,bool))); setTabBar(m_tabBar); setDocumentMode(true); @@ -308,6 +345,18 @@ void TabWidget::moveTab(int fromIndex, int toIndex) m_lineEdits->insertWidget(toIndex, lineEdit); } +void TabWidget::setAudioMutedForTab(int index, bool mute) +{ + if (index < 0) + index = currentIndex(); + if (index < 0 || index >= count()) + return; + + QWidget *widget = this->widget(index); + if (WebView *tab = qobject_cast<WebView*>(widget)) + tab->page()->setAudioMuted(mute); +} + void TabWidget::addWebAction(QAction *action, QWebEnginePage::WebAction webAction) { if (!action) @@ -551,10 +600,14 @@ WebView *TabWidget::newTab(bool makeCurrent) urlLineEdit->setWebView(webView); connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); - connect(webView, SIGNAL(iconChanged()), - this, SLOT(webViewIconChanged())); + connect(webView, SIGNAL(iconChanged(QIcon)), + this, SLOT(webViewIconChanged(QIcon))); connect(webView, SIGNAL(titleChanged(QString)), this, SLOT(webViewTitleChanged(QString))); + connect(webView->page(), SIGNAL(audioMutedChanged(bool)), + this, SLOT(webPageMutedOrAudibleChanged())); + connect(webView->page(), SIGNAL(recentlyAudibleChanged(bool)), + this, SLOT(webPageMutedOrAudibleChanged())); connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(webViewUrlChanged(QUrl))); @@ -686,14 +739,12 @@ void TabWidget::webViewLoadStarted() } } -void TabWidget::webViewIconChanged() +void TabWidget::webViewIconChanged(const QIcon &icon) { WebView *webView = qobject_cast<WebView*>(sender()); int index = webViewIndex(webView); - if (-1 != index) { - QIcon icon = webView->icon(); + if (-1 != index) setTabIcon(index, icon); - } } void TabWidget::webViewTitleChanged(const QString &title) @@ -708,6 +759,23 @@ void TabWidget::webViewTitleChanged(const QString &title) BrowserApplication::historyManager()->updateHistoryItem(webView->url(), title); } +void TabWidget::webPageMutedOrAudibleChanged() { + QWebEnginePage* webPage = qobject_cast<QWebEnginePage*>(sender()); + WebView *webView = qobject_cast<WebView*>(webPage->view()); + + int index = webViewIndex(webView); + if (-1 != index) { + QString title = webView->title(); + + bool muted = webPage->isAudioMuted(); + bool audible = webPage->recentlyAudible(); + if (muted) title += tr(" (muted)"); + else if (audible) title += tr(" (audible)"); + + setTabText(index, title); + } +} + void TabWidget::webViewUrlChanged(const QUrl &url) { WebView *webView = qobject_cast<WebView*>(sender()); @@ -852,6 +920,14 @@ bool TabWidget::restoreState(const QByteArray &state) void TabWidget::downloadRequested(QWebEngineDownloadItem *download) { + if (download->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat) { + SavePageDialog dlg(this, download->savePageFormat(), download->path()); + if (dlg.exec() != SavePageDialog::Accepted) + return; + download->setSavePageFormat(dlg.pageFormat()); + download->setPath(dlg.filePath()); + } + BrowserApplication::downloadManager()->download(download); download->accept(); } diff --git a/examples/webenginewidgets/demobrowser/tabwidget.h b/examples/webenginewidgets/demobrowser/tabwidget.h index cfe1b0397..77e7dde42 100644 --- a/examples/webenginewidgets/demobrowser/tabwidget.h +++ b/examples/webenginewidgets/demobrowser/tabwidget.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -64,6 +74,7 @@ signals: void closeTab(int index); void closeOtherTabs(int index); void reloadTab(int index); + void muteTab(int index, bool mute); void reloadAllTabs(); void tabMoveRequested(int fromIndex, int toIndex); @@ -80,6 +91,8 @@ private slots: void closeTab(); void closeOtherTabs(); void reloadTab(); + void muteTab(); + void unmuteTab(); void contextMenuRequested(const QPoint &position); private: @@ -206,6 +219,7 @@ public slots: void reloadAllTabs(); void nextTab(); void previousTab(); + void setAudioMutedForTab(int index, bool mute); private slots: void currentChanged(int index); @@ -213,7 +227,7 @@ private slots: void aboutToShowRecentTriggeredAction(QAction *action); void downloadRequested(QWebEngineDownloadItem *download); void webViewLoadStarted(); - void webViewIconChanged(); + void webViewIconChanged(const QIcon &icon); void webViewTitleChanged(const QString &title); void webViewUrlChanged(const QUrl &url); void lineEditReturnPressed(); @@ -221,6 +235,7 @@ private slots: void moveTab(int fromIndex, int toIndex); void fullScreenRequested(QWebEngineFullScreenRequest request); void handleTabBarDoubleClicked(int index); + void webPageMutedOrAudibleChanged(); private: void setupPage(QWebEnginePage* page); diff --git a/examples/webenginewidgets/demobrowser/toolbarsearch.cpp b/examples/webenginewidgets/demobrowser/toolbarsearch.cpp index 37ba14ec0..41c5ef314 100644 --- a/examples/webenginewidgets/demobrowser/toolbarsearch.cpp +++ b/examples/webenginewidgets/demobrowser/toolbarsearch.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/toolbarsearch.h b/examples/webenginewidgets/demobrowser/toolbarsearch.h index 078deac49..d3e914055 100644 --- a/examples/webenginewidgets/demobrowser/toolbarsearch.h +++ b/examples/webenginewidgets/demobrowser/toolbarsearch.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/urllineedit.cpp b/examples/webenginewidgets/demobrowser/urllineedit.cpp index a8b41b963..8203e4f0f 100644 --- a/examples/webenginewidgets/demobrowser/urllineedit.cpp +++ b/examples/webenginewidgets/demobrowser/urllineedit.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -271,8 +281,8 @@ void UrlLineEdit::setWebView(WebView *webView) m_iconLabel->m_webView = webView; connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(webViewUrlChanged(QUrl))); - connect(webView, SIGNAL(iconChanged()), - this, SLOT(webViewIconChanged())); + connect(webView, SIGNAL(iconChanged(QIcon)), + this, SLOT(webViewIconChanged(QIcon))); connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update())); } @@ -283,11 +293,10 @@ void UrlLineEdit::webViewUrlChanged(const QUrl &url) m_lineEdit->setCursorPosition(0); } -void UrlLineEdit::webViewIconChanged() +void UrlLineEdit::webViewIconChanged(const QIcon &icon) { Q_ASSERT(m_webView); - QPixmap pixmap = m_webView->icon().pixmap(16, 16); - m_iconLabel->setPixmap(pixmap); + m_iconLabel->setPixmap(icon.pixmap(16, 16)); } QLinearGradient UrlLineEdit::generateGradient(const QColor &color) const diff --git a/examples/webenginewidgets/demobrowser/urllineedit.h b/examples/webenginewidgets/demobrowser/urllineedit.h index 06efcd528..51c5c0836 100644 --- a/examples/webenginewidgets/demobrowser/urllineedit.h +++ b/examples/webenginewidgets/demobrowser/urllineedit.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -99,7 +109,7 @@ protected: private slots: void webViewUrlChanged(const QUrl &url); - void webViewIconChanged(); + void webViewIconChanged(const QIcon &icon); private: QLinearGradient generateGradient(const QColor &color) const; diff --git a/examples/webenginewidgets/demobrowser/webview.cpp b/examples/webenginewidgets/demobrowser/webview.cpp index 94e872dbf..633b72bf1 100644 --- a/examples/webenginewidgets/demobrowser/webview.cpp +++ b/examples/webenginewidgets/demobrowser/webview.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -55,9 +65,7 @@ #include <QtWidgets/QMessageBox> #include <QtGui/QMouseEvent> -#if defined(QWEBENGINEPAGE_HITTESTCONTENT) -#include <QWebEngineHitTestResult> -#endif +#include <QWebEngineContextMenuData> #ifndef QT_NO_UITOOLS #include <QtUiTools/QUiLoader> @@ -165,6 +173,8 @@ QWebEnginePage *WebPage::createWindow(QWebEnginePage::WebWindowType type) { if (type == QWebEnginePage::WebBrowserTab) { return mainWindow()->tabWidget()->newTab()->page(); + } else if (type == QWebEnginePage::WebBrowserBackgroundTab) { + return mainWindow()->tabWidget()->newTab(false)->page(); } else if (type == QWebEnginePage::WebBrowserWindow) { BrowserApplication::instance()->newMainWindow(); BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); @@ -261,11 +271,8 @@ void WebPage::authenticationRequired(const QUrl &requestUrl, QAuthenticator *aut passwordDialog.introLabel->setWordWrap(true); if (dialog.exec() == QDialog::Accepted) { - QByteArray key = BrowserApplication::authenticationKey(requestUrl, auth->realm()); auth->setUser(passwordDialog.userNameLineEdit->text()); auth->setPassword(passwordDialog.passwordLineEdit->text()); - auth->setOption("key", key); - BrowserApplication::instance()->setLastAuthenticator(auth); } else { // Set authenticator null if dialog is cancelled *auth = QAuthenticator(); @@ -292,12 +299,8 @@ void WebPage::proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator proxyDialog.introLabel->setWordWrap(true); if (dialog.exec() == QDialog::Accepted) { - QString user = proxyDialog.userNameLineEdit->text(); - QByteArray key = BrowserApplication::proxyAuthenticationKey(user, proxyHost, auth->realm()); - auth->setUser(user); + auth->setUser(proxyDialog.userNameLineEdit->text()); auth->setPassword(proxyDialog.passwordLineEdit->text()); - auth->setOption("key", key); - BrowserApplication::instance()->setLastProxyAuthenticator(auth); } else { // Set authenticator null if dialog is cancelled *auth = QAuthenticator(); @@ -308,7 +311,6 @@ WebView::WebView(QWidget* parent) : QWebEngineView(parent) , m_progress(0) , m_page(0) - , m_iconReply(0) { connect(this, SIGNAL(loadProgress(int)), this, SLOT(setProgress(int))); @@ -347,8 +349,10 @@ void WebView::setPage(WebPage *_page) connect(page(), SIGNAL(statusBarMessage(QString)), SLOT(setStatusBarText(QString))); #endif - connect(page(), SIGNAL(iconUrlChanged(QUrl)), - this, SLOT(onIconUrlChanged(QUrl))); + connect(page(), SIGNAL(loadingUrl(QUrl)), + this, SIGNAL(urlChanged(QUrl))); + connect(page(), SIGNAL(iconChanged(QIcon)), + this, SLOT(onIconChanged(QIcon))); connect(page(), &WebPage::featurePermissionRequested, this, &WebView::onFeaturePermissionRequested); #if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) page()->setForwardUnsupportedContent(true); @@ -357,16 +361,20 @@ void WebView::setPage(WebPage *_page) void WebView::contextMenuEvent(QContextMenuEvent *event) { - QMenu *menu = page()->createStandardContextMenu(); - const QList<QAction*> actions = menu->actions(); - QList<QAction*>::const_iterator it = qFind(actions.cbegin(), actions.cend(), page()->action(QWebEnginePage::OpenLinkInThisWindow)); - if (it != actions.cend()) { - (*it)->setText(tr("Open Link in This Window")); - ++it; - QAction *before(it == actions.cend() ? nullptr : *it); - menu->insertAction(before, page()->action(QWebEnginePage::OpenLinkInNewWindow)); - menu->insertAction(before, page()->action(QWebEnginePage::OpenLinkInNewTab)); + QMenu *menu; + if (page()->contextMenuData().linkUrl().isValid()) { + menu = new QMenu(this); + menu->addAction(page()->action(QWebEnginePage::OpenLinkInThisWindow)); + menu->addAction(page()->action(QWebEnginePage::OpenLinkInNewWindow)); + menu->addAction(page()->action(QWebEnginePage::OpenLinkInNewBackgroundTab)); + menu->addSeparator(); + menu->addAction(page()->action(QWebEnginePage::DownloadLinkToDisk)); + menu->addAction(page()->action(QWebEnginePage::CopyLinkToClipboard)); + } else { + menu = page()->createStandardContextMenu(); } + if (page()->contextMenuData().selectedText().isEmpty()) + menu->addAction(page()->action(QWebEnginePage::SavePage)); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); menu->popup(event->globalPos()); } @@ -435,33 +443,12 @@ QUrl WebView::url() const return m_initialUrl; } -QIcon WebView::icon() const -{ - if (!m_icon.isNull()) - return m_icon; - return BrowserApplication::instance()->defaultIcon(); -} - -void WebView::onIconUrlChanged(const QUrl &url) +void WebView::onIconChanged(const QIcon &icon) { - QNetworkRequest iconRequest(url); - m_iconReply = BrowserApplication::networkAccessManager()->get(iconRequest); - m_iconReply->setParent(this); - connect(m_iconReply, SIGNAL(finished()), this, SLOT(iconLoaded())); -} - -void WebView::iconLoaded() -{ - m_icon = QIcon(); - if (m_iconReply) { - QByteArray data = m_iconReply->readAll(); - QPixmap pixmap; - pixmap.loadFromData(data); - m_icon.addPixmap(pixmap); - m_iconReply->deleteLater(); - m_iconReply = 0; - } - emit iconChanged(); + if (icon.isNull()) + emit iconChanged(BrowserApplication::instance()->defaultIcon()); + else + emit iconChanged(icon); } void WebView::mousePressEvent(QMouseEvent *event) diff --git a/examples/webenginewidgets/demobrowser/webview.h b/examples/webenginewidgets/demobrowser/webview.h index c506ec8b9..e3df8f795 100644 --- a/examples/webenginewidgets/demobrowser/webview.h +++ b/examples/webenginewidgets/demobrowser/webview.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 @@ -91,7 +101,6 @@ public: void loadUrl(const QUrl &url); QUrl url() const; - QIcon icon() const; QString lastStatusBarText() const; inline int progress() const { return m_progress; } @@ -103,7 +112,7 @@ protected: void wheelEvent(QWheelEvent *event); signals: - void iconChanged(); + void iconChanged(const QIcon &icon); private slots: void setProgress(int progress); @@ -111,16 +120,13 @@ private slots: void setStatusBarText(const QString &string); void openLinkInNewTab(); void onFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature); - void onIconUrlChanged(const QUrl &url); - void iconLoaded(); + void onIconChanged(const QIcon &icon); private: QString m_statusBarText; QUrl m_initialUrl; int m_progress; WebPage *m_page; - QIcon m_icon; - QNetworkReply *m_iconReply; }; #endif diff --git a/examples/webenginewidgets/demobrowser/xbel.cpp b/examples/webenginewidgets/demobrowser/xbel.cpp index fa7beffde..d66c44faa 100644 --- a/examples/webenginewidgets/demobrowser/xbel.cpp +++ b/examples/webenginewidgets/demobrowser/xbel.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 diff --git a/examples/webenginewidgets/demobrowser/xbel.h b/examples/webenginewidgets/demobrowser/xbel.h index b0a931431..89f5e259f 100644 --- a/examples/webenginewidgets/demobrowser/xbel.h +++ b/examples/webenginewidgets/demobrowser/xbel.h @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 |