diff options
author | Robin Burchell <robin+git@viroteck.net> | 2019-05-16 02:47:08 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-16 13:31:19 +0200 |
commit | 23c90da26c0bf63c61463507172fbaf9eabfe3be (patch) | |
tree | 602d4df01cfdc0e4fff143de8908ea9a8157fb78 /LibGUI | |
parent | 176f683f663eadc49d611ed9156aedd193e3cb31 (diff) | |
download | serenity-23c90da26c0bf63c61463507172fbaf9eabfe3be.zip |
GFilePicker: Make the path selected accessible externally
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GFilePicker.cpp | 4 | ||||
-rw-r--r-- | LibGUI/GFilePicker.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/LibGUI/GFilePicker.cpp b/LibGUI/GFilePicker.cpp index 80be839476..735fb26eed 100644 --- a/LibGUI/GFilePicker.cpp +++ b/LibGUI/GFilePicker.cpp @@ -122,7 +122,9 @@ GFilePicker::GFilePicker(const String& path, CObject* parent) ok_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill); ok_button->set_preferred_size({ 80, 0 }); 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); }; } diff --git a/LibGUI/GFilePicker.h b/LibGUI/GFilePicker.h index e61bae3dd2..632c0b2ff5 100644 --- a/LibGUI/GFilePicker.h +++ b/LibGUI/GFilePicker.h @@ -8,7 +8,8 @@ public: GFilePicker(const String& path = "/", CObject* parent = nullptr); 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"; } |