Changeset View
Changeset View
Standalone View
Standalone View
kded/config.cpp
Show All 11 Lines | |||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. | ||
14 | 14 | | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | *********************************************************************/ | 17 | *********************************************************************/ | ||
18 | #include "config.h" | 18 | #include "config.h" | ||
19 | #include "output.h" | 19 | #include "output.h" | ||
20 | #include "control.h" | 20 | #include "../common/globals.h" | ||
21 | #include "../common/control.h" | ||||
21 | #include "kscreen_daemon_debug.h" | 22 | #include "kscreen_daemon_debug.h" | ||
22 | #include "device.h" | 23 | #include "device.h" | ||
23 | 24 | | |||
24 | #include <QFile> | 25 | #include <QFile> | ||
25 | #include <QStandardPaths> | 26 | #include <QStandardPaths> | ||
26 | #include <QRect> | 27 | #include <QRect> | ||
27 | #include <QJsonDocument> | 28 | #include <QJsonDocument> | ||
28 | #include <QDir> | 29 | #include <QDir> | ||
29 | #include <QLoggingCategory> | 30 | #include <QLoggingCategory> | ||
30 | 31 | | |||
31 | #include <kscreen/config.h> | 32 | #include <kscreen/config.h> | ||
32 | #include <kscreen/output.h> | 33 | #include <kscreen/output.h> | ||
33 | 34 | | |||
34 | QString Config::s_fixedConfigFileName = QStringLiteral("fixed-config"); | 35 | QString Config::s_fixedConfigFileName = QStringLiteral("fixed-config"); | ||
35 | QString Config::s_dirPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/"); | | |||
36 | QString Config::s_configsDirName = QStringLiteral("" /*"configs/"*/); // TODO: KDE6 - move these files into the subfolder | 36 | QString Config::s_configsDirName = QStringLiteral("" /*"configs/"*/); // TODO: KDE6 - move these files into the subfolder | ||
37 | 37 | | |||
38 | QString Config::configsDirPath() | 38 | QString Config::configsDirPath() | ||
39 | { | 39 | { | ||
40 | return s_dirPath % s_configsDirName; | 40 | return Globals::dirPath() % s_configsDirName; | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | Config::Config(KScreen::ConfigPtr config) | 43 | Config::Config(KScreen::ConfigPtr config) | ||
44 | : m_data(config) | 44 | : m_data(config) | ||
45 | { | 45 | { | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | void Config::setDirPath(const QString &path) | | |||
49 | { | | |||
50 | s_dirPath = path; | | |||
51 | if (!s_dirPath.endsWith(QLatin1Char('/'))) { | | |||
52 | s_dirPath += QLatin1Char('/'); | | |||
53 | } | | |||
54 | } | | |||
55 | | ||||
56 | QString Config::filePath() | 48 | QString Config::filePath() | ||
57 | { | 49 | { | ||
58 | if (!QDir().mkpath(configsDirPath())) { | 50 | if (!QDir().mkpath(configsDirPath())) { | ||
59 | return QString(); | 51 | return QString(); | ||
60 | } | 52 | } | ||
61 | return configsDirPath() % id(); | 53 | return configsDirPath() % id(); | ||
62 | } | 54 | } | ||
63 | 55 | | |||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |