diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index 137247c245a..2ab268441b0 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -97,6 +97,22 @@ void ThemeModel::invalidate() Model::invalidate(); } +Vector ThemeModel::matches(StringView needle, unsigned flags, const GUI::ModelIndex& parent) +{ + Vector found = {}; + + for (size_t i = 0; i < m_themes.size(); ++i) { + auto theme = m_themes[i]; + if (!string_matches(theme, needle, flags)) + continue; + found.append(index(i, 0, parent)); + if (flags & GUI::Model::MatchesFlag::FirstMatchOnly) + break; + } + + return found; +} + ErrorOr> ThemeWidget::try_create() { auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ThemeWidget())); @@ -145,6 +161,4 @@ void ThemeWidget::apply_settings() void ThemeWidget::reset_default_values() { m_theme_name_box->set_text("Default"); - // FIXME: ComboBox::set_text() doesn't fire the on_change callback, so we have to set the theme here manually. - m_mouse_cursor_model->change_theme("Default"); } diff --git a/Userland/Applications/MouseSettings/ThemeWidget.h b/Userland/Applications/MouseSettings/ThemeWidget.h index 5c17717f88c..9762ec5e172 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.h +++ b/Userland/Applications/MouseSettings/ThemeWidget.h @@ -56,6 +56,7 @@ public: virtual int column_count(const GUI::ModelIndex&) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; + virtual Vector matches(StringView, unsigned = GUI::Model::MatchesFlag::AllMatching, GUI::ModelIndex const& = GUI::ModelIndex()) override; virtual void invalidate() override; private: