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

ProfileManager: remove some fallback-profile-related code

After the previous commit the Fallback profile shouldn't be editable
at all.

(cherry picked from commit 238a8b45)
parent 176a0e18
......@@ -302,7 +302,6 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
{
Q_ASSERT(profile);
const bool isFallback = profile->isFallback();
const QString origPath = profile->path();
const QString uniqueProfileName = generateUniqueName();
......@@ -310,17 +309,6 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
// Don't save a profile with an empty name on disk
persistent = persistent && !profile->name().isEmpty();
// If we are asked to store the fallback profile (which has an
// invalid path by design), we reset the path to an empty string
// which will make the profile writer automatically generate a
// proper path.
if (persistent && isFallback) {
profile->setProperty(Profile::UntranslatedName, uniqueProfileName);
profile->setProperty(Profile::Name, uniqueProfileName);
profile->setProperty(Profile::MenuIndex, QStringLiteral("0"));
profile->setHidden(false);
}
bool messageShown = false;
// Insert the changes into the existing Profile instance
for (auto it = propertyMap.cbegin(); it != propertyMap.cend(); ++it) {
......@@ -373,7 +361,7 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
// when creating a new profile, this works around a bug where
// the newly created profile appears twice in the ProfileSettings
// dialog
if (!isFallback && !origPath.isEmpty() && profile->path() != origPath) {
if (!origPath.isEmpty() && profile->path() != origPath) {
// this is needed to include the old profile too
_loadedAllProfiles = false;
const QList<Profile::Ptr> availableProfiles = ProfileManager::instance()->allProfiles();
......@@ -390,22 +378,8 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
}
}
if (isFallback) {
// addProfile has to be called after a path has been set for
// "profile", otherwise the newly saved profile won't show up
// in the ProfileSettings dialog in the current Konsole window
addProfile(profile);
setDefaultProfile(profile);
// Since the profile object pointed to by _fallbackProfile has
// been given a name above, now init a fallback profile again.
// This way there is always a "Default" profile available in the
// context menu.
initFallbackProfile();
} else {
// notify the world about the change
Q_EMIT profileChanged(profile);
}
// Notify the world about the change
Q_EMIT profileChanged(profile);
}
void ProfileManager::addProfile(const Profile::Ptr &profile)
......
......@@ -88,11 +88,8 @@ public:
/**
* This creates a profile based on the fallback profile, it's shown
* as "Default". This is a special profile as it's not saved on disk
* but rather created from code in Profile class, based on the default
* profile settings. When the user tries to save this profile, a name
* (other than "Default") is set for it, e.g. "Profile 1" unless the
* user has specified a name; then we init a fallback profile again as
* a separate instance.
* but rather created from code in the Profile class, based on the default
* profile settings.
*/
void initFallbackProfile();
......
......@@ -236,8 +236,6 @@ void EditProfileDialog::save()
return;
}
const bool isFallback = _profile->isFallback();
ProfileManager::instance()->changeProfile(_profile, _tempProfile->setProperties());
// ensure that these settings are not undone by a call
......@@ -250,14 +248,6 @@ void EditProfileDialog::save()
createTempProfile();
if (isFallback) {
// Needed to update the profile name in the dialog, if the user
// used "Apply" and the dialog is still open, since the fallback
// profile will have a unique name, e.g. "Profile 1", generated
// for it by the ProfileManager.
setProfile(_profile);
}
_buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
}
......@@ -919,7 +909,7 @@ void EditProfileDialog::toggleAlternateScrolling(bool enable)
updateTempProfileProperty(Profile::AlternateScrolling, enable);
}
void EditProfileDialog::toggleAllowColorFilter(bool enable)
void EditProfileDialog::toggleAllowColorFilter(bool enable)
{
updateTempProfileProperty(Profile::ColorFilterEnabled, enable);
}
......
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