Commit 605d912d authored by Alois Wohlschlager's avatar Alois Wohlschlager 🌾 Committed by Nate Graham
Browse files

Use unique temporary directory for CSD assets, and clean it up

The configurator used a fixed temporary directory for the CSD button
files, and never deleted it. This is not feasible on multi-user systems.
Change it to use a random path which is cleaned up afterwards.

BUG: 433608
FIXED-IN: 5.21.2
parent 1cbd78de
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
ConfigValueProvider::ConfigValueProvider() : ConfigValueProvider::ConfigValueProvider() :
kdeglobalsConfig(KSharedConfig::openConfig()), kdeglobalsConfig(KSharedConfig::openConfig()),
inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))), inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))),
kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc"))) kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc"))),
generatedCSDTempPath(QDir::tempPath() + QStringLiteral("/plasma-csd-generator"))
{ {
} }
...@@ -197,9 +198,7 @@ QStringList ConfigValueProvider::windowDecorationsButtonsImages() const ...@@ -197,9 +198,7 @@ QStringList ConfigValueProvider::windowDecorationsButtonsImages() const
for (const auto &buttonState : buttonStates) { for (const auto &buttonState : buttonStates) {
QSvgGenerator svgGenerator {}; QSvgGenerator svgGenerator {};
const QString fileDirPath = QDir::tempPath() + QStringLiteral("/plasma-csd-generator"); QString filePath = generatedCSDTempPath.filePath(QStringLiteral("%1-%2.svg").arg(buttonType, buttonState));
QDir(fileDirPath).mkpath(QStringLiteral("."));
QString filePath = QStringLiteral("%1/%2-%3.svg").arg(fileDirPath, buttonType, buttonState);
svgGenerator.setFileName(filePath); svgGenerator.setFileName(filePath);
svgGenerator.setViewBox(DecorationPainter::ButtonGeometry); svgGenerator.setViewBox(DecorationPainter::ButtonGeometry);
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#pragma once #pragma once
#include <QTemporaryDir>
#include <KSharedConfig> #include <KSharedConfig>
class QString; class QString;
...@@ -38,4 +40,6 @@ private: ...@@ -38,4 +40,6 @@ private:
KSharedConfigPtr kdeglobalsConfig; KSharedConfigPtr kdeglobalsConfig;
KSharedConfigPtr inputConfig; KSharedConfigPtr inputConfig;
KSharedConfigPtr kwinConfig; KSharedConfigPtr kwinConfig;
QTemporaryDir generatedCSDTempPath;
}; };
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment