2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2013-01-23 01:34:15 +01:00
|
|
|
* Copyright (C) 2010-2013 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"
|
|
|
|
#include "qupzilla.h"
|
|
|
|
#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"
|
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"
|
2013-01-28 18:20:36 +01:00
|
|
|
#include "html5permissions/html5permissionsdialog.h"
|
2013-03-29 19:22:55 +01:00
|
|
|
#include "pac/pacmanager.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>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2011-11-02 12:52:55 +01:00
|
|
|
Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|
|
|
: QDialog(parent)
|
|
|
|
, ui(new Ui::Preferences)
|
|
|
|
, p_QupZilla(mainClass)
|
|
|
|
, 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);
|
|
|
|
|
2013-06-05 00:06:23 +02:00
|
|
|
m_themesManager = new ThemeManager(ui->themesWidget, this);
|
|
|
|
m_autoFillManager = new AutoFillManager(this);
|
|
|
|
ui->autoFillFrame->addWidget(m_autoFillManager);
|
|
|
|
m_pluginsList = new PluginsManager(this);
|
|
|
|
ui->pluginsFrame->addWidget(m_pluginsList);
|
|
|
|
|
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");
|
2011-11-06 17:01:23 +01:00
|
|
|
m_homepage = settings.value("homepage", "qupzilla:start").toString();
|
2011-12-04 16:54:57 +01:00
|
|
|
m_newTabUrl = settings.value("newTabUrl", "qupzilla:speeddial").toString();
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->homepage->setText(m_homepage);
|
|
|
|
ui->newTabUrl->setText(m_newTabUrl);
|
2011-11-06 17:01:23 +01:00
|
|
|
int afterLaunch = settings.value("afterLaunch", 1).toInt();
|
2011-04-04 19:29:03 +02:00
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->afterLaunch->setCurrentIndex(afterLaunch);
|
2011-12-28 13:16:04 +01:00
|
|
|
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool());
|
2012-03-11 15:17:12 +01:00
|
|
|
ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", false).toBool());
|
2012-12-01 07:50:31 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
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()));
|
|
|
|
}
|
|
|
|
#else // just Windows
|
|
|
|
ui->hSpacerDefaultBrowser->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
ui->hLayoutDefaultBrowser->invalidate();
|
|
|
|
delete ui->hLayoutDefaultBrowser;
|
|
|
|
delete ui->checkDefaultBrowser;
|
|
|
|
delete ui->checkNowDefaultBrowser;
|
|
|
|
#endif
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTabFrame->setVisible(false);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (m_newTabUrl.isEmpty()) {
|
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
|
|
|
}
|
2012-09-04 12:42:45 +02:00
|
|
|
else if (m_newTabUrl == QLatin1String("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)));
|
2012-09-17 12:29:08 +02:00
|
|
|
if (p_QupZilla) {
|
|
|
|
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);
|
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
//PROFILES
|
2012-04-04 18:48:54 +02:00
|
|
|
m_actProfileName = mApp->currentProfilePath();
|
2011-12-27 19:10:53 +01:00
|
|
|
m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1);
|
2012-09-04 12:42:45 +02:00
|
|
|
m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf(QLatin1Char('/')));
|
|
|
|
m_actProfileName.remove(QLatin1Char('/'));
|
2011-12-27 15:26:32 +01:00
|
|
|
|
|
|
|
ui->activeProfile->setText("<b>" + m_actProfileName + "</b>");
|
|
|
|
|
2011-12-28 14:55:54 +01:00
|
|
|
QSettings profileSettings(mApp->PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat);
|
2011-12-27 15:26:32 +01:00
|
|
|
QString actProfileName = profileSettings.value("Profiles/startProfile", "default").toString();
|
2011-10-15 16:37:32 +02:00
|
|
|
|
2011-12-27 15:26:32 +01:00
|
|
|
ui->startProfile->addItem(actProfileName);
|
2011-12-28 14:55:54 +01:00
|
|
|
QDir profilesDir(mApp->PROFILEDIR + "profiles/");
|
2011-09-11 19:15:06 +02:00
|
|
|
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
2013-03-06 09:05:41 +01:00
|
|
|
foreach (const QString &name, list_) {
|
2011-12-27 15:26:32 +01:00
|
|
|
if (actProfileName == name) {
|
2011-04-04 19:29:03 +02:00
|
|
|
continue;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2012-04-04 21:12:52 +02:00
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
ui->startProfile->addItem(name);
|
|
|
|
}
|
|
|
|
connect(ui->createProfile, SIGNAL(clicked()), this, SLOT(createProfile()));
|
|
|
|
connect(ui->deleteProfile, SIGNAL(clicked()), this, SLOT(deleteProfile()));
|
|
|
|
connect(ui->startProfile, SIGNAL(currentIndexChanged(QString)), this, SLOT(startProfileIndexChanged(QString)));
|
2011-12-27 15:26:32 +01:00
|
|
|
startProfileIndexChanged(ui->startProfile->currentText());
|
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());
|
2012-09-17 12:29:08 +02:00
|
|
|
if (p_QupZilla) {
|
|
|
|
ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible());
|
|
|
|
ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
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());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->useTransparentBg->setChecked(settings.value("useTransparentBackground", false).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();
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->useTransparentBg->setEnabled(QtWin::isCompositionEnabled());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//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());
|
2012-06-26 23:39:23 +02:00
|
|
|
ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool());
|
2012-01-20 14:12:26 +01:00
|
|
|
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
2012-01-23 00:23:45 +01:00
|
|
|
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
|
2012-04-10 18:29:22 +02:00
|
|
|
ui->showTabPreviews->setChecked(settings.value("showTabPreviews", true).toBool());
|
|
|
|
ui->animatedTabPreviews->setChecked(settings.value("tabPreviewAnimationsEnabled", true).toBool());
|
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());
|
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);
|
|
|
|
QColor pbColor = settings.value("CustomProgressColor", p_QupZilla->palette().color(QPalette::Highlight)).value<QColor>();
|
|
|
|
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();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//BROWSING
|
|
|
|
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-22 13:52:46 +01:00
|
|
|
ui->caretBrowsing->setChecked(settings.value("CaretBrowsing", 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());
|
|
|
|
ui->defaultZoom->setValue(settings.value("DefaultZoom", 100).toInt());
|
2011-11-13 20:36:10 +01:00
|
|
|
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
|
2011-11-06 17:01:23 +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");
|
2013-02-10 14:50:18 +01:00
|
|
|
ui->cachePath->setText(settings.value("CachePath", QString("%1networkcache/").arg(mApp->currentProfilePath())).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
|
|
|
|
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
|
|
|
|
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");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", mApp->webSettings()->fontFamily(QWebSettings::StandardFont)).toString()));
|
|
|
|
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", mApp->webSettings()->fontFamily(QWebSettings::CursiveFont)).toString()));
|
|
|
|
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", mApp->webSettings()->fontFamily(QWebSettings::FantasyFont)).toString()));
|
|
|
|
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", mApp->webSettings()->fontFamily(QWebSettings::FixedFont)).toString()));
|
|
|
|
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", mApp->webSettings()->fontFamily(QWebSettings::SansSerifFont)).toString()));
|
|
|
|
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", mApp->webSettings()->fontFamily(QWebSettings::SerifFont)).toString()));
|
|
|
|
|
|
|
|
ui->sizeDefault->setValue(settings.value("DefaultFontSize", mApp->webSettings()->fontSize(QWebSettings::DefaultFontSize)).toInt());
|
|
|
|
ui->sizeFixed->setValue(settings.value("FixedFontSize", mApp->webSettings()->fontSize(QWebSettings::DefaultFixedFontSize)).toInt());
|
2012-01-23 19:28:47 +01:00
|
|
|
ui->sizeMinimum->setValue(settings.value("MinimumFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumFontSize)).toInt());
|
|
|
|
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", mApp->webSettings()->fontSize(QWebSettings::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());
|
|
|
|
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);
|
2012-12-22 12:47:45 +01:00
|
|
|
#ifdef QZ_WS_X11
|
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();
|
|
|
|
if (!activeLanguage.isEmpty() && activeLanguage != QLatin1String("en_US")) {
|
2012-04-04 18:48:54 +02:00
|
|
|
QLocale locale(activeLanguage);
|
2011-03-02 16:57:41 +01:00
|
|
|
QString country = QLocale::countryToString(locale.country());
|
|
|
|
QString language = QLocale::languageToString(locale.language());
|
2012-04-04 18:48:54 +02:00
|
|
|
ui->languages->addItem(language + ", " + country + " (" + 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)");
|
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
QDir lanDir(mApp->TRANSLATIONSDIR);
|
2011-03-02 16:57:41 +01:00
|
|
|
QStringList list = lanDir.entryList(QStringList("*.qm"));
|
2013-03-06 09:05:41 +01:00
|
|
|
foreach (const QString &name, list) {
|
2012-09-04 12:42:45 +02:00
|
|
|
if (name.startsWith(QLatin1String("qt_"))) {
|
2011-03-02 16:57:41 +01:00
|
|
|
continue;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
QString loc = name;
|
2012-09-04 12:42:45 +02:00
|
|
|
loc.remove(QLatin1String(".qm"));
|
2012-07-10 22:26:59 +02:00
|
|
|
|
|
|
|
if (loc == activeLanguage) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
QLocale locale(loc);
|
|
|
|
QString country = QLocale::countryToString(locale.country());
|
|
|
|
QString language = QLocale::languageToString(locale.language());
|
2012-04-04 18:48:54 +02:00
|
|
|
ui->languages->addItem(language + ", " + country + " (" + 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()));
|
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
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->version->setText(" QupZilla v" + QupZilla::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);
|
|
|
|
|
2013-01-20 12:10:28 +01:00
|
|
|
#if QTWEBKIT_TO_2_3
|
2013-01-09 18:47:36 +01:00
|
|
|
ui->caretBrowsing->setHidden(true);
|
|
|
|
ui->animateScrolling->setHidden(true);
|
|
|
|
#endif
|
2013-01-28 18:20:36 +01:00
|
|
|
|
|
|
|
#if QTWEBKIT_TO_2_2
|
|
|
|
ui->html5permissions->setDisabled(true);
|
|
|
|
#endif
|
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);
|
|
|
|
if (index == 10) {
|
2012-07-06 14:37:49 +02:00
|
|
|
m_pluginsList->load();
|
|
|
|
}
|
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()
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
ui->homepage->setText(p_QupZilla->weView()->url().toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::useActualNewTab()
|
|
|
|
{
|
|
|
|
ui->newTabUrl->setText(p_QupZilla->weView()->url().toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::chooseDownPath()
|
|
|
|
{
|
2013-02-10 14:50:18 +01:00
|
|
|
QString userFileName = QFileDialog::getExistingDirectory(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-02-10 14:50:18 +01:00
|
|
|
QString file = QFileDialog::getOpenFileName(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-02-10 14:50:18 +01:00
|
|
|
QString path = QFileDialog::getOpenFileName(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()
|
|
|
|
{
|
|
|
|
UserAgentDialog dialog(this);
|
|
|
|
dialog.exec();
|
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
{
|
2012-02-17 18:55:34 +01:00
|
|
|
CookieManager* m = mApp->cookieManager();
|
2011-03-02 16:57:41 +01:00
|
|
|
m->refreshTable();
|
2012-02-17 18:55:34 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
m->show();
|
2012-02-17 18:55:34 +01:00
|
|
|
m->raise();
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
|
2013-01-28 18:20:36 +01:00
|
|
|
void Preferences::showHtml5Permissions()
|
|
|
|
{
|
|
|
|
HTML5PermissionsDialog dialog(this);
|
|
|
|
dialog.exec();
|
|
|
|
}
|
|
|
|
|
2011-03-04 13:59:07 +01:00
|
|
|
void Preferences::openSslManager()
|
|
|
|
{
|
2011-10-26 19:23:50 +02:00
|
|
|
SSLManager* m = new SSLManager(this);
|
2011-03-04 13:59:07 +01:00
|
|
|
m->show();
|
|
|
|
}
|
|
|
|
|
2012-12-28 01:17:01 +01:00
|
|
|
void Preferences::openJsOptions()
|
|
|
|
{
|
2013-01-09 13:52:12 +01:00
|
|
|
JsOptions options(this);
|
|
|
|
options.exec();
|
2012-12-28 01:17:01 +01:00
|
|
|
}
|
|
|
|
|
2011-10-18 17:39:51 +02:00
|
|
|
void Preferences::showAcceptLanguage()
|
|
|
|
{
|
2012-09-11 11:43:11 +02:00
|
|
|
AcceptLanguage a(this);
|
|
|
|
a.exec();
|
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()
|
|
|
|
{
|
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Choose cache path..."), ui->cachePath->text());
|
|
|
|
if (path.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->cachePath->setText(path);
|
|
|
|
}
|
|
|
|
|
2013-03-29 19:22:55 +01:00
|
|
|
void Preferences::reloadPacFileClicked()
|
|
|
|
{
|
|
|
|
mApp->networkManager()->proxyFactory()->pacManager()->downloadPacFile();
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::showPassManager(bool state)
|
|
|
|
{
|
|
|
|
m_autoFillManager->setVisible(state);
|
|
|
|
}
|
|
|
|
|
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);
|
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
|
|
|
}
|
2011-12-28 14:55:54 +01:00
|
|
|
QDir dir(mApp->PROFILEDIR + "profiles/");
|
2011-04-04 19:29:03 +02:00
|
|
|
if (QDir(dir.absolutePath() + "/" + name).exists()) {
|
|
|
|
QMessageBox::warning(this, tr("Error!"), tr("This profile already exists!"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dir.mkdir(name)) {
|
|
|
|
QMessageBox::warning(this, tr("Error!"), tr("Cannot create profile directory!"));
|
|
|
|
return;
|
|
|
|
}
|
2012-08-01 23:02:04 +02:00
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
dir.cd(name);
|
2011-12-27 15:26:32 +01:00
|
|
|
QFile(":data/browsedata.db").copy(dir.absolutePath() + "/browsedata.db");
|
|
|
|
QFile(dir.absolutePath() + "/browsedata.db").setPermissions(QFile::ReadUser | QFile::WriteUser);
|
2011-04-04 19:29:03 +02:00
|
|
|
|
2012-08-01 23:02:04 +02:00
|
|
|
QFile versionFile(dir.absolutePath() + "/version");
|
|
|
|
versionFile.open(QFile::WriteOnly);
|
|
|
|
versionFile.write(QupZilla::VERSION.toUtf8());
|
|
|
|
versionFile.close();
|
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
ui->startProfile->insertItem(0, name);
|
|
|
|
ui->startProfile->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-01-22 19:04:22 +01:00
|
|
|
QzTools::removeDir(mApp->PROFILEDIR + "profiles/" + name);
|
2011-04-04 19:29:03 +02:00
|
|
|
ui->startProfile->removeItem(ui->startProfile->currentIndex());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::startProfileIndexChanged(QString index)
|
|
|
|
{
|
|
|
|
ui->deleteProfile->setEnabled(m_actProfileName != index);
|
2011-10-02 17:39:59 +02:00
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
if (m_actProfileName == index) {
|
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
|
|
|
|
settings.beginGroup("Web-URL-Settings");
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("homepage", ui->homepage->text());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
QString homepage = ui->homepage->text();
|
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:
|
2013-03-29 19:22:55 +01:00
|
|
|
settings.setValue("newTabUrl", QString());
|
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:
|
|
|
|
settings.setValue("newTabUrl", "qupzilla:speeddial");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("newTabUrl", 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");
|
2011-11-06 17:01:23 +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-03-02 16:57:41 +01:00
|
|
|
settings.setValue("useTransparentBackground", ui->useTransparentBg->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());
|
2012-06-26 23:39:23 +02:00
|
|
|
settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked());
|
2012-01-20 14:12:26 +01:00
|
|
|
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
2011-07-19 21:38:11 +02:00
|
|
|
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
2012-01-23 00:23:45 +01:00
|
|
|
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
|
2012-04-10 18:29:22 +02:00
|
|
|
settings.setValue("showTabPreviews", ui->showTabPreviews->isChecked());
|
|
|
|
settings.setValue("tabPreviewAnimationsEnabled", ui->animatedTabPreviews->isChecked());
|
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());
|
|
|
|
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-22 13:52:46 +01:00
|
|
|
settings.setValue("CaretBrowsing", ui->caretBrowsing->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());
|
2011-10-29 18:37:28 +02:00
|
|
|
settings.setValue("DefaultZoom", ui->defaultZoom->value());
|
2011-11-13 20:36:10 +01:00
|
|
|
settings.setValue("XSSAuditing", ui->xssAuditing->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());
|
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
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
//Profiles
|
2011-12-28 14:55:54 +01:00
|
|
|
QSettings profileSettings(mApp->PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat);
|
2011-10-15 16:37:32 +02:00
|
|
|
profileSettings.setValue("Profiles/startProfile", 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();
|
2011-07-11 21:08:41 +02:00
|
|
|
mApp->reloadSettings();
|
2011-03-04 13:59:07 +01:00
|
|
|
mApp->plugins()->c2f_saveSettings();
|
2011-04-26 19:47:12 +02:00
|
|
|
mApp->networkManager()->loadSettings();
|
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()
|
|
|
|
{
|
|
|
|
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()) {
|
|
|
|
color = p_QupZilla->palette().color(QPalette::Highlight);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|