Commit bfda9104 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Profile: add convenience function isFallback()

There are a couple of places in the code where we want to check if the
path of the profile is "FALLBACK/".
parent a3c318dc
......@@ -268,6 +268,11 @@ void Profile::clone(Profile::Ptr profile, bool differentOnly)
Profile::~Profile() = default;
bool Profile::isFallback() const
{
return path() == QLatin1String{"FALLBACK/"};
}
bool Profile::isHidden() const
{
return _hidden;
......
......@@ -413,6 +413,12 @@ public:
/** Returns true if no properties have been set in this Profile instance. */
bool isEmpty() const;
/**
* Returns true if this profile is the fallback profile, i.e. the
* profile path is "FALLBACK/".
*/
bool isFallback() const;
/**
* Returns true if this is a 'hidden' profile which should not be
* displayed in menus or saved to disk.
......
......@@ -338,10 +338,9 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
{
Q_ASSERT(profile);
const bool isFallback = profile->isFallback();
const QString origPath = profile->path();
const bool isFallback = origPath == QLatin1String("FALLBACK/");
const QStringList existingProfileNames = availableProfileNames();
// Generate a unique profile name
int nameSuffix = 1;
......
......@@ -236,7 +236,7 @@ void EditProfileDialog::save()
return;
}
const bool isFallback = _profile->path() == QLatin1String("FALLBACK/");
const bool isFallback = _profile->isFallback();
ProfileManager::instance()->changeProfile(_profile, _tempProfile->setProperties());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment