summaryrefslogtreecommitdiffstats
path: root/kate/app/katedocmanageriface.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kate/app/katedocmanageriface.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/app/katedocmanageriface.cpp')
-rw-r--r--kate/app/katedocmanageriface.cpp131
1 files changed, 131 insertions, 0 deletions
diff --git a/kate/app/katedocmanageriface.cpp b/kate/app/katedocmanageriface.cpp
new file mode 100644
index 000000000..9c2eabc03
--- /dev/null
+++ b/kate/app/katedocmanageriface.cpp
@@ -0,0 +1,131 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Ian Reinhart Geiser <geiseri@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "katedocmanageriface.h"
+
+#include "katedocmanager.h"
+
+#include <kdebug.h>
+
+KateDocManagerDCOPIface::KateDocManagerDCOPIface (KateDocManager *dm) : DCOPObject ("KateDocumentManager"), m_dm (dm)
+{
+
+}
+
+// bit more error save than the forcing c cast ;()
+DCOPRef KateDocManagerDCOPIface::document (uint n)
+{
+ Kate::Document *doc = m_dm->document(n);
+
+ if (!doc)
+ return DCOPRef ();
+
+ DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject"));
+
+ if (!obj)
+ return DCOPRef ();
+
+ return DCOPRef (obj);
+}
+
+DCOPRef KateDocManagerDCOPIface::activeDocument ()
+{
+ Kate::Document *doc = m_dm->activeDocument();
+
+ if (!doc)
+ return DCOPRef ();
+
+ DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject"));
+
+ if (!obj)
+ return DCOPRef ();
+
+ return DCOPRef (obj);
+}
+
+uint KateDocManagerDCOPIface::activeDocumentNumber ()
+{
+ Kate::Document *doc = m_dm->activeDocument();
+
+ if (doc)
+ return doc->documentNumber ();
+
+ return 0;
+}
+
+DCOPRef KateDocManagerDCOPIface::documentWithID (uint id)
+{
+ Kate::Document *doc = m_dm->documentWithID (id);
+
+ if (!doc)
+ return DCOPRef ();
+
+ DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject"));
+
+ if (!obj)
+ return DCOPRef ();
+
+ return DCOPRef (obj);
+}
+
+DCOPRef KateDocManagerDCOPIface::openURL (KURL url, QString encoding)
+{
+ Kate::Document *doc = m_dm->openURL (url, encoding);
+
+ if (!doc)
+ return DCOPRef ();
+
+ DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject"));
+
+ if (!obj)
+ return DCOPRef ();
+
+ return DCOPRef (obj);
+}
+
+bool KateDocManagerDCOPIface::closeDocument(uint n)
+{
+ return m_dm->closeDocument(n);
+}
+
+bool KateDocManagerDCOPIface::closeDocumentWithID(uint id)
+{
+ return m_dm->closeDocumentWithID (id);
+}
+
+bool KateDocManagerDCOPIface::closeAllDocuments()
+{
+ return m_dm->closeAllDocuments();
+}
+
+bool KateDocManagerDCOPIface::isOpen(KURL url)
+{
+ return m_dm->isOpen (url);
+}
+
+uint KateDocManagerDCOPIface::documents ()
+{
+ return m_dm->documents();
+}
+
+int KateDocManagerDCOPIface::findDocument (KURL url)
+{
+ return m_dm->findDocument (url);
+}
+
+