Fix DecorationPalette loading when kdeglobals doesn't exist
When kdeglobals doesn't exist, QStandardPaths::locate() for it returns an empty string, so the check in previous fix doesn't work in this case. This change sets m_colorScheme properly in this case and also creates an empty kdeglobals(needed because QFileSystemWatcher can't monitor non-existing files) so kdeglobals can be reloaded if it is later populated. REVIEW: 123399
This commit is contained in:
parent
740be3e8d3
commit
9636922827
1 changed files with 9 additions and 0 deletions
|
@ -41,6 +41,15 @@ DecorationPalette::DecorationPalette(const QString &colorScheme)
|
|||
? colorScheme
|
||||
: QStandardPaths::locate(QStandardPaths::GenericConfigLocation, colorScheme))
|
||||
{
|
||||
if (m_colorScheme.isEmpty() && colorScheme == QStringLiteral("kdeglobals")) {
|
||||
// kdeglobals doesn't exist so create it. This is needed to monitor it using QFileSystemWatcher.
|
||||
auto config = KSharedConfig::openConfig(colorScheme, KConfig::SimpleConfig);
|
||||
KConfigGroup wmConfig(config, QStringLiteral("WM"));
|
||||
wmConfig.writeEntry("FakeEntryToKeepThisGroup", true);
|
||||
config->sync();
|
||||
|
||||
m_colorScheme = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, colorScheme);
|
||||
}
|
||||
m_watcher.addPath(m_colorScheme);
|
||||
connect(&m_watcher, &QFileSystemWatcher::fileChanged, [this]() {
|
||||
m_watcher.addPath(m_colorScheme);
|
||||
|
|
Loading…
Reference in a new issue