kate Library API Documentation

katedocumenthelpers.cpp

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00004 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de> 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 version 2 as published by the Free Software Foundation. 00009 00010 This library 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 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #include "katedocumenthelpers.h" 00022 #include "katedocumenthelpers.moc" 00023 00024 #include "katedocument.h" 00025 00026 #include <kpopupmenu.h> 00027 #include <klocale.h> 00028 00029 KateBrowserExtension::KateBrowserExtension( KateDocument* doc ) 00030 : KParts::BrowserExtension( doc, "katepartbrowserextension" ), 00031 m_doc (doc) 00032 { 00033 connect( doc, SIGNAL( selectionChanged() ), 00034 this, SLOT( slotSelectionChanged() ) ); 00035 emit enableAction( "print", true ); 00036 } 00037 00038 void KateBrowserExtension::copy() 00039 { 00040 m_doc->copy(); 00041 } 00042 00043 void KateBrowserExtension::print() 00044 { 00045 m_doc->printDialog(); 00046 } 00047 00048 void KateBrowserExtension::slotSelectionChanged() 00049 { 00050 emit enableAction( "copy", m_doc->hasSelection() ); 00051 } 00052 00053 KateExportAction::KateExportAction(const QString& text, QObject* parent, const char* name) 00054 : Kate::ActionMenu(text, parent, name) 00055 { 00056 filter.clear(); 00057 filter<<QString("kate_html_export"); 00058 popupMenu()->insertItem (i18n("&HTML..."),0); 00059 connect(popupMenu(),SIGNAL(activated(int)),this,SLOT(filterChoosen(int))); 00060 m_doc=0L; 00061 } 00062 00063 void KateExportAction::updateMenu (Kate::Document *doc) 00064 { 00065 m_doc = doc; 00066 } 00067 00068 void KateExportAction::filterChoosen(int id) 00069 { 00070 Kate::Document *doc = m_doc; 00071 00072 if (!doc) 00073 return; 00074 00075 doc->exportAs(*filter.at(id)); 00076 } 00077 00078 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:46:06 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003