• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • xmlgui
kmainwindowiface.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
3 Copyright (C) 2006 Thiago Macieira <thiago@kde.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the Lesser GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the Lesser GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "kmainwindowiface_p.h"
22
23#include <kactioncollection.h>
24#include <kapplication.h>
25#include <kxmlguiwindow.h>
26#include <kaction.h>
27#include <QtGui/QClipboard>
28
29
30KMainWindowInterface::KMainWindowInterface(KXmlGuiWindow * mainWindow)
31 : QDBusAbstractAdaptor(mainWindow)
32{
33 m_MainWindow = mainWindow;
34}
35
36KMainWindowInterface::~KMainWindowInterface()
37{
38}
39
40QStringList KMainWindowInterface::actions()
41{
42 QStringList tmp_actions;
43 QList<QAction *> lst = m_MainWindow->actionCollection()->actions();
44 foreach( QAction* it, lst ) {
45 if (it->associatedWidgets().count()>0)
46 tmp_actions.append( it->objectName() );
47 }
48 return tmp_actions;
49}
50
51bool KMainWindowInterface::activateAction( const QString& action )
52{
53 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
54 if (tmp_Action)
55 {
56 tmp_Action->trigger();
57 return true;
58 }
59 else
60 return false;
61}
62
63bool KMainWindowInterface::disableAction( const QString& action)
64{
65 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
66 if (tmp_Action)
67 {
68 tmp_Action->setEnabled(false);
69 return true;
70 }
71 else
72 return false;
73}
74
75bool KMainWindowInterface::enableAction( const QString& action)
76{
77 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
78 if (tmp_Action)
79 {
80 tmp_Action->setEnabled(true);
81 return true;
82 }
83 else
84 return false;
85}
86
87bool KMainWindowInterface::actionIsEnabled( const QString& action)
88{
89 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
90 if (tmp_Action)
91 {
92 return tmp_Action->isEnabled();
93 }
94 else
95 return false;
96}
97
98QString KMainWindowInterface::actionToolTip( const QString& action)
99{
100 QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
101 if (tmp_Action)
102 {
103 return tmp_Action->toolTip().toUtf8();
104 }
105 else
106 return "Error no such object!";
107}
108
109qlonglong KMainWindowInterface::winId()
110{
111 return qlonglong(m_MainWindow->winId());
112}
113
114void KMainWindowInterface::grabWindowToClipBoard()
115{
116 QClipboard *clipboard = QApplication::clipboard();
117 clipboard->setPixmap(QPixmap::grabWidget(m_MainWindow));
118}
119
120#include "kmainwindowiface_p.moc"
KXmlGuiWindow
KDE top level main window with predefined action layout
Definition: kxmlguiwindow.h:62
QAction
QDBusAbstractAdaptor
QList
kaction.h
kactioncollection.h
kapplication.h
kxmlguiwindow.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal