2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2011-10-17 09:57:07 +02:00
|
|
|
* Copyright (C) 2010-2011 David Rosca
|
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"
|
|
|
|
#include "historymodel.h"
|
|
|
|
#include "tabwidget.h"
|
|
|
|
#include "cookiejar.h"
|
|
|
|
#include "locationbar.h"
|
|
|
|
#include "autofillmanager.h"
|
|
|
|
#include "mainapplication.h"
|
|
|
|
#include "cookiemanager.h"
|
|
|
|
#include "pluginslist.h"
|
|
|
|
#include "qtwin.h"
|
|
|
|
#include "pluginproxy.h"
|
2011-03-04 13:59:07 +01:00
|
|
|
#include "sslmanager.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"
|
2011-10-26 19:23:50 +02:00
|
|
|
#include "globalfunctions.h"
|
2011-11-02 12:52:55 +01:00
|
|
|
#include "autofillmodel.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
bool removeFile(const QString &fullFileName)
|
2011-04-04 19:29:03 +02:00
|
|
|
{
|
|
|
|
QFile f(fullFileName);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (f.exists()) {
|
2011-04-04 19:29:03 +02:00
|
|
|
return f.remove();
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
2011-04-04 19:29:03 +02:00
|
|
|
}
|
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
void removeDir(const QString &d)
|
2011-04-04 19:29:03 +02:00
|
|
|
{
|
|
|
|
QDir dir(d);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (dir.exists()) {
|
2011-04-04 19:29:03 +02:00
|
|
|
const QFileInfoList list = dir.entryInfoList();
|
|
|
|
QFileInfo fi;
|
2011-11-06 17:01:23 +01:00
|
|
|
for (int l = 0; l < list.size(); l++) {
|
2011-04-04 19:29:03 +02:00
|
|
|
fi = list.at(l);
|
2011-11-06 17:01:23 +01:00
|
|
|
if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..") {
|
2011-04-04 19:29:03 +02:00
|
|
|
removeDir(fi.absoluteFilePath());
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else if (fi.isFile()) {
|
2011-04-04 19:29:03 +02:00
|
|
|
removeFile(fi.absoluteFilePath());
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-04-04 19:29:03 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
dir.rmdir(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2011-11-19 18:21:22 +01:00
|
|
|
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")));
|
|
|
|
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
|
|
|
|
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
|
|
|
|
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
|
|
|
|
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
|
|
|
|
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
|
|
|
|
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
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();
|
|
|
|
m_newTabUrl = settings.value("newTabUrl", "").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-11-06 17:01:23 +01:00
|
|
|
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", true).toBool());
|
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
|
|
|
}
|
|
|
|
else {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTab->setCurrentIndex(2);
|
|
|
|
ui->newTabFrame->setVisible(true);
|
|
|
|
}
|
|
|
|
connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged()));
|
|
|
|
connect(ui->useActualBut, SIGNAL(clicked()), this, SLOT(useActualHomepage()));
|
|
|
|
connect(ui->newTabUseActual, SIGNAL(clicked()), this, SLOT(useActualNewTab()));
|
|
|
|
|
|
|
|
//PROFILES
|
2011-10-15 16:37:32 +02:00
|
|
|
QString homePath = QDir::homePath();
|
|
|
|
homePath += "/.qupzilla/";
|
|
|
|
QSettings profileSettings(homePath + "profiles/profiles.ini", QSettings::IniFormat);
|
|
|
|
m_actProfileName = profileSettings.value("Profiles/startProfile", "default").toString();
|
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
ui->startProfile->addItem(m_actProfileName);
|
2011-10-15 16:37:32 +02:00
|
|
|
QDir profilesDir(QDir::homePath() + "/.qupzilla/profiles/");
|
2011-09-11 19:15:06 +02:00
|
|
|
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
2011-11-06 17:01:23 +01:00
|
|
|
foreach(QString name, list_) {
|
|
|
|
if (m_actProfileName == name) {
|
2011-04-04 19:29:03 +02:00
|
|
|
continue;
|
2011-11-06 17:01:23 +01: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-03-02 16:57:41 +01:00
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
//APPEREANCE
|
|
|
|
m_themesManager = new ThemeManager(ui->themesWidget);
|
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());
|
|
|
|
ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible());
|
|
|
|
ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible());
|
|
|
|
ui->showHome->setChecked(settings.value("showHomeButton", true).toBool());
|
|
|
|
ui->showBackForward->setChecked(settings.value("showBackForwardButtons", true).toBool());
|
|
|
|
ui->showAddTabButton->setChecked(settings.value("showAddTabButton", false).toBool());
|
|
|
|
ui->useTransparentBg->setChecked(settings.value("useTransparentBackground", false).toBool());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
ui->useTransparentBg->setEnabled(QtWin::isCompositionEnabled());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//TABS
|
|
|
|
settings.beginGroup("Browser-Tabs-Settings");
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->makeMovable->setChecked(settings.value("makeTabsMovable", true).toBool());
|
|
|
|
ui->hideCloseOnTab->setChecked(settings.value("hideCloseButtonWithOneTab", false).toBool());
|
|
|
|
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
|
|
|
|
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
|
|
|
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
//AddressBar
|
|
|
|
settings.beginGroup("AddressBar");
|
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());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
|
|
|
//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->blockPopup->setChecked(!settings.value("allowJavaScriptOpenWindow", false).toBool());
|
|
|
|
ui->allowJava->setChecked(settings.value("allowJava", true).toBool());
|
|
|
|
ui->loadImages->setChecked(settings.value("autoLoadImages", true).toBool());
|
|
|
|
ui->allowDNSPrefetch->setChecked(settings.value("DNS-Prefetch", false).toBool());
|
|
|
|
ui->jscanAccessClipboard->setChecked(settings.value("JavaScriptCanAccessClipboard", true).toBool());
|
|
|
|
ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
|
|
|
|
ui->zoomTextOnly->setChecked(settings.value("zoomTextOnly", false).toBool());
|
|
|
|
ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
|
|
|
|
ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
|
|
|
|
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
|
|
|
|
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
|
|
|
|
|
|
|
if (!ui->allowJavaScript->isChecked()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->blockPopup->setEnabled(false);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->allowJavaScript, SIGNAL(toggled(bool)), this, SLOT(allowJavaScriptChanged(bool)));
|
|
|
|
//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");
|
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)));
|
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)));
|
|
|
|
|
|
|
|
m_autoFillManager = new AutoFillManager(this);
|
|
|
|
ui->autoFillFrame->addWidget(m_autoFillManager);
|
2011-11-02 12:52:55 +01:00
|
|
|
showPassManager(ui->allowPassManager->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
//PRIVACY
|
|
|
|
//Web storage
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->storeIcons->setChecked(settings.value("allowPersistentStorage", true).toBool());
|
|
|
|
ui->saveHistory->setChecked(mApp->history()->isSaving());
|
|
|
|
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)));
|
|
|
|
//Cookies
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool());
|
|
|
|
if (!ui->saveCookies->isChecked()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->deleteCookiesOnClose->setEnabled(false);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
connect(ui->saveCookies, SIGNAL(toggled(bool)), this, SLOT(saveCookiesChanged(bool)));
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool());
|
|
|
|
ui->matchExactly->setChecked(settings.value("allowCookiesFromVisitedDomainOnly", false).toBool());
|
|
|
|
ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool());
|
2011-05-10 21:25:31 +02:00
|
|
|
|
|
|
|
//CSS Style
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
|
2011-05-10 21:25:31 +02:00
|
|
|
connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked()));
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
|
|
|
//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());
|
|
|
|
ui->downlaodNativeSystemDialog->setChecked(settings.value("useNativeDialog",
|
2011-05-25 14:26:36 +02:00
|
|
|
#ifdef Q_WS_WIN
|
2011-11-06 17:01:23 +01:00
|
|
|
false
|
2011-05-25 14:26:36 +02:00
|
|
|
#else
|
2011-11-06 17:01:23 +01:00
|
|
|
true
|
2011-05-25 14:26:36 +02:00
|
|
|
#endif
|
2011-11-06 17:01:23 +01:00
|
|
|
).toBool());
|
|
|
|
if (ui->downLoc->text().isEmpty()) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->askEverytime->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->useDefined->setChecked(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
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()));
|
|
|
|
downLocChanged(ui->useDefined->isChecked());
|
|
|
|
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());
|
2011-03-17 15:35:51 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//PLUGINS
|
|
|
|
m_pluginsList = new PluginsList(this);
|
|
|
|
ui->pluginsFrame->addWidget(m_pluginsList);
|
|
|
|
|
2011-04-27 09:49:41 +02:00
|
|
|
//NOTIFICATIONS
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
ui->useNativeSystemNotifications->setEnabled(true);
|
|
|
|
#endif
|
|
|
|
DesktopNotificationsFactory::Type notifyType;
|
|
|
|
settings.beginGroup("Notifications");
|
|
|
|
ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000);
|
|
|
|
#ifdef Q_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
|
2011-11-06 17:01:23 +01:00
|
|
|
if (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
|
|
|
|
|
|
|
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
|
2011-11-06 17:01:23 +01:00
|
|
|
QString activeLanguage = "";
|
2011-03-02 16:57:41 +01:00
|
|
|
if (!p_QupZilla->activeLanguage().isEmpty()) {
|
|
|
|
activeLanguage = p_QupZilla->activeLanguage();
|
|
|
|
QString loc = activeLanguage;
|
|
|
|
loc.remove(".qm");
|
|
|
|
QLocale locale(loc);
|
|
|
|
QString country = QLocale::countryToString(locale.country());
|
|
|
|
QString language = QLocale::languageToString(locale.language());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->languages->addItem(language + ", " + country + " (" + loc + ")", activeLanguage);
|
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"));
|
|
|
|
foreach(QString name, list) {
|
2011-11-06 17:01:23 +01:00
|
|
|
if (name.startsWith("qt_") || name == activeLanguage) {
|
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;
|
|
|
|
loc.remove(".qm");
|
|
|
|
QLocale locale(loc);
|
|
|
|
QString country = QLocale::countryToString(locale.country());
|
|
|
|
QString language = QLocale::languageToString(locale.language());
|
2011-11-06 17:01:23 +01:00
|
|
|
ui->languages->addItem(language + ", " + country + " (" + loc + ")", name);
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
2011-04-26 19:47:12 +02:00
|
|
|
//Proxy Config
|
|
|
|
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());
|
|
|
|
|
|
|
|
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
|
|
|
ui->systemProxy->setChecked(proxyPreference == NetworkProxyFactory::SystemProxy);
|
|
|
|
ui->noProxy->setChecked(proxyPreference == NetworkProxyFactory::NoProxy);
|
|
|
|
ui->manualProxy->setChecked(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
|
|
|
setManualProxyConfigurationEnabled(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
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());
|
|
|
|
ui->proxyExceptions->setText(settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList().join(","));
|
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +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()));
|
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()));
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
|
|
|
|
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);
|
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
|
|
|
}
|
|
|
|
ui->caption->setText("<b>" + item->text() + "</b>");
|
|
|
|
ui->stackedWidget->setCurrentIndex(item->whatsThis().toInt());
|
|
|
|
|
|
|
|
if (ui->stackedWidget->currentIndex() == 8) {
|
|
|
|
m_notification = new DesktopNotification(true);
|
|
|
|
m_notification->setPixmap(QPixmap(":icons/preferences/stock_dialog-question.png"));
|
|
|
|
m_notification->setHeading(tr("OSD Notification"));
|
|
|
|
m_notification->setText(tr("Drag it on the screen to place it where you want."));
|
|
|
|
m_notification->move(m_notifPosition);
|
|
|
|
m_notification->show();
|
2011-11-19 17:38:47 +01:00
|
|
|
|
2011-11-19 18:21:22 +01:00
|
|
|
mApp->desktopNotifications()->nativeNotificationPreview();
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else if (m_notification) {
|
|
|
|
m_notifPosition = m_notification->pos();
|
|
|
|
delete m_notification;
|
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|
|
|
|
void Preferences::allowCacheChanged(bool state)
|
|
|
|
{
|
|
|
|
ui->cacheFrame->setEnabled(state);
|
|
|
|
ui->cacheMB->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
QString userFileName = QFileDialog::getExistingDirectory(p_QupZilla, 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
|
|
|
}
|
2011-10-17 09:57:07 +02:00
|
|
|
#ifdef Q_WS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??)
|
|
|
|
userFileName.replace("\\", "/");
|
|
|
|
#endif
|
|
|
|
userFileName += "/";
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->downLoc->setText(userFileName);
|
|
|
|
}
|
|
|
|
|
2011-05-10 21:25:31 +02:00
|
|
|
void Preferences::chooseUserStyleClicked()
|
|
|
|
{
|
|
|
|
QString file = QFileDialog::getOpenFileName(p_QupZilla, 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);
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::newTabChanged()
|
|
|
|
{
|
2011-11-06 17:01:23 +01:00
|
|
|
if (ui->newTab->currentIndex() == 2) {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTabFrame->setVisible(true);
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-03-02 16:57:41 +01:00
|
|
|
ui->newTabFrame->setVisible(false);
|
2011-11-06 17:01:23 +01: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);
|
|
|
|
ui->proxyExceptions->setEnabled(state);
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::allowJavaScriptChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->blockPopup->setEnabled(stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::saveHistoryChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->deleteHistoryOnClose->setEnabled(stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::saveCookiesChanged(bool stat)
|
|
|
|
{
|
|
|
|
ui->deleteCookiesOnClose->setEnabled(stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::showCookieManager()
|
|
|
|
{
|
|
|
|
CookieManager* m = new CookieManager();
|
|
|
|
m->refreshTable();
|
|
|
|
m->show();
|
|
|
|
}
|
|
|
|
|
2011-03-04 13:59:07 +01:00
|
|
|
void Preferences::openSslManager()
|
|
|
|
{
|
2011-10-26 19:23:50 +02:00
|
|
|
SSLManager* m = new SSLManager(this);
|
|
|
|
// qz_centerWidgetToParent(m, this);
|
2011-03-04 13:59:07 +01:00
|
|
|
m->show();
|
|
|
|
}
|
|
|
|
|
2011-10-18 17:39:51 +02:00
|
|
|
void Preferences::showAcceptLanguage()
|
|
|
|
{
|
|
|
|
AcceptLanguage a(this);
|
|
|
|
a.exec();
|
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::cacheValueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->MBlabel->setText(QString::number(value) + " MB");
|
|
|
|
if (value == 0) {
|
|
|
|
ui->allowCache->setChecked(false);
|
|
|
|
allowCacheChanged(false);
|
|
|
|
}
|
|
|
|
else if (!ui->allowCache->isChecked()) {
|
|
|
|
ui->allowCache->setChecked(true);
|
|
|
|
allowCacheChanged(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::pageCacheValueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->pageCacheLabel->setText(QString::number(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
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:"));
|
2011-11-06 17:01:23 +01:00
|
|
|
if (name.isEmpty() || name.contains("/") || name.contains("\\")) {
|
2011-04-04 19:29:03 +02:00
|
|
|
return;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
|
|
|
QDir dir(QDir::homePath() + "/.qupzilla/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;
|
|
|
|
}
|
|
|
|
dir.cd(name);
|
2011-11-06 17:01:23 +01:00
|
|
|
QFile(mApp->DATADIR + "data/default/profiles/default/browsedata.db").copy(dir.absolutePath() + "/browsedata.db");
|
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
|
|
|
|
2011-11-06 17:01:23 +01:00
|
|
|
removeDir(QDir::homePath() + "/.qupzilla/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
|
|
|
}
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void Preferences::saveSettings()
|
|
|
|
{
|
2011-11-06 17:01:23 +01:00
|
|
|
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
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-11-06 17:01:23 +01:00
|
|
|
if (ui->newTab->currentIndex() == 0) {
|
|
|
|
settings.setValue("newTabUrl", "");
|
|
|
|
}
|
|
|
|
else if (ui->newTab->currentIndex() == 1) {
|
|
|
|
settings.setValue("newTabUrl", homepage);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.setValue("newTabUrl", ui->newTabUrl->text());
|
|
|
|
}
|
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());
|
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());
|
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("makeTabsMovable", ui->makeMovable->isChecked());
|
|
|
|
settings.setValue("hideCloseButtonWithOneTab", ui->hideCloseOnTab->isChecked());
|
|
|
|
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
2011-07-19 21:38:11 +02:00
|
|
|
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->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());
|
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());
|
|
|
|
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());
|
|
|
|
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());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("allowJavaScriptOpenWindow", !ui->blockPopup->isChecked());
|
2011-11-02 12:52:55 +01:00
|
|
|
settings.setValue("allowJava", ui->allowJava->isChecked());
|
|
|
|
settings.setValue("autoLoadImages", ui->loadImages->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("DNS-Prefetch", ui->allowDNSPrefetch->isChecked());
|
|
|
|
settings.setValue("JavaScriptCanAccessClipboard", ui->jscanAccessClipboard->isChecked());
|
|
|
|
settings.setValue("IncludeLinkInFocusChain", ui->linksInFocusChain->isChecked());
|
|
|
|
settings.setValue("zoomTextOnly", ui->zoomTextOnly->isChecked());
|
|
|
|
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());
|
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());
|
|
|
|
|
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());
|
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
|
|
|
|
settings.setValue("allowPersistentStorage", ui->storeIcons->isChecked());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("deleteHistoryOnClose", ui->deleteHistoryOnClose->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
//Cookies
|
2011-11-02 12:52:55 +01:00
|
|
|
settings.setValue("allowCookies", ui->saveCookies->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.setValue("deleteCookiesOnClose", ui->deleteCookiesOnClose->isChecked());
|
2011-11-06 17:01:23 +01:00
|
|
|
settings.setValue("allowCookiesFromVisitedDomainOnly", ui->matchExactly->isChecked());
|
|
|
|
settings.setValue("filterTrackingCookie", ui->filterTracking->isChecked());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
|
|
|
|
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());
|
|
|
|
settings.setValue("Position", m_notification ? m_notification->pos() : m_notifPosition);
|
|
|
|
settings.endGroup();
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
//OTHER
|
|
|
|
//AddressBar
|
|
|
|
settings.beginGroup("AddressBar");
|
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());
|
2011-03-02 16:57:41 +01:00
|
|
|
settings.endGroup();
|
2011-11-02 12:52:55 +01:00
|
|
|
|
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
|
|
|
}
|
|
|
|
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());
|
|
|
|
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(","));
|
|
|
|
settings.endGroup();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-04 19:29:03 +02:00
|
|
|
//Profiles
|
|
|
|
QString homePath = QDir::homePath();
|
2011-10-15 16:37:32 +02:00
|
|
|
homePath += "/.qupzilla/";
|
|
|
|
QSettings profileSettings(homePath + "profiles/profiles.ini", QSettings::IniFormat);
|
|
|
|
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;
|
2011-11-06 17:01:23 +01:00
|
|
|
if (m_notification) {
|
2011-04-27 09:49:41 +02:00
|
|
|
delete m_notification;
|
2011-11-06 17:01:23 +01:00
|
|
|
}
|
2011-03-02 16:57:41 +01:00
|
|
|
}
|