summaryrefslogtreecommitdiff
path: root/ui/qt/profile_dialog.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-07-17 23:19:19 +0000
committerGerald Combs <gerald@wireshark.org>2013-07-17 23:19:19 +0000
commitaf6ba75da4ea05f724fa220d2ad674eb7f6ff217 (patch)
tree1dbd5f563c1e72829b303049d529d4438da83d84 /ui/qt/profile_dialog.cpp
parent2d006a2d57316a19edc58322757537443e98c852 (diff)
downloadwireshark-af6ba75da4ea05f724fa220d2ad674eb7f6ff217.tar.gz
Initially select the default item. Don't try to delete the default item
or global items. Don't let the user try to do that. svn path=/trunk/; revision=50711
Diffstat (limited to 'ui/qt/profile_dialog.cpp')
-rw-r--r--ui/qt/profile_dialog.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 879afb1894..5ecdaeaa00 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -38,7 +38,6 @@
#include <QUrl>
#include <QBrush>
#include <QMessageBox>
-#include <QDebug>
Q_DECLARE_METATYPE(GList *)
@@ -90,6 +89,7 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
connect(pd_ui_->profileTreeWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
this, SLOT(editingFinished()));
+ pd_ui_->profileTreeWidget->setCurrentItem(pd_ui_->profileTreeWidget->topLevelItem(0));
updateWidgets();
}
@@ -144,7 +144,7 @@ void ProfileDialog::updateWidgets()
current_profile = (profile_def *) item->data(0, Qt::UserRole).value<GList *>()->data;
enable_new = true;
enable_copy = true;
- if (!current_profile->is_global || current_profile->status != PROF_STAT_DEFAULT) {
+ if (!current_profile->is_global && current_profile->status != PROF_STAT_DEFAULT) {
enable_del = true;
}
}
@@ -214,11 +214,15 @@ void ProfileDialog::on_deleteToolButton_clicked()
if (item) {
GList *fl_entry = item->data(0, Qt::UserRole).value<GList *>();
- // Select the default
- pd_ui_->profileTreeWidget->setCurrentItem(pd_ui_->profileTreeWidget->topLevelItem(0));
-
+ profile_def *profile = (profile_def *) fl_entry->data;
+ if (profile->is_global || profile->status == PROF_STAT_DEFAULT) {
+ return;
+ }
remove_from_profile_list(fl_entry);
delete item;
+
+ // Select the default
+ pd_ui_->profileTreeWidget->setCurrentItem(pd_ui_->profileTreeWidget->topLevelItem(0));
}
}