From f60ec39f5639064290a788a508a542e0f043ae08 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 7 Mar 2013 23:25:02 +0000 Subject: [PATCH] Prevent Ok being pressed when no device is selected Disable Ok until a device has been selected, and select the first device when scan is pressed --- pv/dialogs/connect.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 87fc451a..51de735e 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -112,6 +112,7 @@ void Connect::unset_connection() _device_list.clear(); _serial_device.hide(); _form_layout.labelForField(&_serial_device)->hide(); + _button_box.button(QDialogButtonBox::Ok)->setDisabled(true); } void Connect::set_serial_connection() @@ -167,6 +168,9 @@ void Connect::scan_pressed() g_slist_free(devices); g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts); + + _device_list.setCurrentRow(0); + _button_box.button(QDialogButtonBox::Ok)->setDisabled(false); } void Connect::device_selected(int index) -- 2.30.2