TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

katedocumenthelpers.cpp 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* This file is part of the KDE libraries
  2. Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
  3. Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
  4. Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License version 2 as published by the Free Software Foundation.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include "katedocumenthelpers.h"
  18. #include "katedocumenthelpers.moc"
  19. #include "katedocument.h"
  20. #include "kateview.h"
  21. #include <tdepopupmenu.h>
  22. #include <tdelocale.h>
  23. KateBrowserExtension::KateBrowserExtension( KateDocument* doc )
  24. : KParts::BrowserExtension( doc, "katepartbrowserextension" ),
  25. m_doc (doc)
  26. {
  27. connect( doc, TQT_SIGNAL( selectionChanged() ),
  28. this, TQT_SLOT( slotSelectionChanged() ) );
  29. emit enableAction( "print", true );
  30. }
  31. void KateBrowserExtension::copy()
  32. {
  33. if (m_doc->activeView())
  34. m_doc->activeView()->copy();
  35. }
  36. void KateBrowserExtension::print()
  37. {
  38. m_doc->printDialog();
  39. }
  40. void KateBrowserExtension::slotSelectionChanged()
  41. {
  42. if (m_doc->activeView())
  43. emit enableAction( "copy", m_doc->activeView()->hasSelection() );
  44. }
  45. // kate: space-indent on; indent-width 2; replace-tabs on;