Write lnf defaults on startup

wilder-5.24
David Redondo 4 years ago committed by Nate Graham
parent 75608d87bf
commit 12087e947b
  1. 10
      kcms/lookandfeel/lookandfeelmanager.cpp
  2. 2
      startkde/CMakeLists.txt
  3. 15
      startkde/startplasma.cpp

@ -208,11 +208,7 @@ void LookAndFeelManager::writeNewDefaults(KConfig &config,
void LookAndFeelManager::writeNewDefaults(KConfigGroup &cg, KConfigGroup &cgd, const QString &key, const QString &value, KConfig::WriteConfigFlags writeFlags)
{
if (m_data->isDefaults()) {
cgd.revertToDefault(key);
} else {
cgd.writeEntry(key, value, writeFlags);
}
cgd.writeEntry(key, value, writeFlags);
cgd.sync();
if (m_mode == Mode::Apply) {
@ -356,6 +352,10 @@ void LookAndFeelManager::save(const KPackage::Package &package, const KPackage::
setSplashScreen(m_data->settings()->lookAndFeelPackage());
setLockScreen(m_data->settings()->lookAndFeelPackage());
QFile packageFile(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/kdedefaults/package"));
packageFile.open(QIODevice::WriteOnly);
packageFile.write(m_data->settings()->lookAndFeelPackage().toUtf8());
if (m_mode == Mode::Defaults) {
return;
}

@ -22,8 +22,10 @@ target_link_libraries(startplasma PUBLIC
Qt::DBus
KF5::ConfigCore
KF5::Notifications
KF5::Package
${PHONON_LIBRARIES}
PW::KWorkspace
lookandfeelmanager
)
add_executable(startplasma-x11 ${START_PLASMA_COMMON_SRCS} startplasma-x11.cpp kcheckrunning/kcheckrunning.cpp)

@ -18,6 +18,8 @@
#include <KConfig>
#include <KConfigGroup>
#include <KNotifyConfig>
#include <KPackage/Package>
#include <KPackage/PackageLoader>
#include <KSharedConfig>
#include <phonon/audiooutput.h>
@ -32,6 +34,7 @@
#include "startplasma.h"
#include "../config-workspace.h"
#include "../kcms/lookandfeel/lookandfeelmanager.h"
#include "debug.h"
QTextStream out(stderr);
@ -357,7 +360,19 @@ void setupPlasmaEnvironment()
currentConfigDirs = "/etc/xdg";
}
const auto extraConfigDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation).toUtf8() + "/kdedefaults";
QDir().mkpath(QString::fromUtf8(extraConfigDir));
qputenv("XDG_CONFIG_DIRS", extraConfigDir + ":" + currentConfigDirs);
const KConfig globals;
const QString currentLnf = KConfigGroup(&globals, QStringLiteral("KDE")).readEntry("LookAndFeelPackage", QStringLiteral("org.kde.breeze.desktop"));
QFile activeLnf(QString::fromUtf8(extraConfigDir + "/package"));
activeLnf.open(QIODevice::ReadOnly);
if (activeLnf.readLine() != currentLnf.toUtf8()) {
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"), currentLnf);
LookAndFeelManager lnfManager;
lnfManager.setMode(LookAndFeelManager::Mode::Defaults);
lnfManager.save(package, KPackage::Package());
}
}
void setupX11()

Loading…
Cancel
Save