sidebarpage.cpp
statusbarspaceinfo.cpp
statusbarmessagelabel.cpp
+ terminalsidebarpage.cpp
treeviewcontextmenu.cpp
treeviewsidebarpage.cpp
sidebartreeview.cpp
#include "infosidebarpage.h"
#include "metadatawidget.h"
#include "mainwindowadaptor.h"
+#include "terminalsidebarpage.h"
#include "treeviewsidebarpage.h"
#include "kurlnavigator.h"
#include "viewpropertiesdialog.h"
m_activeView->setShowHiddenFiles(show);
}
-void DolphinMainWindow::showFilterBar()
+void DolphinMainWindow::toggleFilterBarVisibility()
{
const KToggleAction* showFilterBarAction =
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
m_activeView->goHome();
}
-void DolphinMainWindow::openTerminal()
-{
- QString command("konsole --workdir \"");
- command.append(m_activeView->url().path());
- command.append('\"');
-
- KRun::runCommand(command, "Konsole", "konsole");
-}
-
void DolphinMainWindow::findFile()
{
KRun::run("kfind", m_activeView->url());
KStandardAction::home(this, SLOT(goHome()), actionCollection());
// setup 'Tools' menu
- QAction* openTerminal = actionCollection()->addAction("open_terminal");
- openTerminal->setText(i18n("Open Terminal"));
- openTerminal->setShortcut(Qt::Key_F4);
- openTerminal->setIcon(KIcon("konsole"));
- connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
-
QAction* findFile = actionCollection()->addAction("find_file");
findFile->setText(i18n("Find File..."));
findFile->setShortcut(Qt::CTRL | Qt::Key_F);
KToggleAction* showFilterBar = actionCollection()->add<KToggleAction>("show_filter_bar");
showFilterBar->setText(i18n("Show Filter Bar"));
showFilterBar->setShortcut(Qt::Key_Slash);
- connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
+ connect(showFilterBar, SIGNAL(triggered()), this, SLOT(toggleFilterBarVisibility()));
QAction* compareFiles = actionCollection()->addAction("compare_files");
compareFiles->setText(i18n("Compare Files"));
SidebarPage* infoWidget = new InfoSidebarPage(infoDock);
infoDock->setWidget(infoWidget);
- infoDock->toggleViewAction()->setText(i18n("Show Information Panel"));
+ infoDock->toggleViewAction()->setText(i18n("Information"));
actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
addDockWidget(Qt::RightDockWidgetArea, infoDock);
TreeViewSidebarPage* treeWidget = new TreeViewSidebarPage(treeViewDock);
treeViewDock->setWidget(treeWidget);
- treeViewDock->toggleViewAction()->setText(i18n("Show Folders Panel"));
+ treeViewDock->toggleViewAction()->setText(i18n("Folders"));
actionCollection()->addAction("show_folders_panel", treeViewDock->toggleViewAction());
addDockWidget(Qt::LeftDockWidgetArea, treeViewDock);
connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)),
this, SLOT(dropUrls(KUrl::List, KUrl)));
+ // setup "Terminal"
+ QDockWidget* terminalDock = new QDockWidget(i18n("Terminal"));
+ terminalDock->setObjectName("terminalDock");
+ terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+ SidebarPage* terminalWidget = new TerminalSidebarPage(terminalDock);
+ terminalDock->setWidget(terminalWidget);
+
+ terminalDock->toggleViewAction()->setText(i18n("Terminal"));
+ actionCollection()->addAction("show_terminal_panel", terminalDock->toggleViewAction());
+
+ addDockWidget(Qt::RightDockWidgetArea, terminalDock);
+ connect(this, SIGNAL(urlChanged(KUrl)),
+ terminalWidget, SLOT(setUrl(KUrl)));
+
const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
if (firstRun) {
infoDock->hide();
treeViewDock->hide();
+ terminalDock->hide();
}
QDockWidget *placesDock = new QDockWidget(i18n("Places"));
void toggleShowHiddenFiles();
/**
- * Switches between showing and hiding of the filter bar dependent
+ * Toggles between showing and hiding of the filter bar dependent
* from the current state of the 'Show Filter Bar' menu toggle action.
*/
- void showFilterBar();
+ void toggleFilterBarVisibility();
/** Increases the size of the current set view mode. */
void zoomIn();
/** Goes to the home URL. */
void goHome();
- /** Opens a terminal for the current shown directory. */
- void openTerminal();
-
/** Opens KFind for the current shown directory. */
void findFile();
<Action name="show_places_panel" />
<Action name="show_info_panel" />
<Action name="show_folders_panel" />
+ <Action name="show_terminal_panel" />
</Menu>
<Menu name="navigation_bar">
<text>Navigation Bar</text>
<Action name="view_properties" />
</Menu>
<Menu name="tools">
- <Action name="open_terminal" />
<Action name="find_file" />
<Action name="show_filter_bar" />
<Action name="compare_files" />
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * 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 <klibloader.h>
+#include <kde_terminal_interface.h>
+#include <kparts/part.h>
+
+#include <QVBoxLayout>
+
+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<KParts::Part*>(factory->create(this, "KParts::ReadOnlyPart"));
+ if (part != 0) {
+ m_terminal = part->widget();
+ m_layout->addWidget(m_terminal);
+ }
+ }
+ SidebarPage::showEvent(event);
+}
+
+#include "terminalsidebarpage.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+#ifndef TERMINALSIDEBARPAGE_H
+#define TERMINALSIDEBARPAGE_H
+
+#include <sidebarpage.h>
+
+class QVBoxLayout;
+
+/**
+ * @brief Shows the terminal which is synchronized with the URL of the
+ * active view.
+ */
+class TerminalSidebarPage : public SidebarPage
+{
+ Q_OBJECT
+
+public:
+ TerminalSidebarPage(QWidget* parent = 0);
+ virtual ~TerminalSidebarPage();
+
+public slots:
+ /** @see SidebarPage::setUrl(). */
+ virtual void setUrl(const KUrl& url);
+
+protected:
+ /** @see QWidget::showEvent() */
+ virtual void showEvent(QShowEvent* event);
+
+private:
+ QVBoxLayout* m_layout;
+ QWidget* m_terminal;
+};
+
+#endif // TERMINALSIDEBARPAGE_H