diff --git a/kcms/colors/colorscm.cpp b/kcms/colors/colorscm.cpp --- a/kcms/colors/colorscm.cpp +++ b/kcms/colors/colorscm.cpp @@ -179,6 +179,14 @@ const bool canWrite = (permissions & QFile::WriteUser); qDebug() << "checking permissions of " << path; schemeRemoveButton->setEnabled(canWrite); + + if (canWrite && QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + "color-schemes/" + fileBaseName + ".colors").length() > 1) { + schemeRemoveButton->setText(i18n("Default Values")); + } else { + schemeRemoveButton->setText(i18n("Remove Scheme")); + } + schemeEditButton->setEnabled(true); KSharedConfigPtr config = KSharedConfig::openConfig(path); @@ -203,7 +211,13 @@ job->uiDelegate()->setParent(this); if (job->exec()) { - delete schemeList->takeItem(schemeList->currentRow()); + //no more fallback files for this scheme? + if (QStandardPaths::locate(QStandardPaths::GenericDataLocation, + "color-schemes/" + schemeList->currentItem()->data(Qt::UserRole).toString() + ".colors").isEmpty()) { + delete schemeList->takeItem(schemeList->currentRow()); + } else { + schemeRemoveButton->setText(i18n("Remove Scheme")); + } } else { diff --git a/kcms/colors/scmeditordialog.cpp b/kcms/colors/scmeditordialog.cpp --- a/kcms/colors/scmeditordialog.cpp +++ b/kcms/colors/scmeditordialog.cpp @@ -144,8 +144,8 @@ filename.replace(0, 1, filename.at(0).toUpper()); // check if that name is already in the list - const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, - "color-schemes/" + filename + ".colors"); + const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + + "color-schemes/" + filename + ".colors"; QFile file(path); const int permissions = file.permissions();