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.
76 lines
1.8 KiB
76 lines
1.8 KiB
/*
|
|
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(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(TQT_TQOBJECT(this));
|
|
if (!k_part) return;
|
|
|
|
k_part->widget()->setFocusPolicy(TQ_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"
|