File indexing completed on 2024-04-28 16:44:24
0001 /* 0002 SPDX-FileCopyrightText: 2001 Waldo Bastian <bastian@kde.org> 0003 SPDX-FileCopyrightText: 2004 Frans Englich <frans.englich@telia.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 0007 */ 0008 0009 #ifndef MAIN_H 0010 #define MAIN_H 0011 0012 #include <KCMultiDialog> 0013 #include <KPageDialog> 0014 #include <QApplication> 0015 0016 /** 0017 * The application instance for kcmshell. 0018 */ 0019 class KCMShell : public QApplication 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 KCMShell(int &argc, char **argv) 0025 : QApplication(argc, argv) 0026 { 0027 } 0028 0029 /** 0030 * Sets m_serviceName basically to @p serviceName, 0031 * and then registers with D-BUS. 0032 * 0033 * @param serviceName name to set the D-BUS name to 0034 */ 0035 void setServiceName(const QString &serviceName); 0036 0037 /** 0038 * Waits until the last instance of kcmshell with the same 0039 * module as this one exits, and then exits. 0040 */ 0041 void waitForExit(); 0042 0043 /** 0044 * @return true if the shell is running 0045 */ 0046 bool isRunning(); 0047 0048 private Q_SLOTS: 0049 0050 /** 0051 */ 0052 void appExit(const QString &appId, const QString &, const QString &); 0053 0054 private: 0055 /** 0056 * The D-Bus name which actually is registered. 0057 * For example "kcmshell_mouse". 0058 */ 0059 QString m_serviceName; 0060 }; 0061 0062 /** 0063 * Essentially a plain KCMultiDialog, but has the additional functionality 0064 * of allowing it to be told to request windows focus. 0065 * 0066 * @author Waldo Bastian <bastian@kde.org> 0067 */ 0068 class KCMShellMultiDialog : public KCMultiDialog 0069 { 0070 Q_OBJECT 0071 Q_CLASSINFO("D-Bus Interface", "org.kde.KCMShellMultiDialog") 0072 0073 public: 0074 /** 0075 * Constructor. Parameter @p dialogFace is passed to KCMultiDialog 0076 * unchanged. 0077 */ 0078 explicit KCMShellMultiDialog(KPageDialog::FaceType dialogFace, QWidget *parent = nullptr); 0079 0080 public Q_SLOTS: 0081 0082 /** 0083 * Activate a module with id @p asn_id . This is used when 0084 * black helicopters are spotted overhead. 0085 */ 0086 virtual Q_SCRIPTABLE void activate(const QByteArray &asn_id); 0087 }; 0088 0089 // vim: sw=4 et sts=4 0090 #endif // MAIN_H