void TerminalSidebarPage::setUrl(const KUrl& url)
{
- if (!SidebarPage::url().equals(url, KUrl::CompareWithoutTrailingSlash)) {
- SidebarPage::setUrl(url);
- if ((m_terminal != 0) && isVisible()) {
- m_terminal->sendInput("cd " + KShell::quoteArg(url.path()) + '\n');
- }
+ if (!url.isValid() || (url == SidebarPage::url())) {
+ return;
+ }
+
+ SidebarPage::setUrl(url);
+ if ((m_terminal != 0) && isVisible() && url.isLocalFile()) {
+ m_terminal->sendInput("cd " + KShell::quoteArg(url.path()) + '\n');
}
}
{
emit hideTerminalSidebarPage();
- KPluginFactory* factory = KPluginLoader("libkonsolepart").factory();
- KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
- if (part != 0) {
- connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
- m_terminalWidget = part->widget();
- m_layout->addWidget(m_terminalWidget);
- m_terminal = qobject_cast<TerminalInterface *>(part);
- m_terminal->showShellInDir(url().path());
- }
- if (m_terminal != 0) {
- m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');
- m_terminal->sendInput("clear\n");
- m_terminalWidget->setFocus();
- }
+ m_terminal = 0;
}
void TerminalSidebarPage::showEvent(QShowEvent* event)