File indexing completed on 2024-05-19 04:59:18
0001 /* ============================================================ 0002 * StatusBarIcons - Extra icons in statusbar for Falkon 0003 * Copyright (C) 2014 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #include "sbi_icon.h" 0019 #include "browserwindow.h" 0020 #include "tabbedwebview.h" 0021 #include "webpage.h" 0022 0023 SBI_Icon::SBI_Icon(BrowserWindow* window, const QString &settingsPath) 0024 : ClickableLabel(window) 0025 , m_window(window) 0026 , m_settingsFile(settingsPath + QL1S("/extensions.ini")) 0027 { 0028 } 0029 0030 bool SBI_Icon::testCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr) const 0031 { 0032 return currentPageSettings() && currentPageSettings()->testAttribute(attr); 0033 } 0034 0035 void SBI_Icon::setCurrentPageWebAttribute(QWebEngineSettings::WebAttribute attr, bool value) 0036 { 0037 if (currentPageSettings()) { 0038 currentPageSettings()->setAttribute(attr, value); 0039 } 0040 } 0041 0042 QWebEngineSettings* SBI_Icon::currentPageSettings() const 0043 { 0044 if (!m_window->weView()) { 0045 return nullptr; 0046 } 0047 0048 return m_window->weView()->page()->settings(); 0049 } 0050 0051 WebPage* SBI_Icon::currentPage() const 0052 { 0053 if (!m_window->weView()) { 0054 return nullptr; 0055 } 0056 0057 return m_window->weView()->page(); 0058 } 0059