1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Merge branch 'v2.1'

This commit is contained in:
David Rosca 2017-02-08 10:51:23 +01:00
commit 69193399b4
7 changed files with 76 additions and 16 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -72,6 +72,12 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -52,6 +52,12 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -411,6 +411,13 @@ Preferences::Preferences(BrowserWindow* window)
const QStringList spellcheckLanguages = settings.value(QSL("Languages")).toStringList();
settings.endGroup();
auto updateSpellCheckEnabled = [this]() {
ui->spellcheckLanguages->setEnabled(ui->spellcheckEnabled->isChecked());
ui->spellcheckNoLanguages->setEnabled(ui->spellcheckEnabled->isChecked());
};
updateSpellCheckEnabled();
connect(ui->spellcheckEnabled, &QCheckBox::toggled, this, updateSpellCheckEnabled);
QStringList dictionariesDirs = {
#ifdef Q_OS_OSX
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Contents/Resources/qtwebengine_dictionaries")),
@ -429,16 +436,29 @@ Preferences::Preferences(BrowserWindow* window)
const QStringList files = dir.entryList({QSL("*.bdic")});
for (const QString &file : files) {
const QString lang = file.left(file.size() - 5);
const QString langName = createLanguageItem(lang);
if (!ui->spellcheckLanguages->findItems(langName, Qt::MatchExactly).isEmpty()) {
continue;
}
QListWidgetItem *item = new QListWidgetItem;
item->setText(createLanguageItem(lang));
item->setText(langName);
item->setData(Qt::UserRole, lang);
ui->spellcheckLanguages->addItem(item);
if (spellcheckLanguages.contains(lang)) {
ui->spellcheckLanguages->setCurrentItem(item, QItemSelectionModel::Select);
}
}
}
int topIndex = 0;
for (const QString &lang : spellcheckLanguages) {
const auto items = ui->spellcheckLanguages->findItems(createLanguageItem(lang), Qt::MatchExactly);
if (items.isEmpty()) {
continue;
}
QListWidgetItem *item = items.at(0);
ui->spellcheckLanguages->takeItem(ui->spellcheckLanguages->row(item));
ui->spellcheckLanguages->insertItem(topIndex++, item);
ui->spellcheckLanguages->setCurrentItem(item, QItemSelectionModel::Select);
}
if (ui->spellcheckLanguages->count() == 0) {
ui->spellcheckLanguages->hide();
} else {
@ -990,8 +1010,11 @@ void Preferences::saveSettings()
settings.beginGroup(QSL("SpellCheck"));
settings.setValue("Enabled", ui->spellcheckEnabled->isChecked());
QStringList languages;
for (QListWidgetItem *item : ui->spellcheckLanguages->selectedItems()) {
languages.append(item->data(Qt::UserRole).toString());
for (int i = 0; i < ui->spellcheckLanguages->count(); ++i) {
QListWidgetItem *item = ui->spellcheckLanguages->item(i);
if (item->isSelected()) {
languages.append(item->data(Qt::UserRole).toString());
}
}
settings.setValue("Languages", languages);
settings.endGroup();

View File

@ -2431,8 +2431,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>96</width>
<height>28</height>
<width>560</width>
<height>80</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">
@ -2451,6 +2451,12 @@
<height>100</height>
</size>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -63,6 +63,12 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -67,6 +67,12 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -1,6 +1,7 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2016 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2016 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -42,6 +43,12 @@ void TabFilterDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opt
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);