File indexing completed on 2024-05-12 03:54:27
0001 /* 0002 SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef KDESKTOPFILEACTION_H 0007 #define KDESKTOPFILEACTION_H 0008 #include <kconfigcore_export.h> 0009 0010 #include <QSharedDataPointer> 0011 #include <QString> 0012 0013 class KDesktopFileActionPrivate; 0014 0015 /** 0016 * Class for representing an Action of a desktop file 0017 * 0018 * @since 6.0 0019 */ 0020 class KCONFIGCORE_EXPORT KDesktopFileAction 0021 { 0022 public: 0023 /** 0024 * Construct a KDesktopFileAction with all required properties 0025 */ 0026 explicit KDesktopFileAction(const QString &name, const QString &text, const QString &icon, const QString &exec, const QString &desktopFilePath); 0027 0028 /// @internal Dummy constructor with empty properties 0029 explicit KDesktopFileAction(); 0030 KDesktopFileAction(const KDesktopFileAction &other); 0031 KDesktopFileAction &operator=(const KDesktopFileAction &other); 0032 ~KDesktopFileAction(); 0033 0034 /** 0035 * @return the action's internal name 0036 * For instance Actions=Setup;... and the group [Desktop Action Setup] 0037 * define an action with the name "Setup". 0038 */ 0039 QString actionsKey() const; 0040 0041 /** 0042 * @return Path of the desktop file this action was loaded from 0043 */ 0044 QString desktopFilePath() const; 0045 0046 /** 0047 * @return the action's Name, as defined by the Name key in the desktop action group 0048 */ 0049 QString name() const; 0050 0051 /** 0052 * @return the action's icon, as defined by the Icon key in the desktop action group 0053 */ 0054 QString icon() const; 0055 0056 /** 0057 * @return the action's exec command, as defined by the Exec key in the desktop action group 0058 */ 0059 QString exec() const; 0060 0061 /** 0062 * Returns whether the action is a separator. 0063 * This is true when the Actions key contains "_SEPARATOR_". 0064 */ 0065 bool isSeparator() const; 0066 0067 private: 0068 QSharedDataPointer<KDesktopFileActionPrivate> d; 0069 }; 0070 #endif