diff options
author | Roland Knall <rknall@gmail.com> | 2019-07-21 22:33:12 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-07-21 21:07:04 +0000 |
commit | 193ca63247b48540425c623e5d3e327ee3052c31 (patch) | |
tree | dfd95f0dfe5b7266e27c4b1fccd9b0ae37280bd9 | |
parent | a80b4fdd409dec75e96475f9d17034788e296b88 (diff) |
Qt: Fix deletion
- If a profile, based on a system default, is being deleted the
selected profile should switch back to the default
- The default profile is not a system profile
Change-Id: I267a0e14b9f974fdabe5a9b21187ad0673265b01
Reviewed-on: https://code.wireshark.org/review/34051
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r-- | ui/qt/models/profile_model.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp index 7eadb60c38..041b0a7442 100644 --- a/ui/qt/models/profile_model.cpp +++ b/ui/qt/models/profile_model.cpp @@ -87,7 +87,7 @@ bool ProfileSortModel::filterAcceptsRow(int source_row, const QModelIndex &) con if ( ft_ != ProfileSortModel::AllProfiles ) { - bool gl = idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() || idx.data(ProfileModel::DATA_IS_DEFAULT).toBool(); + bool gl = idx.data(ProfileModel::DATA_IS_GLOBAL).toBool(); if ( ft_ == ProfileSortModel::UserProfiles && gl ) accept = false; else if ( ft_ == ProfileSortModel::GlobalProfiles && ! gl ) @@ -251,12 +251,8 @@ QVariant ProfileModel::data(const QModelIndex &index, int role) const if ( prof->is_global ) font.setItalic(true); - if ( set_profile_.compare(prof->name) == 0 ) - { - profile_def * act = guard(activeProfile().row()); - if ( act->is_global == prof->is_global ) - font.setBold(true); - } + if ( set_profile_.compare(prof->name) == 0 && ! prof->is_global ) + font.setBold(true); if ( prof->status == PROF_STAT_DEFAULT && reset_default_ ) font.setStrikeOut(true); @@ -562,7 +558,13 @@ QModelIndex ProfileModel::activeProfile() const QString sel_profile = get_profile_name(); int row = temp->findByName(sel_profile); if ( row >= 0 ) + { + profile_def * prof = profiles_.at(row); + if ( prof->is_global ) + return QModelIndex(); + return index(row, ProfileModel::COL_NAME); + } return QModelIndex(); } |