Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e932e4c6 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Fix load style

parent 7b243dad
......@@ -76,7 +76,6 @@ ChatWindowStyle::ChatWindowStyle(const QString &styleName, const QString &varian
void ChatWindowStyle::init(const QString &styleName, StyleBuildMode styleBuildMode)
{
qDebug() <<" QStandardPaths::locateAll(QStandardPaths::DataLocation" << QStandardPaths::standardLocations(QStandardPaths::DataLocation);
QStringList styleDirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles/%1/Contents/Resources/").arg(styleName),
QStandardPaths::LocateDirectory);
if (styleDirs.isEmpty()) {
......
......@@ -90,7 +90,7 @@ void ChatWindowStyleManager::loadStyles()
// Make sure there exists a directory where chat styles can be installed to and it will be watched for changes
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("styles/"));
QStringList chatStyles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles/"));
QStringList chatStyles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles/"), QStandardPaths::LocateDirectory);
foreach (const QString &styleDir, chatStyles) {
qDebug() << "ChatWindowStyleManager::loadStyles " << styleDir;
d->styleDirs.push(QUrl::fromLocalFile(styleDir));
......@@ -115,7 +115,7 @@ QStringList ChatWindowStyleManager::getAvailableStyles() const
int ChatWindowStyleManager::installStyle(const QString &styleBundlePath)
{
QString localStyleDir;
QStringList chatStyles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles"));
QStringList chatStyles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles"), QStandardPaths::LocateDirectory);
// findDirs returns preferred paths first, let's check if one of them is writable
foreach (const QString &styleDir, chatStyles) {
if (QFileInfo(styleDir).isWritable()) {
......@@ -268,7 +268,7 @@ bool ChatWindowStyleManager::removeStyle(const QString &styleName)
delete deletedStyle;
}
QStringList styleDirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles/%1").arg(styleName));
QStringList styleDirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("/styles/%1").arg(styleName), QStandardPaths::LocateDirectory);
if (styleDirs.isEmpty()) {
kDebug(14000) << "Failed to find style" << styleName;
return false;
......
Markdown is supported
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