kateappIface.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "kateappIface.h" 00020 00021 #include "kateapp.h" 00022 #include "katesession.h" 00023 #include "katedocmanager.h" 00024 #include "katemainwindow.h" 00025 00026 // FIXME: review Kate's DCOP interface for session management when the new session code is ready 00027 00028 KateAppDCOPIface::KateAppDCOPIface (KateApp *app) : DCOPObject ("KateApplication") 00029 , m_app (app) 00030 { 00031 } 00032 00033 DCOPRef KateAppDCOPIface::documentManager () 00034 { 00035 return DCOPRef (m_app->documentManager()->dcopObject ()); 00036 } 00037 00038 DCOPRef KateAppDCOPIface::activeMainWindow () 00039 { 00040 KateMainWindow *win = m_app->activeMainWindow(); 00041 00042 if (win) 00043 return DCOPRef (win->dcopObject ()); 00044 00045 return DCOPRef (); 00046 } 00047 00048 uint KateAppDCOPIface::activeMainWindowNumber () 00049 { 00050 KateMainWindow *win = m_app->activeMainWindow(); 00051 00052 if (win) 00053 return win->mainWindowNumber (); 00054 00055 return 0; 00056 } 00057 00058 00059 uint KateAppDCOPIface::mainWindows () 00060 { 00061 return m_app->mainWindows (); 00062 } 00063 00064 DCOPRef KateAppDCOPIface::mainWindow (uint n) 00065 { 00066 KateMainWindow *win = m_app->mainWindow(n); 00067 00068 if (win) 00069 return DCOPRef (win->dcopObject ()); 00070 00071 return DCOPRef (); 00072 } 00073 00074 bool KateAppDCOPIface::openURL (KURL url, TQString encoding) 00075 { 00076 return m_app->openURL (url, encoding, false); 00077 } 00078 00079 bool KateAppDCOPIface::openURL (KURL url, TQString encoding, bool isTempFile) 00080 { 00081 return m_app->openURL (url, encoding, isTempFile); 00082 } 00083 00084 bool KateAppDCOPIface::setCursor (int line, int column) 00085 { 00086 return m_app->setCursor (line, column); 00087 } 00088 00089 bool KateAppDCOPIface::openInput (TQString text) 00090 { 00091 return m_app->openInput (text); 00092 } 00093 00094 bool KateAppDCOPIface::activateSession(TQString session) 00095 { 00096 m_app->sessionManager()->activateSession(m_app->sessionManager()->getSessionIdFromName(session)); 00097 return true; 00098 } 00099 00100 const TQString& KateAppDCOPIface::session() const 00101 { 00102 return m_app->sessionManager()->getActiveSessionName(); 00103 } 00104 00105 // kate: space-indent on; indent-width 2; replace-tabs on;
Trinity API Reference