diff options
Diffstat (limited to 'WebCore/platform/qt')
-rw-r--r-- | WebCore/platform/qt/ClipboardQt.cpp | 17 | ||||
-rw-r--r-- | WebCore/platform/qt/ContextMenuQt.cpp | 3 | ||||
-rw-r--r-- | WebCore/platform/qt/CookieJarQt.cpp | 47 | ||||
-rw-r--r-- | WebCore/platform/qt/FileSystemQt.cpp | 33 | ||||
-rw-r--r-- | WebCore/platform/qt/GeolocationServiceQt.cpp | 8 | ||||
-rw-r--r-- | WebCore/platform/qt/PlatformScreenQt.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/qt/TemporaryLinkStubsQt.cpp | 1 |
7 files changed, 74 insertions, 37 deletions
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp index 20cf62b..c14d362 100644 --- a/WebCore/platform/qt/ClipboardQt.cpp +++ b/WebCore/platform/qt/ClipboardQt.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2007 Apple Inc. All rights reserved. * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Sencha, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -204,8 +205,20 @@ HashSet<String> ClipboardQt::types() const PassRefPtr<FileList> ClipboardQt::files() const { - notImplemented(); - return 0; + if (policy() != ClipboardReadable || !m_readableData->hasUrls()) + return FileList::create(); + + RefPtr<FileList> fileList = FileList::create(); + QList<QUrl> urls = m_readableData->urls(); + + for (int i = 0; i < urls.size(); i++) { + QUrl url = urls[i]; + if (url.scheme() != QLatin1String("file")) + continue; + fileList->append(File::create(url.toLocalFile())); + } + + return fileList.release(); } void ClipboardQt::setDragImage(CachedImage* image, const IntPoint& point) diff --git a/WebCore/platform/qt/ContextMenuQt.cpp b/WebCore/platform/qt/ContextMenuQt.cpp index e3715c9..c877642 100644 --- a/WebCore/platform/qt/ContextMenuQt.cpp +++ b/WebCore/platform/qt/ContextMenuQt.cpp @@ -35,8 +35,7 @@ namespace WebCore { -ContextMenu::ContextMenu(const HitTestResult& result) - : m_hitTestResult(result) +ContextMenu::ContextMenu() { } diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp index 049ee0f..e5d36ba 100644 --- a/WebCore/platform/qt/CookieJarQt.cpp +++ b/WebCore/platform/qt/CookieJarQt.cpp @@ -31,6 +31,7 @@ #include "Cookie.h" #include "Document.h" #include "KURL.h" +#include "QtNAMThreadSafeProxy.h" #include "NetworkingContext.h" #include "PlatformString.h" @@ -43,7 +44,8 @@ namespace WebCore { -static QNetworkCookieJar *cookieJar(const Document *document) + +static QNetworkAccessManager *networkAccessManager(const Document *document) { if (!document) return 0; @@ -53,38 +55,30 @@ static QNetworkCookieJar *cookieJar(const Document *document) FrameLoader *loader = frame->loader(); if (!loader) return 0; - QNetworkAccessManager* manager = loader->networkingContext()->networkAccessManager(); - QNetworkCookieJar* jar = manager->cookieJar(); - return jar; + return loader->networkingContext()->networkAccessManager(); } void setCookies(Document* document, const KURL& url, const String& value) { - QUrl u(url); - QUrl p(document->firstPartyForCookies()); - QNetworkCookieJar* jar = cookieJar(document); - if (!jar) + QNetworkAccessManager* manager = networkAccessManager(document); + if (!manager) return; - QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QString(value).toAscii()); - QList<QNetworkCookie>::Iterator it = cookies.begin(); - while (it != cookies.end()) { - if (it->isHttpOnly()) - it = cookies.erase(it); - else - ++it; - } - jar->setCookiesFromUrl(cookies, u); + // Create the manipulator on the heap to let it live until the + // async request is picked by the other thread's event loop. + QtNAMThreadSafeProxy* managerProxy = new QtNAMThreadSafeProxy(manager); + managerProxy->setCookies(url, value); + managerProxy->deleteLater(); } String cookies(const Document* document, const KURL& url) { - QUrl u(url); - QNetworkCookieJar* jar = cookieJar(document); - if (!jar) + QNetworkAccessManager* manager = networkAccessManager(document); + if (!manager) return String(); - QList<QNetworkCookie> cookies = jar->cookiesForUrl(u); + QtNAMThreadSafeProxy managerProxy(manager); + QList<QNetworkCookie> cookies = managerProxy.cookiesForUrl(url); if (cookies.isEmpty()) return String(); @@ -101,12 +95,12 @@ String cookies(const Document* document, const KURL& url) String cookieRequestHeaderFieldValue(const Document* document, const KURL &url) { - QUrl u(url); - QNetworkCookieJar* jar = cookieJar(document); - if (!jar) + QNetworkAccessManager* manager = networkAccessManager(document); + if (!manager) return String(); - QList<QNetworkCookie> cookies = jar->cookiesForUrl(u); + QtNAMThreadSafeProxy managerProxy(manager); + QList<QNetworkCookie> cookies = managerProxy.cookiesForUrl(url); if (cookies.isEmpty()) return String(); @@ -121,8 +115,7 @@ String cookieRequestHeaderFieldValue(const Document* document, const KURL &url) bool cookiesEnabled(const Document* document) { - QNetworkCookieJar* jar = cookieJar(document); - return (jar != 0); + return networkAccessManager(document); } bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp index b384091..d88a967 100644 --- a/WebCore/platform/qt/FileSystemQt.cpp +++ b/WebCore/platform/qt/FileSystemQt.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2008 Apple, Inc. All rights reserved. * Copyright (C) 2008 Collabora, Ltd. All rights reserved. + * Copyright (C) 2010 Sencha, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -94,7 +95,7 @@ String pathGetFileName(const String& path) String directoryName(const String& path) { - return String(QFileInfo(path).absolutePath()); + return QFileInfo(path).absolutePath(); } Vector<String> listDirectory(const String& path, const String& filter) @@ -128,7 +129,6 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) return CString(); } -#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE) PlatformFileHandle openFile(const String& path, FileOpenMode mode) { QIODevice::OpenMode platformMode; @@ -153,7 +153,6 @@ int readFromFile(PlatformFileHandle handle, char* data, int length) return handle->read(data, length); return 0; } -#endif void closeFile(PlatformFileHandle& handle) { @@ -163,6 +162,34 @@ void closeFile(PlatformFileHandle& handle) } } +long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) +{ + if (handle) { + long long current = 0; + + switch (origin) { + case SeekFromBeginning: + break; + case SeekFromCurrent: + current = handle->pos(); + break; + case SeekFromEnd: + current = handle->size(); + break; + } + + // Add the offset to the current position and seek to the new position + // Return our new position if the seek is successful + current += offset; + if (handle->seek(current)) + return current; + else + return -1; + } + + return -1; +} + int writeToFile(PlatformFileHandle handle, const char* data, int length) { if (handle && handle->exists() && handle->isWritable()) diff --git a/WebCore/platform/qt/GeolocationServiceQt.cpp b/WebCore/platform/qt/GeolocationServiceQt.cpp index 3562eb9..f4379b2 100644 --- a/WebCore/platform/qt/GeolocationServiceQt.cpp +++ b/WebCore/platform/qt/GeolocationServiceQt.cpp @@ -83,7 +83,13 @@ void GeolocationServiceQt::positionUpdated(const QGeoPositionInfo &geoPosition) RefPtr<Coordinates> coordinates = Coordinates::create(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); - m_lastPosition = Geoposition::create(coordinates.release(), geoPosition.timestamp().toTime_t()); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + m_lastPosition = Geoposition::create(coordinates.release(), geoPosition.timestamp().toMSecsSinceEpoch()); +#else + QDateTime timestamp = geoPosition.timestamp(); + m_lastPosition = Geoposition::create(coordinates.release(), (timestamp.toTime_t() * 1000.00) + timestamp.time().msec()); +#endif positionChanged(); } diff --git a/WebCore/platform/qt/PlatformScreenQt.cpp b/WebCore/platform/qt/PlatformScreenQt.cpp index db34e21..4db8bd1 100644 --- a/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/WebCore/platform/qt/PlatformScreenQt.cpp @@ -86,7 +86,7 @@ int screenDepthPerComponent(Widget* w) bool screenIsMonochrome(Widget* w) { - return QApplication::desktop()->screen(screenNumber(w))->numColors() < 2; + return QApplication::desktop()->screen(screenNumber(w))->colorCount() == 2; } FloatRect screenRect(Widget* w) diff --git a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp index d7b5104..a46b82c 100644 --- a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp +++ b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp @@ -62,7 +62,6 @@ #include "SystemTime.h" #include "TextBoundaries.h" #include "Widget.h" -#include "loader.h" #include <float.h> #include <stdio.h> |