diff options
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 2 | ||||
| -rw-r--r-- | src/panels/information/informationpanelcontent.cpp | 6 | ||||
| -rw-r--r-- | src/panels/terminal/org.kde.KIOFuse.VFS.xml | 13 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 45 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 2 |
5 files changed, 62 insertions, 6 deletions
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index 23e7f1922..4f0e4e5eb 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -248,7 +248,7 @@ void InformationPanel::showItemInfo() if (item.isNull()) { // No item is hovered and no selection has been done: provide // an item for the currently shown directory. - m_folderStatJob = KIO::stat(url(), KIO::HideProgressInfo); + m_folderStatJob = KIO::statDetails(url(), KIO::StatJob::SourceSide, KIO::StatDefaultDetails | KIO::StatRecursiveSize, KIO::HideProgressInfo); if (m_folderStatJob->uiDelegate()) { KJobWidgets::setWindow(m_folderStatJob, this); } diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 5c7c7c3f1..6cbdd4b3b 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -233,7 +233,7 @@ void InformationPanelContent::refreshPreview() // in the case of a search-URL the URL is not readable for humans // (at least not useful to show in the Information Panel) m_preview->setPixmap( - QIcon::fromTheme(QStringLiteral("baloo")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous) + QIcon::fromTheme(QStringLiteral("baloo")).pixmap(m_preview->height(), m_preview->width()) ); } else { @@ -314,7 +314,7 @@ void InformationPanelContent::showItems(const KFileItemList& items) m_preview->stopAnimatedImage(); m_preview->setPixmap( - QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous) + QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(m_preview->height(), m_preview->width()) ); setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count())); @@ -358,7 +358,7 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event) void InformationPanelContent::showIcon(const KFileItem& item) { m_outdatedPreviewTimer->stop(); - QPixmap pixmap = QIcon::fromTheme(item.iconName()).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous); + QPixmap pixmap = QIcon::fromTheme(item.iconName()).pixmap(m_preview->height(), m_preview->width()); KIconLoader::global()->drawOverlays(item.overlays(), pixmap, KIconLoader::Desktop); m_preview->setPixmap(pixmap); } diff --git a/src/panels/terminal/org.kde.KIOFuse.VFS.xml b/src/panels/terminal/org.kde.KIOFuse.VFS.xml new file mode 100644 index 000000000..56f753e41 --- /dev/null +++ b/src/panels/terminal/org.kde.KIOFuse.VFS.xml @@ -0,0 +1,13 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="org.kde.KIOFuse.VFS"> + <method name="mountUrl"> + <arg name="remoteUrl" type="s" direction="in"/> + <arg type="s" direction="out"/> + </method> + <method name="remoteUrl"> + <arg name="localUrl" type="s" direction="in"/> + <arg type="s" direction="out"/> + </method> + </interface> +</node> diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 861afebee..b0aff9a77 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -18,6 +18,7 @@ ***************************************************************************/ #include "terminalpanel.h" +#include "kiofuse_interface.h" #include <KIO/DesktopExecParser> #include <KIO/Job> @@ -25,6 +26,7 @@ #include <KJobWidgets> #include <KLocalizedString> #include <KMessageWidget> +#include <KMountPoint> #include <KParts/ReadOnlyPart> #include <KPluginFactory> #include <KPluginLoader> @@ -50,7 +52,10 @@ TerminalPanel::TerminalPanel(QWidget* parent) : m_konsolePartMissingMessage(nullptr), m_konsolePart(nullptr), m_konsolePartCurrentDirectory(), - m_sendCdToTerminalHistory() + m_sendCdToTerminalHistory(), + m_kiofuseInterface(QStringLiteral("org.kde.KIOFuse"), + QStringLiteral("/org/kde/KIOFuse"), + QDBusConnection::sessionBus()) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); @@ -244,6 +249,19 @@ void TerminalPanel::slotMostLocalUrlResult(KJob* job) const QUrl url = statJob->mostLocalUrl(); if (url.isLocalFile()) { sendCdToTerminal(url.toLocalFile()); + } else { + // URL isn't local, only hope for the terminal to be in sync with the + // DolphinView is to mount the remote URL in KIOFuse and point to it. + // If we can't do that for any reason, silently fail. + auto reply = m_kiofuseInterface.mountUrl(url.toString()); + QDBusPendingCallWatcher * watcher = new QDBusPendingCallWatcher(reply, this); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=] (QDBusPendingCallWatcher* watcher) { + watcher->deleteLater(); + if (!reply.isError()) { + // Successfully mounted, point to the KIOFuse equivalent path. + sendCdToTerminal(reply.value()); + } + }); } m_mostLocalUrlJob = nullptr; @@ -261,8 +279,31 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir) } } + // User may potentially be browsing inside a KIOFuse mount. + // If so lets try and change the DolphinView to point to the remote URL equivalent. + // instead of into the KIOFuse mount itself (which can cause performance issues!) const QUrl url(QUrl::fromLocalFile(dir)); - emit changeUrl(url); + + KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(m_konsolePartCurrentDirectory); + if (mountPoint && mountPoint->mountType() != QStringLiteral("fuse.kio-fuse")) { + // Not in KIOFUse mount, so just switch to the corresponding URL. + emit changeUrl(url); + return; + } + + auto reply = m_kiofuseInterface.remoteUrl(m_konsolePartCurrentDirectory); + QDBusPendingCallWatcher * watcher = new QDBusPendingCallWatcher(reply, this); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=] (QDBusPendingCallWatcher* watcher) { + watcher->deleteLater(); + if (reply.isError()) { + // KIOFuse errored out... just show the normal URL + emit changeUrl(url); + } else { + // Our location happens to be in a KIOFuse mount and is mounted. + // Let's change the DolphinView to point to the remote URL equivalent. + emit changeUrl(QUrl::fromUserInput(reply.value())); + } + }); } bool TerminalPanel::terminalHasFocus() const diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 6ab205fe3..661fee4d4 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -21,6 +21,7 @@ #define TERMINALPANEL_H #include "panels/panel.h" +#include "kiofuse_interface.h" #include <QQueue> @@ -101,6 +102,7 @@ private: KParts::ReadOnlyPart* m_konsolePart; QString m_konsolePartCurrentDirectory; QQueue<QString> m_sendCdToTerminalHistory; + org::kde::KIOFuse::VFS m_kiofuseInterface; }; #endif // TERMINALPANEL_H |
