diff --git a/kcms/colors/colorscm.cpp b/kcms/colors/colorscm.cpp --- a/kcms/colors/colorscm.cpp +++ b/kcms/colors/colorscm.cpp @@ -103,6 +103,7 @@ *it = QStandardPaths::locate(QStandardPaths::GenericDataLocation, *it); } + QListWidgetItem * defaultItem = nullptr; for (int i = 0; i < schemeFiles.size(); ++i) { // get the file name @@ -114,18 +115,22 @@ icon = createSchemePreviewIcon(config); KConfigGroup group(config, "General"); const QString name = group.readEntry("Name", info.baseName()); - QListWidgetItem * newItem = new QListWidgetItem(icon, name); - // stash the file basename for use later - newItem->setData(Qt::UserRole, info.baseName()); - schemeList->addItem(newItem); + if (name == "Default") { + defaultItem = new QListWidgetItem(icon, name); + defaultItem->setData(Qt::UserRole, info.baseName()); + } else { + QListWidgetItem * newItem = new QListWidgetItem(icon, name); + // stash the file basename for use later + newItem->setData(Qt::UserRole, info.baseName()); + schemeList->addItem(newItem); + } } schemeList->sortItems(); - // add default entry (do this here so that the current and default entry appear at the top) - m_config->setReadDefaults(true); - icon = createSchemePreviewIcon(m_config); - schemeList->insertItem(0, new QListWidgetItem(icon, i18nc("Default color scheme", "Default"))); - m_config->setReadDefaults(false); + // Add "Default" at the top + if (defaultItem != nullptr) { + schemeList->insertItem(0, defaultItem); + } } @@ -158,34 +163,25 @@ const QString name = currentItem->text(); m_currentColorScheme = name; const QString fileBaseName = currentItem->data(Qt::UserRole).toString(); - if (name == i18nc("Default color scheme", "Default")) - { - schemeRemoveButton->setEnabled(false); - schemeEditButton->setEnabled(false); - KSharedConfigPtr config = m_config; - config->setReadDefaults(true); - loadScheme(config); - config->setReadDefaults(false); - // load the default scheme - emit changed(true); - } - else - { - const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, - "color-schemes/" + fileBaseName + ".colors"); + const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, + "color-schemes/" + fileBaseName + ".colors"); + if (name == i18nc("Default color scheme", "Default")) { + schemeRemoveButton->setEnabled(false); + schemeEditButton->setEnabled(false); + } else { const int permissions = QFile(path).permissions(); const bool canWrite = (permissions & QFile::WriteUser); qDebug() << "checking permissions of " << path; schemeRemoveButton->setEnabled(canWrite); schemeEditButton->setEnabled(true); + } - KSharedConfigPtr config = KSharedConfig::openConfig(path); - loadScheme(config); + KSharedConfigPtr config = KSharedConfig::openConfig(path); + loadScheme(config); - emit changed(true); - } + emit changed(true); } else { schemeEditButton->setEnabled(false); schemeRemoveButton->setEnabled(false); @@ -371,26 +367,23 @@ void KColorCm::save() { - QIcon icon = createSchemePreviewIcon(m_config); - schemeList->item(0)->setIcon(icon); - m_config->sync(); KConfig cfg(QStringLiteral("kcmdisplayrc"), KConfig::NoGlobals); KConfigGroup displayGroup(&cfg, "X11"); displayGroup.writeEntry("exportKDEColors", applyToAlien->isChecked()); cfg.sync(); - qDebug() << KRdbExportQtColors << KRdbExportGtkTheme << KRdbExportColors ; + runRdb(KRdbExportQtColors | KRdbExportGtkTheme | ( applyToAlien->isChecked() ? KRdbExportColors : 0 ) ); - qDebug() << "icic"; + QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"), QStringLiteral("org.kde.KGlobalSettings"), QStringLiteral("notifyChange") ); QList args; args.append(0);//previous KGlobalSettings::PaletteChanged. This is now private API in khintsettings args.append(0);//unused in palette changed but needed for the DBus signature message.setArguments(args); - qDebug() << KConfigGroup(m_config, "General").readEntry("Name"); + QDBusConnection::sessionBus().send(message); if (qApp->platformName() == QStringLiteral("xcb")) { // Send signal to all kwin instances diff --git a/kcms/colors/schemes/Default.colors b/kcms/colors/schemes/Default.colors new file mode 100644 --- /dev/null +++ b/kcms/colors/schemes/Default.colors @@ -0,0 +1,119 @@ +[ColorEffects:Disabled] +Color=56,56,56 +ColorAmount=0 +ColorEffect=0 +ContrastAmount=0.65 +ContrastEffect=1 +IntensityAmount=0.1 +IntensityEffect=2 + +[ColorEffects:Inactive] +ChangeSelectionColor=true +Color=112,111,110 +ColorAmount=0.025 +ColorEffect=2 +ContrastAmount=0.1 +ContrastEffect=2 +Enable=false +IntensityAmount=0 +IntensityEffect=0 + +[Colors:Button] +BackgroundAlternate=189,195,199 +BackgroundNormal=239,240,241 +DecorationFocus=61,174,233 +DecorationHover=147,206,233 +ForegroundActive=61,174,233 +ForegroundInactive=127,140,141 +ForegroundLink=41,128,185 +ForegroundNegative=218,68,83 +ForegroundNeutral=246,116,0 +ForegroundNormal=49,54,59 +ForegroundPositive=39,174,96 +ForegroundVisited=127,140,141 + +[Colors:Selection] +BackgroundAlternate=29,153,243 +BackgroundNormal=61,174,233 +DecorationFocus=61,174,233 +DecorationHover=147,206,233 +ForegroundActive=252,252,252 +ForegroundInactive=239,240,241 +ForegroundLink=253,188,75 +ForegroundNegative=218,68,83 +ForegroundNeutral=246,116,0 +ForegroundNormal=239,240,241 +ForegroundPositive=39,174,96 +ForegroundVisited=189,195,199 + +[Colors:Tooltip] +BackgroundAlternate=77,77,77 +BackgroundNormal=49,54,59 +DecorationFocus=61,174,233 +DecorationHover=147,206,233 +ForegroundActive=61,174,233 +ForegroundInactive=189,195,199 +ForegroundLink=41,128,185 +ForegroundNegative=218,68,83 +ForegroundNeutral=246,116,0 +ForegroundNormal=239,240,241 +ForegroundPositive=39,174,96 +ForegroundVisited=127,140,141 + +[Colors:View] +BackgroundAlternate=239,240,241 +BackgroundNormal=252,252,252 +DecorationFocus=61,174,233 +DecorationHover=147,206,233 +ForegroundActive=61,174,233 +ForegroundInactive=127,140,141 +ForegroundLink=41,128,185 +ForegroundNegative=218,68,83 +ForegroundNeutral=246,116,0 +ForegroundNormal=49,54,59 +ForegroundPositive=39,174,96 +ForegroundVisited=127,140,141 + +[Colors:Window] +BackgroundAlternate=189,195,199 +BackgroundNormal=239,240,241 +DecorationFocus=61,174,233 +DecorationHover=147,206,233 +ForegroundActive=61,174,233 +ForegroundInactive=127,140,141 +ForegroundLink=41,128,185 +ForegroundNegative=218,68,83 +ForegroundNeutral=246,116,0 +ForegroundNormal=49,54,59 +ForegroundPositive=39,174,96 +ForegroundVisited=127,140,141 + +[Colors:Complementary] +BackgroundAlternate=59,64,69 +BackgroundNormal=49,54,59 +DecorationFocus=30,146,255 +DecorationHover=61,174,230 +ForegroundActive=246,116,0 +ForegroundInactive=175,176,179 +ForegroundLink=61,174,230 +ForegroundNegative=237,21,21 +ForegroundNeutral=201,206,59 +ForegroundNormal=239,240,241 +ForegroundPositive=17,209,22 +ForegroundVisited=61,174,230 + +[General] +ColorScheme=Default +Name=Default +shadeSortColumn=true + +[KDE] +contrast=4 + +[WM] +activeBackground=71,80,87 +activeBlend=255,255,255 +activeForeground=239,240,241 +inactiveBackground=239,240,241 +inactiveBlend=75,71,67 +inactiveForeground=189,195,199 diff --git a/kcms/colors/scmeditordialog.cpp b/kcms/colors/scmeditordialog.cpp --- a/kcms/colors/scmeditordialog.cpp +++ b/kcms/colors/scmeditordialog.cpp @@ -117,6 +117,8 @@ return; } } + m_config->markAsClean(); + m_config->reparseConfiguration(); this->accept(); } } @@ -172,6 +174,8 @@ newpath += filename + ".colors"; KConfig *config = m_config->copyTo(newpath); + m_config->markAsClean(); + m_config->reparseConfiguration(); KConfigGroup group(config, "General"); group.writeEntry("Name", name);