Procházet zdrojové kódy

Symlink Support for Dolphin Plugins (#5428)

Add Symlink Support to Dolphin Overlay Plugin
octotree před 9 roky
rodič
revize
a1b4984d14

+ 3 - 1
shell_integration/dolphin/ownclouddolphinactionplugin.cpp

@@ -24,6 +24,7 @@
 #include <KIOCore/kfileitem.h>
 #include <KIOCore/KFileItemListProperties>
 #include <QtWidgets/QAction>
+#include <QtCore/QDir>
 #include <QtCore/QTimer>
 #include "ownclouddolphinpluginhelper.h"
 
@@ -43,7 +44,8 @@ public:
         auto url = urls.first();
         if (!url.isLocalFile())
             return {};
-        auto localFile = url.toLocalFile();
+        QDir localPath(url.toLocalFile());
+        auto localFile = localPath.canonicalPath();
 
         const auto paths = helper->paths();
         if (!std::any_of(paths.begin(), paths.end(), [&](const QString &s) {

+ 3 - 1
shell_integration/dolphin/ownclouddolphinoverlayplugin.cpp

@@ -21,6 +21,7 @@
 #include <KPluginFactory>
 #include <QtNetwork/QLocalSocket>
 #include <KIOCore/kfileitem.h>
+#include <QDir>
 #include <QTimer>
 #include "ownclouddolphinpluginhelper.h"
 
@@ -46,7 +47,8 @@ public:
             return QStringList();
         if (!url.isLocalFile())
             return QStringList();
-        const QByteArray localFile = url.toLocalFile().toUtf8();
+        QDir localPath(url.toLocalFile());
+        const QByteArray localFile = localPath.canonicalPath().toUtf8();
 
         helper->sendCommand(QByteArray("RETRIEVE_FILE_STATUS:" + localFile + "\n"));