1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-03 21:17:49 +03:00

layout:do not store homepath for schemes

This commit is contained in:
Michail Vourlakos 2021-06-16 16:09:31 +03:00
parent 703c2bd6f6
commit 36f6f73baa

View File

@ -383,7 +383,13 @@ void AbstractLayout::loadConfig()
m_backgroundStyle = static_cast<BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle));
m_schemeFile = m_layoutGroup.readEntry("schemeFile", QString(Data::Layout::DEFAULTSCHEMEFILE));
m_schemeFile = m_schemeFile.isEmpty() ? Data::Layout::DEFAULTSCHEMEFILE : m_schemeFile;
if (m_schemeFile.startsWith("~")) {
m_schemeFile.remove(0, 1);
m_schemeFile = QDir::homePath() + m_schemeFile;
}
m_schemeFile = m_schemeFile.isEmpty() || !QFileInfo(m_schemeFile).exists() ? Data::Layout::DEFAULTSCHEMEFILE : m_schemeFile;
QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString());
QString deprecatedBackground = m_layoutGroup.readEntry("background", QString());
@ -418,7 +424,14 @@ void AbstractLayout::saveConfig()
m_layoutGroup.writeEntry("lastUsedActivity", m_lastUsedActivity);
m_layoutGroup.writeEntry("popUpMargin", m_popUpMargin);
m_layoutGroup.writeEntry("preferredForShortcutsTouched", m_preferredForShortcutsTouched);
m_layoutGroup.writeEntry("schemeFile", m_schemeFile == Data::Layout::DEFAULTSCHEMEFILE ? "" : m_schemeFile);
QString scmfile = m_schemeFile;
if (scmfile.startsWith(QDir::homePath())) {
scmfile.remove(0, QDir::homePath().size());
scmfile = "~" + scmfile;
}
m_layoutGroup.writeEntry("schemeFile", scmfile == Data::Layout::DEFAULTSCHEMEFILE ? "" : scmfile);
m_layoutGroup.sync();
}