• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • TDevelop Interfaces Library
 

TDevelop Interfaces Library

  • lib
  • interfaces
katedocumentmanagerinterface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Ian Reinhart Geiser <geiser@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#include "katedocumentmanagerinterface.h"
20#include "kdevpartcontroller.h"
21#include <kurl.h>
22#include <dcopclient.h>
23#include <tdeapplication.h>
24#include <dcopref.h>
25#include <kate/document.h>
26#include <kurl.h>
27#include <kdebug.h>
28
29KateDocumentManagerInterface::KateDocumentManagerInterface( KDevPartController *pc)
30 : TQObject(pc), DCOPObject("KateDocumentManager"), m_controller(pc)
31{
32
33}
34
35
36KateDocumentManagerInterface::~KateDocumentManagerInterface() {}
37
38
39
40DCOPRef KateDocumentManagerInterface::activeDocument( )
41{
42 return documentWithID(activeDocumentNumber());
43}
44
45DCOPRef KateDocumentManagerInterface::document( uint n )
46{
47 return documentWithID(n);
48}
49
50DCOPRef KateDocumentManagerInterface::documentWithID( uint id )
51{
52 TQString dcopobj = "KateDocument#" + TQString::number(id);
53 return DCOPRef(kapp->dcopClient()->appId(), dcopobj.latin1() );
54}
55
56DCOPRef KateDocumentManagerInterface::openURL( const KURL &url, const TQString &encoding )
57{
58 m_controller->editDocument(url);
59 m_controller->setEncoding(encoding);
60 int idx = findDocument( url );
61 return documentWithID(idx);
62}
63
64bool KateDocumentManagerInterface::closeAllDocuments( )
65{
66 return m_controller->closeAllFiles();
67}
68
69bool KateDocumentManagerInterface::closeDocument( uint n )
70{
71 return false;
72}
73
74bool KateDocumentManagerInterface::isOpen( const KURL &url )
75{
76 return (m_controller->partForURL(url) != 0L);
77}
78
79int KateDocumentManagerInterface::findDocument( const KURL &url )
80{
81 KTextEditor::Document *doc = dynamic_cast<KTextEditor::Document*>(m_controller->partForURL(url));
82 if( doc )
83 return doc->documentNumber();
84 else
85 return 0L;
86}
87
88uint KateDocumentManagerInterface::activeDocumentNumber( )
89{
90 KTextEditor::Document *doc = dynamic_cast<KTextEditor::Document*>(m_controller->activePart());
91 if( doc )
92 {
93 return doc->documentNumber();
94 }
95 else
96 return 0;
97}
98
99uint KateDocumentManagerInterface::documents( )
100{
101 return m_controller->openURLs().count();
102}
103
104#include "katedocumentmanagerinterface.moc"
KDevPartController
Interface to control loaded parts and other documents.
Definition kdevpartcontroller.h:57
kdevpartcontroller.h
KDevelop part controller interface.

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for TDevelop Interfaces Library by doxygen 1.15.0
This website is maintained by Timothy Pearson.