mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Added AcceptLanguage dialog, it is now possible to set preferred
languages for showing web sites
This commit is contained in:
parent
2c9dc68c3e
commit
5ebdfd9a5a
2
BUILDING
2
BUILDING
@ -88,6 +88,6 @@ Available Defines
|
|||||||
value:
|
value:
|
||||||
|
|
||||||
example:
|
example:
|
||||||
$ export NO_SYSTEM_DATAPATH="/usr/"
|
$ export QUPZILLA_PREFIX="/usr/"
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +150,8 @@ SOURCES += main.cpp\
|
|||||||
downloads/downloadfilehelper.cpp \
|
downloads/downloadfilehelper.cpp \
|
||||||
tools/certificateinfowidget.cpp \
|
tools/certificateinfowidget.cpp \
|
||||||
webview/webinspectordockwidget.cpp \
|
webview/webinspectordockwidget.cpp \
|
||||||
app/profileupdater.cpp
|
app/profileupdater.cpp \
|
||||||
|
preferences/acceptlanguage.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
3rdparty/qtwin.h \
|
3rdparty/qtwin.h \
|
||||||
@ -250,7 +251,8 @@ HEADERS += \
|
|||||||
tools/certificateinfowidget.h \
|
tools/certificateinfowidget.h \
|
||||||
webview/webinspectordockwidget.h \
|
webview/webinspectordockwidget.h \
|
||||||
3rdparty/msvc2008.h \
|
3rdparty/msvc2008.h \
|
||||||
app/profileupdater.h
|
app/profileupdater.h \
|
||||||
|
preferences/acceptlanguage.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
preferences/autofillmanager.ui \
|
preferences/autofillmanager.ui \
|
||||||
@ -286,7 +288,9 @@ FORMS += \
|
|||||||
webview/searchtoolbar.ui \
|
webview/searchtoolbar.ui \
|
||||||
preferences/thememanager.ui \
|
preferences/thememanager.ui \
|
||||||
other/pagescreen.ui \
|
other/pagescreen.ui \
|
||||||
tools/certificateinfowidget.ui
|
tools/certificateinfowidget.ui \
|
||||||
|
preferences/acceptlanguage.ui \
|
||||||
|
preferences/addacceptlanguage.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
data/icons.qrc \
|
data/icons.qrc \
|
||||||
@ -346,3 +350,9 @@ message($$DEFINES)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ void MainApplication::translateApp()
|
|||||||
{
|
{
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
QSettings settings(m_activeProfil+"settings.ini", QSettings::IniFormat);
|
QSettings settings(m_activeProfil+"settings.ini", QSettings::IniFormat);
|
||||||
settings.beginGroup("Browser-View-Settings");
|
settings.beginGroup("Language");
|
||||||
QString file = settings.value("language",locale.name()+".qm").toString();
|
QString file = settings.value("language",locale.name()+".qm").toString();
|
||||||
QString shortLoc = file.left(2);
|
QString shortLoc = file.left(2);
|
||||||
|
|
||||||
@ -402,8 +402,8 @@ void MainApplication::quitApplication()
|
|||||||
settings.setValue("isCrashed", false);
|
settings.setValue("isCrashed", false);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose",false).toBool();
|
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose", false).toBool();
|
||||||
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose",false).toBool();
|
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose", false).toBool();
|
||||||
|
|
||||||
if (deleteCookies)
|
if (deleteCookies)
|
||||||
QFile::remove(m_activeProfil+"cookies.dat");
|
QFile::remove(m_activeProfil+"cookies.dat");
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2010-2011 David Rosca
|
||||||
|
*
|
||||||
|
* 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 "profileupdater.h"
|
#include "profileupdater.h"
|
||||||
#include "qupzilla.h"
|
#include "qupzilla.h"
|
||||||
#include "updater.h"
|
#include "updater.h"
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2010-2011 David Rosca
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
* ============================================================ */
|
||||||
#ifndef PROFILEUPDATER_H
|
#ifndef PROFILEUPDATER_H
|
||||||
#define PROFILEUPDATER_H
|
#define PROFILEUPDATER_H
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "qupzillaschemehandler.h"
|
#include "qupzillaschemehandler.h"
|
||||||
#include "certificateinfowidget.h"
|
#include "certificateinfowidget.h"
|
||||||
#include "globalfunctions.h"
|
#include "globalfunctions.h"
|
||||||
|
#include "acceptlanguage.h"
|
||||||
|
|
||||||
NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
|
NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
|
||||||
: NetworkManagerProxy(mainClass, parent)
|
: NetworkManagerProxy(mainClass, parent)
|
||||||
@ -59,6 +60,7 @@ void NetworkManager::loadSettings()
|
|||||||
}
|
}
|
||||||
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
|
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
m_acceptLanguage = AcceptLanguage::generateHeader(settings.value("Language/acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList());
|
||||||
|
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
// From doc:
|
// From doc:
|
||||||
@ -248,6 +250,8 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op
|
|||||||
if (m_doNotTrack)
|
if (m_doNotTrack)
|
||||||
req.setRawHeader("DNT", "1");
|
req.setRawHeader("DNT", "1");
|
||||||
|
|
||||||
|
req.setRawHeader("Accept-Language", m_acceptLanguage);
|
||||||
|
|
||||||
//SchemeHandlers
|
//SchemeHandlers
|
||||||
if (req.url().scheme() == "qupzilla")
|
if (req.url().scheme() == "qupzilla")
|
||||||
reply = m_qupzillaSchemeHandler->createRequest(op, req, outgoingData);
|
reply = m_qupzillaSchemeHandler->createRequest(op, req, outgoingData);
|
||||||
|
@ -83,6 +83,8 @@ private:
|
|||||||
QList<QSslCertificate> m_caCerts;
|
QList<QSslCertificate> m_caCerts;
|
||||||
QList<QSslCertificate> m_localCerts;
|
QList<QSslCertificate> m_localCerts;
|
||||||
|
|
||||||
|
QByteArray m_acceptLanguage;
|
||||||
|
|
||||||
bool m_ignoreAllWarnings;
|
bool m_ignoreAllWarnings;
|
||||||
bool m_doNotTrack;
|
bool m_doNotTrack;
|
||||||
};
|
};
|
||||||
|
204
src/preferences/acceptlanguage.cpp
Normal file
204
src/preferences/acceptlanguage.cpp
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Benjamin C. Meyer <ben@meyerhome.net>
|
||||||
|
*
|
||||||
|
* 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 2 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2010-2011 David Rosca
|
||||||
|
*
|
||||||
|
* 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 "acceptlanguage.h"
|
||||||
|
#include "ui_acceptlanguage.h"
|
||||||
|
#include "ui_addacceptlanguage.h"
|
||||||
|
#include "mainapplication.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
QStringList AcceptLanguage::defaultLanguage()
|
||||||
|
{
|
||||||
|
return QStringList(QLocale::system().name().split(QLatin1Char('_')));
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
|
||||||
|
{
|
||||||
|
if (langs.count() == 0)
|
||||||
|
return QByteArray();
|
||||||
|
|
||||||
|
QByteArray header;
|
||||||
|
header.append(langs.at(0));
|
||||||
|
|
||||||
|
int counter = 8;
|
||||||
|
for (int i = 1; i < langs.count(); i++) {
|
||||||
|
QString s = ", " + langs.at(i) + ";q=0,";
|
||||||
|
s.append(QString::number(counter));
|
||||||
|
if (counter != 2)
|
||||||
|
counter-=2;
|
||||||
|
|
||||||
|
header.append(s);
|
||||||
|
}
|
||||||
|
header.append(", *");
|
||||||
|
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceptLanguage::AcceptLanguage(QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
, ui(new Ui::AcceptLanguage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
QSettings settings(mApp->getActiveProfilPath()+"settings.ini", QSettings::IniFormat);
|
||||||
|
settings.beginGroup("Language");
|
||||||
|
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
|
||||||
|
|
||||||
|
foreach (QString code, langs) {
|
||||||
|
QString code_ = code;
|
||||||
|
QLocale loc = QLocale(code_.replace("-", "_"));
|
||||||
|
QString label;
|
||||||
|
|
||||||
|
if (loc.language() == QLocale::C)
|
||||||
|
label = tr("Personal [%1]").arg(code);
|
||||||
|
else
|
||||||
|
label = QString("%1/%2 [%3]").arg(loc.languageToString(loc.language()), loc.countryToString(loc.country()), code);
|
||||||
|
|
||||||
|
ui->listWidget->addItem(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(ui->add, SIGNAL(clicked()), this, SLOT(addLanguage()));
|
||||||
|
connect(ui->remove, SIGNAL(clicked()), this, SLOT(removeLanguage()));
|
||||||
|
connect(ui->up, SIGNAL(clicked()), this, SLOT(upLanguage()));
|
||||||
|
connect(ui->down, SIGNAL(clicked()), this, SLOT(downLanguage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList AcceptLanguage::expand(const QLocale::Language &language)
|
||||||
|
{
|
||||||
|
QStringList allLanguages;
|
||||||
|
QList<QLocale::Country> countries = QLocale::countriesForLanguage(language);
|
||||||
|
for (int j = 0; j < countries.size(); ++j) {
|
||||||
|
QString languageString;
|
||||||
|
if (countries.count() == 1) {
|
||||||
|
languageString = QString(QLatin1String("%1 [%2]"))
|
||||||
|
.arg(QLocale::languageToString(language))
|
||||||
|
.arg(QLocale(language).name().split(QLatin1Char('_')).at(0));
|
||||||
|
} else {
|
||||||
|
languageString = QString(QLatin1String("%1/%2 [%3]"))
|
||||||
|
.arg(QLocale::languageToString(language))
|
||||||
|
.arg(QLocale::countryToString(countries.at(j)))
|
||||||
|
.arg(QLocale(language, countries.at(j)).name().split(QLatin1Char('_')).join(QLatin1String("-")).toLower());
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!allLanguages.contains(languageString))
|
||||||
|
allLanguages.append(languageString);
|
||||||
|
}
|
||||||
|
return allLanguages;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcceptLanguage::addLanguage()
|
||||||
|
{
|
||||||
|
Ui_AddAcceptLanguage _ui = Ui_AddAcceptLanguage();
|
||||||
|
QDialog dialog(this);
|
||||||
|
_ui.setupUi(&dialog);
|
||||||
|
|
||||||
|
QStringList allLanguages;
|
||||||
|
for (int i = 1 + (int)QLocale::C; i <= (int)QLocale::LastLanguage; ++i)
|
||||||
|
allLanguages += expand(QLocale::Language(i));
|
||||||
|
|
||||||
|
_ui.listWidget->addItems(allLanguages);
|
||||||
|
|
||||||
|
connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), &dialog, SLOT(accept()));
|
||||||
|
|
||||||
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_ui.ownDefinition->text().isEmpty()) {
|
||||||
|
QString title = tr("Personal [%1]").arg(_ui.ownDefinition->text());
|
||||||
|
ui->listWidget->addItem(title);
|
||||||
|
} else {
|
||||||
|
QListWidgetItem* c = _ui.listWidget->currentItem();
|
||||||
|
if (!c)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ui->listWidget->addItem(c->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcceptLanguage::removeLanguage()
|
||||||
|
{
|
||||||
|
QListWidgetItem* currentItem = ui->listWidget->currentItem();
|
||||||
|
if (currentItem)
|
||||||
|
delete currentItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcceptLanguage::upLanguage()
|
||||||
|
{
|
||||||
|
int index = ui->listWidget->currentRow();
|
||||||
|
QListWidgetItem* currentItem = ui->listWidget->currentItem();
|
||||||
|
|
||||||
|
if (!currentItem || index == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ui->listWidget->takeItem(index);
|
||||||
|
ui->listWidget->insertItem(index - 1, currentItem);
|
||||||
|
ui->listWidget->setCurrentItem(currentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcceptLanguage::downLanguage()
|
||||||
|
{
|
||||||
|
int index = ui->listWidget->currentRow();
|
||||||
|
QListWidgetItem* currentItem = ui->listWidget->currentItem();
|
||||||
|
|
||||||
|
if (!currentItem || index == ui->listWidget->count() - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ui->listWidget->takeItem(index);
|
||||||
|
ui->listWidget->insertItem(index + 1, currentItem);
|
||||||
|
ui->listWidget->setCurrentItem(currentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcceptLanguage::accept()
|
||||||
|
{
|
||||||
|
QStringList langs;
|
||||||
|
for (int i = 0; i < ui->listWidget->count(); i++) {
|
||||||
|
QString t = ui->listWidget->item(i)->text();
|
||||||
|
QString code = t.mid(t.indexOf("[") + 1);
|
||||||
|
code.remove("]");
|
||||||
|
langs.append(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings settings(mApp->getActiveProfilPath()+"settings.ini", QSettings::IniFormat);
|
||||||
|
settings.beginGroup("Language");
|
||||||
|
settings.setValue("acceptLanguage", langs);
|
||||||
|
|
||||||
|
QDialog::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceptLanguage::~AcceptLanguage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
55
src/preferences/acceptlanguage.h
Normal file
55
src/preferences/acceptlanguage.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2010-2011 David Rosca
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
* ============================================================ */
|
||||||
|
#ifndef ACCEPTLANGUAGE_H
|
||||||
|
#define ACCEPTLANGUAGE_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QLocale>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AcceptLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AcceptLanguage : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AcceptLanguage(QWidget* parent = 0);
|
||||||
|
~AcceptLanguage();
|
||||||
|
|
||||||
|
static QStringList defaultLanguage();
|
||||||
|
static QByteArray generateHeader(const QStringList &langs);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void accept();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void addLanguage();
|
||||||
|
void removeLanguage();
|
||||||
|
void upLanguage();
|
||||||
|
void downLanguage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList expand(const QLocale::Language &language);
|
||||||
|
|
||||||
|
Ui::AcceptLanguage* ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ACCEPTLANGUAGE_H
|
112
src/preferences/acceptlanguage.ui
Normal file
112
src/preferences/acceptlanguage.ui
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AcceptLanguage</class>
|
||||||
|
<widget class="QDialog" name="AcceptLanguage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>464</width>
|
||||||
|
<height>281</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Preferred Languages</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="add">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="remove">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="up">
|
||||||
|
<property name="text">
|
||||||
|
<string>Up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="down">
|
||||||
|
<property name="text">
|
||||||
|
<string>Down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>AcceptLanguage</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>AcceptLanguage</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
88
src/preferences/addacceptlanguage.ui
Normal file
88
src/preferences/addacceptlanguage.ui
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AddAcceptLanguage</class>
|
||||||
|
<widget class="QDialog" name="AddAcceptLanguage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>366</width>
|
||||||
|
<height>283</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Add Language</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Choose preferred language for web sites</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Personal definition:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="ownDefinition"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>AddAcceptLanguage</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>AddAcceptLanguage</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -36,6 +36,7 @@
|
|||||||
#include "desktopnotification.h"
|
#include "desktopnotification.h"
|
||||||
#include "navigationbar.h"
|
#include "navigationbar.h"
|
||||||
#include "thememanager.h"
|
#include "thememanager.h"
|
||||||
|
#include "acceptlanguage.h"
|
||||||
|
|
||||||
bool removeFile(const QString &fullFileName)
|
bool removeFile(const QString &fullFileName)
|
||||||
{
|
{
|
||||||
@ -317,6 +318,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) :
|
|||||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
||||||
connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
|
connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
|
||||||
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->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);
|
||||||
@ -435,6 +437,12 @@ void Preferences::openSslManager()
|
|||||||
m->show();
|
m->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preferences::showAcceptLanguage()
|
||||||
|
{
|
||||||
|
AcceptLanguage a(this);
|
||||||
|
a.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void Preferences::cacheValueChanged(int value)
|
void Preferences::cacheValueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->MBlabel->setText(QString::number(value) + " MB");
|
ui->MBlabel->setText(QString::number(value) + " MB");
|
||||||
@ -641,7 +649,7 @@ void Preferences::saveSettings()
|
|||||||
settings.setValue("AddCountryDomainWithAltKey", ui->addCountryWithAlt->isChecked() );
|
settings.setValue("AddCountryDomainWithAltKey", ui->addCountryWithAlt->isChecked() );
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
//Languages
|
//Languages
|
||||||
settings.beginGroup("Browser-View-Settings");
|
settings.beginGroup("Language");
|
||||||
settings.setValue("language",ui->languages->itemData(ui->languages->currentIndex()).toString());
|
settings.setValue("language",ui->languages->itemData(ui->languages->currentIndex()).toString());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
//Proxy Configuration
|
//Proxy Configuration
|
||||||
|
@ -53,6 +53,7 @@ private slots:
|
|||||||
void useActualHomepage();
|
void useActualHomepage();
|
||||||
void useActualNewTab();
|
void useActualNewTab();
|
||||||
void openSslManager();
|
void openSslManager();
|
||||||
|
void showAcceptLanguage();
|
||||||
void chooseUserStyleClicked();
|
void chooseUserStyleClicked();
|
||||||
|
|
||||||
void allowJavaScriptChanged(bool stat);
|
void allowJavaScriptChanged(bool stat);
|
||||||
|
@ -1827,7 +1827,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="stackedWidgetPage7">
|
<widget class="QWidget" name="stackedWidgetPage7">
|
||||||
<layout class="QGridLayout" name="gridLayout_13">
|
<layout class="QGridLayout" name="gridLayout_13">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="4">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Language</b></string>
|
<string><b>Language</b></string>
|
||||||
@ -1880,7 +1880,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="11" column="1" colspan="2">
|
||||||
<spacer name="verticalSpacer_13">
|
<spacer name="verticalSpacer_13">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -1893,30 +1893,61 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="6" column="0" colspan="4">
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="label_9">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>User CSS StyleSheet</b></string>
|
<string><b>User CSS StyleSheet</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1" colspan="3">
|
<item row="7" column="1" colspan="3">
|
||||||
<widget class="QLabel" name="label_15">
|
<widget class="QLabel" name="label_15">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>StyleSheet automatically loaded with all websites: </string>
|
<string>StyleSheet automatically loaded with all websites: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QLineEdit" name="userStyleSheet"/>
|
<widget class="QLineEdit" name="userStyleSheet"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="8" column="2">
|
||||||
<widget class="QToolButton" name="chooseUserStylesheet">
|
<widget class="QToolButton" name="chooseUserStylesheet">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="preferredLanguages">
|
||||||
|
<property name="text">
|
||||||
|
<string>Languages</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="4">
|
||||||
|
<widget class="QLabel" name="label_36">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Preferred language for web sites</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user