summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-28 09:55:19 (GMT)
committerPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-28 11:42:49 (GMT)
commit3c2c1c21b41f600eeaa056b66fe44d5017f9b500 (patch)
tree2cac51b8deab69cb1ce1bfb8962b6a366fe15728 /src
parent4470801f73b86d3ee06a866fbbdafcaeb9f294a6 (diff)
downloadQt-3c2c1c21b41f600eeaa056b66fe44d5017f9b500.zip
Qt-3c2c1c21b41f600eeaa056b66fe44d5017f9b500.tar.gz
Qt-3c2c1c21b41f600eeaa056b66fe44d5017f9b500.tar.bz2
Drag and drop of plain text doesnot work on Mac.
While querying for the text in the pasteboard, it was looking in the wrong place. The helper function qt_mac_get_pasteboardString() always searched in generalPasteboard instead of the pasteboard referred by the QMacPasteboard. Reviewed-by: MortenS
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qclipboard_mac.cpp2
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm19
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h2
3 files changed, 15 insertions, 8 deletions
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index 3db647b..8892269 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -532,7 +532,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
// Try to get the NSStringPboardType from NSPasteboard, newlines are mapped
// correctly (as '\n') in this data. The 'public.utf16-plain-text' type
// usually maps newlines to '\r' instead.
- QString str = qt_mac_get_pasteboardString();
+ QString str = qt_mac_get_pasteboardString(paste);
if (!str.isEmpty())
return str;
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 2b2259c..c0fb8aa 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1152,16 +1152,23 @@ CGFloat qt_mac_get_scalefactor()
#endif
}
-QString qt_mac_get_pasteboardString()
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste)
{
QMacCocoaAutoReleasePool pool;
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- NSString *text = [pb stringForType:NSStringPboardType];
- if (text) {
- return qt_mac_NSStringToQString(text);
+ NSPasteboard *pb = nil;
+ CFStringRef pbname;
+ if (PasteboardCopyName (paste, &pbname)) {
+ pb = [NSPasteboard generalPasteboard];
} else {
- return QString();
+ pb = [NSPasteboard pasteboardWithName:reinterpret_cast<const NSString *>(pbname)];
+ CFRelease (pbname);
}
+ if (pb) {
+ NSString *text = [pb stringForType:NSStringPboardType];
+ if (text)
+ return qt_mac_NSStringToQString(text);
+ }
+ return QString();
}
QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 62db064..ea35fb6 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -170,7 +170,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
CGFloat qt_mac_get_scalefactor();
-QString qt_mac_get_pasteboardString();
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste);
#ifdef __OBJC__
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)