mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:17:34 +00:00
Ladybird+LibWeb: Add initial about:version internal page
This commit is contained in:
parent
05c0640474
commit
cde14901bc
7 changed files with 100 additions and 1 deletions
|
@ -148,6 +148,18 @@
|
|||
|
||||
#pragma mark - Private methods
|
||||
|
||||
- (void)openAboutVersionPage:(id)sender
|
||||
{
|
||||
auto* current_tab = [NSApp keyWindow];
|
||||
if (![current_tab isKindOfClass:[Tab class]]) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self createNewTab:URL("about:version"sv)
|
||||
fromTab:(Tab*)current_tab
|
||||
activateTab:Web::HTML::ActivateTab::Yes];
|
||||
}
|
||||
|
||||
- (nonnull TabController*)createNewTab:(Web::HTML::ActivateTab)activate_tab
|
||||
fromTab:(nullable Tab*)tab
|
||||
{
|
||||
|
@ -242,7 +254,7 @@
|
|||
auto* submenu = [[NSMenu alloc] initWithTitle:process_name];
|
||||
|
||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"About %@", process_name]
|
||||
action:@selector(orderFrontStandardAboutPanel:)
|
||||
action:@selector(openAboutVersionPage:)
|
||||
keyEquivalent:@""]];
|
||||
[submenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
|
|
@ -74,6 +74,11 @@ BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar
|
|||
|
||||
auto* menu = menuBar()->addMenu("&File");
|
||||
|
||||
auto* about_action = new QAction("&About Ladybird", this);
|
||||
menu->addAction(about_action);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto* new_tab_action = new QAction("New &Tab", this);
|
||||
new_tab_action->setIcon(load_icon_from_uri("resource://icons/16x16/new-tab.png"sv));
|
||||
new_tab_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::AddTab));
|
||||
|
@ -375,6 +380,9 @@ BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar
|
|||
debug_request("same-origin-policy", state ? "on" : "off");
|
||||
});
|
||||
|
||||
QObject::connect(about_action, &QAction::triggered, this, [this] {
|
||||
new_tab("about:version", Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
QObject::connect(new_tab_action, &QAction::triggered, this, [this] {
|
||||
new_tab(Settings::the()->new_tab_page(), Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue