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 KateAppDCOPIface::KateAppDCOPIface (KateApp *app) : DCOPObject ("KateApplication") 00027 , m_app (app) 00028 { 00029 } 00030 00031 DCOPRef KateAppDCOPIface::documentManager () 00032 { 00033 return DCOPRef (m_app->documentManager()->dcopObject ()); 00034 } 00035 00036 DCOPRef KateAppDCOPIface::activeMainWindow () 00037 { 00038 KateMainWindow *win = m_app->activeMainWindow(); 00039 00040 if (win) 00041 return DCOPRef (win->dcopObject ()); 00042 00043 return DCOPRef (); 00044 } 00045 00046 uint KateAppDCOPIface::activeMainWindowNumber () 00047 { 00048 KateMainWindow *win = m_app->activeMainWindow(); 00049 00050 if (win) 00051 return win->mainWindowNumber (); 00052 00053 return 0; 00054 } 00055 00056 00057 uint KateAppDCOPIface::mainWindows () 00058 { 00059 return m_app->mainWindows (); 00060 } 00061 00062 DCOPRef KateAppDCOPIface::mainWindow (uint n) 00063 { 00064 KateMainWindow *win = m_app->mainWindow(n); 00065 00066 if (win) 00067 return DCOPRef (win->dcopObject ()); 00068 00069 return DCOPRef (); 00070 } 00071 00072 bool KateAppDCOPIface::openURL (KURL url, TQString encoding) 00073 { 00074 return m_app->openURL (url, encoding, false); 00075 } 00076 00077 bool KateAppDCOPIface::openURL (KURL url, TQString encoding, bool isTempFile) 00078 { 00079 return m_app->openURL (url, encoding, isTempFile); 00080 } 00081 00082 bool KateAppDCOPIface::setCursor (int line, int column) 00083 { 00084 return m_app->setCursor (line, column); 00085 } 00086 00087 bool KateAppDCOPIface::openInput (TQString text) 00088 { 00089 return m_app->openInput (text); 00090 } 00091 00092 bool KateAppDCOPIface::activateSession (TQString session) 00093 { 00094 m_app->sessionManager()->activateSession (m_app->sessionManager()->giveSession (session)); 00095 00096 return true; 00097 } 00098 00099 const TQString & KateAppDCOPIface::session() const 00100 { 00101 return m_app->sessionManager()->activeSession()->sessionName(); 00102 } 00103 00104 // kate: space-indent on; indent-width 2; replace-tabs on;