aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-08-08 13:41:49 +0200
committerRoland Knall <rknall@gmail.com>2019-08-13 08:16:41 +0000
commit9ac61952ec6a96dc15eba55b1fef0283cafdbb24 (patch)
treee031703bd6125a040d813727c30c0387893ad2d1 /ui
parent4b00898a2a3f84cd442389439fbbc77fba52a10e (diff)
Qt: Correctly identify the active profile
Correctly mark the active profile in the list and identify it by making it bold, even if it has been renamed Change-Id: I8c5c8215b924735f460c5bd0bb4d4c21632d494b Reviewed-on: https://code.wireshark.org/review/34211 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/models/profile_model.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp
index 2202e1d17f..c5d07c78fb 100644
--- a/ui/qt/models/profile_model.cpp
+++ b/ui/qt/models/profile_model.cpp
@@ -297,8 +297,12 @@ QVariant ProfileModel::dataFontRole(const QModelIndex &index) const
if ( prof->is_global )
font.setItalic(true);
- if ( set_profile_.compare(prof->name) == 0 && ! prof->is_global )
- font.setBold(true);
+ if ( ! prof->is_global && ! checkDuplicate(index) )
+ {
+ if ( ( set_profile_.compare(prof->name) == 0 && prof->status == PROF_STAT_EXISTS ) ||
+ ( set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED ) )
+ font.setBold(true);
+ }
if ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
font.setStrikeOut(true);
@@ -876,16 +880,16 @@ void ProfileModel::doResetModel(bool reset_import)
QModelIndex ProfileModel::activeProfile() const
{
- ProfileModel * temp = const_cast<ProfileModel *>(this);
- QString sel_profile = get_profile_name();
- int row = temp->findByName(sel_profile);
- if ( row >= 0 )
+ QList<int> rows = const_cast<ProfileModel *>(this)->findAllByNameAndVisibility(set_profile_, false, true);
+ foreach ( int row, rows )
{
profile_def * prof = profiles_.at(row);
- if ( prof->is_global )
+ if ( prof->is_global || checkDuplicate(index(row, ProfileModel::COL_NAME) ) )
return QModelIndex();
- return index(row, ProfileModel::COL_NAME);
+ if ( ( set_profile_.compare(prof->name) == 0 && prof->status == PROF_STAT_EXISTS ) ||
+ ( set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED ) )
+ return index(row, ProfileModel::COL_NAME);
}
return QModelIndex();