File indexing completed on 2024-05-12 05:46:47

0001 /* This file is part of the KDE project
0002    Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
0003    Copyright (C) 2006 Thiago Macieira <thiago@kde.org>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This program is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this program; see the file COPYING.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KMAINWINDOWIFACE_P_H
0022 #define KMAINWINDOWIFACE_P_H
0023 
0024 #include <QDBusAbstractAdaptor>
0025 #include <QMap>
0026 
0027 class KXmlGuiWindow;
0028 
0029 /**
0030  * @short D-Bus interface to KMainWindow.
0031  *
0032  * This is the main interface to the KMainWindow.  This will provide a consistent
0033  * D-Bus interface to all KDE applications that use it.
0034  *
0035  * @author Ian Reinhart Geiser <geiseri@yahoo.com>
0036  */
0037 class KMainWindowInterface : public QDBusAbstractAdaptor
0038 {
0039     Q_OBJECT
0040     Q_CLASSINFO("D-Bus Interface", "org.kde.KMainWindow")
0041 
0042 public:
0043     /**
0044     Construct a new interface object.
0045     @param mainWindow - The parent KMainWindow object
0046     that will provide us with the KAction objects.
0047     */
0048     KMainWindowInterface(KXmlGuiWindow *mainWindow);
0049     /**
0050     Destructor
0051     Cleans up the dcop action proxy object.
0052     **/
0053     ~KMainWindowInterface() override;
0054 
0055 public Q_SLOTS:
0056     /**
0057     Return a list of actions available to the application's window.
0058     @return A QStringList containing valid names actions.
0059     */
0060     QStringList actions();
0061 
0062     /**
0063     Activates the requested action.
0064     @param action The name of the action to activate.  The names of valid
0065     actions can be found by calling actions().
0066     @return The success of the operation.
0067     */
0068     bool activateAction(const QString &action);
0069 
0070     /**
0071     Disables the requested action.
0072     @param action The name of the action to disable.  The names of valid
0073     actions can be found by calling actions().
0074     @return The success of the operation.
0075     */
0076     bool disableAction(const QString &action);
0077 
0078     /**
0079     Enables the requested action.
0080     @param action The name of the action to enable.  The names of valid
0081     actions can be found by calling actions().
0082     @return The success of the operation.
0083     */
0084     bool enableAction(const QString &action);
0085 
0086     /**
0087     Returns the status of the requested action.
0088     @param action The name of the action.  The names of valid
0089     actions can be found by calling actions().
0090     @returns The state of the action, true - enabled, false - disabled.
0091     */
0092     bool actionIsEnabled(const QString &action);
0093 
0094     /**
0095     Returns the tool tip text of the requested action.
0096     @param action The name of the action to activate.  The names of valid
0097     actions can be found by calling actions().
0098     @return A QString containing the text of the action's tool tip.
0099     */
0100     QString actionToolTip(const QString &action);
0101 
0102     /**
0103     Returns the ID of the current main window.
0104     This is useful for automated screen captures or other evil
0105     widget fun.
0106     @return A integer value of the main window's ID.
0107     **/
0108     qlonglong winId();
0109     /**
0110     Copies a pixmap representation of the current main window to
0111     the clipboard.
0112     **/
0113     void grabWindowToClipBoard();
0114 private:
0115     KXmlGuiWindow *m_MainWindow;
0116 };
0117 
0118 #endif // KMAINWINDOWIFACE_P_H
0119