110 if (
d->profiles.contains(name)) {
111 QString currentProfileName =
d->currentProfile->name();
113 delete d->profiles.value(name);
114 d->profiles.remove(name);
119 if (userDir.exists(
d->profileFileName(name))) {
120 userDir.remove(
d->profileFileName(name));
123 if (currentProfileName == name) {
124 d->currentProfile =
d->profiles.begin().value();
180 d->currentProfile =
nullptr;
181 qDeleteAll(
d->profiles);
191 QMap<QString, ProfileEntry> profileEntriesToMigrate;
192 QMap<QString, QList<ProfileEntry>> profileEntries;
202 KConfig config(
p, KConfig::SimpleConfig);
203 if (!config.hasGroup(
"General") || !config.group(
"General").hasKey(
"name") || !config.group(
"General").hasKey(
"version")) {
209 entry.
version = config.group(
"General").readEntry(
"version", 0);
210 entry.
name = config.group(
"General").readEntry(
"name");
217 profileEntriesToMigrate[entry.
name] = entry;
220 if (!profileEntries.contains(entry.
name)) {
226 profileEntries[entry.
name].append(entry);
232 auto entriesIt = profileEntriesToMigrate.begin();
233 while (entriesIt != profileEntriesToMigrate.end()) {
238 if (profileEntries.contains(entry.
name)) {
244 if (existingEntry.
fullpath.startsWith(userLocalSaveLocation)) {
245 entriesIt = profileEntriesToMigrate.erase(entriesIt);
254 profileEntries.remove(existingEntry.
name);
264 QMap<ProfileEntry, QList<KisShortcutConfiguration>> parsedProfilesToMigrate =
265 migrator.
migrate(profileEntriesToMigrate);
267 for (
ProfileEntry profileEntry : parsedProfilesToMigrate.keys()) {
273 const QString profilePath = profileEntry.fullpath;
274 QString oldProfileName = QFileInfo(profilePath).fileName();
275 oldProfileName.replace(
".profile", QString::number(
PROFILE_VERSION - 1) +
".profile");
277 QString oldProfilePath = storagePath + oldProfileName;
279 QFile::copy(profilePath, oldProfilePath);
281 KConfig config(oldProfilePath, KConfig::SimpleConfig);
287 for (
const auto &shortcut : shortcuts) {
297 Q_FOREACH(
const QString & profileName, profileEntries.keys()) {
299 if (profileEntries[profileName].isEmpty()) {
305 ProfileEntry entry = profileEntries[profileName].first();
307 KConfig config(entry.
fullpath, KConfig::SimpleConfig);
311 if (!config.hasGroup(action->
id())) {
315 KConfigGroup grp = config.group(action->
id());
317 Q_FOREACH(
const QString & entry, grp.entryMap()) {
332 if (
d->profiles.size() > 0) {
334 QString kritaDefault = QStringLiteral(
"Krita Default");
335 if (
d->profiles.contains(kritaDefault)) {
336 d->currentProfile =
d->profiles.value(kritaDefault);
338 d->currentProfile =
d->profiles.begin().value();
345 if (
d->currentProfile) {