• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

  • kdeui
kmainwindowiface.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the Lesser GNU General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13 
14  You should have received a copy of the Lesser GNU General Public License
15  along with this program; see the file COPYING. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kmainwindowiface.h"
21 
22 #include <dcopclient.h>
23 #include <kapplication.h>
24 #include <kdcopactionproxy.h>
25 #include <kdcoppropertyproxy.h>
26 #include <kmainwindow.h>
27 #include <kaction.h>
28 #include <tqclipboard.h>
29 
30 
31 KMainWindowInterface::KMainWindowInterface(KMainWindow * mainWindow)
32  : DCOPObject( mainWindow->name())
33 {
34  m_MainWindow = mainWindow;
35  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
36  m_dcopPropertyProxy = new KDCOPPropertyProxy(TQT_TQOBJECT(m_MainWindow));
37 }
38 
39 KMainWindowInterface::~KMainWindowInterface()
40 {
41  delete m_dcopActionProxy;
42  delete m_dcopPropertyProxy;
43 }
44 
45 QCStringList KMainWindowInterface::actions()
46 {
47  delete m_dcopActionProxy;
48  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
49  QCStringList tmp_actions;
50  TQValueList<KAction *> lst = m_dcopActionProxy->actions();
51  TQValueList<KAction *>::ConstIterator it = lst.begin();
52  TQValueList<KAction *>::ConstIterator end = lst.end();
53  for (; it != end; ++it )
54  if ((*it)->isPlugged())
55  tmp_actions.append( (TQCString)(*it)->name() );
56  return tmp_actions;
57 }
58 bool KMainWindowInterface::activateAction( TQCString action)
59 {
60  delete m_dcopActionProxy;
61  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
62  KAction *tmp_Action = m_dcopActionProxy->action(action);
63  if (tmp_Action)
64  {
65  tmp_Action->activate();
66  return true;
67  }
68  else
69  return false;
70 }
71 bool KMainWindowInterface::disableAction( TQCString action)
72 {
73  delete m_dcopActionProxy;
74  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
75  KAction *tmp_Action = m_dcopActionProxy->action(action);
76  if (tmp_Action)
77  {
78  tmp_Action->setEnabled(false);
79  return true;
80  }
81  else
82  return false;
83 }
84 bool KMainWindowInterface::enableAction( TQCString action)
85 {
86  delete m_dcopActionProxy;
87  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
88  KAction *tmp_Action = m_dcopActionProxy->action(action);
89  if (tmp_Action)
90  {
91  tmp_Action->setEnabled(true);
92  return true;
93  }
94  else
95  return false;
96 }
97 bool KMainWindowInterface::actionIsEnabled( TQCString action)
98 {
99  delete m_dcopActionProxy;
100  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
101  KAction *tmp_Action = m_dcopActionProxy->action(action);
102  if (tmp_Action)
103  {
104  return tmp_Action->isEnabled();
105  }
106  else
107  return false;
108 }
109 TQCString KMainWindowInterface::actionToolTip( TQCString action)
110 {
111  delete m_dcopActionProxy;
112  m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
113  KAction *tmp_Action = m_dcopActionProxy->action(action);
114  if (tmp_Action)
115  {
116  return tmp_Action->toolTip().utf8();
117  }
118  else
119  return "Error no such object!";
120 }
121 
122 DCOPRef KMainWindowInterface::action( const TQCString &name )
123 {
124  return DCOPRef( kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
125 }
126 
127 TQMap<TQCString,DCOPRef> KMainWindowInterface::actionMap()
128 {
129  return m_dcopActionProxy->actionMap();
130 }
131 
132 int KMainWindowInterface::getWinID()
133 {
134  return (int) m_MainWindow->winId();
135 }
136 void KMainWindowInterface::grabWindowToClipBoard()
137 {
138  TQClipboard *clipboard = TQApplication::clipboard();
139  clipboard->setPixmap(TQPixmap::grabWidget(m_MainWindow));
140 }
141 void KMainWindowInterface::hide()
142 {
143  m_MainWindow->hide();
144 }
145 void KMainWindowInterface::maximize()
146 {
147  m_MainWindow->showMaximized();
148 }
149 void KMainWindowInterface::minimize()
150 {
151  m_MainWindow->showMinimized();
152 }
153 void KMainWindowInterface::resize(int newX, int newY)
154 {
155  m_MainWindow->resize(newX, newY);
156 }
157 void KMainWindowInterface::move(int newX, int newY)
158 {
159  m_MainWindow->move(newX, newY);
160 }
161 void KMainWindowInterface::setGeometry(int newX, int newY, int newWidth, int newHeight)
162 {
163  m_MainWindow->setGeometry(newX, newY, newWidth, newHeight);
164 }
165 void KMainWindowInterface::raise()
166 {
167  m_MainWindow->raise();
168 }
169 void KMainWindowInterface::lower()
170 {
171  m_MainWindow->lower();
172 }
173 void KMainWindowInterface::restore()
174 {
175  m_MainWindow->showNormal();
176 }
177 void KMainWindowInterface::close()
178 {
179  m_MainWindow->close();
180 }
181 void KMainWindowInterface::show()
182 {
183  m_MainWindow->show();
184 }
185 QCStringList KMainWindowInterface::functionsDynamic()
186 {
187  return m_dcopPropertyProxy->functions();
188 }
189 bool KMainWindowInterface::processDynamic(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
190 {
191  return m_dcopPropertyProxy->processPropertyRequest( fun, data, replyType, replyData);
192 
193 }
194 

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |