Commit 0bceb1a4 authored by Méven Car's avatar Méven Car Committed by Méven Car
Browse files

Desktop path settings: translate default paths using xdg-user-dir translations

Reuse xdg-user-dir translation, this makes plasma-desktop depend on xdg-user-dir which is already implicitly the case.

BUG: 427805
FIXED-IN: 5.22
parent 78ffebd8
......@@ -219,3 +219,10 @@ file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
find_package(XdgUserDir)
set_package_properties(XdgUserDir PROPERTIES DESCRIPTION "Xdg-user-dir script"
TYPE RUNTIME
PURPOSE "Used to translate default paths in KCM desktoppath")
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2021 Méven Car meven.car@enioka.com
find_program(XdgUserDir_EXEC xdg-user-dir)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XdgUserDir
FOUND_VAR
XdgUserDir_FOUND
REQUIRED_VARS
XdgUserDir_EXEC
)
......@@ -18,6 +18,8 @@
#include "desktoppathssettings.h"
#include <KLocalizedString>
#include <QDir>
namespace
......@@ -163,7 +165,7 @@ void DesktopPathsSettings::setDesktopLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultDesktopLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Desktop"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Desktop"));
}
QUrl DesktopPathsSettings::documentsLocation() const
......@@ -178,7 +180,7 @@ void DesktopPathsSettings::setDocumentsLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultDocumentsLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Documents"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Documents"));
}
QUrl DesktopPathsSettings::downloadsLocation() const
......@@ -193,7 +195,7 @@ void DesktopPathsSettings::setDownloadsLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultDownloadsLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Downloads"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Downloads"));
}
QUrl DesktopPathsSettings::musicLocation() const
......@@ -208,7 +210,7 @@ void DesktopPathsSettings::setMusicLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultMusicLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Music"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Music"));
}
QUrl DesktopPathsSettings::picturesLocation() const
......@@ -223,7 +225,7 @@ void DesktopPathsSettings::setPicturesLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultPicturesLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Pictures"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Pictures"));
}
QUrl DesktopPathsSettings::videosLocation() const
......@@ -238,7 +240,7 @@ void DesktopPathsSettings::setVideosLocation(const QUrl &url)
QUrl DesktopPathsSettings::defaultVideosLocation() const
{
return QUrl::fromLocalFile(QDir::homePath() + QStringLiteral("/Videos"));
return QUrl::fromLocalFile(QDir::homePath() + QLatin1Char('/') + i18nd("xdg-user-dirs" ,"Videos"));
}
#include "desktoppathssettings.moc"
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