[Pkg-owncloud-commits] [owncloud-client] 112/484: OS X: Use Cocoa Pasteboard instead of QClipBoard #3300
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 98b966d27433a51b4a4f77816b8c2d689bafec5e
Author: Markus Goetz <markus at woboq.com>
Date: Tue Oct 20 15:42:14 2015 +0200
OS X: Use Cocoa Pasteboard instead of QClipBoard #3300
---
src/gui/CMakeLists.txt | 1 +
src/gui/clipboard.mm | 16 ++++++++++++++++
src/gui/sharedialog.cpp | 8 ++++++++
3 files changed, 25 insertions(+)
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index e9a18be..69d65ad 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -97,6 +97,7 @@ IF( APPLE )
list(APPEND client_SRCS settingsdialogmac.cpp)
list(APPEND client_SRCS socketapisocket_mac.mm)
list(APPEND client_SRCS systray.mm)
+ list(APPEND client_SRCS clipboard.mm)
if(SPARKLE_FOUND)
# Define this, we need to check in updater.cpp
diff --git a/src/gui/clipboard.mm b/src/gui/clipboard.mm
new file mode 100644
index 0000000..56361b7
--- /dev/null
+++ b/src/gui/clipboard.mm
@@ -0,0 +1,16 @@
+#include <QString>
+#include <QDebug>
+#import <Cocoa/Cocoa.h>
+
+namespace OCC {
+
+// https://github.com/owncloud/client/issues/3300
+void copyToPasteboard(const QString &string)
+{
+ qDebug() << Q_FUNC_INFO << string;
+ [[NSPasteboard generalPasteboard] clearContents];
+ [[NSPasteboard generalPasteboard] setString:[NSString stringWithUTF8String:string.toUtf8().data()]
+ forType:NSStringPboardType];
+}
+
+}
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index c4ac51a..c4c5b71 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -590,10 +590,18 @@ void ShareDialog::slotCheckBoxExpireClicked()
}
}
+#ifdef Q_OS_MAC
+extern void copyToPasteboard(const QString &string);
+#endif
+
void ShareDialog::slotPushButtonCopyLinkPressed()
{
+#ifdef Q_OS_MAC
+ copyToPasteboard(_shareUrl);
+#else
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(_shareUrl);
+#endif
}
void ShareDialog::slotCheckBoxEditingClicked()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list