Kate
katedocumenthelpers.cpp
Go to the documentation of this file.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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "katedocumenthelpers.h" 00022 #include "katedocumenthelpers.moc" 00023 00024 #include "katedocument.h" 00025 #include "kateview.h" 00026 00027 #include <kmenu.h> 00028 #include <klocale.h> 00029 00030 namespace KTextEditor { class View; } 00031 00032 KateBrowserExtension::KateBrowserExtension( KateDocument* doc ) 00033 : KParts::BrowserExtension( doc ), 00034 m_doc (doc) 00035 { 00036 setObjectName( "katepartbrowserextension" ); 00037 connect( doc, SIGNAL( activeViewSelectionChanged(KTextEditor::View*) ), 00038 this, SLOT( slotSelectionChanged() ) ); 00039 emit enableAction( "print", true ); 00040 } 00041 00042 void KateBrowserExtension::copy() 00043 { 00044 if (m_doc->activeView()) 00045 m_doc->activeKateView()->copy(); 00046 } 00047 00048 void KateBrowserExtension::print() 00049 { 00050 m_doc->printDialog(); 00051 } 00052 00053 void KateBrowserExtension::slotSelectionChanged() 00054 { 00055 if (m_doc->activeView()) 00056 emit enableAction( "copy", m_doc->activeKateView()->selection() ); 00057 } 00058 00059 // kate: space-indent on; indent-width 2; replace-tabs on;