blob: 6b1db37b11800ae352674b9d7a0dd3af86db2576 (
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
|
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
/*
Copyright (C) 2003 Mickael Marchand <marchand@kde.org>
*/
#include "konsolepanel.h"
#include "common.h"
#include "viewcontainer.h"
#include <kdebug.h>
#include <klibloader.h>
#include <tdelocale.h>
KonsolePanel::KonsolePanel(TQWidget *p) : ChatWindow( p ), k_part (0)
{
setName(i18n("Konsole"));
setType(ChatWindow::Konsole);
KLibFactory *fact = KLibLoader::self()->factory("libkonsolepart");
if (!fact) return;
k_part = (KParts::ReadOnlyPart *) fact->create(this);
if (!k_part) return;
k_part->widget()->setFocusPolicy(TQWidget::WheelFocus);
setFocusProxy(k_part->widget());
k_part->widget()->setFocus();
connect(k_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(partDestroyed()));
connect(k_part, TQT_SIGNAL(receivedData(const TQString&)), this, TQT_SLOT(konsoleChanged(const TQString&)));
}
KonsolePanel::~KonsolePanel()
{
kdDebug() << "KonsolePanel::~KonsolePanel()" << endl;
if ( k_part )
{
// make sure to prevent partDestroyed() signals from being sent
disconnect(k_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(partDestroyed()));
delete k_part;
}
}
TQWidget* KonsolePanel::getWidget()
{
if (k_part)
return k_part->widget();
else
return 0;
}
void KonsolePanel::childAdjustFocus()
{
if (k_part) k_part->widget()->setFocus();
}
void KonsolePanel::partDestroyed()
{
k_part = 0;
emit closeView(this);
}
void KonsolePanel::konsoleChanged(const TQString& /* data */)
{
activateTabNotification(Konversation::tnfSystem);
}
#include "konsolepanel.moc"
|