2012-12-28 01:17:01 +01:00
|
|
|
/* ============================================================
|
2017-08-25 17:11:29 +02:00
|
|
|
* Falkon - Qt web browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
|
|
|
|
2013-2014 Mladen Pejaković <pejakm@autistici.org>
|
2012-12-28 01:17:01 +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/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#include "jsoptions.h"
|
|
|
|
#include "ui_jsoptions.h"
|
|
|
|
#include "mainapplication.h"
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
|
|
JsOptions::JsOptions(QWidget* parent)
|
|
|
|
: QDialog(parent)
|
|
|
|
, ui(new Ui::JsOptions)
|
|
|
|
{
|
2014-11-07 18:08:12 +01:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
2012-12-28 01:17:01 +01:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
2018-05-14 13:53:05 +02:00
|
|
|
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
2018-03-01 12:09:54 +01:00
|
|
|
ui->jscanActivateWindow->setVisible(false);
|
|
|
|
#endif
|
|
|
|
|
2018-05-14 13:53:05 +02:00
|
|
|
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
2018-03-01 12:09:54 +01:00
|
|
|
ui->jscanPaste->setVisible(false);
|
|
|
|
#endif
|
|
|
|
|
2012-12-28 01:17:01 +01:00
|
|
|
Settings settings;
|
|
|
|
settings.beginGroup("Web-Browser-Settings");
|
|
|
|
ui->jscanOpenWindow->setChecked(settings.value("allowJavaScriptOpenWindow", false).toBool());
|
2018-03-01 12:09:54 +01:00
|
|
|
ui->jscanActivateWindow->setChecked(settings.value("allowJavaScriptActivateWindow", false).toBool());
|
|
|
|
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", true).toBool());
|
|
|
|
ui->jscanPaste->setChecked(settings.value("allowJavaScriptPaste", true).toBool());
|
2012-12-28 01:17:01 +01:00
|
|
|
settings.endGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JsOptions::accept()
|
|
|
|
{
|
|
|
|
Settings settings;
|
|
|
|
settings.beginGroup("Web-Browser-Settings");
|
|
|
|
settings.setValue("allowJavaScriptOpenWindow", ui->jscanOpenWindow->isChecked());
|
2018-03-01 12:09:54 +01:00
|
|
|
settings.setValue("allowJavaScriptActivateWindow", ui->jscanActivateWindow->isChecked());
|
2012-12-28 01:17:01 +01:00
|
|
|
settings.setValue("allowJavaScriptAccessClipboard", ui->jscanAccessClipboard->isChecked());
|
2018-03-01 12:09:54 +01:00
|
|
|
settings.setValue("allowJavaScriptPaste", ui->jscanPaste->isChecked());
|
2012-12-28 01:17:01 +01:00
|
|
|
settings.endGroup();
|
2013-01-09 13:52:12 +01:00
|
|
|
|
2012-12-28 01:17:01 +01:00
|
|
|
QDialog::close();
|
|
|
|
}
|
|
|
|
|
|
|
|
JsOptions::~JsOptions()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|