diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index 91219f9741f5d..b4f96d7499efc 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -67,7 +67,6 @@ #include #include -#include #include #include @@ -77,6 +76,12 @@ #include #endif +#ifdef HAVE_KGUIADDONS +#include +#include +#else +#include +#endif // This is the version that is returned when the client asks for the VERSION. // The first number should be changed if there is an incompatible change that breaks old clients. @@ -194,6 +199,17 @@ static QString buildMessage(const QString &verb, const QString &path, const QStr } return msg; } + +static void setClipboardText(const QString &text) +{ +#ifdef HAVE_KGUIADDONS + auto mimeData = new QMimeData(); + mimeData->setText(text); + KSystemClipboard::instance()->setMimeData(mimeData, QClipboard::Clipboard); +#else + QApplication::clipboard()->setText(text); +#endif +} } namespace OCC { @@ -902,7 +918,7 @@ void SocketApi::command_COPY_PUBLIC_LINK(const QString &localFile, SocketListene #ifdef Q_OS_WIN void SocketApi::command_COPYASPATH(const QString &localFile, SocketListener *) { - QApplication::clipboard()->setText(localFile); + setClipboardText(localFile); } void SocketApi::command_OPENNEWWINDOW(const QString &localFile, SocketListener *) @@ -995,7 +1011,7 @@ void SocketApi::command_MAKE_ONLINE_ONLY(const QString &filesArg, SocketListener void SocketApi::copyUrlToClipboard(const QString &link) { - QApplication::clipboard()->setText(link); + setClipboardText(link); } void SocketApi::command_RESOLVE_CONFLICT(const QString &localFile, SocketListener *)