1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

Ladybird: Add "Open File..." to menu

This commit is contained in:
Xexxa 2023-05-25 23:47:12 +02:00 committed by Linus Groh
parent e8af912e30
commit 5f39a3f911
4 changed files with 21 additions and 0 deletions

View file

@ -65,6 +65,11 @@ BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdrive
close_current_tab_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Close));
menu->addAction(close_current_tab_action);
auto* open_file_action = new QAction("&Open File...", this);
open_file_action->setIcon(QIcon(QString("%1/res/icons/16x16/filetype-folder-open.png").arg(s_serenity_resource_root.characters())));
open_file_action->setShortcut(QKeySequence(QKeySequence::StandardKey::Open));
menu->addAction(open_file_action);
menu->addSeparator();
auto* quit_action = new QAction("&Quit", this);
@ -349,6 +354,7 @@ BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdrive
QObject::connect(new_tab_action, &QAction::triggered, this, [this] {
new_tab(s_settings->new_tab_page(), Web::HTML::ActivateTab::Yes);
});
QObject::connect(open_file_action, &QAction::triggered, this, &BrowserWindow::open_file);
QObject::connect(settings_action, &QAction::triggered, this, [this] {
new SettingsDialog(this);
});
@ -504,6 +510,11 @@ void BrowserWindow::close_tab(int index)
});
}
void BrowserWindow::open_file()
{
m_current_tab->open_file();
}
void BrowserWindow::close_current_tab()
{
auto count = m_tabs_container->count() - 1;