From 35ee348c45b3400bb7d6842189855b4033f6636b Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 6 May 2007 21:50:24 +0000 Subject: Initial step for showing the terminal embedded inside Dolphin instead of opening a separate window. This allows to synchronize the current directory of the terminal with the shown directory in Dolphin. svn path=/trunk/KDE/kdebase/apps/; revision=661890 --- src/terminalsidebarpage.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/terminalsidebarpage.cpp (limited to 'src/terminalsidebarpage.cpp') diff --git a/src/terminalsidebarpage.cpp b/src/terminalsidebarpage.cpp new file mode 100644 index 000000000..8c8dcedef --- /dev/null +++ b/src/terminalsidebarpage.cpp @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2007 by Peter Penz * + * * + * 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "terminalsidebarpage.h" + +#include +#include +#include + +#include + +TerminalSidebarPage::TerminalSidebarPage(QWidget* parent) : + SidebarPage(parent), + m_layout(0), + m_terminal(0) +{ + m_layout = new QVBoxLayout(this); + m_layout->setMargin(0); +} + +TerminalSidebarPage::~TerminalSidebarPage() +{ +} + +void TerminalSidebarPage::setUrl(const KUrl& url) +{ + SidebarPage::setUrl(url); + // TODO: synchronize terminal +} + +void TerminalSidebarPage::showEvent(QShowEvent* event) +{ + if (m_terminal == 0) { + KLibFactory* factory = KLibLoader::self()->factory("libkonsolepart"); + KParts::Part* part = static_cast(factory->create(this, "KParts::ReadOnlyPart")); + if (part != 0) { + m_terminal = part->widget(); + m_layout->addWidget(m_terminal); + } + } + SidebarPage::showEvent(event); +} + +#include "terminalsidebarpage.moc" -- cgit v1.3