mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:57:45 +00:00
Help: Optionally take an argument to search for
This commit is contained in:
parent
21094b4725
commit
3455876976
1 changed files with 17 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "History.h"
|
#include "History.h"
|
||||||
#include "ManualModel.h"
|
#include "ManualModel.h"
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibDesktop/Launcher.h>
|
#include <LibDesktop/Launcher.h>
|
||||||
#include <LibGUI/AboutDialog.h>
|
#include <LibGUI/AboutDialog.h>
|
||||||
|
@ -83,6 +84,13 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
unveil(nullptr, nullptr);
|
unveil(nullptr, nullptr);
|
||||||
|
|
||||||
|
const char* term_to_search_for_at_launch = nullptr;
|
||||||
|
|
||||||
|
Core::ArgsParser args_parser;
|
||||||
|
args_parser.add_positional_argument(term_to_search_for_at_launch, "Term to search for at launch", "term", Core::ArgsParser::Required::No);
|
||||||
|
|
||||||
|
args_parser.parse(argc, argv);
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-help");
|
auto app_icon = GUI::Icon::default_icon("app-help");
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
|
@ -279,6 +287,15 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
app->set_menubar(move(menubar));
|
app->set_menubar(move(menubar));
|
||||||
|
|
||||||
|
if (term_to_search_for_at_launch) {
|
||||||
|
left_tab_bar.set_active_widget(&search_view);
|
||||||
|
search_box.set_text(term_to_search_for_at_launch);
|
||||||
|
if (auto model = search_list_view.model()) {
|
||||||
|
auto& search_model = *static_cast<GUI::FilteringProxyModel*>(model);
|
||||||
|
search_model.set_filter_term(search_box.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window->set_focused_widget(&left_tab_bar);
|
window->set_focused_widget(&left_tab_bar);
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue