Falkon Develop
Cross-platform Qt-based web browser
sbi_icon.cpp
Go to the documentation of this file.
1/* ============================================================
2* StatusBarIcons - Extra icons in statusbar for Falkon
3* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#include "sbi_icon.h"
19#include "browserwindow.h"
20#include "tabbedwebview.h"
21#include "webpage.h"
22
23SBI_Icon::SBI_Icon(BrowserWindow* window, const QString &settingsPath)
24 : ClickableLabel(window)
25 , m_window(window)
26 , m_settingsFile(settingsPath + QL1S("/extensions.ini"))
27{
28}
29
30bool SBI_Icon::testCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr) const
31{
32 return currentPageSettings() && currentPageSettings()->testAttribute(attr);
33}
34
35void SBI_Icon::setCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr, bool value)
36{
37 if (currentPageSettings()) {
38 currentPageSettings()->setAttribute(attr, value);
39 }
40}
41
42QWebEngineSettings* SBI_Icon::currentPageSettings() const
43{
44 if (!m_window->weView()) {
45 return nullptr;
46 }
47
48 return m_window->weView()->page()->settings();
49}
50
52{
53 if (!m_window->weView()) {
54 return nullptr;
55 }
56
57 return m_window->weView()->page();
58}
59
TabbedWebView * weView() const
SBI_Icon(BrowserWindow *window, const QString &settingsPath=QString())
Definition: sbi_icon.cpp:23
QWebEngineSettings * currentPageSettings() const
Definition: sbi_icon.cpp:42
BrowserWindow * m_window
Definition: sbi_icon.h:42
void setCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr, bool value)
Definition: sbi_icon.cpp:35
WebPage * currentPage() const
Definition: sbi_icon.cpp:51
bool testCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr) const
Definition: sbi_icon.cpp:30
WebPage * page() const
Definition: webview.cpp:132
int value(const QColor &c)
Definition: colors.cpp:238
#define QL1S(x)
Definition: qzcommon.h:44