mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibGUI: Enable/Disable the Open button on text change in FilePicker
Prior this change, the button was updated on user selection change in the file view. This isn't quite right, as you could remove the text from the text box or (even worse) start typing a filename there and the button state wouldn't change.
This commit is contained in:
parent
3c6ad4c7db
commit
71185f91a8
1 changed files with 5 additions and 2 deletions
|
@ -187,7 +187,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
|
|||
done(ExecCancel);
|
||||
};
|
||||
|
||||
m_view->on_selection_change = [this, &ok_button] {
|
||||
m_filename_textbox->on_change = [&] {
|
||||
ok_button.set_enabled(!m_filename_textbox->text().is_empty());
|
||||
};
|
||||
|
||||
m_view->on_selection_change = [this] {
|
||||
auto index = m_view->selection().first();
|
||||
auto& filter_model = (SortingProxyModel&)*m_view->model();
|
||||
auto local_index = filter_model.map_to_source(index);
|
||||
|
@ -199,7 +203,6 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
|
|||
} else if (m_mode != Mode::Save) {
|
||||
m_filename_textbox->clear();
|
||||
}
|
||||
ok_button.set_enabled(!m_filename_textbox->text().is_empty());
|
||||
};
|
||||
|
||||
m_view->on_activation = [this](auto& index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue