summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets/browser/featurepermissionbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webenginewidgets/browser/featurepermissionbar.cpp')
-rw-r--r--examples/webenginewidgets/browser/featurepermissionbar.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/examples/webenginewidgets/browser/featurepermissionbar.cpp b/examples/webenginewidgets/browser/featurepermissionbar.cpp
index 98f19ad1f..b7275dfc2 100644
--- a/examples/webenginewidgets/browser/featurepermissionbar.cpp
+++ b/examples/webenginewidgets/browser/featurepermissionbar.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
@@ -10,27 +10,27 @@
** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** 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.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
+** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
+** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
@@ -53,15 +53,17 @@ static QString textForPermissionType(QWebEnginePage::Feature type)
{
switch (type) {
case QWebEnginePage::Notifications:
- return QObject::tr("desktop notifications");
+ return QObject::tr("use desktop notifications");
case QWebEnginePage::Geolocation:
- return QObject::tr("your position");
+ return QObject::tr("use your position");
case QWebEnginePage::MediaAudioCapture:
- return QObject::tr("your microphone");
+ return QObject::tr("use your microphone");
case QWebEnginePage::MediaVideoCapture:
- return QObject::tr("your camera");
+ return QObject::tr("use your camera");
case QWebEnginePage::MediaAudioVideoCapture:
- return QObject::tr("your camera and microphone");
+ return QObject::tr("use your camera and microphone");
+ case QWebEnginePage::MouseLock:
+ return QObject::tr("lock your mouse");
default:
Q_UNREACHABLE();
}
@@ -80,12 +82,13 @@ FeaturePermissionBar::FeaturePermissionBar(QWidget *view)
l->addStretch();
QPushButton *allowButton = new QPushButton(tr("Allow"), this);
QPushButton *denyButton = new QPushButton(tr("Deny"), this);
+ QPushButton *discardButton = new QPushButton(QIcon(QStringLiteral(":closetab.png")), QString(), this);
connect(allowButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionGranted);
connect(denyButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionDenied);
- QPushButton *discardButton = new QPushButton(QIcon(QStringLiteral(":closetab.png")), QString(), this);
- connect(discardButton, &QPushButton::clicked, this, &QObject::deleteLater);
+ connect(discardButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionUnknown);
connect(allowButton, &QPushButton::clicked, this, &QObject::deleteLater);
connect(denyButton, &QPushButton::clicked, this, &QObject::deleteLater);
+ connect(discardButton, &QPushButton::clicked, this, &QObject::deleteLater);
l->addWidget(denyButton);
l->addWidget(allowButton);
l->addWidget(discardButton);
@@ -96,7 +99,7 @@ void FeaturePermissionBar::requestPermission(const QUrl &securityOrigin, QWebEng
{
m_securityOrigin = securityOrigin;
m_feature = feature;
- m_messageLabel->setText(tr("%1 wants to use %2.").arg(securityOrigin.host()).arg(textForPermissionType(feature)));
+ m_messageLabel->setText(tr("%1 wants to %2.").arg(securityOrigin.host()).arg(textForPermissionType(feature)));
show();
// Ease in
QPropertyAnimation *animation = new QPropertyAnimation(this);
@@ -118,3 +121,8 @@ void FeaturePermissionBar::permissionGranted()
{
emit featurePermissionProvided(m_securityOrigin, m_feature, QWebEnginePage::PermissionGrantedByUser);
}
+
+void FeaturePermissionBar::permissionUnknown()
+{
+ emit featurePermissionProvided(m_securityOrigin, m_feature, QWebEnginePage::PermissionUnknown);
+}