2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2015-05-22 21:46:55 +02:00
|
|
|
* Copyright (C) 2010-2015 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"
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "qtwin.h"
|
2011-03-04 13:59:07 +01:00
|
|
|
#include "sslmanager.h"
|
2012-12-28 01:17:01 +01:00
|
|
|
#include "jsoptions.h"
|
2011-04-26 19:47:12 +02:00
|
|
|
#include "networkproxyfactory.h"
|
|
|
|
#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 "navigationbar.h"
|
|
|
|
#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"
|
2013-03-29 19:22:55 +01:00
|
|
|
#include "pac/pacmanager.h"
|
2014-07-08 19:17:42 +02:00
|
|
|
#include "searchenginesdialog.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>
|
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);
|
|
|
|
|
|
|
|
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)
|
|
|
|
: QWidget()
|
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)
|
2013-07-14 22:29:47 +02:00
|
|
|
, m_autoFillEnabled(false)
|
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);
|
2013-07-11 18:18:32 +02:00
|
|
|
ui->languages->setLayoutDirection(Qt::LeftToRight);
|
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
|
|
|
|
|
2012-09-05 19:58:30 +02:00
|
|
|
if (QIcon::themeName().toLower() == QLatin1String("oxygen")) {
|
2012-09-03 13:24:29 +02:00
|
|
|
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
|
|
|
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
|
|
|
|
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
|
|
|
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
|
|
|
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
|
2013-06-02 17:37:38 +02:00
|
|
|
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("configure-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
|
2012-11-28 11:27:30 +01:00
|
|
|
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
|
|
|
|
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
|
|
|
|
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
|
|
|
|
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
|
|
|
|
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
|
|
|
|
ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
2012-09-03 13:24:29 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
|
|
|
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("application-x-theme", QIcon(":/icons/preferences/application-x-theme.png")));
|
|
|
|
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
|
|
|
|
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
|
|
|
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
|
2012-11-28 11:27:30 +01:00
|
|
|
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("preferences-desktop-keyboard-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
|
|
|
|
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
|
|
|
|
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
|
|
|
|
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
|
|
|
|
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
|
|
|
|
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
|
|
|
|
ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
2012-09-03 13:24:29 +02:00
|
|
|
}
|
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");
|
2014-11-08 11:54:46 +01:00
|
|
|
m_homepage = settings.value("homepage", QUrl(QSL("qupzilla:start"))).toUrl();
|
|
|
|
m_newTabUrl = settings.value("newTabUrl", QUrl(QSL("qupzilla:speeddial"))).toUrl();
|
|
|
|
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());
|
2011-12-28 13:16:04 +01:00
|
|
|
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).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);
|
|
|
|
connect(ui->checkNowDefaultBrowser, SIGNAL(clicked()), this, SLOT(makeQupZillaDefault()));
|
|
|
|
}
|
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
|
|
|
}
|
2014-11-08 11:54:46 +01:00
|
|
|
else if (m_newTabUrl.toString() == QL1S("qupzilla: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");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->showStatusbar->setChecked(settings.value("showStatusBar", true).toBool());
|
2014-03-13 15:58:39 +01:00
|
|
|
ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", true).toBool());
|
|
|
|
ui->showNavigationToolbar->setChecked(settings.value("showNavigationToolbar", true).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->showHome->setChecked(settings.value("showHomeButton", true).toBool());
|
|
|
|
ui->showBackForward->setChecked(settings.value("showBackForwardButtons", true).toBool());
|
|
|
|
ui->showAddTabButton->setChecked(settings.value("showAddTabButton", false).toBool());
|
2012-10-20 11:31:45 +02:00
|
|
|
ui->showReloadStopButtons->setChecked(settings.value("showReloadButton", true).toBool());
|
2012-07-19 19:56:58 +02:00
|
|
|
ui->showWebSearchBar->setChecked(settings.value("showWebSearchBar", 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());
|
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-12 11:28:18 +01:00
|
|
|
ui->showTabPreviews->setChecked(settings.value("showTabPreviews", false).toBool());
|
2012-04-10 18:29:22 +02:00
|
|
|
ui->animatedTabPreviews->setChecked(settings.value("tabPreviewAnimationsEnabled", true).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
|
|
|
|
2012-04-10 18:29:22 +02:00
|
|
|
connect(ui->showTabPreviews, SIGNAL(toggled(bool)), this, SLOT(showTabPreviewsChanged(bool)));
|
|
|
|
showTabPreviewsChanged(ui->showTabPreviews->isChecked());
|
|
|
|
|
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());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->addCountryWithAlt->setChecked(settings.value("AddCountryDomainWithAltKey", true).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");
|
|
|
|
ui->searchWithDefaultEngine->setChecked(settings.value("SearchWithDefaultEngine", false).toBool());
|
|
|
|
settings.endGroup();
|
|
|
|
|
2014-03-29 15:49:49 +01:00
|
|
|
// BROWSING
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.beginGroup("Web-Browser-Settings");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->allowPlugins->setChecked(settings.value("allowFlash", true).toBool());
|
|
|
|
ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool());
|
|
|
|
ui->allowJava->setChecked(settings.value("allowJava", true).toBool());
|
|
|
|
ui->allowDNSPrefetch->setChecked(settings.value("DNS-Prefetch", false).toBool());
|
|
|
|
ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
|
|
|
|
ui->zoomTextOnly->setChecked(settings.value("zoomTextOnly", 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->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
|
|
|
|
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());
|
2014-01-04 19:00:01 +01:00
|
|
|
ui->formsUndoRedo->setChecked(settings.value("enableFormsUndoRedo", false).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->pagesInCache->setValue(settings.value("maximumCachedPages", 3).toInt());
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->pagesInCache, SIGNAL(valueChanged(int)), this, SLOT(pageCacheValueChanged(int)));
|
|
|
|
ui->pageCacheLabel->setText(QString::number(ui->pagesInCache->value()));
|
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
|
|
|
|
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
|
|
|
|
ui->MBlabel->setText(settings.value("LocalCacheSize", 50).toString() + " MB");
|
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)));
|
2011-11-06 17:01:23 +01:00
|
|
|
connect(ui->cacheMB, SIGNAL(valueChanged(int)), this, SLOT(cacheValueChanged(int)));
|
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());
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->allowPassManager, SIGNAL(toggled(bool)), this, SLOT(showPassManager(bool)));
|
|
|
|
|
2011-11-02 12:52:55 +01:00
|
|
|
showPassManager(ui->allowPassManager->isChecked());
|
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
|
|
|
ui->sendReferer->setChecked(settings.value("SendReferer", true).toBool());
|
|
|
|
|
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());
|
2012-04-05 10:27:35 +02:00
|
|
|
ui->downlaodNativeSystemDialog->setChecked(settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
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
|
|
|
}
|
2012-01-28 15:37:11 +01: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)));
|
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()));
|
2012-01-28 15:37:11 +01:00
|
|
|
connect(ui->chooseExternalDown, SIGNAL(clicked()), this, SLOT(chooseExternalDownloadManager()));
|
2011-03-02 16:57:41 +01:00
|
|
|
downLocChanged(ui->useDefined->isChecked());
|
2012-01-28 15:37:11 +01: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");
|
2015-01-27 11:01:52 +01:00
|
|
|
QWebEngineSettings* webSettings = QWebEngineSettings::globalSettings();
|
|
|
|
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString()));
|
|
|
|
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString()));
|
|
|
|
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString()));
|
|
|
|
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebEngineSettings::FixedFont)).toString()));
|
|
|
|
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", webSettings->fontFamily(QWebEngineSettings::SansSerifFont)).toString()));
|
|
|
|
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", webSettings->fontFamily(QWebEngineSettings::SerifFont)).toString()));
|
|
|
|
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
|
|
|
|
2011-12-16 19:07:36 +01:00
|
|
|
connect(ui->useNativeSystemNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
|
|
|
|
connect(ui->useOSDNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
|
|
|
|
|
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();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//OTHER
|
|
|
|
//Languages
|
2013-02-24 13:20:54 +01:00
|
|
|
QString activeLanguage = mApp->currentLanguage();
|
2014-01-04 11:14:48 +01:00
|
|
|
|
2013-02-24 13:20:54 +01:00
|
|
|
if (!activeLanguage.isEmpty() && activeLanguage != QLatin1String("en_US")) {
|
2014-01-04 11:14:48 +01:00
|
|
|
ui->languages->addItem(createLanguageItem(activeLanguage), activeLanguage);
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
2013-02-24 13:20:54 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->languages->addItem("English (en_US)");
|
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
const QStringList translationPaths = DataPaths::allPaths(DataPaths::Translations);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
foreach (const QString &path, translationPaths) {
|
|
|
|
QDir lanDir(path);
|
|
|
|
QStringList list = lanDir.entryList(QStringList("*.qm"));
|
|
|
|
foreach (const QString &name, list) {
|
|
|
|
if (name.startsWith(QLatin1String("qt_"))) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-07-10 22:26:59 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
QString loc = name;
|
|
|
|
loc.remove(QLatin1String(".qm"));
|
|
|
|
|
|
|
|
if (loc == activeLanguage) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-07-10 22:26:59 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
ui->languages->addItem(createLanguageItem(loc), loc);
|
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
2012-02-07 18:37:44 +01:00
|
|
|
|
2012-03-21 15:05:04 +01:00
|
|
|
// Proxy Configuration
|
2011-04-26 19:47:12 +02:00
|
|
|
settings.beginGroup("Web-Proxy");
|
|
|
|
NetworkProxyFactory::ProxyPreference proxyPreference = NetworkProxyFactory::ProxyPreference(settings.value("UseProxy", NetworkProxyFactory::SystemProxy).toInt());
|
|
|
|
QNetworkProxy::ProxyType proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());
|
|
|
|
|
|
|
|
ui->systemProxy->setChecked(proxyPreference == NetworkProxyFactory::SystemProxy);
|
|
|
|
ui->noProxy->setChecked(proxyPreference == NetworkProxyFactory::NoProxy);
|
|
|
|
ui->manualProxy->setChecked(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
2013-03-29 19:22:55 +01:00
|
|
|
ui->pacProxy->setChecked(proxyPreference == NetworkProxyFactory::ProxyAutoConfig);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (proxyType == QNetworkProxy::HttpProxy) {
|
2011-04-26 19:47:12 +02:00
|
|
|
ui->proxyType->setCurrentIndex(0);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-04-26 19:47:12 +02:00
|
|
|
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());
|
2012-03-21 15:05:04 +01:00
|
|
|
|
|
|
|
ui->useHttpsProxy->setChecked(settings.value("UseDifferentProxyForHttps", false).toBool());
|
|
|
|
ui->httpsProxyServer->setText(settings.value("HttpsHostName", "").toString());
|
|
|
|
ui->httpsProxyPort->setText(settings.value("HttpsPort", 8080).toString());
|
|
|
|
ui->httpsProxyUsername->setText(settings.value("HttpsUsername", "").toString());
|
|
|
|
ui->httpsProxyPassword->setText(settings.value("HttpsPassword", "").toString());
|
|
|
|
|
2013-03-29 19:22:55 +01:00
|
|
|
ui->pacUrl->setText(settings.value("PacUrl", QUrl()).toUrl().toString());
|
2012-07-06 20:28:10 +02:00
|
|
|
ui->proxyExceptions->setText(settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList().join(","));
|
2011-04-26 19:47:12 +02:00
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-03-21 15:05:04 +01:00
|
|
|
useDifferentProxyForHttpsChanged(ui->useHttpsProxy->isChecked());
|
|
|
|
setManualProxyConfigurationEnabled(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
2013-03-29 19:22:55 +01:00
|
|
|
setProxyAutoConfigEnabled(proxyPreference == NetworkProxyFactory::ProxyAutoConfig);
|
2012-03-21 15:05:04 +01:00
|
|
|
|
|
|
|
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
2013-03-29 19:22:55 +01:00
|
|
|
connect(ui->pacProxy, SIGNAL(toggled(bool)), this, SLOT(setProxyAutoConfigEnabled(bool)));
|
2012-03-21 15:05:04 +01:00
|
|
|
connect(ui->useHttpsProxy, SIGNAL(toggled(bool)), this, SLOT(useDifferentProxyForHttpsChanged(bool)));
|
2013-03-29 19:22:55 +01:00
|
|
|
connect(ui->reloadPac, SIGNAL(clicked()), this, SLOT(reloadPacFileClicked()));
|
2012-03-21 15:05:04 +01:00
|
|
|
|
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-03-04 13:59:07 +01:00
|
|
|
connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager()));
|
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
|
|
|
|
2014-04-17 15:20:54 +02:00
|
|
|
ui->version->setText(QSL(" QupZilla v") + QL1S(Qz::VERSION));
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2012-12-06 22:28:12 +01:00
|
|
|
setNotificationPreviewVisible(index == 9);
|
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);
|
|
|
|
m_autoFillManager->setVisible(m_autoFillEnabled);
|
|
|
|
}
|
2011-12-16 19:07:36 +01:00
|
|
|
}
|
2011-11-19 17:38:47 +01:00
|
|
|
|
2011-12-16 19:07:36 +01:00
|
|
|
void Preferences::setNotificationPreviewVisible(bool state)
|
|
|
|
{
|
2012-01-18 18:36:10 +01:00
|
|
|
if (!state && m_notification) {
|
2011-12-09 21:56:01 +01:00
|
|
|
m_notifPosition = m_notification.data()->pos();
|
|
|
|
delete m_notification.data();
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-12-16 19:07:36 +01:00
|
|
|
|
|
|
|
if (state) {
|
|
|
|
if (ui->useOSDNotifications->isChecked()) {
|
2012-01-18 18:36:10 +01:00
|
|
|
if (m_notification) {
|
2011-12-16 19:07:36 +01:00
|
|
|
m_notifPosition = m_notification.data()->pos();
|
|
|
|
delete m_notification.data();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_notification = new DesktopNotification(true);
|
|
|
|
m_notification.data()->setPixmap(QPixmap(":icons/preferences/stock_dialog-question.png"));
|
|
|
|
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-03-02 16:57:41 +01:00
|
|
|
}
|
2011-12-16 19:07:36 +01:00
|
|
|
|
2012-12-01 07:50:31 +01:00
|
|
|
void Preferences::makeQupZillaDefault()
|
|
|
|
{
|
2014-01-01 23:15:50 +01:00
|
|
|
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
2012-12-01 07:50:31 +01:00
|
|
|
disconnect(ui->checkNowDefaultBrowser, SIGNAL(clicked()), this, SLOT(makeQupZillaDefault()));
|
|
|
|
mApp->associationManager()->registerAllAssociation();
|
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);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::allowCacheChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->cacheFrame->setEnabled(state);
|
|
|
|
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-01-28 15:37:11 +01:00
|
|
|
void Preferences::chooseExternalDownloadManager()
|
|
|
|
{
|
2013-12-25 19:06:58 +01:00
|
|
|
QString path = QzTools::getOpenFileName("Preferences-ExternalDownloadManager", this, tr("Choose executable location..."), QDir::homePath());
|
2012-01-28 15:37:11 +01:00
|
|
|
if (path.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->externalDownExecutable->setText(path);
|
|
|
|
}
|
|
|
|
|
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);
|
2012-03-21 15:05:04 +01:00
|
|
|
|
|
|
|
useDifferentProxyForHttpsChanged(state ? ui->useHttpsProxy->isChecked() : false);
|
|
|
|
|
|
|
|
ui->useHttpsProxy->setEnabled(state);
|
2011-04-26 19:47:12 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 19:22:55 +01:00
|
|
|
void Preferences::setProxyAutoConfigEnabled(bool state)
|
|
|
|
{
|
|
|
|
ui->pacUrl->setEnabled(state);
|
|
|
|
ui->reloadPac->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
{
|
2015-09-25 22:31:04 +02:00
|
|
|
CookieManager* dialog = new CookieManager();
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-03-04 13:59:07 +01:00
|
|
|
void Preferences::openSslManager()
|
|
|
|
{
|
2011-10-26 19:23:50 +02:00
|
|
|
SSLManager* m = new SSLManager(this);
|
2014-11-07 18:08:12 +01:00
|
|
|
m->open();
|
2011-03-04 13:59:07 +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
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
ui->dontLoadTabsUntilSelected->setEnabled(value == 3);
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::cacheValueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->MBlabel->setText(QString::number(value) + " MB");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::pageCacheValueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->pageCacheLabel->setText(QString::number(value));
|
|
|
|
}
|
|
|
|
|
2012-01-28 15:37:11 +01:00
|
|
|
void Preferences::useExternalDownManagerChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->externalDownExecutable->setEnabled(state);
|
|
|
|
ui->externalDownArguments->setEnabled(state);
|
|
|
|
ui->chooseExternalDown->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2012-03-21 15:05:04 +01:00
|
|
|
void Preferences::useDifferentProxyForHttpsChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->httpsProxyServer->setEnabled(state);
|
|
|
|
ui->httpsProxyPort->setEnabled(state);
|
|
|
|
ui->httpsProxyUsername->setEnabled(state);
|
|
|
|
ui->httpsProxyPassword->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2012-04-10 18:29:22 +02:00
|
|
|
void Preferences::showTabPreviewsChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->animatedTabPreviews->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-03-29 19:22:55 +01:00
|
|
|
void Preferences::reloadPacFileClicked()
|
|
|
|
{
|
2015-01-27 11:01:52 +01:00
|
|
|
#if QTWEBENGINE_DISABLED
|
2013-03-29 19:22:55 +01:00
|
|
|
mApp->networkManager()->proxyFactory()->pacManager()->downloadPacFile();
|
2015-01-27 11:01:52 +01:00
|
|
|
#endif
|
2013-03-29 19:22:55 +01:00
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::showPassManager(bool state)
|
|
|
|
{
|
2013-07-14 22:29:47 +02:00
|
|
|
if (m_autoFillManager) {
|
|
|
|
m_autoFillManager->setVisible(state);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_autoFillEnabled = state;
|
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
ProfileManager profileManager;
|
|
|
|
int res = profileManager.createProfile(name);
|
|
|
|
|
|
|
|
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"),
|
2011-11-06 17:01:23 +01:00
|
|
|
tr("Are you sure to permanently delete \"%1\" profile? This action cannot be undone!").arg(name), QMessageBox::Yes | QMessageBox::No);
|
|
|
|
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
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
ProfileManager profileManager;
|
|
|
|
profileManager.removeProfile(name);
|
|
|
|
|
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
|
|
|
{
|
2014-03-09 21:51:42 +01:00
|
|
|
// Index 0 is current profile
|
|
|
|
|
|
|
|
ui->deleteProfile->setEnabled(index != 0);
|
2011-10-02 17:39:59 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
if (index == 0) {
|
2011-10-02 17:39:59 +02:00
|
|
|
ui->cannotDeleteActiveProfileLabel->setText(tr("Note: You cannot delete active profile."));
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-10-02 17:39:59 +02:00
|
|
|
ui->cannotDeleteActiveProfileLabel->setText(" ");
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
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
|
2014-11-08 11:54:46 +01:00
|
|
|
QUrl homepage = QUrl::fromEncoded(ui->homepage->text().toUtf8());
|
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:
|
2014-11-08 11:54:46 +01:00
|
|
|
settings.setValue("newTabUrl", QUrl(QSL("about:blank")));
|
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:
|
2014-11-08 11:54:46 +01:00
|
|
|
settings.setValue("newTabUrl", QUrl(QSL("qupzilla:speeddial")));
|
2011-12-02 23:25:27 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2014-11-08 11:54:46 +01:00
|
|
|
settings.setValue("newTabUrl", QUrl::fromEncoded(ui->newTabUrl->text().toUtf8()));
|
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());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("showBookmarksToolbar", ui->showBookmarksToolbar->isChecked());
|
|
|
|
settings.setValue("showNavigationToolbar", ui->showNavigationToolbar->isChecked());
|
|
|
|
settings.setValue("showHomeButton", ui->showHome->isChecked());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("showBackForwardButtons", ui->showBackForward->isChecked());
|
2012-07-19 19:56:58 +02:00
|
|
|
settings.setValue("showWebSearchBar", ui->showWebSearchBar->isChecked());
|
2011-04-19 20:46:31 +02:00
|
|
|
settings.setValue("showAddTabButton", ui->showAddTabButton->isChecked());
|
2012-10-20 11:31:45 +02:00
|
|
|
settings.setValue("showReloadButton", ui->showReloadStopButtons->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
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());
|
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());
|
2012-04-10 18:29:22 +02:00
|
|
|
settings.setValue("showTabPreviews", ui->showTabPreviews->isChecked());
|
|
|
|
settings.setValue("tabPreviewAnimationsEnabled", ui->animatedTabPreviews->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());
|
2011-05-25 14:26:36 +02:00
|
|
|
settings.setValue("useNativeDialog", ui->downlaodNativeSystemDialog->isChecked());
|
2012-01-28 15:37:11 +01: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");
|
2011-11-02 12:52:55 +01:00
|
|
|
settings.setValue("allowFlash", ui->allowPlugins->isChecked());
|
|
|
|
settings.setValue("allowJavaScript", ui->allowJavaScript->isChecked());
|
|
|
|
settings.setValue("allowJava", ui->allowJava->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("DNS-Prefetch", ui->allowDNSPrefetch->isChecked());
|
|
|
|
settings.setValue("IncludeLinkInFocusChain", ui->linksInFocusChain->isChecked());
|
|
|
|
settings.setValue("zoomTextOnly", ui->zoomTextOnly->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("PrintElementBackground", ui->printEBackground->isChecked());
|
|
|
|
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());
|
2014-01-04 19:00:01 +01:00
|
|
|
settings.setValue("enableFormsUndoRedo", ui->formsUndoRedo->isChecked());
|
2014-07-17 23:05:38 +02:00
|
|
|
settings.setValue("closeAppWithCtrlQ", ui->closeAppWithCtrlQ->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
|
2011-11-02 12:52:55 +01:00
|
|
|
settings.setValue("maximumCachedPages", ui->pagesInCache->value());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("AllowLocalCache", ui->allowCache->isChecked());
|
|
|
|
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());
|
|
|
|
|
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-01-27 23:01:17 +01:00
|
|
|
settings.setValue("SendReferer", ui->sendReferer->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();
|
|
|
|
|
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());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("AddCountryDomainWithAltKey", ui->addCountryWithAlt->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");
|
|
|
|
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
|
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//Languages
|
2011-10-18 17:39:51 +02:00
|
|
|
settings.beginGroup("Language");
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("language", ui->languages->itemData(ui->languages->currentIndex()).toString());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
2011-11-02 12:52:55 +01:00
|
|
|
|
2011-04-26 19:47:12 +02:00
|
|
|
//Proxy Configuration
|
|
|
|
NetworkProxyFactory::ProxyPreference proxyPreference;
|
2011-11-06 17:01:23 +01:00
|
|
|
if (ui->systemProxy->isChecked()) {
|
2011-04-26 19:47:12 +02:00
|
|
|
proxyPreference = NetworkProxyFactory::SystemProxy;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else if (ui->noProxy->isChecked()) {
|
2011-04-26 19:47:12 +02:00
|
|
|
proxyPreference = NetworkProxyFactory::NoProxy;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2013-03-29 19:22:55 +01:00
|
|
|
else if (ui->pacProxy->isChecked()) {
|
|
|
|
proxyPreference = NetworkProxyFactory::ProxyAutoConfig;
|
|
|
|
}
|
2011-11-06 17:01:23 +01:00
|
|
|
else {
|
2011-04-26 19:47:12 +02:00
|
|
|
proxyPreference = NetworkProxyFactory::DefinedProxy;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-26 19:47:12 +02:00
|
|
|
|
|
|
|
QNetworkProxy::ProxyType proxyType;
|
2011-11-06 17:01:23 +01:00
|
|
|
if (ui->proxyType->currentIndex() == 0) {
|
2011-04-26 19:47:12 +02:00
|
|
|
proxyType = QNetworkProxy::HttpProxy;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-04-26 19:47:12 +02:00
|
|
|
proxyType = QNetworkProxy::Socks5Proxy;
|
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("UseProxy", proxyPreference);
|
|
|
|
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());
|
2012-03-21 15:05:04 +01:00
|
|
|
|
|
|
|
settings.setValue("UseDifferentProxyForHttps", ui->useHttpsProxy->isChecked());
|
|
|
|
settings.setValue("HttpsHostName", ui->httpsProxyServer->text());
|
|
|
|
settings.setValue("HttpsPort", ui->httpsProxyPort->text());
|
|
|
|
settings.setValue("HttpsUsername", ui->httpsProxyUsername->text());
|
|
|
|
settings.setValue("HttpsPassword", ui->httpsProxyPassword->text());
|
|
|
|
|
2013-03-29 19:22:55 +01:00
|
|
|
settings.setValue("PacUrl", ui->pacUrl->text());
|
2013-02-15 12:36:25 +01:00
|
|
|
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(QLatin1Char(','), QString::SkipEmptyParts));
|
2011-04-26 19:47:12 +02:00
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-09 22:17:13 +01:00
|
|
|
ProfileManager profileManager;
|
|
|
|
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-03-04 13:59:07 +01:00
|
|
|
mApp->plugins()->c2f_saveSettings();
|
2015-01-27 11:01:52 +01:00
|
|
|
#if QTWEBENGINE_DISABLED
|
2011-04-26 19:47:12 +02:00
|
|
|
mApp->networkManager()->loadSettings();
|
2015-01-27 11:01:52 +01:00
|
|
|
#endif
|
2011-04-27 09:49:41 +02:00
|
|
|
mApp->desktopNotifications()->loadSettings();
|
2011-11-02 12:52:55 +01:00
|
|
|
mApp->autoFill()->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);
|
|
|
|
}
|
|
|
|
}
|