Qt: Allow renaming personal profile

If a personal profile has the same name as a global profile (which
is usually the case if it has been copied without changing the name
afterwards), there was a bug where renaming the profile was no longer
possible.

Bug: 16423
Change-Id: Idafd216d007179a4c6221eafc2ff296d277d5b1d
Reviewed-on: https://code.wireshark.org/review/36902
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Roland Knall 2020-04-21 22:54:32 +02:00
parent 07576e9f3b
commit adb8feee6d
2 changed files with 7 additions and 1 deletions

View File

@ -354,6 +354,9 @@ bool ProfileModel::checkIfDeleted(const QModelIndex &index) const
deletedNames << profcurr->name;
}
if (profcurr->is_global && deletedNames.contains(profcurr->name))
deletedNames.removeAll(profcurr->name);
current = gxx_list_next(current);
}
@ -374,7 +377,7 @@ bool ProfileModel::checkInvalid(const QModelIndex &index) const
return false;
profile_def * pg = guard(ref);
if (pg && pg->status == PROF_STAT_CHANGED && g_strcmp0(pg->name, pg->reference) != 0)
if (pg && pg->status == PROF_STAT_CHANGED && g_strcmp0(pg->name, pg->reference) != 0 && ! prof->is_global)
return true;
return false;

View File

@ -359,6 +359,9 @@ void ProfileDialog::updateWidgets()
if (rows.count() > 1)
enable_ok = false;
}
if (enable_ok && ! model_->checkIfDeleted(index) && index.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_CHANGED)
hintUrl.clear();
}
pd_ui_->hintLabel->setUrl(hintUrl);