Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schuster <michael@schuster.ms>2020-03-03 20:45:58 +0300
committerMichael Schuster <michael@schuster.ms>2020-03-03 20:45:58 +0300
commitff642085b412a5614329c7ac207bb2516759a864 (patch)
treefb94df05735fd79a77e372c05dae60c904af9c67 /src/gui/socketapi.cpp
parent377526d6f97980cd7231b7a3634f77c0383423fe (diff)
Fix Explorer pinning: Add fallbacks for Shell commands (fixes #1599)
See: #1599 Signed-off-by: Michael Schuster <michael@schuster.ms>
Diffstat (limited to 'src/gui/socketapi.cpp')
-rw-r--r--src/gui/socketapi.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index 7967312b8..45ed44982 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -52,6 +52,7 @@
#include <QInputDialog>
#include <QClipboard>
+#include <QDesktopServices>
#include <QStandardPaths>
@@ -291,6 +292,12 @@ void SocketApi::slotReadSocket()
int indexOfMethod = staticMetaObject.indexOfMethod(functionWithArguments);
QString argument = line.remove(0, command.length() + 1);
+ if (indexOfMethod == -1) {
+ // Fallback: Try upper-case command
+ functionWithArguments = "command_" + command.toUpper() + "(QString,SocketListener*)";
+ indexOfMethod = staticMetaObject.indexOfMethod(functionWithArguments);
+ }
+
if (indexOfMethod != -1) {
staticMetaObject.method(indexOfMethod).invoke(this, Q_ARG(QString, argument), Q_ARG(SocketListener *, listener));
} else {
@@ -621,6 +628,24 @@ void SocketApi::command_COPY_PUBLIC_LINK(const QString &localFile, SocketListene
job->run();
}
+// Windows Shell / Explorer pinning fallbacks, see issue: https://github.com/nextcloud/desktop/issues/1599
+#ifdef Q_OS_WIN
+void SocketApi::command_COPYASPATH(const QString &localFile, SocketListener *)
+{
+ QApplication::clipboard()->setText(localFile);
+}
+
+void SocketApi::command_OPENNEWWINDOW(const QString &localFile, SocketListener *)
+{
+ QDesktopServices::openUrl(QUrl::fromLocalFile(localFile));
+}
+
+void SocketApi::command_OPEN(const QString &localFile, SocketListener *socketListener)
+{
+ command_OPENNEWWINDOW(localFile, socketListener);
+}
+#endif
+
// Fetches the private link url asynchronously and then calls the target slot
void SocketApi::fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QString &url)> &targetFun)
{