blob: d4092b03aea4b0f76664a4c1a592bb697d7a3108 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
%{CPP_TEMPLATE}
#include <tqfileinfo.h>
#include <tqframe.h>
#include <tdeparts/part.h>
#include <kate/document.h>
#include <kate/view.h>
#include <tdelocale.h>
#include <klibloader.h>
#include <kurl.h>
#include "tdemdikonsole.h"
tdemdikonsole::tdemdikonsole(TQWidget *parent, const char *name) : TQVBox(parent, name)
{
m_haskonsole = false;
respawn();
}
tdemdikonsole::~tdemdikonsole()
{
}
void tdemdikonsole::respawn()
{
KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart");
if (!factory) return;
m_part = (KParts::ReadOnlyPart *) factory->create(this);
if (!m_part) return;
if (m_part->widget()->inherits("TQFrame"))
((TQFrame*)m_part->widget())->setFrameStyle(TQFrame::Panel|TQFrame::Sunken);
m_haskonsole=true;
connect( m_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotDestroyed()) );
m_part->widget()->show();
show();
}
void tdemdikonsole::setDirectory(const TQString &dirname)
{
if (m_haskonsole)
{
KURL url(dirname);
if (m_part->url() != url)
m_part->openURL(url);
}
}
void tdemdikonsole::showEvent(TQShowEvent *ev)
{
TQWidget::showEvent(ev);
activate();
}
void tdemdikonsole::activate()
{
if (m_haskonsole)
{
m_part->widget()->show();
setFocusProxy(m_part->widget());
m_part->widget()->setFocus();
}
}
void tdemdikonsole::slotDestroyed()
{
m_haskonsole=false;
respawn();
}
#include "tdemdikonsole.moc"
|