1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07: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

@ -16,6 +16,7 @@
#include <QClipboard>
#include <QCoreApplication>
#include <QCursor>
#include <QFileDialog>
#include <QFont>
#include <QFontMetrics>
#include <QGuiApplication>
@ -523,6 +524,13 @@ void Tab::location_edit_return_pressed()
navigate(m_location_edit->text());
}
void Tab::open_file()
{
auto filename = QFileDialog::getOpenFileName(this, "Open file", QDir::homePath(), "All Files (*.*)");
if (!filename.isNull())
navigate("file://" + filename);
}
int Tab::tab_index()
{
return m_window->tab_index(this);