• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • 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 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the Lesser GNU General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     General Public License for more details.
00013 
00014    You should have received a copy of the Lesser GNU General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kmainwindowiface.h"
00021 
00022 #include <dcopclient.h>
00023 #include <kapplication.h>
00024 #include <kdcopactionproxy.h>
00025 #include <kdcoppropertyproxy.h>
00026 #include <kmainwindow.h>
00027 #include <kaction.h>
00028 #include <qclipboard.h>
00029 
00030 
00031 KMainWindowInterface::KMainWindowInterface(KMainWindow * mainWindow)
00032     : DCOPObject( mainWindow->name()) 
00033 {
00034     m_MainWindow = mainWindow;
00035     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00036     m_dcopPropertyProxy = new KDCOPPropertyProxy(m_MainWindow);
00037 }
00038 
00039 KMainWindowInterface::~KMainWindowInterface()
00040 {
00041     delete m_dcopActionProxy;
00042         delete m_dcopPropertyProxy;
00043 }
00044 
00045 QCStringList KMainWindowInterface::actions()
00046 {
00047     delete m_dcopActionProxy;
00048     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00049     QCStringList tmp_actions;
00050     QValueList<KAction *> lst = m_dcopActionProxy->actions();
00051     QValueList<KAction *>::ConstIterator it = lst.begin();
00052     QValueList<KAction *>::ConstIterator end = lst.end();
00053     for (; it != end; ++it )
00054         if ((*it)->isPlugged())
00055             tmp_actions.append( (QCString)(*it)->name() );
00056     return tmp_actions;
00057 }
00058 bool KMainWindowInterface::activateAction( QCString action)
00059 {
00060     delete m_dcopActionProxy;
00061     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00062     KAction *tmp_Action = m_dcopActionProxy->action(action);
00063     if (tmp_Action)
00064     {
00065         tmp_Action->activate();
00066         return true;
00067     }
00068     else
00069         return false;
00070 }
00071 bool KMainWindowInterface::disableAction( QCString action)
00072 {
00073     delete m_dcopActionProxy;
00074     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00075     KAction *tmp_Action = m_dcopActionProxy->action(action);
00076     if (tmp_Action)
00077     {
00078         tmp_Action->setEnabled(false);
00079         return true;
00080     }
00081     else
00082         return false;
00083 }
00084 bool KMainWindowInterface::enableAction( QCString action)
00085 {
00086     delete m_dcopActionProxy;
00087     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00088     KAction *tmp_Action = m_dcopActionProxy->action(action);
00089     if (tmp_Action)
00090     {
00091         tmp_Action->setEnabled(true);
00092         return true;
00093     }
00094     else
00095         return false;
00096 }
00097 bool KMainWindowInterface::actionIsEnabled( QCString action)
00098 {
00099     delete m_dcopActionProxy;
00100     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00101     KAction *tmp_Action = m_dcopActionProxy->action(action);
00102     if (tmp_Action)
00103     {
00104         return tmp_Action->isEnabled();
00105     }
00106     else
00107         return false;
00108 }
00109 QCString KMainWindowInterface::actionToolTip( QCString action)
00110 {
00111     delete m_dcopActionProxy;
00112     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00113     KAction *tmp_Action = m_dcopActionProxy->action(action);
00114     if (tmp_Action)
00115     {
00116         return tmp_Action->toolTip().utf8();
00117     }
00118     else
00119         return "Error no such object!";
00120 }
00121 
00122 DCOPRef KMainWindowInterface::action( const QCString &name )
00123 {
00124     return DCOPRef( kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
00125 }
00126 
00127 QMap<QCString,DCOPRef> KMainWindowInterface::actionMap()
00128 {
00129     return m_dcopActionProxy->actionMap();
00130 }
00131 
00132 int KMainWindowInterface::getWinID()
00133 {
00134     return (int) m_MainWindow->winId();
00135 }
00136 void KMainWindowInterface::grabWindowToClipBoard()
00137 {
00138     QClipboard *clipboard = QApplication::clipboard();
00139     clipboard->setPixmap(QPixmap::grabWidget(m_MainWindow));
00140 }
00141 void KMainWindowInterface::hide()
00142 {
00143     m_MainWindow->hide();
00144 }
00145 void KMainWindowInterface::maximize()
00146 {
00147     m_MainWindow->showMaximized();
00148 }
00149 void KMainWindowInterface::minimize()
00150 {
00151     m_MainWindow->showMinimized();
00152 }
00153 void KMainWindowInterface::resize(int newX, int newY)
00154 {
00155     m_MainWindow->resize(newX, newY);
00156 }
00157 void KMainWindowInterface::move(int newX, int newY)
00158 {
00159     m_MainWindow->move(newX, newY);
00160 }
00161 void KMainWindowInterface::setGeometry(int newX, int newY, int newWidth, int newHeight)
00162 {
00163     m_MainWindow->setGeometry(newX, newY, newWidth, newHeight);
00164 }
00165 void KMainWindowInterface::raise()
00166 {
00167     m_MainWindow->raise();
00168 }
00169 void KMainWindowInterface::lower()
00170 {
00171     m_MainWindow->lower();
00172 }
00173 void KMainWindowInterface::restore()
00174 {
00175     m_MainWindow->showNormal();
00176 }
00177 void KMainWindowInterface::close()
00178 {
00179     m_MainWindow->close();
00180 }
00181 void KMainWindowInterface::show()
00182 {
00183     m_MainWindow->show();
00184 }
00185 QCStringList KMainWindowInterface::functionsDynamic()
00186 {
00187     return m_dcopPropertyProxy->functions();
00188 }
00189 bool KMainWindowInterface::processDynamic(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00190 {
00191     return m_dcopPropertyProxy->processPropertyRequest( fun, data, replyType, replyData);
00192 
00193 }
00194 

kdeui

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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