summaryrefslogtreecommitdiffstats
path: root/parts/konsole/konsoleviewpart.cpp
blob: 63f720d9bfe2b418f12dda5aea3346aefbf829f1 (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
/***************************************************************************
 *   Copyright (C) 2003 by KDevelop Authors                                *
 *   tdevelop-devel@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 "konsoleviewpart.h"

#include <tqwhatsthis.h>

#include <tdevgenericfactory.h>
#include <kiconloader.h>
#include <tdelocale.h>

#include "tdevcore.h"
#include "tdevproject.h"
#include "tdevmainwindow.h"
#include "tdevplugininfo.h"
#include "tdevshellwidget.h"


typedef TDevGenericFactory<KonsoleViewPart> KonsoleViewFactory;
static const TDevPluginInfo data("tdevkonsoleview");
K_EXPORT_COMPONENT_FACTORY(libtdevkonsoleview, KonsoleViewFactory(data))

KonsoleViewPart::KonsoleViewPart(TQObject *parent, const char *name, const TQStringList &)
  : TDevPlugin(&data, parent, name ? name : "KonsoleViewPart")
{
    setInstance( KonsoleViewFactory::instance() );

    m_widget = new TDevShellWidget( 0, "konsole widget" );

    TQWhatsThis::add(m_widget, i18n("<b>Konsole</b><p>"
        "This window contains an embedded konsole window. It will try to follow you when "
        "you navigate in the source directories")
    );

    m_widget->setIcon( SmallIcon("konsole") );
    m_widget->setCaption(i18n("Konsole"));

    m_widget->activate();
    m_widget->setAutoReactivateOnClose( true );

    mainWindow()->embedOutputView(m_widget, i18n("Konsole"), i18n("Embedded console window"));

    connect(core(), TQT_SIGNAL(projectOpened()), this, TQT_SLOT(projectOpened()));
}


KonsoleViewPart::~KonsoleViewPart()
{
    if ( m_widget )
        mainWindow()->removeView( m_widget );
    delete m_widget;
}

void KonsoleViewPart::projectOpened()
{
	TQString cd_projectdir = TQString("cd ") + project()->projectDirectory() + "\n";
	m_widget->sendInput( cd_projectdir );	
}


#include "konsoleviewpart.moc"