aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/models
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-10-18 13:59:49 -0700
committerGerald Combs <gerald@wireshark.org>2022-10-19 17:03:49 +0000
commitb2b76c2baefc9a483de83cbcb810d9a609e948f0 (patch)
tree4d23d8d45b51391c749355f9a875133c67ab4d0e /ui/qt/models
parent5bb756e203539c7fd3bb6c16dd845e42a347a982 (diff)
Qt: Add geolocation columns back to the Endpoints dialog.
Add geolocation columns back to the Endpoints dialog. Fix our geolocation column alignments as well. Fixes #18320.
Diffstat (limited to 'ui/qt/models')
-rw-r--r--ui/qt/models/atap_data_model.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/ui/qt/models/atap_data_model.cpp b/ui/qt/models/atap_data_model.cpp
index 47bdb6c821..6ca21b89e7 100644
--- a/ui/qt/models/atap_data_model.cpp
+++ b/ui/qt/models/atap_data_model.cpp
@@ -318,6 +318,13 @@ EndpointDataModel::EndpointDataModel(int protoId, QString filter, QObject *paren
int EndpointDataModel::columnCount(const QModelIndex &) const
{
+#ifdef HAVE_MAXMINDDB
+ int proto_ipv4 = proto_get_id_by_filter_name("ip");
+ int proto_ipv6 = proto_get_id_by_filter_name("ipv6");
+ if (protoId() == proto_ipv4 || protoId() == proto_ipv6) {
+ return ENDP_NUM_GEO_COLUMNS;
+ }
+#endif
return ENDP_NUM_COLUMNS;
}
@@ -358,8 +365,15 @@ QVariant EndpointDataModel::headerData(int section, Qt::Orientation orientation,
return tr("AS Organization"); break;
}
} else if (role == Qt::TextAlignmentRole) {
- if (section == ENDP_COLUMN_ADDR)
+ switch (section) {
+ case ENDP_COLUMN_ADDR:
+ case ENDP_COLUMN_GEO_COUNTRY:
+ case ENDP_COLUMN_GEO_CITY:
+ case ENDP_COLUMN_GEO_AS_ORG:
return Qt::AlignLeft;
+ default:
+ break;
+ }
return Qt::AlignRight;
}
@@ -465,8 +479,15 @@ QVariant EndpointDataModel::data(const QModelIndex &idx, int role) const
return QVariant();
}
} else if (role == Qt::TextAlignmentRole) {
- if (idx.column() == ENDP_COLUMN_ADDR)
+ switch (idx.column()) {
+ case ENDP_COLUMN_ADDR:
+ case ENDP_COLUMN_GEO_COUNTRY:
+ case ENDP_COLUMN_GEO_CITY:
+ case ENDP_COLUMN_GEO_AS_ORG:
return Qt::AlignLeft;
+ default:
+ break;
+ }
return Qt::AlignRight;
} else if (role == ATapDataModel::DISPLAY_FILTER) {
return QString(get_endpoint_filter(item));