GFilePicker: Allow overriding the window title for get_open_filepath()

This commit is contained in:
Andreas Kling 2019-10-26 21:42:34 +02:00
parent 9129dbe0b9
commit 4089690cf1
Notes: sideshowbarker 2024-07-19 11:32:00 +09:00
2 changed files with 5 additions and 2 deletions

View file

@ -13,10 +13,13 @@
#include <LibGUI/GTextBox.h>
#include <LibGUI/GToolBar.h>
Optional<String> GFilePicker::get_open_filepath()
Optional<String> GFilePicker::get_open_filepath(const String& window_title)
{
auto picker = GFilePicker::construct(Mode::Open);
if (!window_title.is_null())
picker->set_title(window_title);
if (picker->exec() == GDialog::ExecOK) {
String file_path = picker->selected_file().string();

View file

@ -16,7 +16,7 @@ public:
Save
};
static Optional<String> get_open_filepath();
static Optional<String> get_open_filepath(const String& window_title = {});
static Optional<String> get_save_filepath(const String& title, const String& extension);
static bool file_exists(const StringView& path);