File indexing completed on 2024-05-19 15:09:24

0001 /*
0002     SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KCMSHELL_H
0008 #define KCMSHELL_H
0009 
0010 #include <QObject>
0011 
0012 class KCMShell : public QObject
0013 {
0014     Q_OBJECT
0015 
0016 public:
0017     explicit KCMShell(QObject *parent = nullptr);
0018     ~KCMShell() override;
0019 
0020 public Q_SLOTS:
0021     void open(const QStringList &names) const;
0022 
0023     /**
0024      * Opens the specified module in System Settings. Only a single KCM name may
0025      * be provided.
0026      *
0027      * @code
0028      * onClicked: KCMShell.openSystemSettings("kcm_kscreen")
0029      * @endcode
0030      *
0031      * @param name A single kcm name to open in System Settings. Opening multiple
0032      * KCMs using this function is not supported; to do that, use kcmshell.open.
0033      * @param args Additional arguments to pass to the module.
0034      *
0035      * @since 5.71
0036      */
0037     void openSystemSettings(const QString &name, const QStringList &args = QStringList()) const;
0038 
0039     /**
0040      * Opens the specified module in InfCenter. Only a single KCM name may
0041      * be provided.
0042      *
0043      * @code
0044      * onClicked: KCMShell.openInfoCenter("kcm_energy")
0045      * @endcode
0046      *
0047      * @param name A single kcm name to open in Info Center. Opening multiple
0048      * KCMs using this function is not supported; to do that, use kcmshell.open.
0049      *
0050      * @since 5.71
0051      */
0052     void openInfoCenter(const QString &name) const;
0053 
0054     /**
0055      * Check which of the given control modules the user is
0056      * allowed to access
0057      *
0058      * This can be used for example to hide context menu options
0059      * that would do nothing if the user wasn't authorized.
0060      *
0061      * @code
0062      * visible: KCMShell.authorize(["org.kde.fooconfig.desktop"]).length > 0
0063      * @endcode
0064      *
0065      * @param menuIds A list of control module menu IDs
0066      * @return The entries in @p menuIds that the user is
0067      * authorized to access, may be empty
0068      * @sa KAuthorized::authorizeControlModules
0069      * @since 5.23
0070      */
0071     QStringList authorize(const QStringList &menuIds) const;
0072 };
0073 
0074 #endif // KCMSHELL_H