mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibGUI: Add parent window argument to FilePicker functions
Since FilePicker almost always should be modal, add the parent window as mandatory first argument.
This commit is contained in:
parent
9844088964
commit
6568765e8f
14 changed files with 27 additions and 26 deletions
|
@ -42,9 +42,9 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
Optional<String> FilePicker::get_open_filepath(const String& window_title, Options options)
|
||||
Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, Options options)
|
||||
{
|
||||
auto picker = FilePicker::construct(Mode::Open, options);
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Open, options);
|
||||
|
||||
if (!window_title.is_null())
|
||||
picker->set_title(window_title);
|
||||
|
@ -60,9 +60,9 @@ Optional<String> FilePicker::get_open_filepath(const String& window_title, Optio
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<String> FilePicker::get_save_filepath(const String& title, const String& extension, Options options)
|
||||
Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, Options options)
|
||||
{
|
||||
auto picker = FilePicker::construct(Mode::Save, options, String::format("%s.%s", title.characters(), extension.characters()));
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Save, options, String::format("%s.%s", title.characters(), extension.characters()));
|
||||
|
||||
if (picker->exec() == Dialog::ExecOK) {
|
||||
String file_path = picker->selected_file().string();
|
||||
|
@ -75,7 +75,7 @@ Optional<String> FilePicker::get_save_filepath(const String& title, const String
|
|||
return {};
|
||||
}
|
||||
|
||||
FilePicker::FilePicker(Mode mode, Options options, const StringView& file_name, const StringView& path, Window* parent_window)
|
||||
FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const StringView& file_name, const StringView& path)
|
||||
: Dialog(parent_window)
|
||||
, m_model(FileSystemModel::create())
|
||||
, m_mode(mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue