/* SPDX-FileCopyrightText: 2021 Henri Chain SPDX-License-Identifier: LGPL-2.1-or-later */ #include "autostartscriptdesktopfile.h" #include #include static const auto autostartScriptKey = QStringLiteral("X-KDE-AutostartScript"); QDir AutostartScriptDesktopFile::autostartLocation() { return QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)).filePath(QStringLiteral("autostart")); } AutostartScriptDesktopFile::AutostartScriptDesktopFile(const QString &name, const QString &execPath, const QString &iconName) : KDesktopFile(autostartLocation().absoluteFilePath(name + QStringLiteral(".desktop"))) { KConfigGroup kcg = desktopGroup(); kcg.writeEntry("Type", "Application"); kcg.writeEntry("Name", name); kcg.writeEntry("Exec", execPath); kcg.writeEntry("Icon", iconName); kcg.writeEntry(autostartScriptKey, "true"); } bool AutostartScriptDesktopFile::isAutostartScript(const KDesktopFile &file) { return file.desktopGroup().readEntry(autostartScriptKey, false); }