Commit f3efa546 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Notifications] Return invalid model index for empty query

Otherwise this will erroneously match applications that don't have such an entry
parent 999b619b
......@@ -51,6 +51,9 @@ QPersistentModelIndex SourcesModel::makePersistentModelIndex(const QModelIndex &
QPersistentModelIndex SourcesModel::persistentIndexForDesktopEntry(const QString &desktopEntry) const
{
if (desktopEntry.isEmpty()) {
return QPersistentModelIndex();
}
const auto matches = match(index(0, 0), SourcesModel::DesktopEntryRole, desktopEntry, 1, Qt::MatchFixedString);
if (matches.isEmpty()) {
return QPersistentModelIndex();
......@@ -60,6 +63,9 @@ QPersistentModelIndex SourcesModel::persistentIndexForDesktopEntry(const QString
QPersistentModelIndex SourcesModel::persistentIndexForNotifyRcName(const QString &notifyRcName) const
{
if (notifyRcName.isEmpty()) {
return QPersistentModelIndex();
}
const auto matches = match(index(0, 0), SourcesModel::NotifyRcNameRole, notifyRcName, 1, Qt::MatchFixedString);
if (matches.isEmpty()) {
return QPersistentModelIndex();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment