mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:35:06 +00:00
Help: Add a "Home" action to the toolbar :^)
This commit is contained in:
parent
ae0320183a
commit
88ce755579
1 changed files with 9 additions and 3 deletions
|
@ -260,8 +260,15 @@ int main(int argc, char* argv[])
|
||||||
go_back_action->set_enabled(false);
|
go_back_action->set_enabled(false);
|
||||||
go_forward_action->set_enabled(false);
|
go_forward_action->set_enabled(false);
|
||||||
|
|
||||||
|
auto go_home_action = GUI::CommonActions::make_go_home_action([&](auto&) {
|
||||||
|
String path = "/usr/share/man/man7/Help-index.md";
|
||||||
|
history.push(path);
|
||||||
|
open_page(path);
|
||||||
|
});
|
||||||
|
|
||||||
toolbar.add_action(*go_back_action);
|
toolbar.add_action(*go_back_action);
|
||||||
toolbar.add_action(*go_forward_action);
|
toolbar.add_action(*go_forward_action);
|
||||||
|
toolbar.add_action(*go_home_action);
|
||||||
|
|
||||||
auto menubar = GUI::MenuBar::construct();
|
auto menubar = GUI::MenuBar::construct();
|
||||||
|
|
||||||
|
@ -277,6 +284,7 @@ int main(int argc, char* argv[])
|
||||||
auto& go_menu = menubar->add_menu("Go");
|
auto& go_menu = menubar->add_menu("Go");
|
||||||
go_menu.add_action(*go_back_action);
|
go_menu.add_action(*go_back_action);
|
||||||
go_menu.add_action(*go_forward_action);
|
go_menu.add_action(*go_forward_action);
|
||||||
|
go_menu.add_action(*go_home_action);
|
||||||
|
|
||||||
app->set_menubar(move(menubar));
|
app->set_menubar(move(menubar));
|
||||||
|
|
||||||
|
@ -288,9 +296,7 @@ int main(int argc, char* argv[])
|
||||||
search_model.set_filter_term(search_box.text());
|
search_model.set_filter_term(search_box.text());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String path = "/usr/share/man/man7/Help-index.md";
|
go_home_action->activate();
|
||||||
history.push(path);
|
|
||||||
open_page(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window->set_focused_widget(&left_tab_bar);
|
window->set_focused_widget(&left_tab_bar);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue