GFilePicker: Allow overriding the window title for get_open_filepath()
This commit is contained in:
parent
9129dbe0b9
commit
4089690cf1
Notes:
sideshowbarker
2024-07-19 11:32:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4089690cf11
2 changed files with 5 additions and 2 deletions
|
@ -13,10 +13,13 @@
|
||||||
#include <LibGUI/GTextBox.h>
|
#include <LibGUI/GTextBox.h>
|
||||||
#include <LibGUI/GToolBar.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);
|
auto picker = GFilePicker::construct(Mode::Open);
|
||||||
|
|
||||||
|
if (!window_title.is_null())
|
||||||
|
picker->set_title(window_title);
|
||||||
|
|
||||||
if (picker->exec() == GDialog::ExecOK) {
|
if (picker->exec() == GDialog::ExecOK) {
|
||||||
String file_path = picker->selected_file().string();
|
String file_path = picker->selected_file().string();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
Save
|
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 Optional<String> get_save_filepath(const String& title, const String& extension);
|
||||||
static bool file_exists(const StringView& path);
|
static bool file_exists(const StringView& path);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue