00001 /* This file is part of the KDE project 00002 Copyright (c) 2001 David Faure <faure@kde.org> 00003 00004 $Id: KoMainWindowIface.cc 529520 2006-04-13 16:41:44Z mpfeiffer $ 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 "KoMainWindowIface.h" 00022 00023 #include "KoMainWindow.h" 00024 00025 #include <kapplication.h> 00026 #include <dcopclient.h> 00027 #include <kdcopactionproxy.h> 00028 //Added by qt3to4: 00029 #include <Q3ValueList> 00030 00031 KoMainWindowIface::KoMainWindowIface( KoMainWindow *mainwindow ) 00032 : DCOPObject( mainwindow ) 00033 { 00034 m_pMainWindow = mainwindow; 00035 m_actionProxy = new KDCOPActionProxy( mainwindow->actionCollection(), this ); 00036 } 00037 00038 KoMainWindowIface::~KoMainWindowIface() 00039 { 00040 delete m_actionProxy; 00041 } 00042 00043 DCOPRef KoMainWindowIface::action( const DCOPCString &name ) 00044 { 00045 return DCOPRef( kapp->dcopClient()->appId(), m_actionProxy->actionObjectId( name ) ); 00046 } 00047 00048 DCOPCStringList KoMainWindowIface::actions() 00049 { 00050 DCOPCStringList res; 00051 Q3ValueList<KAction *> lst = m_actionProxy->actions(); 00052 Q3ValueList<KAction *>::ConstIterator it = lst.begin(); 00053 Q3ValueList<KAction *>::ConstIterator end = lst.end(); 00054 for (; it != end; ++it ) 00055 res.append( (*it)->objectName().toUtf8() ); 00056 00057 return res; 00058 } 00059 00060 QMap<DCOPCString,DCOPRef> KoMainWindowIface::actionMap() 00061 { 00062 return m_actionProxy->actionMap(); 00063 } 00064 00065 ASYNC KoMainWindowIface::print(bool quick) { 00066 m_pMainWindow->print(quick); 00067 }