summaryrefslogtreecommitdiff
path: root/ui/qt/profile_dialog.cpp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2017-02-07 21:35:16 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2017-02-08 09:07:17 +0000
commit64984b7a59ca52ec32d6608ad6ca298c054ff49e (patch)
tree02ee9212a6212bcc144d40e7e5048c63a12b1fc6 /ui/qt/profile_dialog.cpp
parentb3068a0d1bfa8b8eec2bcf0f851e5feae118fbec (diff)
downloadwireshark-64984b7a59ca52ec32d6608ad6ca298c054ff49e.tar.gz
Qt: Add check for valid profile name
Add check for a valid profile name in the Profile dialog and disable the Ok button and mark the invalid profile if error. The GTK dialog does not close on errors but the Qt dialog does, so ensure the user is informed beforehand. Change-Id: If31ffe75183066cf49e2b5a082112bfe62d6c06e Reviewed-on: https://code.wireshark.org/review/19995 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/profile_dialog.cpp')
-rw-r--r--ui/qt/profile_dialog.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 486fad3fb3..e5c697d445 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -195,6 +195,16 @@ void ProfileDialog::updateWidgets()
for (int i = 0; i < pd_ui_->profileTreeWidget->topLevelItemCount(); i++) {
item = pd_ui_->profileTreeWidget->topLevelItem(i);
profile = (profile_def *) VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole))->data;
+ if (gchar *err_msg = profile_name_is_valid(profile->name)) {
+ item->setToolTip(0, err_msg);
+ item->setBackground(0, ColorUtils::fromColorT(&prefs.gui_text_invalid));
+ if (profile == current_profile) {
+ pd_ui_->infoLabel->setText(err_msg);
+ }
+ g_free(err_msg);
+ enable_ok = false;
+ continue;
+ }
if (profile->is_global) {
item->setToolTip(0, tr("This is a system provided profile."));
continue;