• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kmainwindowiface.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
00003    Copyright (C) 2006 Thiago Macieira <thiago@kde.org>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the Lesser GNU General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     General Public License for more details.
00014 
00015    You should have received a copy of the Lesser GNU General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "kmainwindowiface_p.h"
00022 
00023 #include <kactioncollection.h>
00024 #include <kapplication.h>
00025 #include <kxmlguiwindow.h>
00026 #include <kaction.h>
00027 #include <QtGui/QClipboard>
00028 
00029 
00030 KMainWindowInterface::KMainWindowInterface(KXmlGuiWindow * mainWindow)
00031         : QDBusAbstractAdaptor(mainWindow)
00032 {
00033     m_MainWindow = mainWindow;
00034 }
00035 
00036 KMainWindowInterface::~KMainWindowInterface()
00037 {
00038 }
00039 
00040 QStringList KMainWindowInterface::actions()
00041 {
00042     QStringList tmp_actions;
00043     QList<QAction *> lst = m_MainWindow->actionCollection()->actions();
00044     foreach( QAction* it, lst ) {
00045         if (it->associatedWidgets().count()>0)
00046             tmp_actions.append( it->objectName() );
00047     }
00048     return tmp_actions;
00049 }
00050 
00051 bool KMainWindowInterface::activateAction( const QString& action )
00052 {
00053     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00054     if (tmp_Action)
00055     {
00056         tmp_Action->trigger();
00057         return true;
00058     }
00059     else
00060         return false;
00061 }
00062 
00063 bool KMainWindowInterface::disableAction( const QString& action)
00064 {
00065     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00066     if (tmp_Action)
00067     {
00068         tmp_Action->setEnabled(false);
00069         return true;
00070     }
00071     else
00072         return false;
00073 }
00074 
00075 bool KMainWindowInterface::enableAction( const QString& action)
00076 {
00077     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00078     if (tmp_Action)
00079     {
00080         tmp_Action->setEnabled(true);
00081         return true;
00082     }
00083     else
00084         return false;
00085 }
00086 
00087 bool KMainWindowInterface::actionIsEnabled( const QString& action)
00088 {
00089     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00090     if (tmp_Action)
00091     {
00092         return tmp_Action->isEnabled();
00093     }
00094     else
00095         return false;
00096 }
00097 
00098 QString KMainWindowInterface::actionToolTip( const QString& action)
00099 {
00100     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00101     if (tmp_Action)
00102     {
00103         return tmp_Action->toolTip().toUtf8();
00104     }
00105     else
00106         return "Error no such object!";
00107 }
00108 
00109 qlonglong KMainWindowInterface::winId()
00110 {
00111     return qlonglong(m_MainWindow->winId());
00112 }
00113 
00114 void KMainWindowInterface::grabWindowToClipBoard()
00115 {
00116     QClipboard *clipboard = QApplication::clipboard();
00117     clipboard->setPixmap(QPixmap::grabWidget(m_MainWindow));
00118 }
00119 
00120 #include "kmainwindowiface_p.moc"

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal