Krita Source Code Documentation
Loading...
Searching...
No Matches
KisKMainWindowInterface Class Reference

D-Bus interface to KisKMainWindow. More...

#include <kmainwindowiface_p.h>

+ Inheritance diagram for KisKMainWindowInterface:

Public Slots

bool actionIsEnabled (const QString &action)
 
QStringList actions ()
 
QString actionToolTip (const QString &action)
 
bool activateAction (const QString &action)
 
bool disableAction (const QString &action)
 
bool enableAction (const QString &action)
 
void grabWindowToClipBoard ()
 
qlonglong winId ()
 

Public Member Functions

 KisKMainWindowInterface (KXmlGuiWindow *mainWindow)
 
 ~KisKMainWindowInterface () override
 

Private Attributes

KXmlGuiWindowm_MainWindow
 

Detailed Description

D-Bus interface to KisKMainWindow.

This is the main interface to the KisKMainWindow. This will provide a consistent D-Bus interface to all KDE applications that use it.

Author
Ian Reinhart Geiser geise.nosp@m.ri@y.nosp@m.ahoo..nosp@m.com

Definition at line 24 of file kmainwindowiface_p.h.

Constructor & Destructor Documentation

◆ KisKMainWindowInterface()

KisKMainWindowInterface::KisKMainWindowInterface ( KXmlGuiWindow * mainWindow)

Construct a new interface object.

Parameters
mainWindow- The parent KisKMainWindow object that will provide us with the KAction objects.

Definition at line 17 of file kmainwindowiface.cpp.

18 : QDBusAbstractAdaptor(mainWindow)
19{
20 m_MainWindow = mainWindow;
21}

References m_MainWindow.

◆ ~KisKMainWindowInterface()

KisKMainWindowInterface::~KisKMainWindowInterface ( )
override

Destructor Cleans up the dcop action proxy object.

Definition at line 23 of file kmainwindowiface.cpp.

24{
25}

Member Function Documentation

◆ actionIsEnabled

bool KisKMainWindowInterface::actionIsEnabled ( const QString & action)
slot

Returns the status of the requested action.

Parameters
actionThe name of the action. The names of valid actions can be found by calling actions().
Returns
The state of the action, true - enabled, false - disabled.

Definition at line 72 of file kmainwindowiface.cpp.

73{
74 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
75 if (tmp_Action) {
76 return tmp_Action->isEnabled();
77 } else {
78 return false;
79 }
80}
QAction * action(int index) const
virtual KisKActionCollection * actionCollection() const

References KisKActionCollection::action(), KisKXMLGUIClient::actionCollection(), and m_MainWindow.

◆ actions

QStringList KisKMainWindowInterface::actions ( )
slot

Return a list of actions available to the application's window.

Returns
A QStringList containing valid names actions.

Definition at line 27 of file kmainwindowiface.cpp.

28{
29 QStringList tmp_actions;
31 foreach (QAction *it, lst) {
32 if (it->associatedWidgets().count() > 0) {
33 tmp_actions.append(it->objectName());
34 }
35 }
36 return tmp_actions;
37}
QList< QAction * > actions() const

References KisKXMLGUIClient::actionCollection(), KisKActionCollection::actions(), and m_MainWindow.

◆ actionToolTip

QString KisKMainWindowInterface::actionToolTip ( const QString & action)
slot

Returns the tool tip text of the requested action.

Parameters
actionThe name of the action to activate. The names of valid actions can be found by calling actions().
Returns
A QString containing the text of the action's tool tip.

Definition at line 82 of file kmainwindowiface.cpp.

83{
84 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
85 if (tmp_Action) {
86 return tmp_Action->toolTip();
87 } else {
88 return QStringLiteral("Error no such object!");
89 }
90}

References KisKActionCollection::action(), KisKXMLGUIClient::actionCollection(), and m_MainWindow.

◆ activateAction

bool KisKMainWindowInterface::activateAction ( const QString & action)
slot

Activates the requested action.

Parameters
actionThe name of the action to activate. The names of valid actions can be found by calling actions().
Returns
The success of the operation.

Definition at line 39 of file kmainwindowiface.cpp.

40{
41 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
42 if (tmp_Action) {
43 tmp_Action->trigger();
44 return true;
45 } else {
46 return false;
47 }
48}

References KisKActionCollection::action(), KisKXMLGUIClient::actionCollection(), and m_MainWindow.

◆ disableAction

bool KisKMainWindowInterface::disableAction ( const QString & action)
slot

Disables the requested action.

Parameters
actionThe name of the action to disable. The names of valid actions can be found by calling actions().
Returns
The success of the operation.

Definition at line 50 of file kmainwindowiface.cpp.

51{
52 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
53 if (tmp_Action) {
54 tmp_Action->setEnabled(false);
55 return true;
56 } else {
57 return false;
58 }
59}

References KisKActionCollection::action(), KisKXMLGUIClient::actionCollection(), and m_MainWindow.

◆ enableAction

bool KisKMainWindowInterface::enableAction ( const QString & action)
slot

Enables the requested action.

Parameters
actionThe name of the action to enable. The names of valid actions can be found by calling actions().
Returns
The success of the operation.

Definition at line 61 of file kmainwindowiface.cpp.

62{
63 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
64 if (tmp_Action) {
65 tmp_Action->setEnabled(true);
66 return true;
67 } else {
68 return false;
69 }
70}

References KisKActionCollection::action(), KisKXMLGUIClient::actionCollection(), and m_MainWindow.

◆ grabWindowToClipBoard

void KisKMainWindowInterface::grabWindowToClipBoard ( )
slot

Copies a pixmap representation of the current main window to the clipboard.

Definition at line 97 of file kmainwindowiface.cpp.

98{
99 QClipboard *clipboard = QApplication::clipboard();
100 clipboard->setPixmap(m_MainWindow->grab());
101}

References m_MainWindow.

◆ winId

qlonglong KisKMainWindowInterface::winId ( )
slot

Returns the ID of the current main window. This is useful for automated screen captures or other evil widget fun.

Returns
A integer value of the main window's ID.

Definition at line 92 of file kmainwindowiface.cpp.

93{
94 return qlonglong(m_MainWindow->winId());
95}

References m_MainWindow.

Member Data Documentation

◆ m_MainWindow

KXmlGuiWindow* KisKMainWindowInterface::m_MainWindow
private

Definition at line 102 of file kmainwindowiface_p.h.


The documentation for this class was generated from the following files: