Falkon Develop
Cross-platform Qt-based web browser
jsoptions.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
4 2013-2014 Mladen Pejaković <pejakm@autistici.org>
5*
6* This program is free software: you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation, either version 3 of the License, or
9* (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program. If not, see <http://www.gnu.org/licenses/>.
18* ============================================================ */
19#include "jsoptions.h"
20#include "ui_jsoptions.h"
21#include "mainapplication.h"
22#include "settings.h"
23#include <QtWebEngineWidgetsVersion>
24
25JsOptions::JsOptions(QWidget* parent)
26 : QDialog(parent)
27 , ui(new Ui::JsOptions)
28{
29 setAttribute(Qt::WA_DeleteOnClose);
30
31 ui->setupUi(this);
32
33 Settings settings;
34 settings.beginGroup(QSL("Web-Browser-Settings"));
35 ui->jscanOpenWindow->setChecked(settings.value(QSL("allowJavaScriptOpenWindow"), false).toBool());
36 ui->jscanActivateWindow->setChecked(settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool());
37 ui->jscanAccessClipboard->setChecked(settings.value(QSL("allowJavaScriptAccessClipboard"), true).toBool());
38 ui->jscanPaste->setChecked(settings.value(QSL("allowJavaScriptPaste"), true).toBool());
39 settings.endGroup();
40}
41
43{
44 Settings settings;
45 settings.beginGroup(QSL("Web-Browser-Settings"));
46 settings.setValue(QSL("allowJavaScriptOpenWindow"), ui->jscanOpenWindow->isChecked());
47 settings.setValue(QSL("allowJavaScriptActivateWindow"), ui->jscanActivateWindow->isChecked());
48 settings.setValue(QSL("allowJavaScriptAccessClipboard"), ui->jscanAccessClipboard->isChecked());
49 settings.setValue(QSL("allowJavaScriptPaste"), ui->jscanPaste->isChecked());
50 settings.endGroup();
51
52 QDialog::close();
53}
54
56{
57 delete ui;
58}
JsOptions(QWidget *parent=nullptr)
Definition: jsoptions.cpp:25
~JsOptions() override
Definition: jsoptions.cpp:55
void accept() override
Definition: jsoptions.cpp:42
void beginGroup(const QString &prefix)
Definition: settings.cpp:79
void endGroup()
Definition: settings.cpp:84
QVariant value(const QString &key, const QVariant &defaultValue=QVariant())
Definition: settings.cpp:74
void setValue(const QString &key, const QVariant &defaultValue=QVariant())
Definition: settings.cpp:69
#define QSL(x)
Definition: qzcommon.h:40