mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-25 18:52:22 -05:00
LibGUI:: Let open/save specify starting directory in FilePicker
This commit is contained in:
parent
3ba86e3156
commit
8afe013069
Notes:
sideshowbarker
2024-07-18 20:40:58 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/8afe013069e Pull-request: https://github.com/SerenityOS/serenity/pull/6161
2 changed files with 6 additions and 6 deletions
|
@ -48,9 +48,9 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title)
|
||||
Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, const StringView& path)
|
||||
{
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Open);
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Open, "", path);
|
||||
|
||||
if (!window_title.is_null())
|
||||
picker->set_title(window_title);
|
||||
|
@ -66,9 +66,9 @@ Optional<String> FilePicker::get_open_filepath(Window* parent_window, const Stri
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension)
|
||||
Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, const StringView& path)
|
||||
{
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension));
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension), path);
|
||||
|
||||
if (picker->exec() == Dialog::ExecOK) {
|
||||
String file_path = picker->selected_file().string();
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
Save
|
||||
};
|
||||
|
||||
static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {});
|
||||
static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension);
|
||||
static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {}, const StringView& path = Core::StandardPaths::home_directory());
|
||||
static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension, const StringView& path = Core::StandardPaths::home_directory());
|
||||
|
||||
virtual ~FilePicker() override;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue