Krita Source Code Documentation
Loading...
Searching...
No Matches
kmainwindowiface.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
3 SPDX-FileCopyrightText: 2006 Thiago Macieira <thiago@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
9
10#include "kactioncollection.h"
11#include "kxmlguiwindow.h"
12
13#include <QApplication>
14#include <QAction>
15#include <QClipboard>
16
18 : QDBusAbstractAdaptor(mainWindow)
19{
20 m_MainWindow = mainWindow;
21}
22
26
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}
38
39bool KisKMainWindowInterface::activateAction(const QString &action)
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}
49
50bool KisKMainWindowInterface::disableAction(const QString &action)
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}
60
61bool KisKMainWindowInterface::enableAction(const QString &action)
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}
71
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}
81
82QString KisKMainWindowInterface::actionToolTip(const QString &action)
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}
91
93{
94 return qlonglong(m_MainWindow->winId());
95}
96
98{
99 QClipboard *clipboard = QApplication::clipboard();
100 clipboard->setPixmap(m_MainWindow->grab());
101}
102
103#include "moc_kmainwindowiface_p.cpp"
KDE top level main window with predefined action layout
QAction * action(int index) const
QList< QAction * > actions() const
QString actionToolTip(const QString &action)
bool activateAction(const QString &action)
KisKMainWindowInterface(KXmlGuiWindow *mainWindow)
bool actionIsEnabled(const QString &action)
bool disableAction(const QString &action)
bool enableAction(const QString &action)
virtual KisKActionCollection * actionCollection() const