21 #include "kateconsole.h"
22 #include "kateconsole.moc"
26 #include "katemainwindow.h"
27 #include "kateviewmanager.h"
29 #include <kate/view.h>
30 #include <kate/document.h>
32 #include <kde_terminal_interface.h>
34 #include <tdeparts/part.h>
37 #include <klibloader.h>
38 #include <tdelocale.h>
40 #include <tdemessagebox.h>
53 disconnect ( m_part, TQ_SIGNAL(destroyed()),
this, TQ_SLOT(slotDestroyed()) );
56 void KateConsole::loadConsoleIfNeeded()
60 if (!topLevelWidget() || !parentWidget())
return;
61 if (!topLevelWidget() || !isVisibleTo(topLevelWidget()))
return;
63 KLibFactory *factory = KLibLoader::self()->factory(
"libkonsolepart");
67 m_part =
static_cast<KParts::ReadOnlyPart *
>(factory->create(
this,
"libkonsolepart",
"KParts::ReadOnlyPart"));
71 setFocusProxy(m_part->widget());
73 TDEGlobal::locale()->insertCatalogue(
"konsole");
75 m_part->widget()->show();
77 connect ( m_part, TQ_SIGNAL(destroyed()),
this, TQ_SLOT(slotDestroyed()) );
79 if (m_mw->viewManager()->activeView())
80 if (m_mw->viewManager()->activeView()->getDoc()->url().isValid())
81 cd(KURL( m_mw->viewManager()->activeView()->getDoc()->url().path() ));
84 void KateConsole::slotDestroyed ()
91 m_mw->hideToolView (m_toolView);
92 m_mw->centralWidget()->setFocus ();
100 loadConsoleIfNeeded();
105 loadConsoleIfNeeded();
109 m_part->openURL (url);
114 loadConsoleIfNeeded();
118 TerminalInterface *t =
static_cast<TerminalInterface*
>( m_part->tqt_cast(
"TerminalInterface" ) );
127 if (KMessageBox::warningContinueCancel
129 , i18n (
"Do you really want to pipe the text to the console? This will execute any contained commands with your user rights.")
130 , i18n (
"Pipe to Console?")
131 , i18n(
"Pipe to Console"),
"Pipe To Console Warning") != KMessageBox::Continue)
134 Kate::View *v = m_mw->viewManager()->activeView();
139 if (v->getDoc()->hasSelection ())
void showEvent(TQShowEvent *ev)
the konsole get shown
void cd(const KURL &url)
cd to dir
void sendInput(const TQString &text)
send given text to console
KateConsole(KateMainWindow *mw, KateMDI::ToolView *parent)
construct us
~KateConsole()
destruct us
void slotPipeToConsole()
pipe current document to console