You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.4 KiB
77 lines
1.4 KiB
15 years ago
|
%{CPP_TEMPLATE}
|
||
|
|
||
14 years ago
|
#include <tqfileinfo.h>
|
||
|
#include <tqframe.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeparts/part.h>
|
||
15 years ago
|
#include <kate/document.h>
|
||
|
#include <kate/view.h>
|
||
|
#include <klocale.h>
|
||
|
#include <klibloader.h>
|
||
|
#include <kurl.h>
|
||
|
|
||
12 years ago
|
#include "tdemdikonsole.h"
|
||
15 years ago
|
|
||
12 years ago
|
tdemdikonsole::tdemdikonsole(TQWidget *parent, const char *name) : TQVBox(parent, name)
|
||
15 years ago
|
{
|
||
|
m_haskonsole = false;
|
||
|
respawn();
|
||
|
}
|
||
|
|
||
12 years ago
|
tdemdikonsole::~tdemdikonsole()
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
12 years ago
|
void tdemdikonsole::respawn()
|
||
15 years ago
|
{
|
||
|
KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart");
|
||
|
|
||
|
if (!factory) return;
|
||
|
m_part = (KParts::ReadOnlyPart *) factory->create(this);
|
||
|
|
||
|
if (!m_part) return;
|
||
|
|
||
14 years ago
|
if (m_part->widget()->inherits(TQFRAME_OBJECT_NAME_STRING))
|
||
14 years ago
|
((TQFrame*)m_part->widget())->setFrameStyle(TQFrame::Panel|TQFrame::Sunken);
|
||
15 years ago
|
|
||
|
m_haskonsole=true;
|
||
14 years ago
|
connect( m_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotDestroyed()) );
|
||
15 years ago
|
|
||
|
m_part->widget()->show();
|
||
|
show();
|
||
|
}
|
||
|
|
||
12 years ago
|
void tdemdikonsole::setDirectory(const TQString &dirname)
|
||
15 years ago
|
{
|
||
|
if (m_haskonsole)
|
||
|
{
|
||
|
KURL url(dirname);
|
||
|
if (m_part->url() != url)
|
||
|
m_part->openURL(url);
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
void tdemdikonsole::showEvent(TQShowEvent *ev)
|
||
15 years ago
|
{
|
||
14 years ago
|
TQWidget::showEvent(ev);
|
||
15 years ago
|
activate();
|
||
|
}
|
||
|
|
||
12 years ago
|
void tdemdikonsole::activate()
|
||
15 years ago
|
{
|
||
|
if (m_haskonsole)
|
||
|
{
|
||
|
m_part->widget()->show();
|
||
|
setFocusProxy(m_part->widget());
|
||
|
m_part->widget()->setFocus();
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
void tdemdikonsole::slotDestroyed()
|
||
15 years ago
|
{
|
||
|
m_haskonsole=false;
|
||
|
respawn();
|
||
|
}
|
||
|
|
||
12 years ago
|
#include "tdemdikonsole.moc"
|