File indexing completed on 2024-05-12 05:35:39
0001 /* 0002 SPDX-FileCopyrightText: 2020 Kevin Ottens <kevin.ottens@enioka.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <KCoreConfigSkeleton> 0010 0011 class XdgPathsSettingsStore; 0012 0013 class DesktopPathsSettings : public KCoreConfigSkeleton 0014 { 0015 Q_OBJECT 0016 0017 Q_PROPERTY(QUrl desktopLocation READ desktopLocation WRITE setDesktopLocation NOTIFY desktopLocationChanged) 0018 Q_PROPERTY(QUrl defaultDesktopLocation READ defaultDesktopLocation CONSTANT) 0019 0020 Q_PROPERTY(QUrl documentsLocation READ documentsLocation WRITE setDocumentsLocation NOTIFY documentsLocationChanged) 0021 Q_PROPERTY(QUrl defaultDocumentsLocation READ defaultDocumentsLocation CONSTANT) 0022 0023 Q_PROPERTY(QUrl downloadsLocation READ downloadsLocation WRITE setDownloadsLocation NOTIFY downloadsLocationChanged) 0024 Q_PROPERTY(QUrl defaultDownloadsLocation READ defaultDownloadsLocation CONSTANT) 0025 0026 Q_PROPERTY(QUrl musicLocation READ musicLocation WRITE setMusicLocation NOTIFY musicLocationChanged) 0027 Q_PROPERTY(QUrl defaultMusicLocation READ defaultMusicLocation CONSTANT) 0028 0029 Q_PROPERTY(QUrl picturesLocation READ picturesLocation WRITE setPicturesLocation NOTIFY picturesLocationChanged) 0030 Q_PROPERTY(QUrl defaultPicturesLocation READ defaultPicturesLocation CONSTANT) 0031 0032 Q_PROPERTY(QUrl videosLocation READ videosLocation WRITE setVideosLocation NOTIFY videosLocationChanged) 0033 Q_PROPERTY(QUrl defaultVideosLocation READ defaultVideosLocation CONSTANT) 0034 0035 Q_PROPERTY(QUrl publicLocation READ publicLocation WRITE setPublicLocation NOTIFY publicLocationChanged) 0036 Q_PROPERTY(QUrl defaultPublicLocation READ defaultPublicLocation CONSTANT) 0037 0038 Q_PROPERTY(QUrl templatesLocation READ templatesLocation WRITE setTemplatesLocation NOTIFY templatesLocationChanged) 0039 Q_PROPERTY(QUrl defaultTemplatesLocation READ defaultTemplatesLocation CONSTANT) 0040 0041 public: 0042 DesktopPathsSettings(QObject *parent = nullptr); 0043 0044 QUrl desktopLocation() const; 0045 void setDesktopLocation(const QUrl &url); 0046 QUrl defaultDesktopLocation() const; 0047 0048 QUrl documentsLocation() const; 0049 void setDocumentsLocation(const QUrl &url); 0050 QUrl defaultDocumentsLocation() const; 0051 0052 QUrl downloadsLocation() const; 0053 void setDownloadsLocation(const QUrl &url); 0054 QUrl defaultDownloadsLocation() const; 0055 0056 QUrl musicLocation() const; 0057 void setMusicLocation(const QUrl &url); 0058 QUrl defaultMusicLocation() const; 0059 0060 QUrl picturesLocation() const; 0061 void setPicturesLocation(const QUrl &url); 0062 QUrl defaultPicturesLocation() const; 0063 0064 QUrl videosLocation() const; 0065 void setVideosLocation(const QUrl &url); 0066 QUrl defaultVideosLocation() const; 0067 0068 QUrl publicLocation() const; 0069 void setPublicLocation(const QUrl &url); 0070 QUrl defaultPublicLocation() const; 0071 0072 QUrl templatesLocation() const; 0073 void setTemplatesLocation(const QUrl &url); 0074 QUrl defaultTemplatesLocation() const; 0075 0076 Q_SIGNALS: 0077 void desktopLocationChanged(); 0078 void documentsLocationChanged(); 0079 void downloadsLocationChanged(); 0080 void musicLocationChanged(); 0081 void picturesLocationChanged(); 0082 void videosLocationChanged(); 0083 void publicLocationChanged(); 0084 void templatesLocationChanged(); 0085 0086 private: 0087 void addItemInternal(const QByteArray &propertyName, const QVariant &defaultValue, const std::function<void()> &signal); 0088 0089 private: 0090 XdgPathsSettingsStore *const m_xdgPathsStore; 0091 };