From c4e8a3222648fcf22ca207f1815ebbf7cd144eeb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:26 +0200 Subject: Adding upstream version 4.4.0. Signed-off-by: Daniel Baumann --- ui/qt/widgets/syntax_line_edit.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'ui/qt/widgets/syntax_line_edit.cpp') diff --git a/ui/qt/widgets/syntax_line_edit.cpp b/ui/qt/widgets/syntax_line_edit.cpp index f2c32142..3e1abe96 100644 --- a/ui/qt/widgets/syntax_line_edit.cpp +++ b/ui/qt/widgets/syntax_line_edit.cpp @@ -9,8 +9,6 @@ #include "config.h" -#include - #include #include #include @@ -86,7 +84,7 @@ void SyntaxLineEdit::setSyntaxState(SyntaxState state) { QColor deprecated_bg = ColorUtils::fromColorT(&prefs.gui_text_deprecated); QColor deprecated_fg = ColorUtils::contrastingTextColor(deprecated_bg); - // Try to matche QLineEdit's placeholder text color (which sets the + // Try to match QLineEdit's placeholder text color (which sets the // alpha channel to 50%, which doesn't work in style sheets). // Setting the foreground color lets us avoid yet another background // color preference and should hopefully make things easier to @@ -212,7 +210,7 @@ bool SyntaxLineEdit::checkDisplayFilter(QString filter) * We're being lazy and only printing the first warning. * Would it be better to print all of them? */ - syntax_error_message_ = QString(static_cast(warn->data)); + syntax_error_message_ = QString(static_cast(warn->data)); } else if (dfp != NULL && (depr = dfilter_deprecated_tokens(dfp)) != NULL) { // You keep using that word. I do not think it means what you think it means. // Possible alternatives: ::Troubled, or ::Problematic maybe? @@ -222,7 +220,7 @@ bool SyntaxLineEdit::checkDisplayFilter(QString filter) * Would it be better to print all of them? */ QString token((const char *)g_ptr_array_index(depr, 0)); - gchar *token_str = qstring_strdup(token.section('.', 0, 0)); + char *token_str = qstring_strdup(token.section('.', 0, 0)); header_field_info *hfi = proto_registrar_get_byalias(token_str); if (hfi) syntax_error_message_ = tr("\"%1\" is deprecated in favour of \"%2\". " @@ -267,10 +265,23 @@ void SyntaxLineEdit::checkCustomColumn(QString fields) return; } - gchar **splitted_fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX, - fields.toUtf8().constData(), G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED); - - for (guint i = 0; i < g_strv_length(splitted_fields); i++) { +#if 0 + // XXX - Eventually, if the operator we split on is something not supported + // in the filter expression syntax (so that we can distinguish multifield + // concatenation of column strings from a logical OR), we would split and + // then check each split result as a valid display filter. + // For now, any expression that is a valid display filter should work. + // + // We also, for the custom columns, want some of the extra completion + // information from DisplayFilterEdit (like the display filter functions), + // without all of its integration into the main app, but not every user + // of FieldFilterEdit wants that, so perhaps we eventually should have + // another class. + char **splitted_fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX, + fields.toUtf8().constData(), (GRegexCompileFlags) G_REGEX_RAW, + (GRegexMatchFlags) 0); + + for (unsigned i = 0; i < g_strv_length(splitted_fields); i++) { if (splitted_fields[i] && *splitted_fields[i]) { if (proto_check_field_name(splitted_fields[i]) != 0) { setSyntaxState(SyntaxLineEdit::Invalid); @@ -280,6 +291,7 @@ void SyntaxLineEdit::checkCustomColumn(QString fields) } } g_strfreev(splitted_fields); +#endif checkDisplayFilter(fields); } -- cgit v1.2.3