• Skip to content
  • Skip to link menu
KDE 4.1 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     //m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00035 }
00036 
00037 KMainWindowInterface::~KMainWindowInterface()
00038 {
00039         //delete m_dcopActionProxy;
00040 }
00041 
00042 QStringList KMainWindowInterface::actions()
00043 {
00044     QStringList tmp_actions;
00045     QList<QAction *> lst = m_MainWindow->actionCollection()->actions();
00046     foreach( QAction* it, lst ) {
00047         if (it->associatedWidgets().count()>0)
00048             tmp_actions.append( it->objectName() );
00049     }
00050     return tmp_actions;
00051 }
00052 
00053 bool KMainWindowInterface::activateAction( const QString& action )
00054 {
00055     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00056     if (tmp_Action)
00057     {
00058         tmp_Action->trigger();
00059         return true;
00060     }
00061     else
00062         return false;
00063 }
00064 
00065 bool KMainWindowInterface::disableAction( const QString& action)
00066 {
00067     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00068     if (tmp_Action)
00069     {
00070         tmp_Action->setEnabled(false);
00071         return true;
00072     }
00073     else
00074         return false;
00075 }
00076 
00077 bool KMainWindowInterface::enableAction( const QString& action)
00078 {
00079     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00080     if (tmp_Action)
00081     {
00082         tmp_Action->setEnabled(true);
00083         return true;
00084     }
00085     else
00086         return false;
00087 }
00088 
00089 bool KMainWindowInterface::actionIsEnabled( const QString& action)
00090 {
00091     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00092     if (tmp_Action)
00093     {
00094         return tmp_Action->isEnabled();
00095     }
00096     else
00097         return false;
00098 }
00099 
00100 QString KMainWindowInterface::actionToolTip( const QString& action)
00101 {
00102     QAction *tmp_Action = m_MainWindow->actionCollection()->action(action);
00103     if (tmp_Action)
00104     {
00105         return tmp_Action->toolTip().toUtf8();
00106     }
00107     else
00108         return "Error no such object!";
00109 }
00110 
00111 qlonglong KMainWindowInterface::winId()
00112 {
00113     return qlonglong(m_MainWindow->winId());
00114 }
00115 
00116 void KMainWindowInterface::grabWindowToClipBoard()
00117 {
00118     QClipboard *clipboard = QApplication::clipboard();
00119     clipboard->setPixmap(QPixmap::grabWidget(m_MainWindow));
00120 }
00121 
00122 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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