blob: 2fe5b99880585cda6064148cdfa60c2aae18c3f7 (
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 <klocale.h>
KonsolePanel::KonsolePanel(QWidget *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(QWidget::WheelFocus);
setFocusProxy(k_part->widget());
k_part->widget()->setFocus();
connect(k_part, SIGNAL(destroyed()), this, SLOT(partDestroyed()));
connect(k_part, SIGNAL(receivedData(const QString&)), this, SLOT(konsoleChanged(const QString&)));
}
KonsolePanel::~KonsolePanel()
{
kdDebug() << "KonsolePanel::~KonsolePanel()" << endl;
if ( k_part )
{
// make sure to prevent partDestroyed() signals from being sent
disconnect(k_part, SIGNAL(destroyed()), this, SLOT(partDestroyed()));
delete k_part;
}
}
QWidget* 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 QString& /* data */)
{
activateTabNotification(Konversation::tnfSystem);
}
#include "konsolepanel.moc"
|