File indexing completed on 2024-03-24 15:40:46

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
0004     SPDX-FileCopyrightText: 2006 Thiago Macieira <thiago@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KMAINWINDOWIFACE_P_H
0010 #define KMAINWINDOWIFACE_P_H
0011 
0012 #include <QDBusAbstractAdaptor>
0013 
0014 class KXmlGuiWindow;
0015 
0016 /**
0017  * @short D-Bus interface to KMainWindow.
0018  *
0019  * This is the main interface to the KMainWindow.  This will provide a consistent
0020  * D-Bus interface to all KDE applications that use it.
0021  *
0022  * @author Ian Reinhart Geiser <geiseri@yahoo.com>
0023  */
0024 class KMainWindowInterface : public QDBusAbstractAdaptor
0025 {
0026     Q_OBJECT
0027     Q_CLASSINFO("D-Bus Interface", "org.kde.KMainWindow")
0028 
0029 public:
0030     /**
0031     Construct a new interface object.
0032     @param mainWindow - The parent KMainWindow object
0033     that will provide us with the QAction objects.
0034     */
0035     explicit KMainWindowInterface(KXmlGuiWindow *mainWindow);
0036     /**
0037     Destructor
0038     Cleans up the dcop action proxy object.
0039     **/
0040     ~KMainWindowInterface() override;
0041 
0042 public Q_SLOTS:
0043     /**
0044     Return a list of actions available to the application's window.
0045     @return A QStringList containing valid names actions.
0046     */
0047     QStringList actions();
0048 
0049     /**
0050     Activates the requested action.
0051     @param action The name of the action to activate.  The names of valid
0052     actions can be found by calling actions().
0053     @return The success of the operation.
0054     */
0055     bool activateAction(const QString &action);
0056 
0057     /**
0058     Disables the requested action.
0059     @param action The name of the action to disable.  The names of valid
0060     actions can be found by calling actions().
0061     @return The success of the operation.
0062     */
0063     bool disableAction(const QString &action);
0064 
0065     /**
0066     Enables the requested action.
0067     @param action The name of the action to enable.  The names of valid
0068     actions can be found by calling actions().
0069     @return The success of the operation.
0070     */
0071     bool enableAction(const QString &action);
0072 
0073     /**
0074     Returns the status of the requested action.
0075     @param action The name of the action.  The names of valid
0076     actions can be found by calling actions().
0077     @returns The state of the action, true - enabled, false - disabled.
0078     */
0079     bool actionIsEnabled(const QString &action);
0080 
0081     /**
0082     Returns the tool tip text of the requested action.
0083     @param action The name of the action to activate.  The names of valid
0084     actions can be found by calling actions().
0085     @return A QString containing the text of the action's tool tip.
0086     */
0087     QString actionToolTip(const QString &action);
0088 
0089     /**
0090     Returns the ID of the current main window.
0091     This is useful for automated screen captures or other evil
0092     widget fun.
0093     @return A integer value of the main window's ID.
0094     **/
0095     qlonglong winId();
0096     /**
0097     Copies a pixmap representation of the current main window to
0098     the clipboard.
0099     **/
0100     void grabWindowToClipBoard();
0101 
0102 private:
0103     KXmlGuiWindow *m_MainWindow;
0104 };
0105 
0106 #endif // KMAINWINDOWIFACE_P_H