mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
GFilePicker: Make the path selected accessible externally
This commit is contained in:
parent
176f683f66
commit
23c90da26c
Notes:
sideshowbarker
2024-07-19 14:07:13 +09:00
Author: https://github.com/rburchell
Commit: 23c90da26c
Pull-request: https://github.com/SerenityOS/serenity/pull/42
2 changed files with 5 additions and 2 deletions
|
@ -122,7 +122,9 @@ GFilePicker::GFilePicker(const String& path, CObject* parent)
|
||||||
ok_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
ok_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||||
ok_button->set_preferred_size({ 80, 0 });
|
ok_button->set_preferred_size({ 80, 0 });
|
||||||
ok_button->set_caption("OK");
|
ok_button->set_caption("OK");
|
||||||
ok_button->on_click = [this] (auto&) {
|
ok_button->on_click = [this, filename_textbox] (auto&) {
|
||||||
|
FileSystemPath path(String::format("%s/%s", m_model->path().characters(), filename_textbox->text().characters()));
|
||||||
|
m_selected_file = path.string();
|
||||||
done(ExecOK);
|
done(ExecOK);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ public:
|
||||||
GFilePicker(const String& path = "/", CObject* parent = nullptr);
|
GFilePicker(const String& path = "/", CObject* parent = nullptr);
|
||||||
virtual ~GFilePicker() override;
|
virtual ~GFilePicker() override;
|
||||||
|
|
||||||
String selected_file() const;
|
// TODO: Should this return a FileSystemPath instead?
|
||||||
|
String selected_file() const { return m_selected_file; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GFilePicker"; }
|
virtual const char* class_name() const override { return "GFilePicker"; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue