summaryrefslogtreecommitdiffstats
path: root/src/libgui/console.cpp
blob: 58830a86cac3f62599a426a1185caae7396b02d9 (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
/***************************************************************************
 *   Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   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.                                   *
 ***************************************************************************/
#include "console.h"

#include <tqlayout.h>
#include <tqlabel.h>
#include <tqdir.h>
#include <klibloader.h>
#include <tdelocale.h>
#include <tdeparts/part.h>
#include <kde_terminal_interface.h>

ConsoleView::ConsoleView(TQWidget *parent)
  : TQWidget(parent, "console_view"), _initialized(false)
{}

void ConsoleView::showEvent(TQShowEvent *e)
{
  if ( !_initialized ) {
    _initialized = true;
    KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart");
    TQVBoxLayout *top = new TQVBoxLayout(this, 0, 10);
    if ( factory==0 ) {
      TQLabel *label = new TQLabel(i18n("Could not find \"konsolepart\"; please install tdebase."), this);
      label->show();
      top->addWidget(label);
      return;
    } else {
      TQWidget *pwidget = static_cast<KParts::Part *>(factory->create(this, "konsole"))->widget();
      pwidget->show();
      top->addWidget(pwidget);
      setFocusProxy(pwidget);
    }
  }
  TQWidget::showEvent(e);
}