|
@@ -12,6 +12,8 @@
|
|
#include <LibGUI/BoxLayout.h>
|
|
#include <LibGUI/BoxLayout.h>
|
|
#include <LibGUI/CommandPalette.h>
|
|
#include <LibGUI/CommandPalette.h>
|
|
#include <LibGUI/FilteringProxyModel.h>
|
|
#include <LibGUI/FilteringProxyModel.h>
|
|
|
|
+#include <LibGUI/Menu.h>
|
|
|
|
+#include <LibGUI/MenuItem.h>
|
|
#include <LibGUI/Model.h>
|
|
#include <LibGUI/Model.h>
|
|
#include <LibGUI/Painter.h>
|
|
#include <LibGUI/Painter.h>
|
|
#include <LibGUI/TableView.h>
|
|
#include <LibGUI/TableView.h>
|
|
@@ -63,6 +65,7 @@ public:
|
|
enum Column {
|
|
enum Column {
|
|
Icon,
|
|
Icon,
|
|
Text,
|
|
Text,
|
|
|
|
+ Menu,
|
|
Shortcut,
|
|
Shortcut,
|
|
__Count,
|
|
__Count,
|
|
};
|
|
};
|
|
@@ -117,7 +120,9 @@ public:
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
case Column::Text:
|
|
case Column::Text:
|
|
- return Gfx::parse_ampersand_string(action.text());
|
|
|
|
|
|
+ return action_text(index);
|
|
|
|
+ case Column::Menu:
|
|
|
|
+ return menu_name(index);
|
|
case Column::Shortcut:
|
|
case Column::Shortcut:
|
|
if (!action.shortcut().is_valid())
|
|
if (!action.shortcut().is_valid())
|
|
return "";
|
|
return "";
|
|
@@ -129,13 +134,33 @@ public:
|
|
|
|
|
|
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override
|
|
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override
|
|
{
|
|
{
|
|
- auto& action = *static_cast<GUI::Action*>(index.internal_data());
|
|
|
|
- auto text = Gfx::parse_ampersand_string(action.text());
|
|
|
|
- if (text.contains(term.as_string(), CaseSensitivity::CaseInsensitive))
|
|
|
|
|
|
+ auto search = String::formatted("{} {}", menu_name(index), action_text(index));
|
|
|
|
+ if (search.contains(term.as_string(), CaseSensitivity::CaseInsensitive))
|
|
return TriState::True;
|
|
return TriState::True;
|
|
return TriState::False;
|
|
return TriState::False;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ static String action_text(ModelIndex const& index)
|
|
|
|
+ {
|
|
|
|
+ auto& action = *static_cast<GUI::Action*>(index.internal_data());
|
|
|
|
+
|
|
|
|
+ return Gfx::parse_ampersand_string(action.text());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static String menu_name(ModelIndex const& index)
|
|
|
|
+ {
|
|
|
|
+ auto& action = *static_cast<GUI::Action*>(index.internal_data());
|
|
|
|
+ if (action.menu_items().is_empty())
|
|
|
|
+ return {};
|
|
|
|
+
|
|
|
|
+ auto* menu_item = *action.menu_items().begin();
|
|
|
|
+ auto* menu = Menu::from_menu_id(menu_item->menu_id());
|
|
|
|
+ if (!menu)
|
|
|
|
+ return {};
|
|
|
|
+
|
|
|
|
+ return Gfx::parse_ampersand_string(menu->name());
|
|
|
|
+ }
|
|
|
|
+
|
|
private:
|
|
private:
|
|
Vector<NonnullRefPtr<GUI::Action>> const& m_actions;
|
|
Vector<NonnullRefPtr<GUI::Action>> const& m_actions;
|
|
};
|
|
};
|