Plasma-workspace

autostartscriptdesktopfile.cpp
1/*
2 SPDX-FileCopyrightText: 2021 Henri Chain <henri.chain@enioka.com>
3 SPDX-License-Identifier: LGPL-2.1-or-later
4*/
5
6#include "autostartscriptdesktopfile.h"
7#include <KConfigGroup>
8#include <QStandardPaths>
9
10static const auto autostartScriptKey = QStringLiteral("X-KDE-AutostartScript");
11
16
17AutostartScriptDesktopFile::AutostartScriptDesktopFile(const QString &name, const QString &execPath, const QString &iconName)
18 : KDesktopFile(autostartLocation().absoluteFilePath(name + QStringLiteral(".desktop")))
19{
21 kcg.writeEntry("Type", "Application");
22 kcg.writeEntry("Name", name);
23 kcg.writeEntry("Exec", execPath);
24 kcg.writeEntry("Icon", iconName);
25 kcg.writeEntry(autostartScriptKey, "true");
26}
27
29{
30 return file.desktopGroup().readEntry<bool>(autostartScriptKey, false);
31}
static bool isAutostartScript(const KDesktopFile &file)
Checks whether this KDesktopFile has X-KDE-AutostartScript=true.
static QDir autostartLocation()
The location of autostart .desktop application and script files ($XDG_CONFIG_HOME/autostart)
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
QString name() const
KConfigGroup desktopGroup() const
QString filePath(const QString &fileName) const const
QString writableLocation(StandardLocation type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.