diff options
43 files changed, 391 insertions, 193 deletions
@@ -115,7 +115,7 @@ getQMakeConf1() inc_file=`echo "$line" | sed -n -e "/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p"` current_dir=`dirname "$1"` conf_file="$current_dir/$inc_file" - if [ ! -e "$conf_file" ]; then + if [ ! -f "$conf_file" ]; then echo "WARNING: Unable to find file $conf_file" >&2 continue fi @@ -2278,7 +2278,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then fi # symlink fonts to be able to run application from build directory -if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then +if [ "$PLATFORM_QWS" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then if [ "$PLATFORM" = "$XPLATFORM" ]; then mkdir -p "${outpath}/lib" ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" @@ -7557,6 +7557,8 @@ elif [ "$CFG_OPENSSL" = "linked" ]; then OPENSSL_LINKAGE="(linked)" fi echo "OpenSSL support ..... $CFG_OPENSSL $OPENSSL_LINKAGE" +echo "Alsa support ........ $CFG_ALSA" +echo [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........ $CFG_PTMALLOC" @@ -7581,8 +7583,6 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries." echo fi -echo "alsa support ........ $CFG_ALSA" -echo sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` PROCS=1 diff --git a/doc/src/examples/svgalib.qdoc b/doc/src/examples/svgalib.qdoc index 9142112..cf6512c 100644 --- a/doc/src/examples/svgalib.qdoc +++ b/doc/src/examples/svgalib.qdoc @@ -43,6 +43,9 @@ \example qws/svgalib \title Accelerated Graphics Driver Example + \warning This example was designed to work with Qt 4.4 and will not work + with current versions of Qt. It will be removed from Qt 4.7. + The Accelerated Graphics Driver example shows how you can write your own accelerated graphics driver and \l {add your graphics driver to Qt for Embedded Linux}. In \l{Qt for Embedded Linux}, diff --git a/doc/src/platforms/emb-install.qdoc b/doc/src/platforms/emb-install.qdoc index c13fbef..623ba89 100644 --- a/doc/src/platforms/emb-install.qdoc +++ b/doc/src/platforms/emb-install.qdoc @@ -84,7 +84,9 @@ Before building the \l{Qt for Embedded Linux} library, run the \c ./configure script to configure the library for your development architecture. You can list all of the configuration system's - options by typing \c {./configure -help}. + options by typing + + \snippet doc/src/snippets/code/doc_src_emb-install.qdoc embedded help Note that by default, \l{Qt for Embedded Linux} is configured for installation in the \c{/usr/local/Trolltech/QtEmbedded-%VERSION%} diff --git a/doc/src/snippets/code/doc_src_emb-install.qdoc b/doc/src/snippets/code/doc_src_emb-install.qdoc index 60775d2..f24f087 100644 --- a/doc/src/snippets/code/doc_src_emb-install.qdoc +++ b/doc/src/snippets/code/doc_src_emb-install.qdoc @@ -41,18 +41,22 @@ //! [0] cd <anywhere> -gunzip qt-embedded-linux-commercial-src-%VERSION%.tar.gz -tar xf qt-embedded-linux-commercial-src-%VERSION%.tar +gunzip qt-everywhere-opensource-src-%VERSION%.tar.gz +tar xf qt-everywhere-opensource-src-%VERSION%.tar //! [0] //! [1] -~/qt-embedded-linux-commercial-src-%VERSION% +~/qt-everywhere-opensource-src-%VERSION% //! [1] +//! [embedded help] +./configure -embedded -help +//! [embedded help] + //! [2] -cd ~/qt-embedded-linux-commercial-src-%VERSION% +cd ~/qt-everywhere-opensource-src-%VERSION% ./configure -embedded [architecture] //! [2] diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp index 483c675..4f27661 100644 --- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp +++ b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp @@ -260,3 +260,14 @@ class CustomItem : public QGraphicsItem ... }; //! [QGraphicsItem type] + +//! [18] +class QGraphicsPathItem : public QAbstractGraphicsShapeItem +{ + public: + enum { Type = 2 }; + int type() const { return Type; } + ... +}; +//! [18] + diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index ea8411f..6adfa75 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -51,7 +51,7 @@ \nextpage The Application Main Window - A \l{Widgets}{widget} that is not embedded in a parent widget is called a window. + A \l{Widgets Tutorial}{widget} that is not embedded in a parent widget is called a window. Usually, windows have a frame and a title bar, although it is also possible to create windows without such decoration using suitable window flags). In Qt, QMainWindow and the various subclasses of QDialog are the most common window types. diff --git a/examples/tools/customtype/message.cpp b/examples/tools/customtype/message.cpp index 4ef041a..d27159e 100644 --- a/examples/tools/customtype/message.cpp +++ b/examples/tools/customtype/message.cpp @@ -64,7 +64,7 @@ Message::Message(const QString &body, const QStringList &headers) } //! [custom type streaming operator] -QDebug &operator<<(QDebug &dbg, const Message &message) +QDebug operator<<(QDebug dbg, const Message &message) { QStringList pieces = message.body().split("\r\n", QString::SkipEmptyParts); if (pieces.isEmpty()) diff --git a/examples/tools/customtype/message.h b/examples/tools/customtype/message.h index 361f803..4ef48d4 100644 --- a/examples/tools/customtype/message.h +++ b/examples/tools/customtype/message.h @@ -70,7 +70,7 @@ Q_DECLARE_METATYPE(Message); //! [custom type meta-type declaration] //! [custom type streaming operator] -QDebug &operator<<(QDebug &dbg, const Message &message); +QDebug operator<<(QDebug dbg, const Message &message); //! [custom type streaming operator] #endif diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 6fe71d6..221c020 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 8f5ca3ba5da63a47d4f90bbd867d3e8453443dd3 + a54fd11a3abcd6d9c858e8162e85fd1f3aa21db1 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 8e1c965..fd5606b 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] Phone backup support for QtWebkit for Symbian devices. + https://bugs.webkit.org/show_bug.cgi?id=34077 + + * WebCore.pro: + +2010-01-21 Thiago Macieira <thiago.macieira@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix incorrect dependency to QtXmlPatterns in generated include/QtWebKit/QtWebKit header + + The generated file includes QtXmlPatterns/QtXmlPatterns, which is neither used/required by + the public QtWebKit API nor will it be available if Qt is configured with -no-xmlpatterns. + + * WebCore.pro: Trick syncqt to believe that xmlpatterns is not a dependency, so that it's not + included in the generated file. It'll still be used and linked to with this trick. + 2010-01-17 Srinidhi Shreedhara <srinidhi.shreedhara@nokia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 04aba62..bf4d6f9 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -18,7 +18,10 @@ symbian: { " " webkitlibs.pkg_prerules = vendorinfo - DEPLOYMENT += webkitlibs + webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml + webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + + DEPLOYMENT += webkitlibs webkitbackup TARGET.UID3 = 0x200267C2 # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. @@ -2780,7 +2783,7 @@ unix:!mac:CONFIG += link_pkgconfig contains(DEFINES, ENABLE_XSLT=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_XSLT=1 - QT += xmlpatterns + tobe|!tobe: QT += xmlpatterns SOURCES += \ bindings/js/JSXSLTProcessorConstructor.cpp \ @@ -3415,14 +3418,8 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 symbian { shared { - contains(MMP_RULES, defBlock) { - MMP_RULES -= defBlock - - MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ../WebKit/qt/symbian/bwins/$${TARGET}.def" \ - "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE ../WebKit/qt/symbian/eabi/$${TARGET}.def" \ - "$${LITERAL_HASH}endif" + contains(CONFIG, def_files) { + defFilePath=../WebKit/qt/symbian } } } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp index 989b34c..714cac9 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp @@ -39,6 +39,7 @@ #include <QGraphicsProxyWidget> #include <QGraphicsScene> #include <QGraphicsView> +#include <QGraphicsWebView> #include <QListWidget> #include <QListWidgetItem> #include <QMenu> @@ -57,8 +58,10 @@ PopupMenu::PopupMenu(PopupMenuClient* client) PopupMenu::~PopupMenu() { - delete m_popup; - delete m_proxy; + // If we create a proxy, then the deletion of the proxy and the + // combo will be done by the proxy's parent (QGraphicsWebView) + if (!m_proxy) + delete m_popup; } void PopupMenu::clear() @@ -100,9 +103,8 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) if (QGraphicsView* view = qobject_cast<QGraphicsView*>(client->ownerWidget())) { if (!m_proxy) { - m_proxy = new QGraphicsProxyWidget; + m_proxy = new QGraphicsProxyWidget(qobject_cast<QGraphicsWebView*>(client->pluginParent())); m_proxy->setWidget(m_popup); - view->scene()->addItem(m_proxy); } else m_proxy->setVisible(true); m_proxy->setGeometry(rect); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index ee555f3..09acd47 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,12 @@ +2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] Phone backup support for QtWebkit for Symbian devices. + https://bugs.webkit.org/show_bug.cgi?id=34077 + + * symbian/backup_registration.xml: Added. + 2009-11-19 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/backup_registration.xml b/src/3rdparty/webkit/WebKit/qt/symbian/backup_registration.xml new file mode 100644 index 0000000..e026140 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/symbian/backup_registration.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" standalone="yes"?> +<backup_registration> + <system_backup/> + <restore requires_reboot = "no"/> +</backup_registration> diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index a131d6c..076cc33 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3241,8 +3241,11 @@ static QString qt_ACE_do(const QString &domain, AceOperation op) while (1) { int idx = nextDotDelimiter(domain, lastIdx); int labelLength = idx - lastIdx; - if (labelLength == 0) + if (labelLength == 0) { + if (idx == domain.length()) + break; return QString(); // two delimiters in a row -- empty label not allowed + } // RFC 3490 says, about the ToASCII operation: // 3. If the UseSTD3ASCIIRules flag is set, then perform these checks: diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 21816b9..1b4b356 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -130,7 +130,7 @@ multiple- or virtual-inheritance (that is, in cases where two different pointer addresses can refer to the same object). In that case, if a pointer is cast to a different type and its value changes, - QSharedPointer's pointer tracking mechanism mail fail to detect that the + QSharedPointer's pointer tracking mechanism may fail to detect that the object being tracked is the same. \omit diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 3466d90..7defc9a 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -535,7 +535,6 @@ QDBusArgument &QDBusArgument::operator<<(const QByteArray &arg) /*! \internal - Returns the type signature of the D-Bus type this QDBusArgument \since 4.5 Appends the variant \a v. diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 30fa0b6..44abf7b 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1660,9 +1660,6 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError } QString busService = QLatin1String(DBUS_SERVICE_DBUS); - WatchedServicesHash::mapped_type &bus = watchedServices[busService]; - bus.refcount = 1; - bus.owner = getNameOwnerNoCache(busService); connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), this, SLOT(registerService(QString))); connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), @@ -2004,7 +2001,8 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service, entry.path == hook.path && entry.signature == hook.signature && entry.obj == hook.obj && - entry.midx == hook.midx) { + entry.midx == hook.midx && + entry.argumentMatch == hook.argumentMatch) { // no need to compare the parameters if it's the same slot return true; // already there } @@ -2046,10 +2044,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook // Do we need to watch for this name? if (shouldWatchService(hook.service)) { WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; - if (data.refcount) { - // already watching - ++data.refcount; - } else { + if (++data.refcount == 1) { // we need to watch for this service changing QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), @@ -2089,7 +2084,8 @@ bool QDBusConnectionPrivate::disconnectSignal(const QString &service, entry.path == hook.path && entry.signature == hook.signature && entry.obj == hook.obj && - entry.midx == hook.midx) { + entry.midx == hook.midx && + entry.argumentMatch == hook.argumentMatch) { // no need to compare the parameters if it's the same slot disconnectSignal(it); return true; // it was there @@ -2105,19 +2101,6 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) { const SignalHook &hook = it.value(); - WatchedServicesHash::Iterator sit = watchedServices.find(hook.service); - if (sit != watchedServices.end()) { - if (sit.value().refcount == 1) { - watchedServices.erase(sit); - QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); - disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), - QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); - } else { - --sit.value().refcount; - } - } - bool erase = false; MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule); if (i == matchRefCounts.end()) { @@ -2136,6 +2119,20 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) if (connection && erase) { qDBusDebug("Removing rule: %s", hook.matchRule.constData()); q_dbus_bus_remove_match(connection, hook.matchRule, NULL); + + // Successfully disconnected the signal + // Were we watching for this name? + WatchedServicesHash::Iterator sit = watchedServices.find(hook.service); + if (sit != watchedServices.end()) { + if (--sit.value().refcount == 0) { + watchedServices.erase(sit); + QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); + disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + } + } + } return signalHooks.erase(it); diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index f156e04..8ec328e 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qdbusargument_p.h" +#include "qdbusmetatype_p.h" #include "qdbusutil_p.h" QT_BEGIN_NAMESPACE @@ -167,7 +168,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg) QByteArray tmpSignature; const char *signature = 0; - if (int(id) == qMetaTypeId<QDBusArgument>()) { + if (int(id) == QDBusMetaTypeId::argument) { // take the signature from the QDBusArgument object we're marshalling tmpSignature = qvariant_cast<QDBusArgument>(value).currentSignature().toLatin1(); @@ -353,7 +354,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) } // intercept QDBusArgument parameters here - if (id == qMetaTypeId<QDBusArgument>()) { + if (id == QDBusMetaTypeId::argument) { QDBusArgument dbusargument = qvariant_cast<QDBusArgument>(arg); QDBusArgumentPrivate *d = QDBusArgumentPrivate::d(dbusargument); if (!d->message) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 561bd42..9773404 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -268,6 +268,17 @@ */ /*! + \variable QGraphicsItem::Type + + The type value returned by the virtual type() function in standard + graphics item classes in Qt. All such standard graphics item + classes in Qt are associated with a unique value for Type, + e.g. the value returned by QGraphicsPathItem::type() is 2. + + \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 18 +*/ + +/*! \variable QGraphicsItem::UserType The lowest permitted type value for custom items (subclasses @@ -276,6 +287,8 @@ and declaring a Type enum value. Example: \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 1 + + \note UserType = 65536 */ /*! diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 9f90cec..18b3772 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -110,6 +110,12 @@ QT_USE_NAMESPACE } } +- (void)removeActionsFromAppMenu +{ + for (NSMenuItem *item in [appMenu itemArray]) + [item setTag:nil]; +} + - (void)dealloc { [lastAppSpecificItem release]; diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h index 432a7a6..81c136e 100644 --- a/src/gui/kernel/qcocoamenuloader_mac_p.h +++ b/src/gui/kernel/qcocoamenuloader_mac_p.h @@ -70,6 +70,7 @@ } - (void)ensureAppMenuInMenu:(NSMenu *)menu; +- (void)removeActionsFromAppMenu; - (NSMenu *)applicationMenu; - (NSMenu *)menu; - (NSMenuItem *)quitMenuItem; diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index eda75db..c7c7caf 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -569,7 +569,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) // in cocoa. [NSApp run] should be called at least once for any cocoa app. if (NSModalSession session = d->currentModalSession()) { QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); - while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse) + while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) qt_mac_waitForMoreModalSessionEvents(); if (!d->interrupt && session == d->currentModalSessionCached) { // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index e36ab9b..e06a810 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -143,6 +143,9 @@ extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) { +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; +#endif OSWindowRef wnd = static_cast<OSWindowRef>(window); if (wnd) { QWidget *widget; @@ -1278,4 +1281,17 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor) } #endif +QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() +{ +#ifndef QT_MAC_USE_COCOA + NSApplicationLoad(); +#endif + pool = (void*)[[NSAutoreleasePool alloc] init]; +} + +QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() +{ + [(NSAutoreleasePool*)pool release]; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ede87de..ffad38b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -3352,7 +3352,7 @@ QPoint QWidget::pos() const \note Setting the size to \c{QSize(0, 0)} will cause the widget to not appear on screen. This also applies to windows. - \sa pos, geometry, minimumSize, maximumSize, resizeEvent() + \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize() */ /*! diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 3dbc843..ebfab21 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -404,7 +404,7 @@ inline static void qt_mac_set_fullscreen_mode(bool b) return; qt_mac_app_fullscreen = b; if (b) { - SetSystemUIMode(kUIModeAllSuppressed, 0); + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); } else { SetSystemUIMode(kUIModeNormal, 0); } diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 97d69b2..f4af579 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -667,32 +667,47 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg switch (ct) { case QStyle::CT_PushButton: { - const QPushButton *psh = static_cast<const QPushButton *>(widg); - QString buttonText = qt_mac_removeMnemonics(psh->text()); - if (buttonText.contains(QLatin1Char('\n'))) - ret = QSize(-1, -1); - else if (sz == QAquaSizeLarge) - ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); - else if (sz == QAquaSizeSmall) - ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); - else if (sz == QAquaSizeMini) - ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); - - if (!psh->icon().isNull()){ - // If the button got an icon, and the icon is larger than the - // button, we can't decide on a default size - ret.setWidth(-1); - if (ret.height() < psh->iconSize().height()) - ret.setHeight(-1); - } - else if (buttonText == QLatin1String("OK") || buttonText == QLatin1String("Cancel")){ - // Aqua Style guidelines restrict the size of OK and Cancel buttons to 68 pixels. - // However, this doesn't work for German, therefore only do it for English, - // I suppose it would be better to do some sort of lookups for languages - // that like to have really long words. - ret.setWidth(77 - 8); - } - + const QPushButton *psh = qobject_cast<const QPushButton *>(widg); + // If this comparison is false, then the widget was not a push button. + // This is bad and there's very little we can do since we were requested to find a + // sensible size for a widget that pretends to be a QPushButton but is not. + if(psh) { + QString buttonText = qt_mac_removeMnemonics(psh->text()); + if (buttonText.contains(QLatin1Char('\n'))) + ret = QSize(-1, -1); + else if (sz == QAquaSizeLarge) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); + else if (sz == QAquaSizeSmall) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); + else if (sz == QAquaSizeMini) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); + + if (!psh->icon().isNull()){ + // If the button got an icon, and the icon is larger than the + // button, we can't decide on a default size + ret.setWidth(-1); + if (ret.height() < psh->iconSize().height()) + ret.setHeight(-1); + } + else if (buttonText == QLatin1String("OK") || buttonText == QLatin1String("Cancel")){ + // Aqua Style guidelines restrict the size of OK and Cancel buttons to 68 pixels. + // However, this doesn't work for German, therefore only do it for English, + // I suppose it would be better to do some sort of lookups for languages + // that like to have really long words. + ret.setWidth(77 - 8); + } + } else { + // The only sensible thing to do is to return whatever the style suggests... + if (sz == QAquaSizeLarge) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); + else if (sz == QAquaSizeSmall) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); + else if (sz == QAquaSizeMini) + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); + else + // Since there's no default size we return the large size... + ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); + } #if 0 //Not sure we are applying the rules correctly for RadioButtons/CheckBoxes --Sam } else if (ct == QStyle::CT_RadioButton) { QRadioButton *rdo = static_cast<QRadioButton *>(widg); @@ -749,23 +764,30 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg if (sz == QAquaSizeSmall) { int width = 0, height = 0; if (szHint == QSize(-1, -1)) { //just 'guess'.. - const QToolButton *bt = static_cast<const QToolButton *>(widg); - if (!bt->icon().isNull()) { - QSize iconSize = bt->iconSize(); - QSize pmSize = bt->icon().actualSize(QSize(32, 32), QIcon::Normal); - width = qMax(width, qMax(iconSize.width(), pmSize.width())); - height = qMax(height, qMax(iconSize.height(), pmSize.height())); - } - if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) { - int text_width = bt->fontMetrics().width(bt->text()), - text_height = bt->fontMetrics().height(); - if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) { - width = qMax(width, text_width); - height += text_height; - } else { - width += text_width; - width = qMax(height, text_height); + const QToolButton *bt = qobject_cast<const QToolButton *>(widg); + // If this conversion fails then the widget was not what it claimed to be. + if(bt) { + if (!bt->icon().isNull()) { + QSize iconSize = bt->iconSize(); + QSize pmSize = bt->icon().actualSize(QSize(32, 32), QIcon::Normal); + width = qMax(width, qMax(iconSize.width(), pmSize.width())); + height = qMax(height, qMax(iconSize.height(), pmSize.height())); + } + if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) { + int text_width = bt->fontMetrics().width(bt->text()), + text_height = bt->fontMetrics().height(); + if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) { + width = qMax(width, text_width); + height += text_height; + } else { + width += text_width; + width = qMax(height, text_height); + } } + } else { + // Let's return the size hint... + width = szHint.width(); + height = szHint.height(); } } else { width = szHint.width(); @@ -778,37 +800,47 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg break; case QStyle::CT_Slider: { int w = -1; - const QSlider *sld = static_cast<const QSlider *>(widg); - if (sz == QAquaSizeLarge) { - if (sld->orientation() == Qt::Horizontal) { - w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); - } else { - w = qt_mac_aqua_get_metric(kThemeMetricVSliderWidth); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricVSliderTickWidth); - } - } else if (sz == QAquaSizeSmall) { - if (sld->orientation() == Qt::Horizontal) { - w = qt_mac_aqua_get_metric(kThemeMetricSmallHSliderHeight); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricSmallHSliderTickHeight); - } else { - w = qt_mac_aqua_get_metric(kThemeMetricSmallVSliderWidth); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricSmallVSliderTickWidth); - } - } else if (sz == QAquaSizeMini) { - if (sld->orientation() == Qt::Horizontal) { - w = qt_mac_aqua_get_metric(kThemeMetricMiniHSliderHeight); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricMiniHSliderTickHeight); - } else { - w = qt_mac_aqua_get_metric(kThemeMetricMiniVSliderWidth); - if (sld->tickPosition() != QSlider::NoTicks) - w += qt_mac_aqua_get_metric(kThemeMetricMiniVSliderTickWidth); + const QSlider *sld = qobject_cast<const QSlider *>(widg); + // If this conversion fails then the widget was not what it claimed to be. + if(sld) { + if (sz == QAquaSizeLarge) { + if (sld->orientation() == Qt::Horizontal) { + w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); + } else { + w = qt_mac_aqua_get_metric(kThemeMetricVSliderWidth); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricVSliderTickWidth); + } + } else if (sz == QAquaSizeSmall) { + if (sld->orientation() == Qt::Horizontal) { + w = qt_mac_aqua_get_metric(kThemeMetricSmallHSliderHeight); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricSmallHSliderTickHeight); + } else { + w = qt_mac_aqua_get_metric(kThemeMetricSmallVSliderWidth); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricSmallVSliderTickWidth); + } + } else if (sz == QAquaSizeMini) { + if (sld->orientation() == Qt::Horizontal) { + w = qt_mac_aqua_get_metric(kThemeMetricMiniHSliderHeight); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricMiniHSliderTickHeight); + } else { + w = qt_mac_aqua_get_metric(kThemeMetricMiniVSliderWidth); + if (sld->tickPosition() != QSlider::NoTicks) + w += qt_mac_aqua_get_metric(kThemeMetricMiniVSliderTickWidth); + } } + } else { + // This is tricky, we were requested to find a size for a slider which is not + // a slider. We don't know if this is vertical or horizontal or if we need to + // have tick marks or not. + // For this case we will return an horizontal slider without tick marks. + w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); + w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); } if (sld->orientation() == Qt::Horizontal) ret.setHeight(w); diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index 0c8aeec..c1e254c 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -52,6 +52,9 @@ struct QTextOptionPrivate /*! Constructs a text option with default properties for text. + The text alignment property is set to Qt::AlignLeft. The + word wrap property is set to QTextOption::WordWrap. The + using of design metrics flag is set to false. */ QTextOption::QTextOption() : align(Qt::AlignLeft), @@ -67,6 +70,8 @@ QTextOption::QTextOption() /*! Constructs a text option with the given \a alignment for text. + The word wrap property is set to QTextOption::WordWrap. The using + of design metrics flag is set to false. */ QTextOption::QTextOption(Qt::Alignment alignment) : align(alignment), diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index ae805f6..0265a83 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -569,16 +569,3 @@ private: } @end - -/* Done here because this is the only .mm for now! -Sam */ -QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() -{ - NSApplicationLoad(); - pool = (void*)[[NSAutoreleasePool alloc] init]; -} - -QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() -{ - [(NSAutoreleasePool*)pool release]; -} - diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index ee79f5a..d92168a 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -472,14 +472,20 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar) void QMainWindowLayout::cleanUpMacToolbarItems() { - for (int i = 0; i < toolbarItemsCopy.size(); ++i) +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; +#endif + for (int i = 0; i < toolbarItemsCopy.size(); ++i) { +#ifdef QT_MAC_USE_COCOA + NSToolbarItem *item = static_cast<NSToolbarItem *>(toolbarItemsCopy.at(i)); + [item setView:0]; +#endif CFRelease(toolbarItemsCopy.at(i)); + } toolbarItemsCopy.clear(); unifiedToolbarHash.clear(); #ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - OSWindowRef window = qt_mac_window_for(layoutState.mainWindow); NSToolbar *macToolbar = [window toolbar]; if (macToolbar) { diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 5031d88..8ce7cc0 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1588,10 +1588,9 @@ QAction *QMenu::insertSeparator(QAction *before) } /*! - This will set the default action to \a act. The default action may - have a visual queue depending on the current QStyle. A default - action is usually meant to indicate what will defaultly happen on a - drop, as shown in a context menu. + This sets the default action to \a act. The default action may have + a visual cue, depending on the current QStyle. A default action + usually indicates what will happen by default when a drop occurs. \sa defaultAction() */ diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index cd7f9bd..7e4bbb5 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -175,6 +175,22 @@ static quint32 constructModifierMask(quint32 accel_key) return ret; } +static void cancelAllMenuTracking() +{ +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + NSMenu *mainMenu = [NSApp mainMenu]; + [mainMenu cancelTracking]; + for (NSMenuItem *item in [mainMenu itemArray]) { + if ([item submenu]) { + [[item submenu] cancelTracking]; + } + } +#else + CancelMenuTracking(AcquireRootMenu(), true, 0); +#endif +} + static bool actualMenuItemVisibility(const QMenuBarPrivate::QMacMenuBarPrivate *mbp, const QMacMenuAction *action) { @@ -1830,6 +1846,12 @@ void QMenuBarPrivate::macDestroyMenuBar() mac_menubar = 0; if (qt_mac_current_menubar.qmenubar == q) { +#ifdef QT_MAC_USE_COCOA + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + [loader removeActionsFromAppMenu]; +#else + cancelAllMenuTracking(); +#endif extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp qt_event_request_menubarupdate(); } @@ -1933,20 +1955,6 @@ static bool qt_mac_should_disable_menu(QMenuBar *menuBar, QWidget *modalWidget) return qt_mac_is_ancestor(menuBar->parentWidget(), modalWidget); } -static void cancelAllMenuTracking() -{ -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - NSMenu *mainMenu = [NSApp mainMenu]; - [mainMenu cancelTracking]; - for (NSMenuItem *item in [mainMenu itemArray]) { - if ([item submenu]) { - [[item submenu] cancelTracking]; - } - } -#endif -} - /*! \internal diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index 8c5065c..4ac9a8c 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -49,10 +49,15 @@ QT_BEGIN_NAMESPACE QFileNetworkReplyPrivate::QFileNetworkReplyPrivate() - : QNetworkReplyPrivate(), realFileSize(0) + : QNetworkReplyPrivate(), fileEngine(0), fileSize(0), filePos(0) { } +QFileNetworkReplyPrivate::~QFileNetworkReplyPrivate() +{ + delete fileEngine; +} + QFileNetworkReply::~QFileNetworkReply() { } @@ -94,9 +99,8 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req if (fileName.isEmpty()) { fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } - d->realFile.setFileName(fileName); - QFileInfo fi(d->realFile); + QFileInfo fi(fileName); if (fi.isDir()) { QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); setError(QNetworkReply::ContentOperationNotPermittedError, msg); @@ -106,14 +110,15 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req return; } - bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); + d->fileEngine = QAbstractFileEngine::create(fileName); + bool opened = d->fileEngine->open(QIODevice::ReadOnly | QIODevice::Unbuffered); // could we open the file? if (!opened) { QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") - .arg(d->realFile.fileName(), d->realFile.errorString()); + .arg(fileName, d->fileEngine->errorString()); - if (d->realFile.exists()) { + if (fi.exists()) { setError(QNetworkReply::ContentAccessDenied, msg); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); @@ -126,13 +131,13 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req return; } - d->realFileSize = fi.size(); + d->fileSize = fi.size(); setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); - setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize); + setHeader(QNetworkRequest::ContentLengthHeader, d->fileSize); QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, - Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize)); + Q_ARG(qint64, d->fileSize), Q_ARG(qint64, d->fileSize)); QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); } @@ -146,20 +151,25 @@ void QFileNetworkReply::close() { Q_D(QFileNetworkReply); QNetworkReply::close(); - d->realFile.close(); + if (d->fileEngine) + d->fileEngine->close(); } void QFileNetworkReply::abort() { Q_D(QFileNetworkReply); QNetworkReply::close(); - d->realFile.close(); + if (d->fileEngine) + d->fileEngine->close(); } qint64 QFileNetworkReply::bytesAvailable() const { Q_D(const QFileNetworkReply); - return QNetworkReply::bytesAvailable() + d->realFile.bytesAvailable(); + if (!d->fileEngine) + return 0; + + return QNetworkReply::bytesAvailable() + d->fileSize - d->filePos; } bool QFileNetworkReply::isSequential () const @@ -170,7 +180,7 @@ bool QFileNetworkReply::isSequential () const qint64 QFileNetworkReply::size() const { Q_D(const QFileNetworkReply); - return d->realFileSize; + return d->fileSize; } /*! @@ -179,11 +189,17 @@ qint64 QFileNetworkReply::size() const qint64 QFileNetworkReply::readData(char *data, qint64 maxlen) { Q_D(QFileNetworkReply); - qint64 ret = d->realFile.read(data, maxlen); - if (ret == 0 && bytesAvailable() == 0) + if (!d->fileEngine) + return -1; + + qint64 ret = d->fileEngine->read(data, maxlen); + if (ret == 0 && bytesAvailable() == 0) { return -1; // everything had been read - else - return ret; + } else if (ret > 0) { + d->filePos += ret; + } + + return ret; } diff --git a/src/network/access/qfilenetworkreply_p.h b/src/network/access/qfilenetworkreply_p.h index 125fa2e..710ec9f 100644 --- a/src/network/access/qfilenetworkreply_p.h +++ b/src/network/access/qfilenetworkreply_p.h @@ -57,6 +57,7 @@ #include "qnetworkreply_p.h" #include "qnetworkaccessmanager.h" #include <QFile> +#include <QAbstractFileEngine> QT_BEGIN_NAMESPACE @@ -85,9 +86,11 @@ class QFileNetworkReplyPrivate: public QNetworkReplyPrivate { public: QFileNetworkReplyPrivate(); + ~QFileNetworkReplyPrivate(); - QFile realFile; - qint64 realFileSize; + QAbstractFileEngine *fileEngine; + qint64 fileSize; + qint64 filePos; virtual bool isFinished() const; diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 6e1df93..a890b3b 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -778,6 +778,14 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxSize) QNativeSocketEnginePrivate::RemoteHostClosedErrorString); close(); return -1; + } else if (readBytes == -1) { + if (!d->hasSetSocketError) { + d->hasSetSocketError = true; + d->socketError = QAbstractSocket::NetworkError; + d->socketErrorString = qt_error_string(); + } + close(); + return -1; } return readBytes; } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index d3b0fe5..9a2c349 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -903,7 +903,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) case EBADF: case EINVAL: case EIO: - setError(QAbstractSocket::NetworkError, ReadErrorString); + //error string is now set in read(), not here in nativeRead() break; #ifdef Q_OS_SYMBIAN case EPIPE: diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 7088a57..8177b4f 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -1068,7 +1068,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) break; case WSAEBADF: case WSAEINVAL: - setError(QAbstractSocket::NetworkError, ReadErrorString); + //error string is now set in read(), not here in nativeRead() break; case WSAECONNRESET: case WSAECONNABORTED: @@ -1199,8 +1199,10 @@ void QNativeSocketEnginePrivate::nativeClose() #if defined (QTCPSOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeClose()"); #endif - linger l = {1, 0}; - ::setsockopt(socketDescriptor, SOL_SOCKET, SO_DONTLINGER, (char*)&l, sizeof(l)); + // We were doing a setsockopt here before with SO_DONTLINGER. (However with kind of wrong + // usage of parameters, it wants a BOOL but we used a struct and pretended it to be bool). + // We don't think setting this option should be done here, if a user wants it she/he can + // do it manually with socketDescriptor()/setSocketDescriptor(); ::closesocket(socketDescriptor); } diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 1db2e1b..5bfe46a 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1148,10 +1148,15 @@ bool QScriptValue::strictlyEquals(const QScriptValue &other) const } if (d->type != other.d_ptr->type) { - if (d->type == QScriptValuePrivate::JavaScriptCore) - return JSC::JSValue::strictEqual(d->jscValue, d->engine->scriptValueToJSCValue(other)); - else if (other.d_ptr->type == QScriptValuePrivate::JavaScriptCore) - return JSC::JSValue::strictEqual(other.d_ptr->engine->scriptValueToJSCValue(*this), other.d_ptr->jscValue); + if (d->type == QScriptValuePrivate::JavaScriptCore) { + QScriptEnginePrivate *eng_p = d->engine ? d->engine : other.d_ptr->engine; + if (eng_p) + return JSC::JSValue::strictEqual(d->jscValue, eng_p->scriptValueToJSCValue(other)); + } else if (other.d_ptr->type == QScriptValuePrivate::JavaScriptCore) { + QScriptEnginePrivate *eng_p = other.d_ptr->engine ? other.d_ptr->engine : d->engine; + if (eng_p) + return JSC::JSValue::strictEqual(eng_p->scriptValueToJSCValue(*this), other.d_ptr->jscValue); + } return false; } diff --git a/src/src.pro b/src/src.pro index 8dec49b..f2070ae 100644 --- a/src/src.pro +++ b/src/src.pro @@ -106,6 +106,7 @@ src_declarative.target = sub-declarative contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network src_xml contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon + contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index b384a55..2aeabf0 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -3091,6 +3091,20 @@ void tst_QScriptValue::strictlyEquals() QVERIFY(!falskt.strictlyEquals(null)); QVERIFY(!falskt.strictlyEquals(QScriptValue())); + QVERIFY(!QScriptValue(false).strictlyEquals(123)); + QVERIFY(!QScriptValue(QScriptValue::UndefinedValue).strictlyEquals(123)); + QVERIFY(!QScriptValue(QScriptValue::NullValue).strictlyEquals(123)); + QVERIFY(!QScriptValue(false).strictlyEquals("ciao")); + QVERIFY(!QScriptValue(QScriptValue::UndefinedValue).strictlyEquals("ciao")); + QVERIFY(!QScriptValue(QScriptValue::NullValue).strictlyEquals("ciao")); + QVERIFY(QScriptValue(&eng, "ciao").strictlyEquals("ciao")); + QVERIFY(QScriptValue("ciao").strictlyEquals(QScriptValue(&eng, "ciao"))); + QVERIFY(!QScriptValue("ciao").strictlyEquals(123)); + QVERIFY(!QScriptValue("ciao").strictlyEquals(QScriptValue(&eng, 123))); + QVERIFY(!QScriptValue(123).strictlyEquals("ciao")); + QVERIFY(!QScriptValue(123).strictlyEquals(QScriptValue(&eng, "ciao"))); + QVERIFY(!QScriptValue(&eng, 123).strictlyEquals("ciao")); + QScriptValue obj1 = eng.newObject(); QScriptValue obj2 = eng.newObject(); QCOMPARE(obj1.strictlyEquals(obj2), false); diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 33812fe..f108f4c 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -165,6 +165,8 @@ private slots: void ace_testsuite(); void std3violations_data(); void std3violations(); + void std3deviations_data(); + void std3deviations(); void tldRestrictions_data(); void tldRestrictions(); void emptyQueryOrFragment(); @@ -3238,6 +3240,8 @@ void tst_QUrl::std3violations_data() QTest::newRow("bang") << "foo!" << false; QTest::newRow("plus") << "foo+bar" << false; QTest::newRow("dot") << "foo.bar"; + QTest::newRow("startingdot") << ".bar" << false; + QTest::newRow("startingdot2") << ".example.com" << false; QTest::newRow("slash") << "foo/bar" << true; QTest::newRow("colon") << "foo:80" << true; QTest::newRow("question") << "foo?bar" << true; @@ -3282,6 +3286,24 @@ void tst_QUrl::std3violations() QVERIFY(!url.isValid()); } +void tst_QUrl::std3deviations_data() +{ + QTest::addColumn<QString>("source"); + + QTest::newRow("ending-dot") << "example.com."; + QTest::newRow("ending-dot3002") << QString("example.com") + QChar(0x3002); +} + +void tst_QUrl::std3deviations() +{ + QFETCH(QString, source); + QVERIFY(!QUrl::toAce(source).isEmpty()); + + QUrl url; + url.setHost(source); + QVERIFY(!url.host().isEmpty()); +} + void tst_QUrl::tldRestrictions_data() { QTest::addColumn<QString>("tld"); diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index 5ec4668..3c014e3 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" ?> <testsuite errors="5" failures="3" tests="9" name="tst_Xunit"> <properties> - <property value="4.6.2" name="QTestVersion"/> - <property value="4.6.2" name="QtVersion"/> + <property value="<INSERT_QT_VERSION_HERE>" name="QTestVersion"/> + <property value="<INSERT_QT_VERSION_HERE>" name="QtVersion"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testFunc1"> diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 89ece0f..0b9cee0 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -248,7 +248,7 @@ void tst_Selftests::doRunSubTest(QString &subdir, QStringList &arguments ) continue; const QString output(QString::fromLatin1(line)); - const QString expected(QString::fromLatin1(exp.at(i))); + const QString expected(QString::fromLatin1(exp.at(i)).replace("<INSERT_QT_VERSION_HERE>", QT_VERSION_STR)); if (line.contains("ASSERT") && output != expected) QEXPECT_FAIL("assert", "QTestLib prints out the absolute path.", Continue); |