2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
2017-08-25 17:11:29 +02:00
|
|
|
* Falkon - Qt web browser
|
2018-01-02 18:49:37 +01:00
|
|
|
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "preferences.h"
|
|
|
|
#include "ui_preferences.h"
|
2014-02-19 22:07:21 +01:00
|
|
|
#include "browserwindow.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "bookmarkstoolbar.h"
|
2012-04-30 16:33:14 +02:00
|
|
|
#include "history.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "tabwidget.h"
|
|
|
|
#include "cookiejar.h"
|
|
|
|
#include "locationbar.h"
|
|
|
|
#include "autofillmanager.h"
|
|
|
|
#include "mainapplication.h"
|
|
|
|
#include "cookiemanager.h"
|
2012-02-29 18:33:50 +01:00
|
|
|
#include "pluginproxy.h"
|
2012-07-06 14:37:49 +02:00
|
|
|
#include "pluginsmanager.h"
|
2012-12-28 01:17:01 +01:00
|
|
|
#include "jsoptions.h"
|
2011-04-26 19:47:12 +02:00
|
|
|
#include "networkmanager.h"
|
2011-04-27 09:49:41 +02:00
|
|
|
#include "desktopnotificationsfactory.h"
|
|
|
|
#include "desktopnotification.h"
|
2011-09-11 19:15:06 +02:00
|
|
|
#include "thememanager.h"
|
2011-10-18 17:39:51 +02:00
|
|
|
#include "acceptlanguage.h"
|
2013-01-22 19:04:22 +01:00
|
|
|
#include "qztools.h"
|
2013-01-24 17:47:50 +01:00
|
|
|
#include "autofill.h"
|
2012-01-11 21:58:25 +01:00
|
|
|
#include "settings.h"
|
2014-03-09 21:51:42 +01:00
|
|
|
#include "datapaths.h"
|
2012-01-21 23:19:38 +01:00
|
|
|
#include "tabbedwebview.h"
|
2012-03-23 17:29:12 +01:00
|
|
|
#include "clearprivatedata.h"
|
2012-08-17 20:55:11 +02:00
|
|
|
#include "useragentdialog.h"
|
2012-12-07 13:17:54 +01:00
|
|
|
#include "registerqappassociation.h"
|
2014-03-09 21:51:42 +01:00
|
|
|
#include "profilemanager.h"
|
2013-01-28 18:20:36 +01:00
|
|
|
#include "html5permissions/html5permissionsdialog.h"
|
2014-07-08 19:17:42 +02:00
|
|
|
#include "searchenginesdialog.h"
|
2016-12-26 12:38:51 +01:00
|
|
|
#include "webscrollbarmanager.h"
|
2018-01-24 14:25:38 +01:00
|
|
|
#include "../config.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include <QSettings>
|
|
|
|
#include <QInputDialog>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMessageBox>
|
2012-08-31 15:19:07 +02:00
|
|
|
#include <QCloseEvent>
|
2012-09-19 10:08:30 +02:00
|
|
|
#include <QColorDialog>
|
2013-04-01 15:01:58 +02:00
|
|
|
#include <QDesktopWidget>
|
2015-05-22 21:46:55 +02:00
|
|
|
#include <QWebEngineProfile>
|
2015-02-08 11:38:38 +01:00
|
|
|
#include <QWebEngineSettings>
|
2016-10-25 23:36:39 +02:00
|
|
|
#include <QLibraryInfo>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2014-01-04 11:14:48 +01:00
|
|
|
static QString createLanguageItem(const QString &lang)
|
|
|
|
{
|
|
|
|
QLocale locale(lang);
|
|
|
|
|
2016-10-25 23:36:39 +02:00
|
|
|
if (locale.language() == QLocale::C) {
|
|
|
|
return lang;
|
|
|
|
}
|
|
|
|
|
2014-01-04 11:14:48 +01:00
|
|
|
QString country = QLocale::countryToString(locale.country());
|
|
|
|
QString language = QLocale::languageToString(locale.language());
|
|
|
|
|
2014-03-23 13:50:15 +01:00
|
|
|
if (lang == QLatin1String("es_ES")) {
|
|
|
|
return QString::fromUtf8("Castellano");
|
|
|
|
}
|
2014-01-04 11:14:48 +01:00
|
|
|
if (lang == QLatin1String("nqo")) {
|
|
|
|
return QString("N'ko (nqo)");
|
|
|
|
}
|
2014-03-10 19:47:27 +01:00
|
|
|
if (lang == QLatin1String("sr")) {
|
|
|
|
return QString::fromUtf8("српски екавски");
|
|
|
|
}
|
|
|
|
if (lang == QLatin1String("sr@ijekavian")) {
|
|
|
|
return QString::fromUtf8("српски ијекавски");
|
|
|
|
}
|
|
|
|
if (lang == QLatin1String("sr@latin")) {
|
|
|
|
return QString::fromUtf8("srpski ekavski");
|
|
|
|
}
|
|
|
|
if (lang == QLatin1String("sr@ijekavianlatin")) {
|
|
|
|
return QString::fromUtf8("srpski ijekavski");
|
|
|
|
}
|
2014-01-04 11:14:48 +01:00
|
|
|
return QString("%1, %2 (%3)").arg(language, country, lang);
|
|
|
|
}
|
|
|
|
|
2015-09-25 22:31:04 +02:00
|
|
|
Preferences::Preferences(BrowserWindow* window)
|
2018-02-09 17:49:32 +01:00
|
|
|
: QDialog(window)
|
2011-11-02 12:52:55 +01:00
|
|
|
, ui(new Ui::Preferences)
|
2014-02-19 22:07:21 +01:00
|
|
|
, m_window(window)
|
2013-07-14 22:29:47 +02:00
|
|
|
, m_autoFillManager(0)
|
2011-11-02 12:52:55 +01:00
|
|
|
, m_pluginsList(0)
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
2011-04-27 09:49:41 +02:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->setupUi(this);
|
2015-09-25 22:31:04 +02:00
|
|
|
QzTools::centerWidgetOnScreen(this);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2013-06-05 00:06:23 +02:00
|
|
|
m_themesManager = new ThemeManager(ui->themesWidget, this);
|
|
|
|
m_pluginsList = new PluginsManager(this);
|
|
|
|
ui->pluginsFrame->addWidget(m_pluginsList);
|
|
|
|
|
2014-02-02 16:21:06 +01:00
|
|
|
#ifdef DISABLE_CHECK_UPDATES
|
|
|
|
ui->checkUpdates->setVisible(false);
|
|
|
|
#endif
|
|
|
|
|
2018-03-01 14:41:45 +01:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
|
|
ui->disableVideoAutoPlay->setVisible(false);
|
|
|
|
ui->webRTCPublicIpOnly->setVisible(false);
|
|
|
|
#endif
|
|
|
|
|
2016-12-21 11:34:22 +01:00
|
|
|
auto setCategoryIcon = [this](int index, const QIcon &icon) {
|
|
|
|
ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32)));
|
|
|
|
};
|
|
|
|
|
2017-01-21 22:36:51 +01:00
|
|
|
setCategoryIcon(0, QIcon(":/icons/preferences/general.svg"));
|
|
|
|
setCategoryIcon(1, QIcon(":/icons/preferences/appearance.svg"));
|
|
|
|
setCategoryIcon(2, QIcon(":/icons/preferences/tabs.svg"));
|
|
|
|
setCategoryIcon(3, QIcon(":/icons/preferences/browsing.svg"));
|
|
|
|
setCategoryIcon(4, QIcon(":/icons/preferences/fonts.svg"));
|
|
|
|
setCategoryIcon(5, QIcon(":/icons/preferences/shortcuts.svg"));
|
|
|
|
setCategoryIcon(6, QIcon(":/icons/preferences/downloads.svg"));
|
|
|
|
setCategoryIcon(7, QIcon(":/icons/preferences/passwords.svg"));
|
|
|
|
setCategoryIcon(8, QIcon(":/icons/preferences/privacy.svg"));
|
|
|
|
setCategoryIcon(9, QIcon(":/icons/preferences/notifications.svg"));
|
|
|
|
setCategoryIcon(10, QIcon(":/icons/preferences/extensions.svg"));
|
|
|
|
setCategoryIcon(11, QIcon(":/icons/preferences/spellcheck.svg"));
|
|
|
|
setCategoryIcon(12, QIcon(":/icons/preferences/other.svg"));
|
2011-11-19 18:21:22 +01:00
|
|
|
|
2012-01-11 21:58:25 +01:00
|
|
|
Settings settings;
|
2011-03-02 16:57:41 +01:00
|
|
|
//GENERAL URLs
|
|
|
|
settings.beginGroup("Web-URL-Settings");
|
2017-08-25 17:11:29 +02:00
|
|
|
m_homepage = settings.value("homepage", QUrl(QSL("falkon:start"))).toUrl();
|
|
|
|
m_newTabUrl = settings.value("newTabUrl", QUrl(QSL("falkon:speeddial"))).toUrl();
|
2014-11-08 11:54:46 +01:00
|
|
|
ui->homepage->setText(m_homepage.toEncoded());
|
|
|
|
ui->newTabUrl->setText(m_newTabUrl.toEncoded());
|
2011-04-04 19:29:03 +02:00
|
|
|
settings.endGroup();
|
2015-09-28 14:51:38 +02:00
|
|
|
ui->afterLaunch->setCurrentIndex(mApp->afterLaunch());
|
2016-04-05 10:18:49 +02:00
|
|
|
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", true).toBool());
|
2014-02-11 15:44:47 +01:00
|
|
|
ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", true).toBool());
|
2014-01-02 15:26:44 +01:00
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
2012-12-01 07:50:31 +01:00
|
|
|
ui->checkDefaultBrowser->setChecked(settings.value("Web-Browser-Settings/CheckDefaultBrowser", DEFAULT_CHECK_DEFAULTBROWSER).toBool());
|
|
|
|
if (mApp->associationManager()->isDefaultForAllCapabilities()) {
|
2013-04-05 11:39:19 +02:00
|
|
|
ui->checkNowDefaultBrowser->setText(tr("Default"));
|
2012-12-01 07:50:31 +01:00
|
|
|
ui->checkNowDefaultBrowser->setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
2013-04-05 11:39:19 +02:00
|
|
|
ui->checkNowDefaultBrowser->setText(tr("Set as default"));
|
2012-12-01 07:50:31 +01:00
|
|
|
ui->checkNowDefaultBrowser->setEnabled(true);
|
2017-08-25 17:11:29 +02:00
|
|
|
connect(ui->checkNowDefaultBrowser, SIGNAL(clicked()), this, SLOT(makeFalkonDefault()));
|
2012-12-01 07:50:31 +01:00
|
|
|
}
|
2014-01-02 15:26:44 +01:00
|
|
|
#else // No Default Browser settings on non-Windows platform
|
2012-12-01 07:50:31 +01:00
|
|
|
ui->hSpacerDefaultBrowser->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
ui->hLayoutDefaultBrowser->invalidate();
|
|
|
|
delete ui->hLayoutDefaultBrowser;
|
|
|
|
delete ui->checkDefaultBrowser;
|
|
|
|
delete ui->checkNowDefaultBrowser;
|
|
|
|
#endif
|
2014-01-02 15:26:44 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTabFrame->setVisible(false);
|
2014-11-08 11:54:46 +01:00
|
|
|
if (m_newTabUrl.isEmpty() || m_newTabUrl.toString() == QL1S("about:blank")) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTab->setCurrentIndex(0);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else if (m_newTabUrl == m_homepage) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTab->setCurrentIndex(1);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2017-08-25 17:11:29 +02:00
|
|
|
else if (m_newTabUrl.toString() == QL1S("falkon:speeddial")) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTab->setCurrentIndex(2);
|
2011-12-02 23:25:27 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->newTab->setCurrentIndex(3);
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTabFrame->setVisible(true);
|
|
|
|
}
|
2012-03-29 20:02:21 +02:00
|
|
|
|
|
|
|
afterLaunchChanged(ui->afterLaunch->currentIndex());
|
|
|
|
connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int)));
|
|
|
|
connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int)));
|
2014-02-19 22:07:21 +01:00
|
|
|
if (m_window) {
|
2012-09-17 12:29:08 +02:00
|
|
|
connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage()));
|
|
|
|
connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab()));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->useCurrentBut->setEnabled(false);
|
|
|
|
ui->newTabUseCurrent->setEnabled(false);
|
|
|
|
}
|
2012-04-04 21:12:52 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
// PROFILES
|
2015-09-28 20:39:10 +02:00
|
|
|
QString startingProfile = ProfileManager::startingProfile();
|
|
|
|
ui->activeProfile->setText("<b>" + ProfileManager::currentProfile() + "</b>");
|
2014-03-09 21:51:42 +01:00
|
|
|
ui->startProfile->addItem(startingProfile);
|
|
|
|
|
2015-09-28 20:39:10 +02:00
|
|
|
foreach (const QString &name, ProfileManager::availableProfiles()) {
|
2014-03-09 21:51:42 +01:00
|
|
|
if (startingProfile != name) {
|
|
|
|
ui->startProfile->addItem(name);
|
|
|
|
}
|
2011-04-04 19:29:03 +02:00
|
|
|
}
|
2014-03-09 21:51:42 +01:00
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
connect(ui->createProfile, SIGNAL(clicked()), this, SLOT(createProfile()));
|
|
|
|
connect(ui->deleteProfile, SIGNAL(clicked()), this, SLOT(deleteProfile()));
|
2014-03-09 21:51:42 +01:00
|
|
|
connect(ui->startProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(startProfileIndexChanged(int)));
|
|
|
|
startProfileIndexChanged(ui->startProfile->currentIndex());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
//APPEREANCE
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.beginGroup("Browser-View-Settings");
|
2016-01-24 16:29:46 +01:00
|
|
|
ui->showStatusbar->setChecked(settings.value("showStatusBar", false).toBool());
|
2016-08-23 08:57:11 +02:00
|
|
|
// NOTE: instantBookmarksToolbar and showBookmarksToolbar cannot be both enabled at the same time
|
|
|
|
ui->instantBookmarksToolbar->setChecked(settings.value("instantBookmarksToolbar", false).toBool());
|
2018-03-24 21:47:24 +01:00
|
|
|
ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", false).toBool());
|
|
|
|
ui->instantBookmarksToolbar->setDisabled(settings.value("showBookmarksToolbar", false).toBool());
|
2016-08-23 08:57:11 +02:00
|
|
|
ui->showBookmarksToolbar->setDisabled(settings.value("instantBookmarksToolbar").toBool());
|
|
|
|
connect(ui->instantBookmarksToolbar, SIGNAL(toggled(bool)), ui->showBookmarksToolbar, SLOT(setDisabled(bool)));
|
|
|
|
connect(ui->showBookmarksToolbar, SIGNAL(toggled(bool)), ui->instantBookmarksToolbar, SLOT(setDisabled(bool)));
|
2014-03-13 15:58:39 +01:00
|
|
|
ui->showNavigationToolbar->setChecked(settings.value("showNavigationToolbar", true).toBool());
|
2012-08-16 23:14:04 +02:00
|
|
|
int currentSettingsPage = settings.value("settingsDialogPage", 0).toInt(0);
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
|
|
|
//TABS
|
|
|
|
settings.beginGroup("Browser-Tabs-Settings");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
|
|
|
|
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
2012-01-24 15:16:33 +01:00
|
|
|
ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
|
2013-01-25 23:49:46 +01:00
|
|
|
ui->openNewEmptyTabAfterActive->setChecked(settings.value("newEmptyTabAfterActive", false).toBool());
|
2016-02-14 10:37:28 +01:00
|
|
|
ui->openPopupsInTabs->setChecked(settings.value("OpenPopupsInTabs", false).toBool());
|
2014-01-12 16:39:23 +01:00
|
|
|
ui->alwaysSwitchTabsWithWheel->setChecked(settings.value("AlwaysSwitchTabsWithWheel", false).toBool());
|
2012-06-26 23:39:23 +02:00
|
|
|
ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool());
|
2014-03-12 22:31:33 +01:00
|
|
|
ui->dontCloseOnLastTab->setChecked(settings.value("dontCloseWithOneTab", false).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
2014-03-24 18:13:37 +01:00
|
|
|
ui->showClosedTabsButton->setChecked(settings.value("showClosedTabsButton", false).toBool());
|
2014-02-23 14:49:32 +01:00
|
|
|
ui->showCloseOnInactive->setCurrentIndex(settings.value("showCloseOnInactiveTabs", 0).toInt());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
2012-08-27 14:01:17 +02:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//AddressBar
|
|
|
|
settings.beginGroup("AddressBar");
|
2012-08-10 18:06:29 +02:00
|
|
|
ui->addressbarCompletion->setCurrentIndex(settings.value("showSuggestions", 0).toInt());
|
2014-01-08 10:29:01 +01:00
|
|
|
ui->useInlineCompletion->setChecked(settings.value("useInlineCompletion", true).toBool());
|
2012-12-04 14:29:27 +01:00
|
|
|
ui->completionShowSwitchTab->setChecked(settings.value("showSwitchTab", true).toBool());
|
2013-06-05 00:02:43 +02:00
|
|
|
ui->alwaysShowGoIcon->setChecked(settings.value("alwaysShowGoIcon", false).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->selectAllOnFocus->setChecked(settings.value("SelectAllTextOnDoubleClick", true).toBool());
|
2011-11-16 16:47:08 +01:00
|
|
|
ui->selectAllOnClick->setChecked(settings.value("SelectAllTextOnClick", false).toBool());
|
2012-09-19 10:08:30 +02:00
|
|
|
bool showPBinAB = settings.value("ShowLoadingProgress", false).toBool();
|
|
|
|
ui->showLoadingInAddressBar->setChecked(showPBinAB);
|
|
|
|
ui->adressProgressSettings->setEnabled(showPBinAB);
|
|
|
|
ui->progressStyleSelector->setCurrentIndex(settings.value("ProgressStyle", 0).toInt());
|
|
|
|
bool pbInABuseCC = settings.value("UseCustomProgressColor", false).toBool();
|
|
|
|
ui->checkBoxCustomProgressColor->setChecked(pbInABuseCC);
|
|
|
|
ui->progressBarColorSelector->setEnabled(pbInABuseCC);
|
2014-10-07 16:15:23 +02:00
|
|
|
QColor pbColor = settings.value("CustomProgressColor", palette().color(QPalette::Highlight)).value<QColor>();
|
2012-09-19 10:08:30 +02:00
|
|
|
setProgressBarColorIcon(pbColor);
|
|
|
|
connect(ui->customColorToolButton, SIGNAL(clicked(bool)), SLOT(selectCustomProgressBarColor()));
|
2013-01-29 14:47:11 +01:00
|
|
|
connect(ui->resetProgressBarcolor, SIGNAL(clicked()), SLOT(setProgressBarColorIcon()));
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2012-09-27 11:59:09 +02:00
|
|
|
settings.beginGroup("SearchEngines");
|
2016-01-14 03:29:47 +01:00
|
|
|
bool searchFromAB = settings.value("SearchFromAddressBar", true).toBool();
|
|
|
|
ui->searchFromAddressBar->setChecked(searchFromAB);
|
|
|
|
ui->searchWithDefaultEngine->setEnabled(searchFromAB);
|
2012-09-27 11:59:09 +02:00
|
|
|
ui->searchWithDefaultEngine->setChecked(settings.value("SearchWithDefaultEngine", false).toBool());
|
2017-12-31 16:43:27 +01:00
|
|
|
ui->showABSearchSuggestions->setEnabled(searchFromAB);
|
|
|
|
ui->showABSearchSuggestions->setChecked(settings.value("showSearchSuggestions", true).toBool());
|
2016-01-14 03:29:47 +01:00
|
|
|
connect(ui->searchFromAddressBar, SIGNAL(toggled(bool)), this, SLOT(searchFromAddressBarChanged(bool)));
|
2012-09-27 11:59:09 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2014-03-29 15:49:49 +01:00
|
|
|
// BROWSING
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.beginGroup("Web-Browser-Settings");
|
2015-10-05 17:29:09 +02:00
|
|
|
ui->allowPlugins->setChecked(settings.value("allowPlugins", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool());
|
|
|
|
ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
|
2013-04-23 13:31:29 +02:00
|
|
|
ui->spatialNavigation->setChecked(settings.value("SpatialNavigation", false).toBool());
|
2012-12-21 16:38:44 +01:00
|
|
|
ui->animateScrolling->setChecked(settings.value("AnimateScrolling", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
|
2011-11-13 20:36:10 +01:00
|
|
|
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
|
2017-02-06 19:52:39 +01:00
|
|
|
ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
|
2017-03-15 10:49:27 +01:00
|
|
|
ui->useNativeScrollbars->setChecked(settings.value("UseNativeScrollbars", false).toBool());
|
2018-03-01 14:41:45 +01:00
|
|
|
ui->disableVideoAutoPlay->setChecked(settings.value("DisableVideoAutoPlay", false).toBool());
|
|
|
|
ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
|
2014-03-29 15:49:49 +01:00
|
|
|
foreach (int level, WebView::zoomLevels()) {
|
|
|
|
ui->defaultZoomLevel->addItem(QString("%1%").arg(level));
|
|
|
|
}
|
|
|
|
ui->defaultZoomLevel->setCurrentIndex(settings.value("DefaultZoomLevel", WebView::zoomLevels().indexOf(100)).toInt());
|
2014-07-17 23:05:38 +02:00
|
|
|
ui->closeAppWithCtrlQ->setChecked(settings.value("closeAppWithCtrlQ", true).toBool());
|
2014-03-29 15:49:49 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//Cache
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
|
2017-01-27 13:37:56 +01:00
|
|
|
ui->removeCache->setChecked(settings.value("deleteCacheOnClose", false).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
|
2015-05-22 21:46:55 +02:00
|
|
|
ui->cachePath->setText(settings.value("CachePath", QWebEngineProfile::defaultProfile()->cachePath()).toString());
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->allowCache, SIGNAL(clicked(bool)), this, SLOT(allowCacheChanged(bool)));
|
2013-02-10 14:50:18 +01:00
|
|
|
connect(ui->changeCachePath, SIGNAL(clicked()), this, SLOT(changeCachePathClicked()));
|
2011-03-02 16:57:41 +01:00
|
|
|
allowCacheChanged(ui->allowCache->isChecked());
|
|
|
|
|
|
|
|
//PASSWORD MANAGER
|
2011-11-02 12:52:55 +01:00
|
|
|
ui->allowPassManager->setChecked(settings.value("SavePasswordsOnSites", true).toBool());
|
2018-01-28 13:57:10 +01:00
|
|
|
ui->autoCompletePasswords->setChecked(settings.value("AutoCompletePasswords", true).toBool());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
//PRIVACY
|
|
|
|
//Web storage
|
2012-01-26 18:23:35 +01:00
|
|
|
ui->saveHistory->setChecked(settings.value("allowHistory", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->deleteHistoryOnClose->setChecked(settings.value("deleteHistoryOnClose", false).toBool());
|
|
|
|
if (!ui->saveHistory->isChecked()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->deleteHistoryOnClose->setEnabled(false);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->saveHistory, SIGNAL(toggled(bool)), this, SLOT(saveHistoryChanged(bool)));
|
2012-01-26 18:23:35 +01:00
|
|
|
|
2012-01-27 23:01:17 +01:00
|
|
|
// Html5Storage
|
2012-01-26 18:23:35 +01:00
|
|
|
ui->html5storage->setChecked(settings.value("HTML5StorageEnabled", true).toBool());
|
|
|
|
ui->deleteHtml5storageOnClose->setChecked(settings.value("deleteHTML5StorageOnClose", false).toBool());
|
|
|
|
connect(ui->html5storage, SIGNAL(toggled(bool)), this, SLOT(allowHtml5storageChanged(bool)));
|
2012-01-27 23:01:17 +01:00
|
|
|
// Other
|
2014-10-02 19:57:56 +02:00
|
|
|
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
|
2012-01-27 23:01:17 +01:00
|
|
|
|
2012-02-17 18:55:34 +01:00
|
|
|
//CSS Style
|
|
|
|
ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
|
|
|
|
connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked()));
|
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//DOWNLOADS
|
|
|
|
settings.beginGroup("DownloadManager");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->downLoc->setText(settings.value("defaultDownloadPath", "").toString());
|
|
|
|
ui->closeDownManOnFinish->setChecked(settings.value("CloseManagerOnFinish", false).toBool());
|
|
|
|
if (ui->downLoc->text().isEmpty()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->askEverytime->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->useDefined->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2015-09-30 18:43:58 +02:00
|
|
|
ui->useExternalDownManager->setChecked(settings.value("UseExternalManager", false).toBool());
|
|
|
|
ui->externalDownExecutable->setText(settings.value("ExternalManagerExecutable", "").toString());
|
|
|
|
ui->externalDownArguments->setText(settings.value("ExternalManagerArguments", "").toString());
|
|
|
|
|
|
|
|
connect(ui->useExternalDownManager, SIGNAL(toggled(bool)), this, SLOT(useExternalDownManagerChanged(bool)));
|
|
|
|
|
2012-01-28 15:37:11 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->useDefined, SIGNAL(toggled(bool)), this, SLOT(downLocChanged(bool)));
|
|
|
|
connect(ui->downButt, SIGNAL(clicked()), this, SLOT(chooseDownPath()));
|
2015-09-30 18:43:58 +02:00
|
|
|
connect(ui->chooseExternalDown, SIGNAL(clicked()), this, SLOT(chooseExternalDownloadManager()));
|
2011-03-02 16:57:41 +01:00
|
|
|
downLocChanged(ui->useDefined->isChecked());
|
2015-09-30 18:43:58 +02:00
|
|
|
useExternalDownManagerChanged(ui->useExternalDownManager->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-17 15:35:51 +01:00
|
|
|
//FONTS
|
|
|
|
settings.beginGroup("Browser-Fonts");
|
2018-01-02 22:19:09 +01:00
|
|
|
QWebEngineSettings* webSettings = mApp->webSettings();
|
2016-05-11 13:33:34 +02:00
|
|
|
auto defaultFont = [&](QWebEngineSettings::FontFamily font) -> const QString {
|
2016-04-23 09:47:00 +02:00
|
|
|
const QString family = webSettings->fontFamily(font);
|
|
|
|
if (!family.isEmpty())
|
|
|
|
return family;
|
|
|
|
switch (font) {
|
|
|
|
case QWebEngineSettings::FixedFont:
|
|
|
|
return QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
|
|
|
|
case QWebEngineSettings::SerifFont:
|
|
|
|
// TODO
|
|
|
|
default:
|
|
|
|
return QFontDatabase::systemFont(QFontDatabase::GeneralFont).family();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", defaultFont(QWebEngineSettings::StandardFont)).toString()));
|
|
|
|
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", defaultFont(QWebEngineSettings::CursiveFont)).toString()));
|
|
|
|
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", defaultFont(QWebEngineSettings::FantasyFont)).toString()));
|
|
|
|
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", defaultFont(QWebEngineSettings::FixedFont)).toString()));
|
|
|
|
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", defaultFont(QWebEngineSettings::SansSerifFont)).toString()));
|
|
|
|
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", defaultFont(QWebEngineSettings::SerifFont)).toString()));
|
2015-01-27 11:01:52 +01:00
|
|
|
ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt());
|
|
|
|
ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt());
|
|
|
|
ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt());
|
|
|
|
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebEngineSettings::MinimumLogicalFontSize)).toInt());
|
2011-03-17 15:35:51 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2012-11-28 11:27:30 +01:00
|
|
|
//KEYBOARD SHORTCUTS
|
|
|
|
settings.beginGroup("Shortcuts");
|
|
|
|
ui->switchTabsAlt->setChecked(settings.value("useTabNumberShortcuts", true).toBool());
|
|
|
|
ui->loadSpeedDialsCtrl->setChecked(settings.value("useSpeedDialNumberShortcuts", true).toBool());
|
2014-04-05 03:00:06 +02:00
|
|
|
ui->singleKeyShortcuts->setChecked(settings.value("useSingleKeyShortcuts", false).toBool());
|
2012-11-28 11:27:30 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
//NOTIFICATIONS
|
2012-07-10 11:56:24 +02:00
|
|
|
ui->useNativeSystemNotifications->setEnabled(mApp->desktopNotifications()->supportsNativeNotifications());
|
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
DesktopNotificationsFactory::Type notifyType;
|
|
|
|
settings.beginGroup("Notifications");
|
|
|
|
ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000);
|
2014-03-03 14:47:47 +01:00
|
|
|
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)
|
2011-11-06 17:01:23 +01:00
|
|
|
notifyType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNotificationsFactory::DesktopNative : DesktopNotificationsFactory::PopupWidget;
|
2011-04-27 09:49:41 +02:00
|
|
|
#else
|
2011-11-06 17:01:23 +01:00
|
|
|
notifyType = DesktopNotificationsFactory::PopupWidget;
|
2011-04-27 09:49:41 +02:00
|
|
|
#endif
|
2012-07-12 23:19:06 +02:00
|
|
|
if (ui->useNativeSystemNotifications->isEnabled() && notifyType == DesktopNotificationsFactory::DesktopNative) {
|
2011-04-27 09:49:41 +02:00
|
|
|
ui->useNativeSystemNotifications->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-04-27 09:49:41 +02:00
|
|
|
ui->useOSDNotifications->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-27 09:49:41 +02:00
|
|
|
|
2017-01-21 18:38:19 +01:00
|
|
|
connect(ui->notificationPreview, &QPushButton::clicked, this, &Preferences::showNotificationPreview);
|
2011-12-16 19:07:36 +01:00
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint();
|
2011-04-27 09:49:41 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2016-10-25 23:36:39 +02:00
|
|
|
//SPELLCHECK
|
|
|
|
settings.beginGroup(QSL("SpellCheck"));
|
|
|
|
ui->spellcheckEnabled->setChecked(settings.value(QSL("Enabled"), false).toBool());
|
2016-12-21 21:53:00 +01:00
|
|
|
const QStringList spellcheckLanguages = settings.value(QSL("Languages")).toStringList();
|
2016-10-25 23:36:39 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2017-02-08 09:51:39 +01:00
|
|
|
auto updateSpellCheckEnabled = [this]() {
|
|
|
|
ui->spellcheckLanguages->setEnabled(ui->spellcheckEnabled->isChecked());
|
|
|
|
ui->spellcheckNoLanguages->setEnabled(ui->spellcheckEnabled->isChecked());
|
|
|
|
};
|
|
|
|
updateSpellCheckEnabled();
|
|
|
|
connect(ui->spellcheckEnabled, &QCheckBox::toggled, this, updateSpellCheckEnabled);
|
|
|
|
|
2017-01-14 17:04:34 +01:00
|
|
|
QStringList dictionariesDirs = {
|
2016-10-26 11:41:22 +02:00
|
|
|
#ifdef Q_OS_OSX
|
2017-03-18 00:09:25 +01:00
|
|
|
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Resources/qtwebengine_dictionaries")),
|
|
|
|
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Frameworks/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries"))
|
2016-10-26 11:36:58 +02:00
|
|
|
#else
|
|
|
|
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/qtwebengine_dictionaries")),
|
|
|
|
QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QL1S("/qtwebengine_dictionaries"))
|
|
|
|
#endif
|
2016-10-25 23:36:39 +02:00
|
|
|
};
|
2017-01-14 17:04:34 +01:00
|
|
|
dictionariesDirs.removeDuplicates();
|
2016-10-25 23:36:39 +02:00
|
|
|
|
2016-10-26 11:13:48 +02:00
|
|
|
ui->spellcheckDirectories->setText(dictionariesDirs.join(QL1C('\n')));
|
|
|
|
|
2016-10-25 23:36:39 +02:00
|
|
|
for (const QString &path : dictionariesDirs) {
|
|
|
|
QDir dir(path);
|
|
|
|
const QStringList files = dir.entryList({QSL("*.bdic")});
|
|
|
|
for (const QString &file : files) {
|
|
|
|
const QString lang = file.left(file.size() - 5);
|
2017-02-08 10:13:41 +01:00
|
|
|
const QString langName = createLanguageItem(lang);
|
|
|
|
if (!ui->spellcheckLanguages->findItems(langName, Qt::MatchExactly).isEmpty()) {
|
2017-02-08 09:49:11 +01:00
|
|
|
continue;
|
|
|
|
}
|
2016-12-21 21:53:00 +01:00
|
|
|
QListWidgetItem *item = new QListWidgetItem;
|
2017-02-08 10:13:41 +01:00
|
|
|
item->setText(langName);
|
2016-12-21 21:53:00 +01:00
|
|
|
item->setData(Qt::UserRole, lang);
|
|
|
|
ui->spellcheckLanguages->addItem(item);
|
2016-10-25 23:36:39 +02:00
|
|
|
}
|
|
|
|
}
|
2016-10-26 10:40:34 +02:00
|
|
|
|
2017-02-08 10:13:41 +01:00
|
|
|
int topIndex = 0;
|
|
|
|
for (const QString &lang : spellcheckLanguages) {
|
|
|
|
const auto items = ui->spellcheckLanguages->findItems(createLanguageItem(lang), Qt::MatchExactly);
|
|
|
|
if (items.isEmpty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
QListWidgetItem *item = items.at(0);
|
|
|
|
ui->spellcheckLanguages->takeItem(ui->spellcheckLanguages->row(item));
|
|
|
|
ui->spellcheckLanguages->insertItem(topIndex++, item);
|
|
|
|
ui->spellcheckLanguages->setCurrentItem(item, QItemSelectionModel::Select);
|
|
|
|
}
|
|
|
|
|
2016-12-21 21:53:00 +01:00
|
|
|
if (ui->spellcheckLanguages->count() == 0) {
|
|
|
|
ui->spellcheckLanguages->hide();
|
2016-10-26 10:40:34 +02:00
|
|
|
} else {
|
|
|
|
ui->spellcheckNoLanguages->hide();
|
|
|
|
}
|
2016-10-25 23:36:39 +02:00
|
|
|
|
2012-03-21 15:05:04 +01:00
|
|
|
// Proxy Configuration
|
2011-04-26 19:47:12 +02:00
|
|
|
settings.beginGroup("Web-Proxy");
|
2017-12-19 15:08:11 +01:00
|
|
|
int proxyType = settings.value("ProxyType", 2).toInt();
|
2017-12-02 22:05:47 +01:00
|
|
|
if (proxyType == 0) {
|
|
|
|
ui->noProxy->setChecked(true);
|
|
|
|
} else if (proxyType == 2) {
|
|
|
|
ui->systemProxy->setChecked(true);
|
|
|
|
} else if (proxyType == 3) {
|
|
|
|
ui->manualProxy->setChecked(true);
|
2015-10-15 14:39:18 +02:00
|
|
|
ui->proxyType->setCurrentIndex(0);
|
2017-12-02 22:05:47 +01:00
|
|
|
} else {
|
|
|
|
ui->manualProxy->setChecked(true);
|
|
|
|
ui->proxyType->setCurrentIndex(1);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-26 19:47:12 +02:00
|
|
|
|
|
|
|
ui->proxyServer->setText(settings.value("HostName", "").toString());
|
|
|
|
ui->proxyPort->setText(settings.value("Port", 8080).toString());
|
|
|
|
ui->proxyUsername->setText(settings.value("Username", "").toString());
|
|
|
|
ui->proxyPassword->setText(settings.value("Password", "").toString());
|
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2017-12-02 22:05:47 +01:00
|
|
|
setManualProxyConfigurationEnabled(ui->manualProxy->isChecked());
|
2012-03-21 15:05:04 +01:00
|
|
|
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
|
|
|
|
2011-04-26 19:47:12 +02:00
|
|
|
//CONNECTS
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
|
|
|
connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
|
2013-01-28 18:20:36 +01:00
|
|
|
connect(ui->html5permissions, SIGNAL(clicked()), this, SLOT(showHtml5Permissions()));
|
2011-10-18 17:39:51 +02:00
|
|
|
connect(ui->preferredLanguages, SIGNAL(clicked()), this, SLOT(showAcceptLanguage()));
|
2012-01-27 23:01:17 +01:00
|
|
|
connect(ui->deleteHtml5storage, SIGNAL(clicked()), this, SLOT(deleteHtml5storage()));
|
2012-08-17 20:55:11 +02:00
|
|
|
connect(ui->uaManager, SIGNAL(clicked()), this, SLOT(openUserAgentManager()));
|
2012-12-28 01:17:01 +01:00
|
|
|
connect(ui->jsOptionsButton, SIGNAL(clicked()), this, SLOT(openJsOptions()));
|
2014-07-08 19:17:42 +02:00
|
|
|
connect(ui->searchEngines, SIGNAL(clicked()), this, SLOT(openSearchEnginesManager()));
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-08-16 23:14:04 +02:00
|
|
|
ui->listWidget->setCurrentRow(currentSettingsPage);
|
2013-01-09 18:47:36 +01:00
|
|
|
|
2013-04-01 15:01:58 +02:00
|
|
|
QDesktopWidget* desktop = QApplication::desktop();
|
|
|
|
QSize s = size();
|
|
|
|
if (desktop->availableGeometry(this).size().width() < s.width()) {
|
|
|
|
s.setWidth(desktop->availableGeometry(this).size().width() - 50);
|
|
|
|
}
|
|
|
|
if (desktop->availableGeometry(this).size().height() < s.height()) {
|
|
|
|
s.setHeight(desktop->availableGeometry(this).size().height() - 50);
|
|
|
|
}
|
|
|
|
resize(s);
|
|
|
|
|
2014-11-10 12:05:49 +01:00
|
|
|
settings.beginGroup(QSL("Preferences"));
|
|
|
|
restoreGeometry(settings.value(QSL("Geometry")).toByteArray());
|
|
|
|
settings.endGroup();
|
|
|
|
|
2013-07-07 12:32:55 +02:00
|
|
|
QzTools::setWmClass("Preferences", this);
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
2015-09-30 18:43:58 +02:00
|
|
|
void Preferences::chooseExternalDownloadManager()
|
|
|
|
{
|
|
|
|
QString path = QzTools::getOpenFileName("Preferences-ExternalDownloadManager", this, tr("Choose executable location..."), QDir::homePath());
|
|
|
|
if (path.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->externalDownExecutable->setText(path);
|
|
|
|
}
|
|
|
|
|
2011-03-17 17:03:04 +01:00
|
|
|
void Preferences::showStackedPage(QListWidgetItem* item)
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
2011-11-06 17:01:23 +01:00
|
|
|
if (!item) {
|
2011-03-02 16:57:41 +01:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2012-03-13 17:51:06 +01:00
|
|
|
|
2012-07-06 14:37:49 +02:00
|
|
|
int index = ui->listWidget->currentRow();
|
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->caption->setText("<b>" + item->text() + "</b>");
|
2012-07-06 14:37:49 +02:00
|
|
|
ui->stackedWidget->setCurrentIndex(index);
|
2011-11-06 17:01:23 +01:00
|
|
|
|
2017-01-21 18:38:19 +01:00
|
|
|
if (m_notification) {
|
|
|
|
m_notifPosition = m_notification.data()->pos();
|
|
|
|
delete m_notification.data();
|
|
|
|
}
|
2013-07-14 22:29:47 +02:00
|
|
|
|
2012-12-06 22:28:12 +01:00
|
|
|
if (index == 10) {
|
2012-07-06 14:37:49 +02:00
|
|
|
m_pluginsList->load();
|
|
|
|
}
|
2013-07-14 22:29:47 +02:00
|
|
|
|
|
|
|
if (index == 7 && !m_autoFillManager) {
|
|
|
|
m_autoFillManager = new AutoFillManager(this);
|
|
|
|
ui->autoFillFrame->addWidget(m_autoFillManager);
|
|
|
|
}
|
2011-12-16 19:07:36 +01:00
|
|
|
}
|
2011-11-19 17:38:47 +01:00
|
|
|
|
2017-01-21 18:38:19 +01:00
|
|
|
void Preferences::showNotificationPreview()
|
2011-12-16 19:07:36 +01:00
|
|
|
{
|
2017-01-21 18:38:19 +01:00
|
|
|
if (ui->useOSDNotifications->isChecked()) {
|
|
|
|
if (m_notification) {
|
|
|
|
m_notifPosition = m_notification.data()->pos();
|
|
|
|
delete m_notification.data();
|
2011-12-16 19:07:36 +01:00
|
|
|
}
|
2017-01-21 18:38:19 +01:00
|
|
|
|
|
|
|
m_notification = new DesktopNotification(true);
|
|
|
|
m_notification.data()->setHeading(tr("OSD Notification"));
|
|
|
|
m_notification.data()->setText(tr("Drag it on the screen to place it where you want."));
|
|
|
|
m_notification.data()->move(m_notifPosition);
|
|
|
|
m_notification.data()->show();
|
|
|
|
}
|
|
|
|
else if (ui->useNativeSystemNotifications->isChecked()) {
|
|
|
|
mApp->desktopNotifications()->nativeNotificationPreview();
|
2011-12-16 19:07:36 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
2011-12-16 19:07:36 +01:00
|
|
|
|
2017-08-25 17:11:29 +02:00
|
|
|
void Preferences::makeFalkonDefault()
|
2012-12-01 07:50:31 +01:00
|
|
|
{
|
2014-01-01 23:15:50 +01:00
|
|
|
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
2017-08-25 17:11:29 +02:00
|
|
|
disconnect(ui->checkNowDefaultBrowser, SIGNAL(clicked()), this, SLOT(makeFalkonDefault()));
|
2013-04-05 11:39:19 +02:00
|
|
|
ui->checkNowDefaultBrowser->setText(tr("Default"));
|
2012-12-01 07:50:31 +01:00
|
|
|
ui->checkNowDefaultBrowser->setEnabled(false);
|
2017-08-22 02:01:00 +02:00
|
|
|
|
|
|
|
if (!mApp->associationManager()->showNativeDefaultAppSettingsUi())
|
|
|
|
mApp->associationManager()->registerAllAssociation();
|
2012-12-01 07:50:31 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::allowCacheChanged(bool state)
|
|
|
|
{
|
2017-01-27 13:37:56 +01:00
|
|
|
ui->removeCache->setEnabled(state);
|
2017-01-22 09:22:03 +01:00
|
|
|
ui->maxCacheLabel->setEnabled(state);
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->cacheMB->setEnabled(state);
|
2013-02-10 14:50:18 +01:00
|
|
|
ui->storeCacheLabel->setEnabled(state);
|
|
|
|
ui->cachePath->setEnabled(state);
|
|
|
|
ui->changeCachePath->setEnabled(state);
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::useActualHomepage()
|
|
|
|
{
|
2014-10-07 16:15:23 +02:00
|
|
|
if (!m_window)
|
|
|
|
return;
|
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
ui->homepage->setText(m_window->weView()->url().toString());
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::useActualNewTab()
|
|
|
|
{
|
2014-10-07 16:15:23 +02:00
|
|
|
if (!m_window)
|
|
|
|
return;
|
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
ui->newTabUrl->setText(m_window->weView()->url().toString());
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::chooseDownPath()
|
|
|
|
{
|
2013-12-25 19:06:58 +01:00
|
|
|
QString userFileName = QzTools::getExistingDirectory("Preferences-ChooseDownPath", this, tr("Choose download location..."), QDir::homePath());
|
2011-11-06 17:01:23 +01:00
|
|
|
if (userFileName.isEmpty()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??)
|
2012-09-04 12:42:45 +02:00
|
|
|
userFileName.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
2011-10-17 09:57:07 +02:00
|
|
|
#endif
|
2012-09-04 12:42:45 +02:00
|
|
|
userFileName += QLatin1Char('/');
|
2011-10-17 09:57:07 +02:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->downLoc->setText(userFileName);
|
|
|
|
}
|
|
|
|
|
2011-05-10 21:25:31 +02:00
|
|
|
void Preferences::chooseUserStyleClicked()
|
|
|
|
{
|
2013-12-26 20:49:59 +01:00
|
|
|
QString file = QzTools::getOpenFileName("Preferences-UserStyle", this, tr("Choose stylesheet location..."), QDir::homePath(), "*.css");
|
2011-11-06 17:01:23 +01:00
|
|
|
if (file.isEmpty()) {
|
2011-05-10 21:25:31 +02:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-05-10 21:25:31 +02:00
|
|
|
ui->userStyleSheet->setText(file);
|
|
|
|
}
|
|
|
|
|
2012-01-27 23:01:17 +01:00
|
|
|
void Preferences::deleteHtml5storage()
|
|
|
|
{
|
2012-03-23 17:29:12 +01:00
|
|
|
ClearPrivateData::clearLocalStorage();
|
2012-01-27 23:01:17 +01:00
|
|
|
|
|
|
|
ui->deleteHtml5storage->setText(tr("Deleted"));
|
|
|
|
ui->deleteHtml5storage->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
2012-08-17 20:55:11 +02:00
|
|
|
void Preferences::openUserAgentManager()
|
|
|
|
{
|
2014-11-07 18:08:12 +01:00
|
|
|
UserAgentDialog* dialog = new UserAgentDialog(this);
|
|
|
|
dialog->open();
|
2012-08-17 20:55:11 +02:00
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::downLocChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->downButt->setEnabled(state);
|
|
|
|
ui->downLoc->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2011-04-26 19:47:12 +02:00
|
|
|
void Preferences::setManualProxyConfigurationEnabled(bool state)
|
|
|
|
{
|
|
|
|
ui->proxyType->setEnabled(state);
|
|
|
|
ui->proxyServer->setEnabled(state);
|
|
|
|
ui->proxyPort->setEnabled(state);
|
|
|
|
ui->proxyUsername->setEnabled(state);
|
|
|
|
ui->proxyPassword->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2016-01-14 03:29:47 +01:00
|
|
|
void Preferences::searchFromAddressBarChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->searchWithDefaultEngine->setEnabled(stat);
|
2017-12-31 16:43:27 +01:00
|
|
|
ui->showABSearchSuggestions->setEnabled(stat);
|
2016-01-14 03:29:47 +01:00
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::saveHistoryChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->deleteHistoryOnClose->setEnabled(stat);
|
|
|
|
}
|
|
|
|
|
2012-01-26 18:23:35 +01:00
|
|
|
void Preferences::allowHtml5storageChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->deleteHtml5storageOnClose->setEnabled(stat);
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::showCookieManager()
|
|
|
|
{
|
2018-02-09 17:55:27 +01:00
|
|
|
CookieManager* dialog = new CookieManager(this);
|
2015-09-25 22:31:04 +02:00
|
|
|
dialog->show();
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
2013-01-28 18:20:36 +01:00
|
|
|
void Preferences::showHtml5Permissions()
|
|
|
|
{
|
2014-11-07 18:08:12 +01:00
|
|
|
HTML5PermissionsDialog* dialog = new HTML5PermissionsDialog(this);
|
|
|
|
dialog->open();
|
2013-01-28 18:20:36 +01:00
|
|
|
}
|
|
|
|
|
2012-12-28 01:17:01 +01:00
|
|
|
void Preferences::openJsOptions()
|
|
|
|
{
|
2014-11-07 18:08:12 +01:00
|
|
|
JsOptions* dialog = new JsOptions(this);
|
|
|
|
dialog->open();
|
2012-12-28 01:17:01 +01:00
|
|
|
}
|
|
|
|
|
2015-09-30 18:43:58 +02:00
|
|
|
void Preferences::useExternalDownManagerChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->externalDownExecutable->setEnabled(state);
|
|
|
|
ui->externalDownArguments->setEnabled(state);
|
|
|
|
ui->chooseExternalDown->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2014-07-08 19:17:42 +02:00
|
|
|
void Preferences::openSearchEnginesManager()
|
|
|
|
{
|
|
|
|
SearchEnginesDialog* dialog = new SearchEnginesDialog(this);
|
2014-11-07 18:08:12 +01:00
|
|
|
dialog->open();
|
2014-07-08 19:17:42 +02:00
|
|
|
}
|
|
|
|
|
2011-10-18 17:39:51 +02:00
|
|
|
void Preferences::showAcceptLanguage()
|
|
|
|
{
|
2014-11-07 18:08:12 +01:00
|
|
|
AcceptLanguage* dialog = new AcceptLanguage(this);
|
|
|
|
dialog->open();
|
2011-10-18 17:39:51 +02:00
|
|
|
}
|
|
|
|
|
2012-03-29 20:02:21 +02:00
|
|
|
void Preferences::newTabChanged(int value)
|
|
|
|
{
|
|
|
|
ui->newTabFrame->setVisible(value == 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::afterLaunchChanged(int value)
|
|
|
|
{
|
2018-01-02 18:49:37 +01:00
|
|
|
ui->dontLoadTabsUntilSelected->setEnabled(value == 3 || value == 4);
|
2012-03-29 20:02:21 +02:00
|
|
|
}
|
|
|
|
|
2013-02-10 14:50:18 +01:00
|
|
|
void Preferences::changeCachePathClicked()
|
|
|
|
{
|
2013-12-25 19:06:58 +01:00
|
|
|
QString path = QzTools::getExistingDirectory("Preferences-CachePath", this, tr("Choose cache path..."), ui->cachePath->text());
|
2013-02-10 14:50:18 +01:00
|
|
|
if (path.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->cachePath->setText(path);
|
|
|
|
}
|
|
|
|
|
2011-03-17 17:03:04 +01:00
|
|
|
void Preferences::buttonClicked(QAbstractButton* button)
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
switch (ui->buttonBox->buttonRole(button)) {
|
|
|
|
case QDialogButtonBox::ApplyRole:
|
|
|
|
saveSettings();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QDialogButtonBox::RejectRole:
|
|
|
|
close();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QDialogButtonBox::AcceptRole:
|
|
|
|
saveSettings();
|
|
|
|
close();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
void Preferences::createProfile()
|
|
|
|
{
|
|
|
|
QString name = QInputDialog::getText(this, tr("New Profile"), tr("Enter the new profile's name:"));
|
2013-01-22 19:04:22 +01:00
|
|
|
name = QzTools::filterCharsFromFilename(name);
|
2014-03-09 21:51:42 +01:00
|
|
|
|
2012-03-29 20:02:21 +02:00
|
|
|
if (name.isEmpty()) {
|
2011-04-04 19:29:03 +02:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2014-03-09 21:51:42 +01:00
|
|
|
|
2015-09-28 20:44:15 +02:00
|
|
|
int res = ProfileManager::createProfile(name);
|
2014-03-09 21:51:42 +01:00
|
|
|
|
|
|
|
if (res == -1) {
|
2011-04-04 19:29:03 +02:00
|
|
|
QMessageBox::warning(this, tr("Error!"), tr("This profile already exists!"));
|
|
|
|
return;
|
|
|
|
}
|
2014-03-09 21:51:42 +01:00
|
|
|
|
|
|
|
if (res != 0) {
|
2011-04-04 19:29:03 +02:00
|
|
|
QMessageBox::warning(this, tr("Error!"), tr("Cannot create profile directory!"));
|
|
|
|
return;
|
|
|
|
}
|
2012-08-01 23:02:04 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
ui->startProfile->addItem(name);
|
|
|
|
ui->startProfile->setCurrentIndex(ui->startProfile->count() - 1);
|
2011-04-04 19:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::deleteProfile()
|
|
|
|
{
|
|
|
|
QString name = ui->startProfile->currentText();
|
|
|
|
QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Confirmation"),
|
2016-02-15 09:58:14 +01:00
|
|
|
tr("Are you sure you want to permanently delete \"%1\" profile? This action cannot be undone!").arg(name), QMessageBox::Yes | QMessageBox::No);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (button != QMessageBox::Yes) {
|
2011-04-04 19:29:03 +02:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-04 19:29:03 +02:00
|
|
|
|
2015-09-28 20:44:15 +02:00
|
|
|
ProfileManager::removeProfile(name);
|
2014-03-09 21:51:42 +01:00
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
ui->startProfile->removeItem(ui->startProfile->currentIndex());
|
|
|
|
}
|
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
void Preferences::startProfileIndexChanged(int index)
|
2011-04-04 19:29:03 +02:00
|
|
|
{
|
2017-01-22 10:34:44 +01:00
|
|
|
const bool current = ui->startProfile->itemText(index) == ProfileManager::currentProfile();
|
2014-03-09 21:51:42 +01:00
|
|
|
|
2017-01-22 10:34:44 +01:00
|
|
|
ui->deleteProfile->setEnabled(!current);
|
|
|
|
ui->cannotDeleteActiveProfileLabel->setText(current ? tr("Note: You cannot delete active profile.") : QString());
|
2011-04-04 19:29:03 +02:00
|
|
|
}
|
|
|
|
|
2012-08-17 20:55:11 +02:00
|
|
|
void Preferences::closeEvent(QCloseEvent* event)
|
|
|
|
{
|
|
|
|
Settings settings;
|
|
|
|
settings.beginGroup("Browser-View-Settings");
|
|
|
|
settings.setValue("settingsDialogPage", ui->stackedWidget->currentIndex());
|
|
|
|
settings.endGroup();
|
|
|
|
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::saveSettings()
|
|
|
|
{
|
2012-01-11 21:58:25 +01:00
|
|
|
Settings settings;
|
2011-03-02 16:57:41 +01:00
|
|
|
//GENERAL URLs
|
2015-10-01 18:35:29 +02:00
|
|
|
QUrl homepage = QUrl::fromUserInput(ui->homepage->text());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-11-08 11:54:46 +01:00
|
|
|
settings.beginGroup("Web-URL-Settings");
|
|
|
|
settings.setValue("homepage", homepage);
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("afterLaunch", ui->afterLaunch->currentIndex());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-12-02 23:25:27 +01:00
|
|
|
switch (ui->newTab->currentIndex()) {
|
|
|
|
case 0:
|
2017-02-07 10:41:58 +01:00
|
|
|
settings.setValue("newTabUrl", QUrl());
|
2011-12-02 23:25:27 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("newTabUrl", homepage);
|
2011-12-02 23:25:27 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2017-08-25 17:11:29 +02:00
|
|
|
settings.setValue("newTabUrl", QUrl(QSL("falkon:speeddial")));
|
2011-12-02 23:25:27 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2015-10-01 18:35:29 +02:00
|
|
|
settings.setValue("newTabUrl", QUrl::fromUserInput(ui->newTabUrl->text()));
|
2011-12-02 23:25:27 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
settings.endGroup();
|
|
|
|
//PROFILES
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//WINDOW
|
|
|
|
settings.beginGroup("Browser-View-Settings");
|
2014-03-14 13:33:33 +01:00
|
|
|
settings.setValue("showStatusBar", ui->showStatusbar->isChecked());
|
2016-08-23 08:57:11 +02:00
|
|
|
settings.setValue("instantBookmarksToolbar", ui->instantBookmarksToolbar->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("showBookmarksToolbar", ui->showBookmarksToolbar->isChecked());
|
|
|
|
settings.setValue("showNavigationToolbar", ui->showNavigationToolbar->isChecked());
|
|
|
|
settings.endGroup();
|
|
|
|
|
|
|
|
//TABS
|
|
|
|
settings.beginGroup("Browser-Tabs-Settings");
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
2012-01-24 15:16:33 +01:00
|
|
|
settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked());
|
2013-01-25 23:49:46 +01:00
|
|
|
settings.setValue("newEmptyTabAfterActive", ui->openNewEmptyTabAfterActive->isChecked());
|
2016-02-14 10:37:28 +01:00
|
|
|
settings.setValue("OpenPopupsInTabs", ui->openPopupsInTabs->isChecked());
|
2014-01-12 16:39:23 +01:00
|
|
|
settings.setValue("AlwaysSwitchTabsWithWheel", ui->alwaysSwitchTabsWithWheel->isChecked());
|
2012-06-26 23:39:23 +02:00
|
|
|
settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked());
|
2014-03-12 22:31:33 +01:00
|
|
|
settings.setValue("dontCloseWithOneTab", ui->dontCloseOnLastTab->isChecked());
|
2011-07-19 21:38:11 +02:00
|
|
|
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
2014-03-17 15:01:28 +01:00
|
|
|
settings.setValue("showClosedTabsButton", ui->showClosedTabsButton->isChecked());
|
2014-02-23 14:49:32 +01:00
|
|
|
settings.setValue("showCloseOnInactiveTabs", ui->showCloseOnInactive->currentIndex());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
2011-03-17 15:35:51 +01:00
|
|
|
|
|
|
|
//DOWNLOADS
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.beginGroup("DownloadManager");
|
2011-11-06 17:01:23 +01:00
|
|
|
if (ui->askEverytime->isChecked()) {
|
|
|
|
settings.setValue("defaultDownloadPath", "");
|
|
|
|
}
|
|
|
|
else {
|
2011-10-17 09:57:07 +02:00
|
|
|
settings.setValue("defaultDownloadPath", ui->downLoc->text());
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-10-30 16:32:36 +01:00
|
|
|
settings.setValue("CloseManagerOnFinish", ui->closeDownManOnFinish->isChecked());
|
2015-09-30 18:43:58 +02:00
|
|
|
settings.setValue("UseExternalManager", ui->useExternalDownManager->isChecked());
|
|
|
|
settings.setValue("ExternalManagerExecutable", ui->externalDownExecutable->text());
|
|
|
|
settings.setValue("ExternalManagerArguments", ui->externalDownArguments->text());
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-17 15:35:51 +01:00
|
|
|
//FONTS
|
|
|
|
settings.beginGroup("Browser-Fonts");
|
|
|
|
settings.setValue("StandardFont", ui->fontStandard->currentFont().family());
|
2013-03-18 22:55:18 +01:00
|
|
|
settings.setValue("CursiveFont", ui->fontCursive->currentFont().family());
|
2011-03-17 15:35:51 +01:00
|
|
|
settings.setValue("FantasyFont", ui->fontFantasy->currentFont().family());
|
|
|
|
settings.setValue("FixedFont", ui->fontFixed->currentFont().family());
|
|
|
|
settings.setValue("SansSerifFont", ui->fontSansSerif->currentFont().family());
|
|
|
|
settings.setValue("SerifFont", ui->fontSerif->currentFont().family());
|
2011-11-02 12:52:55 +01:00
|
|
|
|
2011-03-17 15:35:51 +01:00
|
|
|
settings.setValue("DefaultFontSize", ui->sizeDefault->value());
|
|
|
|
settings.setValue("FixedFontSize", ui->sizeFixed->value());
|
2012-01-23 19:28:47 +01:00
|
|
|
settings.setValue("MinimumFontSize", ui->sizeMinimum->value());
|
|
|
|
settings.setValue("MinimumLogicalFontSize", ui->sizeMinimumLogical->value());
|
2011-03-17 15:35:51 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2012-11-28 11:27:30 +01:00
|
|
|
//KEYBOARD SHORTCUTS
|
|
|
|
settings.beginGroup("Shortcuts");
|
|
|
|
settings.setValue("useTabNumberShortcuts", ui->switchTabsAlt->isChecked());
|
|
|
|
settings.setValue("useSpeedDialNumberShortcuts", ui->loadSpeedDialsCtrl->isChecked());
|
2014-04-05 03:00:06 +02:00
|
|
|
settings.setValue("useSingleKeyShortcuts", ui->singleKeyShortcuts->isChecked());
|
2012-11-28 11:27:30 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//BROWSING
|
|
|
|
settings.beginGroup("Web-Browser-Settings");
|
2015-10-05 17:29:09 +02:00
|
|
|
settings.setValue("allowPlugins", ui->allowPlugins->isChecked());
|
2011-11-02 12:52:55 +01:00
|
|
|
settings.setValue("allowJavaScript", ui->allowJavaScript->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("IncludeLinkInFocusChain", ui->linksInFocusChain->isChecked());
|
2013-04-23 13:31:29 +02:00
|
|
|
settings.setValue("SpatialNavigation", ui->spatialNavigation->isChecked());
|
2012-12-21 16:38:44 +01:00
|
|
|
settings.setValue("AnimateScrolling", ui->animateScrolling->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("wheelScrollLines", ui->wheelScroll->value());
|
2011-04-05 20:56:55 +02:00
|
|
|
settings.setValue("DoNotTrack", ui->doNotTrack->isChecked());
|
2011-10-02 17:39:59 +02:00
|
|
|
settings.setValue("CheckUpdates", ui->checkUpdates->isChecked());
|
2012-03-11 15:17:12 +01:00
|
|
|
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
|
2014-03-29 15:49:49 +01:00
|
|
|
settings.setValue("DefaultZoomLevel", ui->defaultZoomLevel->currentIndex());
|
2011-11-13 20:36:10 +01:00
|
|
|
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
|
2017-02-06 19:52:39 +01:00
|
|
|
settings.setValue("PrintElementBackground", ui->printEBackground->isChecked());
|
2014-07-17 23:05:38 +02:00
|
|
|
settings.setValue("closeAppWithCtrlQ", ui->closeAppWithCtrlQ->isChecked());
|
2016-12-26 12:38:51 +01:00
|
|
|
settings.setValue("UseNativeScrollbars", ui->useNativeScrollbars->isChecked());
|
2018-03-01 14:41:45 +01:00
|
|
|
settings.setValue("DisableVideoAutoPlay", ui->disableVideoAutoPlay->isChecked());
|
|
|
|
settings.setValue("WebRTCPublicIpOnly", ui->webRTCPublicIpOnly->isChecked());
|
|
|
|
|
2012-12-01 07:50:31 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked());
|
|
|
|
#endif
|
2011-03-02 16:57:41 +01:00
|
|
|
//Cache
|
|
|
|
settings.setValue("AllowLocalCache", ui->allowCache->isChecked());
|
2017-01-27 13:37:56 +01:00
|
|
|
settings.setValue("deleteCacheOnClose", ui->removeCache->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("LocalCacheSize", ui->cacheMB->value());
|
2013-02-10 14:50:18 +01:00
|
|
|
settings.setValue("CachePath", ui->cachePath->text());
|
2011-05-10 21:25:31 +02:00
|
|
|
//CSS Style
|
|
|
|
settings.setValue("userStyleSheet", ui->userStyleSheet->text());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-11-02 12:52:55 +01:00
|
|
|
//PASSWORD MANAGER
|
|
|
|
settings.setValue("SavePasswordsOnSites", ui->allowPassManager->isChecked());
|
2018-01-28 13:57:10 +01:00
|
|
|
settings.setValue("AutoCompletePasswords", ui->autoCompletePasswords->isChecked());
|
2011-11-02 12:52:55 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//PRIVACY
|
|
|
|
//Web storage
|
2012-01-26 18:23:35 +01:00
|
|
|
settings.setValue("allowHistory", ui->saveHistory->isChecked());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("deleteHistoryOnClose", ui->deleteHistoryOnClose->isChecked());
|
2012-01-26 18:23:35 +01:00
|
|
|
settings.setValue("HTML5StorageEnabled", ui->html5storage->isChecked());
|
|
|
|
settings.setValue("deleteHTML5StorageOnClose", ui->deleteHtml5storageOnClose->isChecked());
|
2012-02-17 18:55:34 +01:00
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
//NOTIFICATIONS
|
|
|
|
settings.beginGroup("Notifications");
|
|
|
|
settings.setValue("Timeout", ui->notificationTimeout->value() * 1000);
|
|
|
|
settings.setValue("Enabled", !ui->doNotUseNotifications->isChecked());
|
|
|
|
settings.setValue("UseNativeDesktop", ui->useNativeSystemNotifications->isChecked());
|
2011-12-09 21:56:01 +01:00
|
|
|
settings.setValue("Position", m_notification.data() ? m_notification.data()->pos() : m_notifPosition);
|
2011-04-27 09:49:41 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2016-10-25 23:36:39 +02:00
|
|
|
//SPELLCHECK
|
|
|
|
settings.beginGroup(QSL("SpellCheck"));
|
|
|
|
settings.setValue("Enabled", ui->spellcheckEnabled->isChecked());
|
2016-12-21 21:53:00 +01:00
|
|
|
QStringList languages;
|
2017-02-08 10:13:41 +01:00
|
|
|
for (int i = 0; i < ui->spellcheckLanguages->count(); ++i) {
|
|
|
|
QListWidgetItem *item = ui->spellcheckLanguages->item(i);
|
|
|
|
if (item->isSelected()) {
|
|
|
|
languages.append(item->data(Qt::UserRole).toString());
|
|
|
|
}
|
2016-12-21 21:53:00 +01:00
|
|
|
}
|
|
|
|
settings.setValue("Languages", languages);
|
2016-10-25 23:36:39 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//OTHER
|
|
|
|
//AddressBar
|
|
|
|
settings.beginGroup("AddressBar");
|
2012-08-10 18:06:29 +02:00
|
|
|
settings.setValue("showSuggestions", ui->addressbarCompletion->currentIndex());
|
2014-01-08 10:29:01 +01:00
|
|
|
settings.setValue("useInlineCompletion", ui->useInlineCompletion->isChecked());
|
2013-06-05 00:02:43 +02:00
|
|
|
settings.setValue("alwaysShowGoIcon", ui->alwaysShowGoIcon->isChecked());
|
2012-12-04 14:29:27 +01:00
|
|
|
settings.setValue("showSwitchTab", ui->completionShowSwitchTab->isChecked());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("SelectAllTextOnDoubleClick", ui->selectAllOnFocus->isChecked());
|
2011-11-16 16:47:08 +01:00
|
|
|
settings.setValue("SelectAllTextOnClick", ui->selectAllOnClick->isChecked());
|
2012-08-24 20:53:53 +02:00
|
|
|
settings.setValue("ShowLoadingProgress", ui->showLoadingInAddressBar->isChecked());
|
2012-09-19 10:08:30 +02:00
|
|
|
settings.setValue("ProgressStyle", ui->progressStyleSelector->currentIndex());
|
|
|
|
settings.setValue("UseCustomProgressColor", ui->checkBoxCustomProgressColor->isChecked());
|
|
|
|
settings.setValue("CustomProgressColor", ui->customColorToolButton->property("ProgressColor").value<QColor>());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
2011-11-02 12:52:55 +01:00
|
|
|
|
2012-09-27 11:59:09 +02:00
|
|
|
settings.beginGroup("SearchEngines");
|
2016-01-14 03:29:47 +01:00
|
|
|
settings.setValue("SearchFromAddressBar", ui->searchFromAddressBar->isChecked());
|
2012-09-27 11:59:09 +02:00
|
|
|
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
|
2017-12-31 16:43:27 +01:00
|
|
|
settings.setValue("showSearchSuggestions", ui->showABSearchSuggestions->isChecked());
|
2012-09-27 11:59:09 +02:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-04-26 19:47:12 +02:00
|
|
|
//Proxy Configuration
|
2017-12-02 22:05:47 +01:00
|
|
|
int proxyType;
|
|
|
|
if (ui->noProxy->isChecked()) {
|
|
|
|
proxyType = 0;
|
|
|
|
} else if (ui->systemProxy->isChecked()) {
|
|
|
|
proxyType = 2;
|
|
|
|
} else if (ui->proxyType->currentIndex() == 0) { // Http
|
|
|
|
proxyType = 3;
|
|
|
|
} else { // Socks5
|
|
|
|
proxyType = 4;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-26 19:47:12 +02:00
|
|
|
|
|
|
|
settings.beginGroup("Web-Proxy");
|
|
|
|
settings.setValue("ProxyType", proxyType);
|
|
|
|
settings.setValue("HostName", ui->proxyServer->text());
|
|
|
|
settings.setValue("Port", ui->proxyPort->text().toInt());
|
|
|
|
settings.setValue("Username", ui->proxyUsername->text());
|
|
|
|
settings.setValue("Password", ui->proxyPassword->text());
|
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2015-09-28 20:44:15 +02:00
|
|
|
ProfileManager::setStartingProfile(ui->startProfile->currentText());
|
2011-04-04 19:29:03 +02:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
m_pluginsList->save();
|
2011-09-11 19:15:06 +02:00
|
|
|
m_themesManager->save();
|
2011-03-04 13:59:07 +01:00
|
|
|
mApp->cookieJar()->loadSettings();
|
|
|
|
mApp->history()->loadSettings();
|
2014-03-10 00:47:07 +01:00
|
|
|
mApp->reloadSettings();
|
2011-04-27 09:49:41 +02:00
|
|
|
mApp->desktopNotifications()->loadSettings();
|
2011-11-02 12:52:55 +01:00
|
|
|
mApp->autoFill()->loadSettings();
|
2015-10-15 14:39:18 +02:00
|
|
|
mApp->networkManager()->loadSettings();
|
2016-12-26 12:38:51 +01:00
|
|
|
|
|
|
|
WebScrollBarManager::instance()->loadSettings();
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Preferences::~Preferences()
|
|
|
|
{
|
2014-11-10 12:05:49 +01:00
|
|
|
Settings().setValue(QSL("Preferences/Geometry"), saveGeometry());
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
delete ui;
|
|
|
|
delete m_autoFillManager;
|
|
|
|
delete m_pluginsList;
|
2012-09-11 11:43:11 +02:00
|
|
|
delete m_notification.data();
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
2012-09-19 10:08:30 +02:00
|
|
|
|
|
|
|
void Preferences::setProgressBarColorIcon(QColor color)
|
|
|
|
{
|
|
|
|
const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
|
|
|
|
QPixmap pm(QSize(size, size));
|
|
|
|
if (!color.isValid()) {
|
2014-10-07 16:15:23 +02:00
|
|
|
color = palette().color(QPalette::Highlight);
|
2012-09-19 10:08:30 +02:00
|
|
|
}
|
|
|
|
pm.fill(color);
|
|
|
|
ui->customColorToolButton->setIcon(pm);
|
|
|
|
ui->customColorToolButton->setProperty("ProgressColor", color);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::selectCustomProgressBarColor()
|
|
|
|
{
|
|
|
|
QColor newColor = QColorDialog::getColor(ui->customColorToolButton->property("ProgressColor").value<QColor>(), this, tr("Select Color"));
|
|
|
|
if (newColor.isValid()) {
|
|
|
|
setProgressBarColorIcon(newColor);
|
|
|
|
}
|
|
|
|
}
|