summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qmacmime.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-02-26 13:43:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-06 20:48:59 +0100
commit6de7a96405f3f2ae5b22a2525b9f65e22ef6e210 (patch)
treeecb47095e84010d3dcf52eae55eb86d3aa2d6547 /src/plugins/platforms/cocoa/qmacmime.mm
parent35ca2b85af9691f1f9663eeb9c496d5bf59b4a11 (diff)
Cocoa: remove old carbon code from qmacmime
Prepare qmacmime to be moved to platform support by removing unused includes and function declarations and other dependencies on carbon or cocoa. Also remove unneeded QCFString convertions, and use UTI strings directly (fetched from apple docs) rather than querying the system. Change-Id: I8f622664c13f3fd05862720c3658cfc1b59baf28 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qmacmime.mm')
-rw-r--r--src/plugins/platforms/cocoa/qmacmime.mm47
1 files changed, 9 insertions, 38 deletions
diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm
index bcc4618712..a9f4c57d6d 100644
--- a/src/plugins/platforms/cocoa/qmacmime.mm
+++ b/src/plugins/platforms/cocoa/qmacmime.mm
@@ -40,28 +40,10 @@
****************************************************************************/
#include "qmacmime.h"
-#include "qcocoahelpers.h"
-#include "qmacclipboard.h"
-
-#include "qdebug.h"
-#include "qpixmap.h"
-#include "qimagewriter.h"
-#include "qimagereader.h"
-#include "qdatastream.h"
-#include "qbuffer.h"
-#include "qdatetime.h"
#include "qguiapplication.h"
-#include "qtextcodec.h"
-#include "qregexp.h"
-#include "qurl.h"
-#include "qmap.h"
-
-#include <Cocoa/Cocoa.h>
QT_BEGIN_NAMESPACE
-extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp
-
typedef QList<QMacInternalPasteboardMime*> MimeList;
Q_GLOBAL_STATIC(MimeList, globalMimeList)
Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
@@ -108,13 +90,6 @@ const QStringList& qt_mac_enabledDraggedTypes()
*****************************************************************************/
//#define DEBUG_MIME_MAPS
-//functions
-extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
-extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp
-
-ScrapFlavorType qt_mac_mime_type = 'CUTE';
-CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker");
-
/*!
\class QMacPasteboardMime
\brief The QMacPasteboardMime class converts between a MIME type and a
@@ -303,7 +278,7 @@ QVariant QMacPasteboardMimeTypeName::convertToMime(const QString &, QList<QByteA
QList<QByteArray> QMacPasteboardMimeTypeName::convertFromMime(const QString &, QVariant, QString)
{
QList<QByteArray> ret;
- ret.append(QString("x-qt-mime-type-name").toUtf8());
+ ret.append(QString(QLatin1String("x-qt-mime-type-name")).toUtf8());
return ret;
}
@@ -349,11 +324,10 @@ QVariant QMacPasteboardMimePlainText::convertToMime(const QString &mimetype, QLi
qWarning("QMacPasteboardMimePlainText: Cannot handle multiple member data");
const QByteArray &firstData = data.first();
QVariant ret;
- if (flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text"))) {
- QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault,
+ if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) {
+ return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
firstData.size(), CFStringGetSystemEncoding(), false));
- ret = QString(str);
} else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
}
@@ -364,7 +338,7 @@ QList<QByteArray> QMacPasteboardMimePlainText::convertFromMime(const QString &,
{
QList<QByteArray> ret;
QString string = data.toString();
- if (flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text")))
+ if (flavor == QLatin1String("com.apple.traditional-mac-plain-text"))
ret.append(string.toLatin1());
return ret;
}
@@ -425,10 +399,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
// I can only handle two types (system and unicode) so deal with them that way
QVariant ret;
if (flavor == QLatin1String("public.utf8-plain-text")) {
- QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault,
+ ret = QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
firstData.size(), CFStringGetSystemEncoding(), false));
- ret = QString(str);
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
ret = QString(reinterpret_cast<const QChar *>(firstData.constData()),
firstData.size() / sizeof(QChar));
@@ -524,21 +497,20 @@ QString QMacPasteboardMimeFileUri::convertorName()
QString QMacPasteboardMimeFileUri::flavorFor(const QString &mime)
{
if (mime == QLatin1String("text/uri-list"))
- return QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0));
+ return QLatin1String("public.file-url");
return QString();
}
QString QMacPasteboardMimeFileUri::mimeFor(QString flav)
{
- if (flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0)))
+ if (flav == QLatin1String("public.file-url"))
return QLatin1String("text/uri-list");
return QString();
}
bool QMacPasteboardMimeFileUri::canConvert(const QString &mime, QString flav)
{
- return mime == QLatin1String("text/uri-list")
- && flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0));
+ return mime == QLatin1String("text/uri-list") && flav == QLatin1String("public.file-url");
}
QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
@@ -670,7 +642,7 @@ public:
QString QMacPasteboardMimeVCard::convertorName()
{
- return QString("VCard");
+ return QLatin1String("VCard");
}
bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
@@ -710,7 +682,6 @@ QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime,
return ret;
}
-
/*!
\internal