blob: d0c856ec2b7de7261338d837b0942a4d49cb51c3 (
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 <kparts/part.h>
#include <kate/document.h>
#include <kate/view.h>
#include <klocale.h>
#include <klibloader.h>
#include <kurl.h>
#include "kmdikonsole.h"
kmdikonsole::kmdikonsole(TQWidget *tqparent, const char *name) : TQVBox(tqparent, name)
{
m_haskonsole = false;
respawn();
}
kmdikonsole::~kmdikonsole()
{
}
void kmdikonsole::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_OBJECT_NAME_STRING))
((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 kmdikonsole::setDirectory(const TQString &dirname)
{
if (m_haskonsole)
{
KURL url(dirname);
if (m_part->url() != url)
m_part->openURL(url);
}
}
void kmdikonsole::showEvent(TQShowEvent *ev)
{
TQWidget::showEvent(ev);
activate();
}
void kmdikonsole::activate()
{
if (m_haskonsole)
{
m_part->widget()->show();
setFocusProxy(m_part->widget());
m_part->widget()->setFocus();
}
}
void kmdikonsole::slotDestroyed()
{
m_haskonsole=false;
respawn();
}
#include "kmdikonsole.moc"
|