diff options
author | Michael Mann <mmann78@netscape.net> | 2018-10-21 19:24:01 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-10-22 04:45:59 +0000 |
commit | 6db67117b5cf417ffa7e0ed84219d22f93c2d9ab (patch) | |
tree | 69abd1ea04bf2dcd0f6123b5531007c7b813decd /ui | |
parent | aa038336ce55f84022a613c29e52f85d90eeeb32 (diff) |
Add ability to disable autocomplete suggestions for filter controls.
Add a preference (enabled by default) that can enable/disable the ability for Wireshark to autocomplete display and capture filter controls.
Bug: 14368
Change-Id: Ib2b688bb75c4465dab14a6a635a870d7e5c4fe80
Reviewed-on: https://code.wireshark.org/review/30320
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window_preferences_frame.cpp | 7 | ||||
-rw-r--r-- | ui/qt/main_window_preferences_frame.h | 2 | ||||
-rw-r--r-- | ui/qt/main_window_preferences_frame.ui | 7 | ||||
-rw-r--r-- | ui/qt/widgets/syntax_line_edit.cpp | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/ui/qt/main_window_preferences_frame.cpp b/ui/qt/main_window_preferences_frame.cpp index 4832a417cb..a29be594ed 100644 --- a/ui/qt/main_window_preferences_frame.cpp +++ b/ui/qt/main_window_preferences_frame.cpp @@ -35,6 +35,7 @@ MainWindowPreferencesFrame::MainWindowPreferencesFrame(QWidget *parent) : pref_recent_df_entries_max_ = prefFromPrefPtr(&prefs.gui_recent_df_entries_max); pref_recent_files_count_max_ = prefFromPrefPtr(&prefs.gui_recent_files_count_max); pref_ask_unsaved_ = prefFromPrefPtr(&prefs.gui_ask_unsaved); + pref_autocomplete_filter_ = prefFromPrefPtr(&prefs.gui_autocomplete_filter); pref_toolbar_main_style_ = prefFromPrefPtr(&prefs.gui_toolbar_main_style); QStyleOption style_opt; @@ -122,6 +123,7 @@ void MainWindowPreferencesFrame::updateWidgets() ui->maxRecentLineEdit->setText(QString::number(prefs_get_uint_value_real(pref_recent_files_count_max_, pref_stashed))); ui->confirmUnsavedCheckBox->setChecked(prefs_get_bool_value(pref_ask_unsaved_, pref_stashed)); + ui->displayAutoCompleteCheckBox->setChecked(prefs_get_bool_value(pref_autocomplete_filter_, pref_stashed)); ui->mainToolbarComboBox->setCurrentIndex(prefs_get_enum_value(pref_toolbar_main_style_, pref_stashed)); @@ -188,6 +190,11 @@ void MainWindowPreferencesFrame::on_confirmUnsavedCheckBox_toggled(bool checked) prefs_set_bool_value(pref_ask_unsaved_, checked, pref_stashed); } +void MainWindowPreferencesFrame::on_displayAutoCompleteCheckBox_toggled(bool checked) +{ + prefs_set_bool_value(pref_autocomplete_filter_, checked, pref_stashed); +} + void MainWindowPreferencesFrame::on_mainToolbarComboBox_currentIndexChanged(int index) { prefs_set_enum_value(pref_toolbar_main_style_, index, pref_stashed); diff --git a/ui/qt/main_window_preferences_frame.h b/ui/qt/main_window_preferences_frame.h index 01477e344c..5f51e1f87f 100644 --- a/ui/qt/main_window_preferences_frame.h +++ b/ui/qt/main_window_preferences_frame.h @@ -40,6 +40,7 @@ private: pref_t *pref_recent_df_entries_max_; pref_t *pref_recent_files_count_max_; pref_t *pref_ask_unsaved_; + pref_t *pref_autocomplete_filter_; pref_t *pref_toolbar_main_style_; void updateWidgets(); @@ -52,6 +53,7 @@ private slots: void on_maxFilterLineEdit_textEdited(const QString &new_max); void on_maxRecentLineEdit_textEdited(const QString &new_max); void on_confirmUnsavedCheckBox_toggled(bool checked); + void on_displayAutoCompleteCheckBox_toggled(bool checked); void on_mainToolbarComboBox_currentIndexChanged(int index); void on_languageComboBox_currentIndexChanged(int index); }; diff --git a/ui/qt/main_window_preferences_frame.ui b/ui/qt/main_window_preferences_frame.ui index 9824bbd80c..35dd6580f4 100644 --- a/ui/qt/main_window_preferences_frame.ui +++ b/ui/qt/main_window_preferences_frame.ui @@ -155,6 +155,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="displayAutoCompleteCheckBox"> + <property name="text"> + <string>Display autocompletion for filter text</string> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QLabel" name="label_5"> diff --git a/ui/qt/widgets/syntax_line_edit.cpp b/ui/qt/widgets/syntax_line_edit.cpp index a846640f46..e241c86b7b 100644 --- a/ui/qt/widgets/syntax_line_edit.cpp +++ b/ui/qt/widgets/syntax_line_edit.cpp @@ -306,7 +306,7 @@ void SyntaxLineEdit::completionKeyPressEvent(QKeyEvent *event) // ...otherwise process the key ourselves. SyntaxLineEdit::keyPressEvent(event); - if (!completer_ || !completion_model_) return; + if (!completer_ || !completion_model_ || !prefs.gui_autocomplete_filter) return; // Do nothing on bare shift. if ((event->modifiers() & Qt::ShiftModifier) && event->text().isEmpty()) return; |