1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 12:46:35 +01:00

Add filter to preferences extensions page

Developed by: Yehor Tsyba @malibushko

BUG: 408312
This commit is contained in:
Juraj Oravec 2020-12-12 03:00:06 +01:00 committed by Juraj Oravec
parent f7cb769371
commit d8a706f3a9
4 changed files with 23 additions and 1 deletions

View File

@ -11,6 +11,13 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="search">
<property name="placeholderText">
<string>Enter name</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="list">
<property name="alternatingRowColors">

View File

@ -52,6 +52,7 @@ PluginsManager::PluginsManager(QWidget* parent)
connect(ui->butRemove, &QAbstractButton::clicked, this, &PluginsManager::removeClicked);
connect(ui->list, &QListWidget::currentItemChanged, this, &PluginsManager::currentChanged);
connect(ui->list, &QListWidget::itemChanged, this, &PluginsManager::itemChanged);
connect(ui->search, &QLineEdit::textChanged, this, &PluginsManager::addFilter);
connect(mApp->plugins(), &Plugins::availablePluginsChanged, this, &PluginsManager::refresh);
ui->list->setItemDelegate(new PluginListDelegate(ui->list));
@ -243,6 +244,19 @@ void PluginsManager::removeClicked()
mApp->plugins()->removePlugin(&plugin);
}
void PluginsManager::addFilter(const QString& filter) {
for (int i = 0; i < ui->list->count(); ++i) {
const QString& pluginName = ui->list->item(i)->text();
if (pluginName.contains(filter,Qt::CaseInsensitive) || !filter.size()) {
ui->list->item(i)->setHidden(false);
}
else {
ui->list->item(i)->setHidden(true);
}
}
}
PluginsManager::~PluginsManager()
{
delete ui;

View File

@ -45,6 +45,7 @@ private Q_SLOTS:
void removeClicked();
void currentChanged(QListWidgetItem* item);
void itemChanged(QListWidgetItem* item);
void addFilter(const QString& newText);
void refresh();

View File

@ -232,7 +232,7 @@ QString Scripts::completeFormData(const QByteArray &data)
" var type = input.type.toLowerCase();"
" if (type != 'text' && type != 'password' && type != 'email')"
" continue;"
" if (input.name == key) {"
" if (input.name == key && input.name != "") {"
" input.value = val;"
" input.dispatchEvent(new Event('change'));"
" }"