Changeset View
Changeset View
Standalone View
Standalone View
src/ProfileManager.cpp
Context not available. | |||||
342 | { | 342 | { | ||
---|---|---|---|---|---|
343 | Q_ASSERT(profile); | 343 | Q_ASSERT(profile); | ||
344 | 344 | | |||
345 | QString origPath = profile->path(); | ||||
346 | | ||||
345 | // never save a profile with empty name into disk! | 347 | // never save a profile with empty name into disk! | ||
346 | persistent = persistent && !profile->name().isEmpty(); | 348 | persistent = persistent && !profile->name().isEmpty(); | ||
347 | 349 | | |||
Context not available. | |||||
411 | // it has no file on disk | 413 | // it has no file on disk | ||
412 | if (persistent && !newProfile->isHidden()) { | 414 | if (persistent && !newProfile->isHidden()) { | ||
413 | newProfile->setProperty(Profile::Path, saveProfile(newProfile)); | 415 | newProfile->setProperty(Profile::Path, saveProfile(newProfile)); | ||
416 | // if the profile was renamed, after saving the new profile | ||||
417 | // delete the the old/redundant profile. | ||||
418 | // only do this if origPath is not empty, because it's empty | ||||
419 | // when creating a new profile, this works around a bug where | ||||
420 | // the newly created profile appears twice in the ProfileSettings | ||||
421 | // dialog | ||||
422 | if (!origPath.isEmpty() && newProfile->path() != origPath) { | ||||
423 | Profile::Ptr oldProfile; | ||||
424 | // this is needed to include the old profile too | ||||
425 | _loadedAllProfiles = false; | ||||
426 | QList<Profile::Ptr> availableProfiles = ProfileManager::instance()->allProfiles(); | ||||
427 | foreach(oldProfile, availableProfiles) { | ||||
428 | if (oldProfile->path() == origPath) { | ||||
429 | // assign the same shortcut of the old profile to | ||||
430 | // the newly renamed profile | ||||
431 | setShortcut(newProfile, shortcut(oldProfile)); | ||||
432 | deleteProfile(oldProfile); | ||||
433 | } | ||||
434 | } | ||||
435 | } | ||||
414 | } | 436 | } | ||
415 | 437 | | |||
416 | // notify the world about the change | 438 | // notify the world about the change | ||
Context not available. |