1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Small cleanup in code (classes holding settings as static variables)

- merged LocationBarSettings and WebSettings into one class
- new class QzSettings no longer uses static variables
This commit is contained in:
nowrep 2012-08-10 21:16:43 +02:00
parent 1f225de11c
commit e709e17d5c
20 changed files with 103 additions and 158 deletions

View File

@ -44,8 +44,7 @@
#include "speeddial.h" #include "speeddial.h"
#include "webpage.h" #include "webpage.h"
#include "settings.h" #include "settings.h"
#include "locationbarsettings.h" #include "qzsettings.h"
#include "websettings.h"
#include "clearprivatedata.h" #include "clearprivatedata.h"
#include "commandlineoptions.h" #include "commandlineoptions.h"
@ -373,8 +372,7 @@ void MainApplication::loadSettings()
m_downloadManager->loadSettings(); m_downloadManager->loadSettings();
} }
LocationBarSettings::loadSettings(); qzSettings->loadSettings();
WebSettings::loadSettings();
} }
void MainApplication::reloadSettings() void MainApplication::reloadSettings()

View File

@ -16,10 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "settings.h" #include "settings.h"
#include "qzsettings.h"
#include <QSettings> #include <QSettings>
QSettings* Settings::s_settings = 0; QSettings* Settings::s_settings = 0;
QzSettings* Settings::s_qzSettings = 0;
Settings::Settings() Settings::Settings()
{ {
@ -32,6 +34,7 @@ Settings::Settings()
void Settings::createSettings(const QString &fileName) void Settings::createSettings(const QString &fileName)
{ {
s_settings = new QSettings(fileName, QSettings::IniFormat); s_settings = new QSettings(fileName, QSettings::IniFormat);
s_qzSettings = new QzSettings();
} }
void Settings::syncSettings() void Settings::syncSettings()
@ -64,6 +67,11 @@ QSettings* Settings::globalSettings()
return s_settings; return s_settings;
} }
QzSettings *Settings::staticSettings()
{
return s_qzSettings;
}
Settings::~Settings() Settings::~Settings()
{ {
if (!s_settings->group().isEmpty()) { if (!s_settings->group().isEmpty()) {

View File

@ -25,7 +25,9 @@
class QSettings; class QSettings;
class Settings class QzSettings;
class QT_QUPZILLA_EXPORT Settings
{ {
public: public:
explicit Settings(); explicit Settings();
@ -35,6 +37,7 @@ public:
static void syncSettings(); static void syncSettings();
static QSettings* globalSettings(); static QSettings* globalSettings();
static QzSettings* staticSettings();
void setValue(const QString &key, const QVariant &defaultValue = QVariant()); void setValue(const QString &key, const QVariant &defaultValue = QVariant());
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()); QVariant value(const QString &key, const QVariant &defaultValue = QVariant());
@ -48,6 +51,7 @@ public slots:
private: private:
static QSettings* s_settings; static QSettings* s_settings;
static QzSettings* s_qzSettings;
}; };

View File

@ -29,7 +29,7 @@
#include "bookmarksimportdialog.h" #include "bookmarksimportdialog.h"
#include "iconchooser.h" #include "iconchooser.h"
#include "webtab.h" #include "webtab.h"
#include "websettings.h" #include "qzsettings.h"
#include <QInputDialog> #include <QInputDialog>
#include <QComboBox> #include <QComboBox>
@ -194,7 +194,7 @@ void BookmarksManager::itemControlClicked(QTreeWidgetItem* item)
void BookmarksManager::loadInNewTab() void BookmarksManager::loadInNewTab()
{ {
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
getQupZilla()->tabWidget()->addView(action->data().toUrl(), WebSettings::newTabPosition); getQupZilla()->tabWidget()->addView(action->data().toUrl(), qzSettings->newTabPosition);
} }
} }

View File

@ -25,7 +25,7 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "historymodel.h" #include "historymodel.h"
#include "headerview.h" #include "headerview.h"
#include "websettings.h" #include "qzsettings.h"
#include <QMessageBox> #include <QMessageBox>
@ -90,7 +90,7 @@ void HistoryManager::search(const QString &searchText)
void HistoryManager::openLink(const QUrl &url, HistoryView::OpenBehavior openIn) void HistoryManager::openLink(const QUrl &url, HistoryView::OpenBehavior openIn)
{ {
if (openIn == HistoryView::OpenInNewTab) { if (openIn == HistoryView::OpenInNewTab) {
getQupZilla()->tabWidget()->addView(url, WebSettings::newTabPosition); getQupZilla()->tabWidget()->addView(url, qzSettings->newTabPosition);
} }
else { else {
getQupZilla()->weView()->load(url); getQupZilla()->weView()->load(url);

View File

@ -110,7 +110,6 @@ SOURCES += \
3rdparty/squeezelabelv2.cpp \ 3rdparty/squeezelabelv2.cpp \
3rdparty/squeezelabelv1.cpp \ 3rdparty/squeezelabelv1.cpp \
tools/buttonwithmenu.cpp \ tools/buttonwithmenu.cpp \
navigation/locationbarsettings.cpp \
other/browsinglibrary.cpp \ other/browsinglibrary.cpp \
3rdparty/stylehelper.cpp \ 3rdparty/stylehelper.cpp \
3rdparty/fancytabwidget.cpp \ 3rdparty/fancytabwidget.cpp \
@ -164,7 +163,6 @@ SOURCES += \
bookmarksimport/bookmarksimporticonfetcher.cpp \ bookmarksimport/bookmarksimporticonfetcher.cpp \
other/checkboxdialog.cpp \ other/checkboxdialog.cpp \
tools/plaineditwithlines.cpp \ tools/plaineditwithlines.cpp \
webview/websettings.cpp \
tools/focusselectlineedit.cpp \ tools/focusselectlineedit.cpp \
navigation/completer/locationcompleterdelegate.cpp \ navigation/completer/locationcompleterdelegate.cpp \
navigation/completer/locationcompleter.cpp \ navigation/completer/locationcompleter.cpp \
@ -181,7 +179,8 @@ SOURCES += \
adblock/adblockschemehandler.cpp \ adblock/adblockschemehandler.cpp \
tools/emptynetworkreply.cpp \ tools/emptynetworkreply.cpp \
3rdparty/processinfo.cpp \ 3rdparty/processinfo.cpp \
preferences/pluginsmanager.cpp preferences/pluginsmanager.cpp \
other/qzsettings.cpp
HEADERS += \ HEADERS += \
webview/tabpreview.h \ webview/tabpreview.h \
@ -259,7 +258,6 @@ HEADERS += \
3rdparty/squeezelabelv2.h \ 3rdparty/squeezelabelv2.h \
3rdparty/squeezelabelv1.h \ 3rdparty/squeezelabelv1.h \
tools/buttonwithmenu.h \ tools/buttonwithmenu.h \
navigation/locationbarsettings.h \
other/browsinglibrary.h \ other/browsinglibrary.h \
3rdparty/stylehelper.h \ 3rdparty/stylehelper.h \
3rdparty/fancytabwidget.h \ 3rdparty/fancytabwidget.h \
@ -317,7 +315,6 @@ HEADERS += \
network/schemehandler.h \ network/schemehandler.h \
tools/plaineditwithlines.h \ tools/plaineditwithlines.h \
sidebar/sidebarinterface.h \ sidebar/sidebarinterface.h \
webview/websettings.h \
tools/focusselectlineedit.h \ tools/focusselectlineedit.h \
navigation/completer/locationcompleterdelegate.h \ navigation/completer/locationcompleterdelegate.h \
navigation/completer/locationcompleter.h \ navigation/completer/locationcompleter.h \
@ -334,7 +331,8 @@ HEADERS += \
adblock/adblockschemehandler.h \ adblock/adblockschemehandler.h \
tools/emptynetworkreply.h \ tools/emptynetworkreply.h \
3rdparty/processinfo.h \ 3rdparty/processinfo.h \
preferences/pluginsmanager.h preferences/pluginsmanager.h \
other/qzsettings.h
FORMS += \ FORMS += \
preferences/autofillmanager.ui \ preferences/autofillmanager.ui \

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "locationcompletermodel.h" #include "locationcompletermodel.h"
#include "locationbarsettings.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "qzsettings.h"
#include "mainapplication.h" #include "mainapplication.h"
#include <QSqlQuery> #include <QSqlQuery>
@ -43,7 +43,7 @@ void LocationCompleterModel::refreshCompletions(const QString &string)
clear(); clear();
Type showType = (Type) LocationBarSettings::showLocationSuggestions; Type showType = (Type) qzSettings->showLocationSuggestions;
int limit = string.size() < 3 ? 25 : 15; int limit = string.size() < 3 ? 25 : 15;
QString searchString = QString("%%1%").arg(string); QString searchString = QString("%%1%").arg(string);

View File

@ -28,7 +28,6 @@
#include "bookmarkicon.h" #include "bookmarkicon.h"
#include "progressbar.h" #include "progressbar.h"
#include "statusbarmessage.h" #include "statusbarmessage.h"
#include "locationbarsettings.h"
#include "toolbutton.h" #include "toolbutton.h"
#include "searchenginesmanager.h" #include "searchenginesmanager.h"
#include "siteicon.h" #include "siteicon.h"
@ -37,7 +36,7 @@
#include "downicon.h" #include "downicon.h"
#include "globalfunctions.h" #include "globalfunctions.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "websettings.h" #include "qzsettings.h"
#include <QClipboard> #include <QClipboard>
@ -376,7 +375,7 @@ void LocationBar::focusOutEvent(QFocusEvent* e)
void LocationBar::mouseDoubleClickEvent(QMouseEvent* event) void LocationBar::mouseDoubleClickEvent(QMouseEvent* event)
{ {
if (event->button() == Qt::LeftButton && LocationBarSettings::selectAllOnDoubleClick) { if (event->button() == Qt::LeftButton && qzSettings->selectAllOnDoubleClick) {
selectAll(); selectAll();
} }
else { else {
@ -386,7 +385,7 @@ void LocationBar::mouseDoubleClickEvent(QMouseEvent* event)
void LocationBar::mousePressEvent(QMouseEvent* event) void LocationBar::mousePressEvent(QMouseEvent* event)
{ {
if (cursorPosition() == 0 && LocationBarSettings::selectAllOnClick) { if (cursorPosition() == 0 && qzSettings->selectAllOnClick) {
selectAll(); selectAll();
return; return;
} }
@ -429,7 +428,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
break; break;
case Qt::AltModifier: case Qt::AltModifier:
p_QupZilla->tabWidget()->addView(createUrl(), WebSettings::newTabPosition); p_QupZilla->tabWidget()->addView(createUrl(), qzSettings->newTabPosition);
m_holdingAlt = false; m_holdingAlt = false;
break; break;
@ -468,7 +467,7 @@ void LocationBar::keyReleaseEvent(QKeyEvent* event)
{ {
QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country"); QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country");
if (event->key() == Qt::Key_Alt && m_holdingAlt && LocationBarSettings::addCountryWithAlt && if (event->key() == Qt::Key_Alt && m_holdingAlt && qzSettings->addCountryWithAlt &&
!text().endsWith(localDomain) && !text().endsWith("/")) { !text().endsWith(localDomain) && !text().endsWith("/")) {
LineEdit::setText(text().append(localDomain)); LineEdit::setText(text().append(localDomain));
} }

View File

@ -1,47 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "locationbarsettings.h"
#include "mainapplication.h"
#include "settings.h"
bool LocationBarSettings::selectAllOnDoubleClick = false;
bool LocationBarSettings::selectAllOnClick = false;
bool LocationBarSettings::addCountryWithAlt = false;
int LocationBarSettings::showLocationSuggestions = 0;
bool LocationBarSettings::showSearchSuggestions = false;
LocationBarSettings::LocationBarSettings()
{
loadSettings();
}
void LocationBarSettings::loadSettings()
{
Settings settings;
settings.beginGroup("AddressBar");
selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick", true).toBool();
selectAllOnClick = settings.value("SelectAllTextOnClick", false).toBool();
addCountryWithAlt = settings.value("AddCountryDomainWithAltKey", true).toBool();
showLocationSuggestions = settings.value("showSuggestions", 0).toInt();
settings.endGroup();
settings.beginGroup("SearchEngines");
showSearchSuggestions = settings.value("showSuggestions", true).toBool();
settings.endGroup();
}

View File

@ -1,37 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef LOCATIONBARSETTINGS_H
#define LOCATIONBARSETTINGS_H
#include "qz_namespace.h"
class QT_QUPZILLA_EXPORT LocationBarSettings
{
public:
LocationBarSettings();
static void loadSettings();
static bool selectAllOnDoubleClick;
static bool selectAllOnClick;
static bool addCountryWithAlt;
static int showLocationSuggestions;
static bool showSearchSuggestions;
};
#endif // LOCATIONBARSETTINGS_H

View File

@ -27,7 +27,7 @@
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
#include "websettings.h" #include "qzsettings.h"
#include <QSplitter> #include <QSplitter>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -297,7 +297,7 @@ void NavigationBar::goAtHistoryIndexInNewTab(int index)
QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history(); QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history();
history->goToItem(history->itemAt(index)); history->goToItem(history->itemAt(index));
if (WebSettings::newTabPosition == Qz::NT_SelectedTab) { if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {
tabWidget->setCurrentIndex(tabIndex); tabWidget->setCurrentIndex(tabIndex);
} }
} }

View File

@ -21,13 +21,12 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "webpage.h" #include "webpage.h"
#include "settings.h" #include "settings.h"
#include "websettings.h" #include "qzsettings.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "clickablelabel.h" #include "clickablelabel.h"
#include "buttonwithmenu.h" #include "buttonwithmenu.h"
#include "searchenginesmanager.h" #include "searchenginesmanager.h"
#include "searchenginesdialog.h" #include "searchenginesdialog.h"
#include "locationbarsettings.h"
#include "networkmanager.h" #include "networkmanager.h"
#include <QCompleter> #include <QCompleter>
@ -104,7 +103,7 @@ void WebSearchBar::aboutToShowMenu()
void WebSearchBar::addSuggestions(const QStringList &list) void WebSearchBar::addSuggestions(const QStringList &list)
{ {
if (LocationBarSettings::showSearchSuggestions) { if (qzSettings->showSearchSuggestions) {
QStringList list_ = list.mid(0, 6); QStringList list_ = list.mid(0, 6);
m_completerModel->setStringList(list_); m_completerModel->setStringList(list_);
} }
@ -129,7 +128,7 @@ void WebSearchBar::enableSearchSuggestions(bool enable)
settings.setValue("showSuggestions", enable); settings.setValue("showSuggestions", enable);
settings.endGroup(); settings.endGroup();
LocationBarSettings::showSearchSuggestions = enable; qzSettings->showSearchSuggestions = enable;
m_completerModel->setStringList(QStringList()); m_completerModel->setStringList(QStringList());
} }
@ -193,7 +192,7 @@ void WebSearchBar::search()
void WebSearchBar::searchInNewTab() void WebSearchBar::searchInNewTab()
{ {
p_QupZilla->weView()->setFocus(); p_QupZilla->weView()->setFocus();
p_QupZilla->tabWidget()->addView(m_searchManager->searchUrl(m_activeEngine, text()), WebSettings::newTabPosition); p_QupZilla->tabWidget()->addView(m_searchManager->searchUrl(m_activeEngine, text()), qzSettings->newTabPosition);
} }
void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
@ -293,7 +292,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
m_menu->addSeparator(); m_menu->addSeparator();
QAction* act = m_menu->addAction(tr("Show suggestions")); QAction* act = m_menu->addAction(tr("Show suggestions"));
act->setCheckable(true); act->setCheckable(true);
act->setChecked(LocationBarSettings::showSearchSuggestions); act->setChecked(qzSettings->showSearchSuggestions);
connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool))); connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool)));
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty()); m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());

View File

@ -15,27 +15,33 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "websettings.h" #include "qzsettings.h"
#include "settings.h" #include "settings.h"
int WebSettings::defaultZoom = 100; QzSettings::QzSettings()
bool WebSettings::loadTabsOnActivation = false; {
loadSettings();
}
Qz::NewTabPositionFlag WebSettings::newTabPosition; void QzSettings::loadSettings()
QStringList WebSettings::autoOpenProtocols;
QStringList WebSettings::blockedProtocols;
void WebSettings::loadSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("AddressBar");
selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick", true).toBool();
selectAllOnClick = settings.value("SelectAllTextOnClick", false).toBool();
addCountryWithAlt = settings.value("AddCountryDomainWithAltKey", true).toBool();
showLocationSuggestions = settings.value("showSuggestions", 0).toInt();
settings.endGroup();
settings.beginGroup("SearchEngines");
showSearchSuggestions = settings.value("showSuggestions", true).toBool();
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");
defaultZoom = settings.value("DefaultZoom", 100).toInt(); defaultZoom = settings.value("DefaultZoom", 100).toInt();
loadTabsOnActivation = settings.value("LoadTabsOnActivation", false).toBool(); loadTabsOnActivation = settings.value("LoadTabsOnActivation", false).toBool();
autoOpenProtocols = settings.value("AutomaticallyOpenProtocols", QStringList()).toStringList(); autoOpenProtocols = settings.value("AutomaticallyOpenProtocols", QStringList()).toStringList();
blockedProtocols = settings.value("BlockOpeningProtocols", QStringList()).toStringList(); blockedProtocols = settings.value("BlockOpeningProtocols", QStringList()).toStringList();
settings.endGroup(); settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings"); settings.beginGroup("Browser-Tabs-Settings");
@ -43,7 +49,7 @@ void WebSettings::loadSettings()
settings.endGroup(); settings.endGroup();
} }
void WebSettings::saveSettings() void QzSettings::saveSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("Web-Browser-Settings");
@ -53,3 +59,5 @@ void WebSettings::saveSettings()
settings.endGroup(); settings.endGroup();
} }

View File

@ -15,27 +15,42 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#ifndef WEBVIEWSETTINGS_H #ifndef QZSETTINGS_H
#define WEBVIEWSETTINGS_H #define QZSETTINGS_H
#include "qz_namespace.h" #include "qz_namespace.h"
#include "settings.h"
#include <QStringList> #include <QStringList>
class WebSettings class QT_QUPZILLA_EXPORT QzSettings
{ {
public: public:
WebSettings(); QzSettings();
static void loadSettings(); void loadSettings();
static void saveSettings(); void saveSettings();
static int defaultZoom; // AddressBar
static bool loadTabsOnActivation; bool selectAllOnDoubleClick;
bool selectAllOnClick;
bool addCountryWithAlt;
int showLocationSuggestions;
static Qz::NewTabPositionFlag newTabPosition; // SearchEngines
static QStringList autoOpenProtocols; bool showSearchSuggestions;
static QStringList blockedProtocols;
// Web-Browser-Settings
int defaultZoom;
bool loadTabsOnActivation;
QStringList autoOpenProtocols;
QStringList blockedProtocols;
// Browser-Tabs-Settings
Qz::NewTabPositionFlag newTabPosition;
}; };
#endif // WEBVIEWSETTINGS_H #define qzSettings Settings::staticSettings()
#endif // QZSETTINGS_H

View File

@ -26,7 +26,7 @@
#include "globalfunctions.h" #include "globalfunctions.h"
#include "followredirectreply.h" #include "followredirectreply.h"
#include "networkmanager.h" #include "networkmanager.h"
#include "websettings.h" #include "qzsettings.h"
#include <QMenu> #include <QMenu>
#include <QXmlStreamReader> #include <QXmlStreamReader>
@ -266,13 +266,13 @@ void RSSManager::controlLoadFeed(QTreeWidgetItem* item)
return; return;
} }
getQupZilla()->tabWidget()->addView(QUrl(item->toolTip(0)), WebSettings::newTabPosition); getQupZilla()->tabWidget()->addView(QUrl(item->toolTip(0)), qzSettings->newTabPosition);
} }
void RSSManager::loadFeedInNewTab() void RSSManager::loadFeedInNewTab()
{ {
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
getQupZilla()->tabWidget()->addView(action->data().toUrl(), WebSettings::newTabPosition); getQupZilla()->tabWidget()->addView(action->data().toUrl(), qzSettings->newTabPosition);
} }
} }

View File

@ -24,7 +24,7 @@
#include "bookmarkstoolbar.h" #include "bookmarkstoolbar.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "bookmarksmodel.h" #include "bookmarksmodel.h"
#include "websettings.h" #include "qzsettings.h"
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
@ -80,7 +80,7 @@ void BookmarksSideBar::itemDoubleClicked(QTreeWidgetItem* item)
void BookmarksSideBar::loadInNewTab() void BookmarksSideBar::loadInNewTab()
{ {
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
p_QupZilla->tabWidget()->addView(action->data().toUrl(), WebSettings::newTabPosition); p_QupZilla->tabWidget()->addView(action->data().toUrl(), qzSettings->newTabPosition);
} }
} }

View File

@ -22,7 +22,7 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "historymodel.h" #include "historymodel.h"
#include "websettings.h" #include "qzsettings.h"
HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent) HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent)
: QWidget(parent) : QWidget(parent)
@ -43,7 +43,7 @@ HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent)
void HistorySideBar::openLink(const QUrl &url, HistoryView::OpenBehavior openIn) void HistorySideBar::openLink(const QUrl &url, HistoryView::OpenBehavior openIn)
{ {
if (openIn == HistoryView::OpenInNewTab) { if (openIn == HistoryView::OpenInNewTab) {
p_QupZilla->tabWidget()->addView(url, WebSettings::newTabPosition); p_QupZilla->tabWidget()->addView(url, qzSettings->newTabPosition);
} }
else { else {
p_QupZilla->weView()->load(url); p_QupZilla->weView()->load(url);

View File

@ -33,7 +33,7 @@
#include "adblockicon.h" #include "adblockicon.h"
#include "adblockmanager.h" #include "adblockmanager.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "websettings.h" #include "qzsettings.h"
#ifdef NONBLOCK_JS_DIALOGS #ifdef NONBLOCK_JS_DIALOGS
#include "ui_jsconfirm.h" #include "ui_jsconfirm.h"
@ -310,12 +310,12 @@ void WebPage::handleUnknownProtocol(const QUrl &url)
{ {
const QString &protocol = url.scheme(); const QString &protocol = url.scheme();
if (WebSettings::blockedProtocols.contains(protocol)) { if (qzSettings->blockedProtocols.contains(protocol)) {
qDebug() << "WebPage::handleUnknownProtocol Protocol" << protocol << "is blocked!"; qDebug() << "WebPage::handleUnknownProtocol Protocol" << protocol << "is blocked!";
return; return;
} }
if (WebSettings::autoOpenProtocols.contains(protocol)) { if (qzSettings->autoOpenProtocols.contains(protocol)) {
desktopServicesOpen(url); desktopServicesOpen(url);
return; return;
} }
@ -335,8 +335,8 @@ void WebPage::handleUnknownProtocol(const QUrl &url)
switch (dialog.exec()) { switch (dialog.exec()) {
case QDialog::Accepted: case QDialog::Accepted:
if (dialog.isChecked()) { if (dialog.isChecked()) {
WebSettings::autoOpenProtocols.append(protocol); qzSettings->autoOpenProtocols.append(protocol);
WebSettings::saveSettings(); qzSettings->saveSettings();
} }
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
@ -344,8 +344,8 @@ void WebPage::handleUnknownProtocol(const QUrl &url)
case QDialog::Rejected: case QDialog::Rejected:
if (dialog.isChecked()) { if (dialog.isChecked()) {
WebSettings::blockedProtocols.append(protocol); qzSettings->blockedProtocols.append(protocol);
WebSettings::saveSettings(); qzSettings->saveSettings();
} }
break; break;

View File

@ -23,7 +23,7 @@
#include "tabwidget.h" #include "tabwidget.h"
#include "locationbar.h" #include "locationbar.h"
#include "globalfunctions.h" #include "globalfunctions.h"
#include "websettings.h" #include "qzsettings.h"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWebHistory> #include <QWebHistory>
@ -222,7 +222,7 @@ bool WebTab::isRestored() const
void WebTab::restoreTab(const WebTab::SavedTab &tab) void WebTab::restoreTab(const WebTab::SavedTab &tab)
{ {
if (WebSettings::loadTabsOnActivation) { if (qzSettings->loadTabsOnActivation) {
m_savedTab = tab; m_savedTab = tab;
int index = tabIndex(); int index = tabIndex();

View File

@ -29,7 +29,7 @@
#include "browsinglibrary.h" #include "browsinglibrary.h"
#include "bookmarksmanager.h" #include "bookmarksmanager.h"
#include "settings.h" #include "settings.h"
#include "websettings.h" #include "qzsettings.h"
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "pluginproxy.h" #include "pluginproxy.h"
@ -125,7 +125,7 @@ void WebView::setPage(QWebPage* page)
QWebView::setPage(page); QWebView::setPage(page);
m_page = qobject_cast<WebPage*>(page); m_page = qobject_cast<WebPage*>(page);
setZoom(WebSettings::defaultZoom); setZoom(qzSettings->defaultZoom);
connect(m_page, SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)), this, SLOT(frameStateChanged())); connect(m_page, SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)), this, SLOT(frameStateChanged()));
connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool))); connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool)));
@ -509,7 +509,7 @@ void WebView::openUrlInBackgroundTab()
void WebView::userDefinedOpenUrlInNewTab(const QUrl &url, bool invert) void WebView::userDefinedOpenUrlInNewTab(const QUrl &url, bool invert)
{ {
Qz::NewTabPositionFlag position = WebSettings::newTabPosition; Qz::NewTabPositionFlag position = qzSettings->newTabPosition;
if (invert) { if (invert) {
position = (position == Qz::NT_SelectedTab) ? Qz::NT_NotSelectedTab : Qz::NT_SelectedTab; position = (position == Qz::NT_SelectedTab) ? Qz::NT_NotSelectedTab : Qz::NT_SelectedTab;
} }