forked from osmocom/wireshark
Qt: Remove unnecessary label from default copy
Restructures dataPath for PROF_STAT_COPY to ensure correct labeling of the hintLabel Bug: 15974 Change-Id: I69f61f4f8db74ca52c3b72d32af2b2bb8b19957d Reviewed-on: https://code.wireshark.org/review/34202 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
293b239406
commit
52e111e4d9
|
@ -395,32 +395,46 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
|
|||
return QVariant();
|
||||
}
|
||||
case PROF_STAT_COPY:
|
||||
if (prof->reference)
|
||||
{
|
||||
ProfileModel * nthis = const_cast<ProfileModel *>(this);
|
||||
int row = nthis->findByNameAndVisibility(prof->reference, false, true);
|
||||
profile_def * ref = Q_NULLPTR;
|
||||
if ( row > 0 && row != index.row() )
|
||||
ref = guard(row);
|
||||
else
|
||||
row = -1;
|
||||
QString msg;
|
||||
|
||||
QString msg = tr("Copied from: %1").arg(prof->reference);
|
||||
/* this should always be the case, but just as a precaution it is checked */
|
||||
if (prof->reference)
|
||||
{
|
||||
msg = tr("Copied from: %1").arg(prof->reference);
|
||||
QString appendix;
|
||||
|
||||
QString appendix;
|
||||
if ( profile_exists(prof->reference, TRUE) && prof->from_global )
|
||||
appendix = tr("system provided");
|
||||
else if ( row > 0 && ref && QString(ref->name).compare(prof->reference) != 0 )
|
||||
appendix = tr("renamed to %1").arg(ref->name);
|
||||
else if ( row < 0 )
|
||||
appendix = tr("deleted");
|
||||
/* A global profile is neither deleted or removed, only system provided is allowed as appendix */
|
||||
if ( profile_exists(prof->reference, TRUE) && prof->from_global )
|
||||
appendix = tr("system provided");
|
||||
/* A default model as reference can neither be deleted or renamed, so skip if the reference was one */
|
||||
else if ( ! index.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
|
||||
{
|
||||
/* find all non-global, non-default profiles which are referenced by this one. Those are the only
|
||||
* ones which could be renamed or deleted */
|
||||
int row = const_cast<ProfileModel *>(this)->findByNameAndVisibility(prof->reference, false, true);
|
||||
if ( row > 0 && row != index.row() )
|
||||
{
|
||||
/* found another profile, so the reference had been renamed, it the status is changed */
|
||||
profile_def * ref = guard(row);
|
||||
if ( ref && ref->status == PROF_STAT_CHANGED )
|
||||
appendix = tr("renamed to %1").arg(ref->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* found no other profile, original one had to be deleted */
|
||||
appendix = tr("deleted");
|
||||
}
|
||||
|
||||
if ( appendix.length() > 0 )
|
||||
msg.append(QString(" (%1)").arg(appendix));
|
||||
|
||||
}
|
||||
|
||||
if ( appendix.length() > 0 )
|
||||
msg.append(QString(" (%1)").arg(appendix));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
|
Loading…
Reference in New Issue