mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
parent
6e2d8d8fe7
commit
bcf824dce2
@ -436,19 +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);
|
||||
if (!ui->spellcheckLanguages->findItems(lang, Qt::MatchExactly).isEmpty()) {
|
||||
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 {
|
||||
@ -1003,8 +1013,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();
|
||||
|
@ -2424,8 +2424,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">
|
||||
@ -2444,6 +2444,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>
|
||||
|
Loading…
Reference in New Issue
Block a user