lib

KoViewIface.cc

00001 /* This file is part of the KDE project
00002    Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
00003 
00004    $Id: KoViewIface.cc 508787 2006-02-12 18:28:12Z ingwa $
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 #include "KoViewIface.h"
00022 
00023 #include "KoView.h"
00024 
00025 #include <kapplication.h>
00026 #include <dcopclient.h>
00027 #include <kdcopactionproxy.h>
00028 #include <kaction.h>
00029 
00030 //static
00031 QCString KoViewIface::newIfaceName()
00032 {
00033     static int s_viewIFNumber = 0;
00034     QCString name; name.setNum( s_viewIFNumber++ ); name.prepend("View-");
00035     return name;
00036 }
00037 
00038 KoViewIface::KoViewIface( KoView *view )
00039     : DCOPObject( newIfaceName() )
00040 {
00041     m_actionProxy = new KDCOPActionProxy( view->actionCollection(), this );
00042 }
00043 
00044 KoViewIface::KoViewIface( const char *name, KoView *view )
00045     : DCOPObject( name )
00046 {
00047     m_pView = view;
00048     m_actionProxy = new KDCOPActionProxy( view->actionCollection(), this );
00049 }
00050 
00051 KoViewIface::~KoViewIface()
00052 {
00053     delete m_actionProxy;
00054 }
00055 
00056 DCOPRef KoViewIface::action( const QCString &name )
00057 {
00058     return DCOPRef( kapp->dcopClient()->appId(), m_actionProxy->actionObjectId( name ) );
00059 }
00060 
00061 QCStringList KoViewIface::actions()
00062 {
00063     QCStringList res;
00064     QValueList<KAction *> lst = m_actionProxy->actions();
00065     QValueList<KAction *>::ConstIterator it = lst.begin();
00066     QValueList<KAction *>::ConstIterator end = lst.end();
00067     for (; it != end; ++it )
00068         res.append( (*it)->name() );
00069 
00070     return res;
00071 }
00072 
00073 QMap<QCString,DCOPRef> KoViewIface::actionMap()
00074 {
00075     return m_actionProxy->actionMap();
00076 }
KDE Home | KDE Accessibility Home | Description of Access Keys