]> cloud.milkyroute.net Git - dolphin.git/blob - src/terminalsidebarpage.cpp
minor adjustments for working together with Max after the BIC Monday...
[dolphin.git] / src / terminalsidebarpage.cpp
1 /***************************************************************************
2 * Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #include "terminalsidebarpage.h"
21
22 #include <klibloader.h>
23 #include <kde_terminal_interface.h>
24 #include <kparts/part.h>
25
26 #include <QVBoxLayout>
27
28 TerminalSidebarPage::TerminalSidebarPage(QWidget* parent) :
29 SidebarPage(parent),
30 m_layout(0),
31 m_terminal(0)
32 {
33 m_layout = new QVBoxLayout(this);
34 m_layout->setMargin(0);
35 }
36
37 TerminalSidebarPage::~TerminalSidebarPage()
38 {
39 }
40
41 void TerminalSidebarPage::setUrl(const KUrl& url)
42 {
43 SidebarPage::setUrl(url);
44 // TODO: synchronize terminal
45 // m_terminal->showShellInDir(...);
46 }
47
48 void TerminalSidebarPage::showEvent(QShowEvent* event)
49 {
50 if (m_terminal == 0) {
51 KLibFactory* factory = KLibLoader::self()->factory("libkonsolepart");
52 KParts::Part* part = static_cast<KParts::Part*>(factory->create(this, "KParts::ReadOnlyPart"));
53 if (part != 0) {
54 m_layout->addWidget(part->widget());
55 }
56
57 // TODO: port to KDE4
58 //TerminalInterface* m_terminal = static_cast<TerminalInterface*>(part->qt_cast("TerminalInterface"));
59 // like this?
60 //m_terminal = qobject_cast<TerminalInterface*>(part);
61 }
62 SidebarPage::showEvent(event);
63 }
64
65 #include "terminalsidebarpage.moc"