diff options
-rw-r--r-- | ui/qt/search_frame.cpp | 14 | ||||
-rw-r--r-- | ui/qt/widgets/display_filter_edit.cpp | 5 | ||||
-rw-r--r-- | ui/qt/widgets/field_filter_edit.cpp | 3 | ||||
-rw-r--r-- | ui/qt/widgets/syntax_line_edit.cpp | 8 | ||||
-rw-r--r-- | ui/qt/widgets/syntax_line_edit.h | 2 |
5 files changed, 21 insertions, 11 deletions
diff --git a/ui/qt/search_frame.cpp b/ui/qt/search_frame.cpp index ef20ec16b6..feea246b5c 100644 --- a/ui/qt/search_frame.cpp +++ b/ui/qt/search_frame.cpp @@ -274,9 +274,6 @@ void SearchFrame::updateWidgets() return; } - // Enable completion only for display filter search. - sf_ui_->searchLineEdit->allowCompletion(search_type == df_search_); - if (sf_ui_->searchLineEdit->text().isEmpty() || sf_ui_->searchLineEdit->syntaxState() == SyntaxLineEdit::Invalid) { sf_ui_->findButton->setEnabled(false); } else { @@ -343,7 +340,16 @@ void SearchFrame::on_searchTypeComboBox_currentIndexChanged(int idx) break; } - wsApp->popStatus(WiresharkApplication::FilterSyntax); + // Enable completion only for display filter search. + sf_ui_->searchLineEdit->allowCompletion(idx == df_search_); + + if (idx == df_search_) { + sf_ui_->searchLineEdit->checkFilter(); + } else { + sf_ui_->searchLineEdit->setToolTip(QString()); + wsApp->popStatus(WiresharkApplication::FilterSyntax); + } + updateWidgets(); } diff --git a/ui/qt/widgets/display_filter_edit.cpp b/ui/qt/widgets/display_filter_edit.cpp index dc77e2a9ca..e87bfdc394 100644 --- a/ui/qt/widgets/display_filter_edit.cpp +++ b/ui/qt/widgets/display_filter_edit.cpp @@ -341,8 +341,8 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text) } emit popFilterSyntaxStatus(); - setToolTip(QString()); - checkDisplayFilter(filter_text); + if (!checkDisplayFilter(filter_text)) + return; switch (syntaxState()) { case Deprecated: @@ -359,6 +359,7 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text) break; } default: + setToolTip(QString()); break; } diff --git a/ui/qt/widgets/field_filter_edit.cpp b/ui/qt/widgets/field_filter_edit.cpp index 9795eb7e70..6d5fd8a9b2 100644 --- a/ui/qt/widgets/field_filter_edit.cpp +++ b/ui/qt/widgets/field_filter_edit.cpp @@ -94,7 +94,8 @@ bool FieldFilterEdit::checkFilter() void FieldFilterEdit::checkFilter(const QString& filter_text) { popFilterSyntaxStatus(); - checkDisplayFilter(filter_text); + if (!checkDisplayFilter(filter_text)) + return; switch (syntaxState()) { case Deprecated: diff --git a/ui/qt/widgets/syntax_line_edit.cpp b/ui/qt/widgets/syntax_line_edit.cpp index 187f432ee8..9d8b954517 100644 --- a/ui/qt/widgets/syntax_line_edit.cpp +++ b/ui/qt/widgets/syntax_line_edit.cpp @@ -155,15 +155,15 @@ void SyntaxLineEdit::insertFilter(const QString &filter) insert(padded_filter); } -void SyntaxLineEdit::checkDisplayFilter(QString filter) +bool SyntaxLineEdit::checkDisplayFilter(QString filter) { if (!completion_enabled_) { - return; + return false; } if (filter.isEmpty()) { setSyntaxState(SyntaxLineEdit::Empty); - return; + return true; } dfilter_t *dfp = NULL; @@ -200,6 +200,8 @@ void SyntaxLineEdit::checkDisplayFilter(QString filter) g_free(err_msg); } dfilter_free(dfp); + + return true; } void SyntaxLineEdit::checkFieldName(QString field) diff --git a/ui/qt/widgets/syntax_line_edit.h b/ui/qt/widgets/syntax_line_edit.h index cc1b8461e3..c63af3de26 100644 --- a/ui/qt/widgets/syntax_line_edit.h +++ b/ui/qt/widgets/syntax_line_edit.h @@ -44,7 +44,7 @@ public slots: void insertFilter(const QString &filter); // Built-in syntax checks. Connect textChanged to these as needed. - void checkDisplayFilter(QString filter); + bool checkDisplayFilter(QString filter); void checkFieldName(QString field); void checkCustomColumn(QString fields); void checkInteger(QString number); |