mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Preferences: Save last page even when closing preferences with "Cancel"
This commit is contained in:
parent
e06b82ef1c
commit
a6564b5eea
@ -42,6 +42,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "tabbedwebview.h"
|
#include "tabbedwebview.h"
|
||||||
#include "clearprivatedata.h"
|
#include "clearprivatedata.h"
|
||||||
|
#include "useragentdialog.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
@ -239,30 +240,6 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
|
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
|
||||||
ui->sendReferer->setChecked(settings.value("SendReferer", true).toBool());
|
ui->sendReferer->setChecked(settings.value("SendReferer", true).toBool());
|
||||||
|
|
||||||
// UserAgent
|
|
||||||
const QString &os = qz_buildSystem();
|
|
||||||
QStringList items;
|
|
||||||
items << QString("Opera/9.80 (%1) Presto/2.10.229 Version/11.61").arg(os)
|
|
||||||
<< QString("Mozilla/5.0 (%1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7").arg(os)
|
|
||||||
<< QString("Mozilla/5.0 (%1) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1").arg(os)
|
|
||||||
<< QString("Mozilla/5.0 (%1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1").arg(os);
|
|
||||||
|
|
||||||
const QString &savedUserAgent = settings.value("UserAgent", "").toString();
|
|
||||||
ui->changeUserAgent->setChecked(!savedUserAgent.isEmpty());
|
|
||||||
ui->userAgentCombo->addItems(items);
|
|
||||||
|
|
||||||
int index = ui->userAgentCombo->findText(savedUserAgent);
|
|
||||||
if (index >= 0) {
|
|
||||||
ui->userAgentCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->userAgentCombo->lineEdit()->setText(savedUserAgent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->userAgentCombo->lineEdit()->setCursorPosition(0);
|
|
||||||
connect(ui->changeUserAgent, SIGNAL(toggled(bool)), this, SLOT(changeUserAgentChanged(bool)));
|
|
||||||
changeUserAgentChanged(ui->changeUserAgent->isChecked());
|
|
||||||
|
|
||||||
//CSS Style
|
//CSS Style
|
||||||
ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
|
ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
|
||||||
connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked()));
|
connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked()));
|
||||||
@ -420,6 +397,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager()));
|
connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager()));
|
||||||
connect(ui->preferredLanguages, SIGNAL(clicked()), this, SLOT(showAcceptLanguage()));
|
connect(ui->preferredLanguages, SIGNAL(clicked()), this, SLOT(showAcceptLanguage()));
|
||||||
connect(ui->deleteHtml5storage, SIGNAL(clicked()), this, SLOT(deleteHtml5storage()));
|
connect(ui->deleteHtml5storage, SIGNAL(clicked()), this, SLOT(deleteHtml5storage()));
|
||||||
|
connect(ui->uaManager, SIGNAL(clicked()), this, SLOT(openUserAgentManager()));
|
||||||
|
|
||||||
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
|
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
|
||||||
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
|
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
|
||||||
@ -529,6 +507,12 @@ void Preferences::chooseExternalDownloadManager()
|
|||||||
ui->externalDownExecutable->setText(path);
|
ui->externalDownExecutable->setText(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preferences::openUserAgentManager()
|
||||||
|
{
|
||||||
|
UserAgentDialog dialog(this);
|
||||||
|
dialog.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void Preferences::downLocChanged(bool state)
|
void Preferences::downLocChanged(bool state)
|
||||||
{
|
{
|
||||||
ui->downButt->setEnabled(state);
|
ui->downButt->setEnabled(state);
|
||||||
@ -626,11 +610,6 @@ void Preferences::useExternalDownManagerChanged(bool state)
|
|||||||
ui->chooseExternalDown->setEnabled(state);
|
ui->chooseExternalDown->setEnabled(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::changeUserAgentChanged(bool state)
|
|
||||||
{
|
|
||||||
ui->userAgentCombo->setEnabled(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::useDifferentProxyForHttpsChanged(bool state)
|
void Preferences::useDifferentProxyForHttpsChanged(bool state)
|
||||||
{
|
{
|
||||||
ui->httpsProxyServer->setEnabled(state);
|
ui->httpsProxyServer->setEnabled(state);
|
||||||
@ -725,6 +704,16 @@ void Preferences::startProfileIndexChanged(QString index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preferences::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
Settings settings;
|
||||||
|
settings.beginGroup("Browser-View-Settings");
|
||||||
|
settings.setValue("settingsDialogPage", ui->stackedWidget->currentIndex());
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
void Preferences::saveSettings()
|
void Preferences::saveSettings()
|
||||||
{
|
{
|
||||||
Settings settings;
|
Settings settings;
|
||||||
@ -774,7 +763,6 @@ void Preferences::saveSettings()
|
|||||||
settings.setValue("showWebSearchBar", ui->showWebSearchBar->isChecked());
|
settings.setValue("showWebSearchBar", ui->showWebSearchBar->isChecked());
|
||||||
settings.setValue("useTransparentBackground", ui->useTransparentBg->isChecked());
|
settings.setValue("useTransparentBackground", ui->useTransparentBg->isChecked());
|
||||||
settings.setValue("showAddTabButton", ui->showAddTabButton->isChecked());
|
settings.setValue("showAddTabButton", ui->showAddTabButton->isChecked());
|
||||||
settings.setValue("settingsDialogPage", ui->stackedWidget->currentIndex());
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
//TABS
|
//TABS
|
||||||
@ -836,7 +824,6 @@ void Preferences::saveSettings()
|
|||||||
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
|
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
|
||||||
settings.setValue("DefaultZoom", ui->defaultZoom->value());
|
settings.setValue("DefaultZoom", ui->defaultZoom->value());
|
||||||
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
|
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
|
||||||
settings.setValue("UserAgent", ui->changeUserAgent->isChecked() ? ui->userAgentCombo->currentText() : "");
|
|
||||||
|
|
||||||
//Cache
|
//Cache
|
||||||
settings.setValue("maximumCachedPages", ui->pagesInCache->value());
|
settings.setValue("maximumCachedPages", ui->pagesInCache->value());
|
||||||
|
@ -60,6 +60,7 @@ private slots:
|
|||||||
void chooseUserStyleClicked();
|
void chooseUserStyleClicked();
|
||||||
void deleteHtml5storage();
|
void deleteHtml5storage();
|
||||||
void chooseExternalDownloadManager();
|
void chooseExternalDownloadManager();
|
||||||
|
void openUserAgentManager();
|
||||||
|
|
||||||
void allowJavaScriptChanged(bool state);
|
void allowJavaScriptChanged(bool state);
|
||||||
void saveHistoryChanged(bool state);
|
void saveHistoryChanged(bool state);
|
||||||
@ -70,7 +71,6 @@ private slots:
|
|||||||
void showPassManager(bool state);
|
void showPassManager(bool state);
|
||||||
void setManualProxyConfigurationEnabled(bool state);
|
void setManualProxyConfigurationEnabled(bool state);
|
||||||
void useExternalDownManagerChanged(bool state);
|
void useExternalDownManagerChanged(bool state);
|
||||||
void changeUserAgentChanged(bool state);
|
|
||||||
void useDifferentProxyForHttpsChanged(bool state);
|
void useDifferentProxyForHttpsChanged(bool state);
|
||||||
void showTabPreviewsChanged(bool state);
|
void showTabPreviewsChanged(bool state);
|
||||||
|
|
||||||
@ -86,6 +86,8 @@ private slots:
|
|||||||
void setNotificationPreviewVisible(bool state);
|
void setNotificationPreviewVisible(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
Ui::Preferences* ui;
|
Ui::Preferences* ui;
|
||||||
QupZilla* p_QupZilla;
|
QupZilla* p_QupZilla;
|
||||||
AutoFillManager* m_autoFillManager;
|
AutoFillManager* m_autoFillManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user