mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
WebTab: Show notifications over webview
Mouse grab permission workaround now can be removed as the notification (and mouse cursor) is inside webview
This commit is contained in:
parent
5cc7dd080e
commit
eeef5da06c
|
@ -1,6 +1,6 @@
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - Qt web browser
|
||||||
* Copyright (C) 2013-2015 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2013-2017 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -87,15 +87,7 @@ void HTML5PermissionsNotification::grantPermissions()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [this]() {
|
m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);
|
||||||
// We need to have cursor inside view to correctly grab mouse
|
|
||||||
if (m_feature == QWebEnginePage::MouseLock) {
|
|
||||||
QWidget *view = m_page->view();
|
|
||||||
QCursor::setPos(view->mapToGlobal(view->rect().center()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (ui->remember->isChecked()) {
|
if (ui->remember->isChecked()) {
|
||||||
mApp->html5PermissionsManager()->rememberPermissions(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);
|
mApp->html5PermissionsManager()->rememberPermissions(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - Qt web browser
|
||||||
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -385,14 +385,14 @@ void WebTab::p_restoreTab(const WebTab::SavedTab &tab)
|
||||||
|
|
||||||
void WebTab::showNotification(QWidget* notif)
|
void WebTab::showNotification(QWidget* notif)
|
||||||
{
|
{
|
||||||
const int notifPos = 0;
|
if (m_notification) {
|
||||||
|
delete m_notification;
|
||||||
if (m_layout->count() > notifPos + 1) {
|
|
||||||
delete m_layout->itemAt(notifPos)->widget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_layout->insertWidget(notifPos, notif);
|
m_notification = notif;
|
||||||
notif->show();
|
m_notification->setParent(this);
|
||||||
|
m_notification->setFixedWidth(width());;
|
||||||
|
m_notification->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebTab::loadStarted()
|
void WebTab::loadStarted()
|
||||||
|
@ -445,6 +445,15 @@ void WebTab::showEvent(QShowEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebTab::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
|
||||||
|
if (m_notification) {
|
||||||
|
m_notification->setFixedWidth(width());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool WebTab::isCurrentTab() const
|
bool WebTab::isCurrentTab() const
|
||||||
{
|
{
|
||||||
return m_tabBar && tabIndex() == m_tabBar->currentIndex();
|
return m_tabBar && tabIndex() == m_tabBar->currentIndex();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - Qt web browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showEvent(QShowEvent* event);
|
void showEvent(QShowEvent* event);
|
||||||
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
BrowserWindow* m_window;
|
BrowserWindow* m_window;
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
|
@ -121,6 +123,7 @@ private:
|
||||||
LocationBar* m_locationBar;
|
LocationBar* m_locationBar;
|
||||||
TabIcon* m_tabIcon;
|
TabIcon* m_tabIcon;
|
||||||
TabBar* m_tabBar;
|
TabBar* m_tabBar;
|
||||||
|
QPointer<QWidget> m_notification;
|
||||||
|
|
||||||
SavedTab m_savedTab;
|
SavedTab m_savedTab;
|
||||||
bool m_isPinned;
|
bool m_isPinned;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user