mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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
Notes:
sideshowbarker
2024-07-19 17:13:26 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/71185f91a82 Pull-request: https://github.com/SerenityOS/serenity/pull/10003
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…
Reference in a new issue