summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qurl.cpp73
-rw-r--r--src/corelib/io/qurl.h1
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp56
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp13
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h7
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h1
-rw-r--r--src/corelib/tools/qchar.cpp31
-rw-r--r--src/corelib/tools/qchar.h9
-rw-r--r--src/corelib/tools/qlocale.cpp12
-rw-r--r--src/corelib/tools/qlocale_p.h18
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp53
-rw-r--r--src/corelib/tools/qmap.h20
-rw-r--r--src/dbus/qdbusinternalfilters.cpp2
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h2
-rw-r--r--src/declarative/qml/qdeclarativebinding_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings_p.h4
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecontext.h2
-rw-r--r--src/declarative/qml/qdeclarativeguard_p.h2
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp2
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.h2
-rw-r--r--src/declarative/qml/qdeclarativestringconverters_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript_p.h2
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp6
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent_p.h2
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p.h2
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow_p.h2
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager_p_p.h2
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm20
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm32
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm16
-rw-r--r--src/gui/dialogs/qnspanelproxy_mac.mm24
-rw-r--r--src/gui/dialogs/qpagesetupdialog_mac.mm8
-rw-r--r--src/gui/dialogs/qprintdialog_mac.mm8
-rw-r--r--src/gui/dialogs/qwizard_win.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp7
-rw-r--r--src/gui/kernel/qapplication.cpp17
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qdnd_qws.cpp4
-rw-r--r--src/gui/kernel/qdnd_x11.cpp6
-rw-r--r--src/gui/kernel/qgesturemanager.cpp33
-rw-r--r--src/gui/kernel/qgesturemanager_p.h2
-rw-r--r--src/gui/kernel/qsound_mac.mm6
-rw-r--r--src/gui/kernel/qwidget.cpp3
-rw-r--r--src/gui/kernel/qwidget_mac.mm30
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwidget_wince.cpp2
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp46
-rw-r--r--src/gui/painting/qprintengine_pdf_p.h1
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp6
-rw-r--r--src/gui/styles/qgtkstyle.cpp45
-rw-r--r--src/gui/util/qcompleter.cpp21
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm37
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac.mm2
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac_p.h2
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp11
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp13
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h4
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp5
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp11
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp13
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp38
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp8
-rw-r--r--src/network/access/qnetworkrequest.cpp52
-rw-r--r--src/network/access/qnetworkrequest.h7
-rw-r--r--src/network/kernel/qhostinfo.cpp29
-rw-r--r--src/network/kernel/qhostinfo_p.h4
-rw-r--r--src/network/socket/qtcpserver.cpp18
-rw-r--r--src/network/socket/qtcpserver.h1
78 files changed, 728 insertions, 224 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 4e580dd..7b5bfed 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -5970,19 +5970,22 @@ bool QUrl::isDetached() const
/*!
- Returns a QUrl representation of \a localFile, interpreted as a
- local file.
+ Returns a QUrl representation of \a localFile, interpreted as a local
+ file. This function accepts paths separated by slashes as well as the
+ native separator for this platform.
- \sa toLocalFile()
+ This function also accepts paths with a doubled leading slash (or
+ backslash) to indicate a remote file, as in
+ "//servername/path/to/file.txt". Note that only certain platforms can
+ actually open this file using QFile::open().
+
+ \sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators
*/
QUrl QUrl::fromLocalFile(const QString &localFile)
{
QUrl url;
url.setScheme(QLatin1String("file"));
- QString deslashified = localFile;
- deslashified.replace(QLatin1Char('\\'), QLatin1Char('/'));
-
-
+ QString deslashified = QDir::toNativeSeparators(localFile);
// magic for drives on windows
if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {
@@ -6001,35 +6004,61 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
}
/*!
- Returns the path of this URL formatted as a local file path.
+ Returns the path of this URL formatted as a local file path. The path
+ returned will use forward slashes, even if it was originally created
+ from one with backslashes.
- \sa fromLocalFile()
+ If this URL contains a non-empty hostname, it will be encoded in the
+ returned value in the form found on SMB networks (for example,
+ "//servername/path/to/file.txt").
+
+ \sa fromLocalFile(), isLocalFile()
*/
QString QUrl::toLocalFile() const
{
- if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ // the call to isLocalFile() also ensures that we're parsed
+ if (!isLocalFile())
+ return QString();
QString tmp;
QString ourPath = path();
- if (d->scheme.isEmpty() || QString::compare(d->scheme, QLatin1String("file"), Qt::CaseInsensitive) == 0) {
- // magic for shared drive on windows
- if (!d->host.isEmpty()) {
- tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
- ? QLatin1Char('/') + ourPath : ourPath);
- } else {
- tmp = ourPath;
- // magic for drives on windows
- if (ourPath.length() > 2 && ourPath.at(0) == QLatin1Char('/') && ourPath.at(2) == QLatin1Char(':'))
- tmp.remove(0, 1);
- }
+ // magic for shared drive on windows
+ if (!d->host.isEmpty()) {
+ tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
+ ? QLatin1Char('/') + ourPath : ourPath);
+ } else {
+ tmp = ourPath;
+ // magic for drives on windows
+ if (ourPath.length() > 2 && ourPath.at(0) == QLatin1Char('/') && ourPath.at(2) == QLatin1Char(':'))
+ tmp.remove(0, 1);
}
return tmp;
}
/*!
+ \since 4.7
+ Returns true if this URL is pointing to a local file path. A URL is a
+ local file path if the scheme is "file".
+
+ Note that this function considers URLs with hostnames to be local file
+ paths, even if the eventual file path cannot be opened with
+ QFile::open().
+
+ \sa fromLocalFile(), toLocalFile()
+*/
+bool QUrl::isLocalFile() const
+{
+ if (!d) return false;
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+
+ if (d->scheme.compare(QLatin1String("file"), Qt::CaseInsensitive) != 0)
+ return false; // not file
+ return true;
+}
+
+/*!
Returns true if this URL is a parent of \a childUrl. \a childUrl is a child
of this URL if the two URLs share the same scheme and authority,
and this URL's path is a parent of the path of \a childUrl.
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 6f8331a..162aa7c 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -183,6 +183,7 @@ public:
static QUrl fromLocalFile(const QString &localfile);
QString toLocalFile() const;
+ bool isLocalFile() const;
QString toString(FormattingOptions options = None) const;
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index b0503be..3660a3c 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2530,6 +2530,62 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
condition is true, in which case you should abort your move
operation.
+ \table 80%
+ \row
+ \o \inlineimage modelview-move-rows-1.png Moving rows to another parent
+ \o Specify the first and last row numbers for the span of rows in
+ the source parent you want to move in the model. Also specify
+ the row in the destination parent to move the span to.
+
+ For example, as shown in the diagram, we move three rows from
+ row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4.
+ We move those items to above row 2 in the destination, so \a destinationRow is 2.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6
+
+ This moves the three rows rows 2, 3, and 4 in the source to become 2, 3 and 4 in
+ the destination. Other affected siblings are displaced accordingly.
+ \row
+ \o \inlineimage modelview-move-rows-2.png Moving rows to append to another parent
+ \o To append rows to another parent, move them to after the last row.
+
+ For example, as shown in the diagram, we move three rows to a
+ collection of 6 existing rows (ending in row 5), so \a destinationStart is 6:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7
+
+ This moves the target rows to the end of the target parent as 6, 7 and 8.
+ \row
+ \o \inlineimage modelview-move-rows-3.png Moving rows in the same parent up
+ \o To move rows within the same parent, specify the row to move them to.
+
+ For example, as shown in the diagram, we move one item from row 2 to row 0,
+ so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 0.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 8
+
+ Note that other rows may be displaced accordingly. Note also that when moving
+ items within the same parent you should not attempt invalid or no-op moves. In
+ the above example, item 2 is at row 2 before the move, so it can not be moved
+ to row 2 (where it is already) or row 3 (no-op as row 3 means above row 3, where
+ it is already)
+
+ \row
+ \o \inlineimage modelview-move-rows-4.png Moving rows in the same parent down
+ \o To move rows within the same parent, specify the row to move them to.
+
+ For example, as shown in the diagram, we move one item from row 2 to row 4,
+ so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 4.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 9
+
+ Note that other rows may be displaced accordingly.
+ \endtable
+
+ \note This function emits the rowsAboutToBeInserted() signal which
+ connected views (or proxies) must handle before the data is inserted.
+ Otherwise, the views may end up in an invalid state.
+
\sa endMoveRows()
\since 4.6
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 609e6b3..4e6e6b9 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -63,6 +63,7 @@
#include <qvarlengtharray.h>
#include <private/qfactoryloader_p.h>
#include <private/qfunctions_p.h>
+#include <private/qlocale_p.h>
#ifdef Q_OS_SYMBIAN
# include <exception>
@@ -521,6 +522,9 @@ QCoreApplication::QCoreApplication(int &argc, char **argv)
QFactoryLoader::refreshAll();
#endif
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ d_func()->symbianInit();
+#endif
}
// ### move to QCoreApplicationPrivate constructor?
@@ -597,6 +601,15 @@ void QCoreApplication::init()
qt_startup_hook();
}
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+void QCoreApplicationPrivate::symbianInit()
+{
+ if (!environmentChangeNotifier)
+ environmentChangeNotifier.reset(new QEnvironmentChangeNotifier);
+}
+#endif
+
+
/*!
Destroys the QCoreApplication object.
*/
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 77188d3..e066137 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE
typedef QList<QTranslator*> QTranslatorList;
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class QEnvironmentChangeNotifier;
+#endif
class QAbstractEventDispatcher;
class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate
@@ -113,6 +116,10 @@ public:
bool aboutToQuitEmitted;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ QScopedPointer<QEnvironmentChangeNotifier> environmentChangeNotifier;
+ void symbianInit();
+#endif
static bool isTranslatorInstalled(QTranslator *translator);
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index a6d486e..687a6d9 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -1105,3 +1105,5 @@ void CQtActiveScheduler::Error(TInt aError) const
}
QT_END_NAMESPACE
+
+#include "moc_qeventdispatcher_symbian_p.cpp"
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 05758ca..bc42753 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -221,6 +221,7 @@ public: // from CActiveScheduler
class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher
{
+ Q_OBJECT
Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
public:
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 67ea00d..2f09b0e 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -653,14 +653,41 @@ bool QChar::isSymbol() const
\fn bool QChar::isHighSurrogate() const
Returns true if the QChar is the high part of a utf16 surrogate
- (ie. if its code point is between 0xd800 and 0xdbff).
+ (ie. if its code point is between 0xd800 and 0xdbff, inclusive).
*/
/*!
\fn bool QChar::isLowSurrogate() const
Returns true if the QChar is the low part of a utf16 surrogate
- (ie. if its code point is between 0xdc00 and 0xdfff).
+ (ie. if its code point is between 0xdc00 and 0xdfff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::isHighSurrogate(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ is the high part of a utf16 surrogate
+ (ie. if its code point is between 0xd800 and 0xdbff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::isLowSurrogate(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ is the high part of a utf16 surrogate
+ (ie. if its code point is between 0xdc00 and 0xdfff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::requiresSurrogates(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ can be splited to the high and low parts of a utf16 surrogate
+ (ie. if its code point is greater than or equals to 0x10000).
*/
/*!
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 1432c7f..205f911 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -285,6 +285,15 @@ public:
inline void setCell(uchar cell);
inline void setRow(uchar row);
+ static inline bool isHighSurrogate(uint ucs4) {
+ return ((ucs4 & 0xfffffc00) == 0xd800);
+ }
+ static inline bool isLowSurrogate(uint ucs4) {
+ return ((ucs4 & 0xfffffc00) == 0xdc00);
+ }
+ static inline bool requiresSurrogates(uint ucs4) {
+ return (ucs4 >= 0x10000);
+ }
static inline uint surrogateToUcs4(ushort high, ushort low) {
return (uint(high)<<10) + low - 0x35fdc00;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index c3f6783..20c2e27 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -129,6 +129,11 @@ inline bool isascii(int c)
}
#endif
+#if defined(Q_OS_SYMBIAN)
+void qt_symbianUpdateSystemPrivate();
+void qt_symbianInitSystemLocale();
+#endif
+
/******************************************************************************
** Helpers for accessing Qt locale database
*/
@@ -1407,6 +1412,9 @@ static const QSystemLocale *systemLocale()
{
if (_systemLocale)
return _systemLocale;
+#if defined(Q_OS_SYMBIAN)
+ qt_symbianInitSystemLocale();
+#endif
return QSystemLocale_globalSystemLocale();
}
@@ -1417,6 +1425,10 @@ void QLocalePrivate::updateSystemPrivate()
system_lp = globalLocalePrivate();
*system_lp = *sys_locale->fallbackLocale().d();
+#if defined(Q_OS_SYMBIAN)
+ qt_symbianUpdateSystemPrivate();
+#endif
+
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull())
system_lp->m_language_id = res.toInt();
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index ecf79e9..6205745 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -58,6 +58,10 @@
#include "qlocale.h"
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class CEnvironmentChangeNotifier;
+#endif
+
QT_BEGIN_NAMESPACE
struct Q_CORE_EXPORT QLocalePrivate
@@ -201,6 +205,20 @@ inline char QLocalePrivate::digitToCLocale(const QChar &in) const
return 0;
}
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class QEnvironmentChangeNotifier
+{
+public:
+ QEnvironmentChangeNotifier();
+ ~QEnvironmentChangeNotifier();
+
+ static TInt localeChanged(TAny *data);
+
+private:
+ CEnvironmentChangeNotifier *iChangeNotifier;
+};
+#endif
+
QT_END_NAMESPACE
#endif // QLOCALE_P_H
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index 01f56cc..6e36dcd 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -46,8 +46,14 @@
#include <QThread>
#include <e32std.h>
+#include <e32const.h>
+#include <e32base.h>
+#include <e32property.h>
+#include <bacntf.h>
#include "private/qcore_symbian_p.h"
-
+#include "private/qcoreapplication_p.h"
+#include "private/qlocale_p.h"
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -771,13 +777,18 @@ static QLocale::MeasurementSystem symbianMeasurementSystem()
return QLocale::MetricSystem;
}
-QLocale QSystemLocale::fallbackLocale() const
+void qt_symbianUpdateSystemPrivate()
{
// load system data before query calls
+ _s60Locale.LoadSystemSettings();
+}
+
+void qt_symbianInitSystemLocale()
+{
static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0);
+ if (initDone == 2)
+ return;
if (initDone.testAndSetRelaxed(0, 1)) {
- _s60Locale.LoadSystemSettings();
-
// Initialize platform version dependent function pointers
ptrTimeFormatL = reinterpret_cast<FormatFunc>
(qt_resolveS60PluginFunc(S60Plugin_TimeFormatL));
@@ -801,7 +812,10 @@ QLocale QSystemLocale::fallbackLocale() const
}
while(initDone != 2)
QThread::yieldCurrentThread();
+}
+QLocale QSystemLocale::fallbackLocale() const
+{
TLanguage lang = User::Language();
QString locale = QLatin1String(qt_symbianLocaleName(lang));
return QLocale(locale);
@@ -884,4 +898,35 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return QVariant();
}
+#if !defined(QT_NO_SYSTEMLOCALE)
+QEnvironmentChangeNotifier::QEnvironmentChangeNotifier()
+{
+ // Create the change notifier and install the callback function
+ const TCallBack callback(&QEnvironmentChangeNotifier::localeChanged, this);
+ QT_TRAP_THROWING(iChangeNotifier = CEnvironmentChangeNotifier::NewL(CActive::EPriorityStandard, callback));
+ iChangeNotifier->Start();
+}
+
+TInt QEnvironmentChangeNotifier::localeChanged(TAny *data)
+{
+ QEnvironmentChangeNotifier *that = reinterpret_cast<QEnvironmentChangeNotifier *>(data);
+
+ TInt flag = that->iChangeNotifier->Change();
+ if (flag & EChangesLocale) {
+ static bool first = true;
+ if (!first) { // skip the first notification on app startup
+ QT_TRYCATCH_LEAVING(QLocalePrivate::updateSystemPrivate());
+ QT_TRYCATCH_LEAVING(QCoreApplication::postEvent(qApp, new QEvent(QEvent::LocaleChange)));
+ }
+ first = false;
+ }
+ return KErrNone;
+}
+
+QEnvironmentChangeNotifier::~QEnvironmentChangeNotifier()
+{
+ delete iChangeNotifier;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index df0ae46..5696ba6 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -125,6 +125,10 @@ template <class Key, class T>
struct QMapNode {
Key key;
T value;
+
+private:
+ // never access these members through this structure.
+ // see below
QMapData::Node *backward;
QMapData::Node *forward[1];
};
@@ -134,6 +138,22 @@ struct QMapPayloadNode
{
Key key;
T value;
+
+private:
+ // QMap::e is a pointer to QMapData::Node, which matches the member
+ // below. However, the memory allocation node in QMapData::node_create
+ // allocates sizeof(QMapPayloNode) and incorrectly calculates the offset
+ // of 'backward' below. If the alignment of QMapPayloadNode is larger
+ // than the alignment of a pointer, the 'backward' member is aligned to
+ // the end of this structure, not to 'value' above, and will occupy the
+ // tail-padding area.
+ //
+ // e.g., on a 32-bit archictecture with Key = int and
+ // sizeof(T) = alignof(T) = 8
+ // 0 4 8 12 16 20 24 byte
+ // | key | PAD | value |backward| PAD | correct layout
+ // | key | PAD | value | |backward| how it's actually used
+ // |<----- value of QMap::payload() = 20 ----->|
QMapData::Node *backward;
};
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 8fc219a..78abf94 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -87,7 +87,7 @@ static const char propertiesInterfaceXml[] =
" <method name=\"GetAll\">\n"
" <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n"
- " <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>"
+ " <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"
" </method>\n"
" </interface>\n";
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 9c25d82..463ac73 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -160,7 +160,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
// do we need to describe this argument?
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
xml += QString::fromLatin1(" <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
- .arg(typeNameToXml(mm.typeName()));
+ .arg(typeNameToXml(QVariant::typeToName(QVariant::Type(typeId))));
} else
continue;
}
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index c06879e..f5d061d 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -142,7 +142,7 @@ public:
void setSnapMode(SnapMode mode);
enum PositionMode { Beginning, Center, End, Visible, Contain };
- Q_ENUMS(PositionMode);
+ Q_ENUMS(PositionMode)
Q_INVOKABLE void positionViewAtIndex(int index, int mode);
Q_INVOKABLE int indexAt(int x, int y) const;
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 9c0b7dd..051455c 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -200,7 +200,7 @@ public:
static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *);
enum PositionMode { Beginning, Center, End, Visible, Contain };
- Q_ENUMS(PositionMode);
+ Q_ENUMS(PositionMode)
Q_INVOKABLE void positionViewAtIndex(int index, int mode);
Q_INVOKABLE int indexAt(int x, int y) const;
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
index 2d3acf5..598f09f 100644
--- a/src/declarative/qml/qdeclarativebinding_p.h
+++ b/src/declarative/qml/qdeclarativebinding_p.h
@@ -164,6 +164,6 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeBinding*);
+Q_DECLARE_METATYPE(QDeclarativeBinding*)
#endif // QDECLARATIVEBINDING_P_H
diff --git a/src/declarative/qml/qdeclarativecompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h
index a17bc84..d5c6a02 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings_p.h
+++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h
@@ -104,8 +104,8 @@ protected:
int qt_metacall(QMetaObject::Call, int, void **);
private:
- Q_DISABLE_COPY(QDeclarativeCompiledBindings);
- Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings);
+ Q_DISABLE_COPY(QDeclarativeCompiledBindings)
+ Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings)
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index 24e5386..8b95945 100644
--- a/src/declarative/qml/qdeclarativecomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -149,7 +149,7 @@ Q_SIGNALS:
void destruction();
private:
- friend class QDeclarativeContextData;;
+ friend class QDeclarativeContextData;
friend class QDeclarativeComponentPrivate;
};
diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h
index 548869c..d87123a 100644
--- a/src/declarative/qml/qdeclarativecontext.h
+++ b/src/declarative/qml/qdeclarativecontext.h
@@ -107,7 +107,7 @@ private:
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QList<QObject*>);
+Q_DECLARE_METATYPE(QList<QObject*>)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativeguard_p.h b/src/declarative/qml/qdeclarativeguard_p.h
index be60ce4..02fed0b 100644
--- a/src/declarative/qml/qdeclarativeguard_p.h
+++ b/src/declarative/qml/qdeclarativeguard_p.h
@@ -97,7 +97,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>);
+Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>)
#include "private/qdeclarativedata_p.h"
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index 888945b..26bddde 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -45,7 +45,7 @@
#include "private/qdeclarativebinding_p.h"
#include <QtCore/qdebug.h>
-Q_DECLARE_METATYPE(QScriptValue);
+Q_DECLARE_METATYPE(QScriptValue)
QT_BEGIN_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativescriptstring.h b/src/declarative/qml/qdeclarativescriptstring.h
index 43bef44..fc92a9b 100644
--- a/src/declarative/qml/qdeclarativescriptstring.h
+++ b/src/declarative/qml/qdeclarativescriptstring.h
@@ -79,7 +79,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeScriptString);
+Q_DECLARE_METATYPE(QDeclarativeScriptString)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativestringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h
index 7afdfd3..97f72fc 100644
--- a/src/declarative/qml/qdeclarativestringconverters_p.h
+++ b/src/declarative/qml/qdeclarativestringconverters_p.h
@@ -80,7 +80,7 @@ namespace QDeclarativeStringConverters
QSizeF Q_DECLARATIVE_EXPORT sizeFFromString(const QString &, bool *ok = 0);
QRectF Q_DECLARATIVE_EXPORT rectFFromString(const QString &, bool *ok = 0);
QVector3D Q_DECLARATIVE_EXPORT vector3DFromString(const QString &, bool *ok = 0);
-};
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h
index 6cce799..4019d13 100644
--- a/src/declarative/qml/qdeclarativeworkerscript_p.h
+++ b/src/declarative/qml/qdeclarativeworkerscript_p.h
@@ -119,7 +119,7 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeWorkerScript);
+QML_DECLARE_TYPE(QDeclarativeWorkerScript)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index b7e1832..e034165 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -318,9 +318,9 @@ public:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(Node);
-Q_DECLARE_METATYPE(NodeList);
-Q_DECLARE_METATYPE(NamedNodeMap);
+Q_DECLARE_METATYPE(Node)
+Q_DECLARE_METATYPE(NodeList)
+Q_DECLARE_METATYPE(NamedNodeMap)
QT_BEGIN_NAMESPACE
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
index 53d30c2..1622144 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
@@ -146,7 +146,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeListModelWorkerAgent::VariantRef);
+Q_DECLARE_METATYPE(QDeclarativeListModelWorkerAgent::VariantRef)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h
index 17aafa4..f45d19f 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation_p.h
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h
@@ -96,7 +96,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation);
+QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h
index d860052..6319192 100644
--- a/src/declarative/util/qdeclarativesmoothedfollow_p.h
+++ b/src/declarative/util/qdeclarativesmoothedfollow_p.h
@@ -106,7 +106,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeSmoothedFollow);
+QML_DECLARE_TYPE(QDeclarativeSmoothedFollow)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativetransitionmanager_p_p.h b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
index 4131391..2e23898 100644
--- a/src/declarative/util/qdeclarativetransitionmanager_p_p.h
+++ b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
@@ -70,7 +70,7 @@ public:
void cancel();
private:
- Q_DISABLE_COPY(QDeclarativeTransitionManager);
+ Q_DISABLE_COPY(QDeclarativeTransitionManager)
QDeclarativeTransitionManagerPrivate *d;
void complete();
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 8af0d2b..82cfa24 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -65,9 +65,9 @@ typedef float CGFloat; // Should only not be defined on 32-bit platforms
QT_USE_NAMESPACE
-@class QCocoaColorPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate);
-@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> {
+@interface QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) : NSObject<NSWindowDelegate> {
NSColorPanel *mColorPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -99,7 +99,7 @@ QT_USE_NAMESPACE
- (void)setResultSet:(BOOL)result;
@end
-@implementation QCocoaColorPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate)
- (id)initWithColorPanel:(NSColorPanel *)panel
stolenContentView:(NSView *)stolenContentView
okButton:(NSButton *)okButton
@@ -432,26 +432,26 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial,
[colorPanel setDefaultButtonCell:[okButton cell]];
}
- delegate = [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel
+ delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel
stolenContentView:stolenContentView
okButton:okButton
cancelButton:cancelButton
priv:this];
- [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
+ [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)];
}
[delegate setResultSet:false];
setCocoaPanelColor(initial);
- [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel];
}
void QColorDialogPrivate::closeCocoaColorPanel()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) onCancelClicked];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) onCancelClicked];
}
void QColorDialogPrivate::releaseCocoaColorPanelDelegate()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) release];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) release];
}
void QColorDialogPrivate::mac_nativeDialogModalHelp()
@@ -471,13 +471,13 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp()
void QColorDialogPrivate::_q_macRunNativeAppModalPanel()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) exec];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) exec];
}
void QColorDialogPrivate::setCocoaPanelColor(const QColor &color)
{
QMacCocoaAutoReleasePool pool;
- QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate);
NSColor *nsColor;
const QColor::Spec spec = color.spec();
if (spec == QColor::Cmyk) {
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 28acf24..b07b1ea 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -82,9 +82,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_USE_NAMESPACE
-@class QNSOpenSavePanelDelegate;
+@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
-@interface QNSOpenSavePanelDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject {
@public
NSOpenPanel *mOpenPanel;
NSSavePanel *mSavePanel;
@@ -123,7 +123,7 @@ QT_USE_NAMESPACE
@end
-@implementation QNSOpenSavePanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
- (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode
title:(const QString &)title
@@ -554,7 +554,7 @@ void QFileDialogPrivate::setDirectory_sys(const QString &directory)
}
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)];
#endif
}
@@ -565,7 +565,7 @@ QString QFileDialogPrivate::directory_sys() const
return mCurrentLocation;
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return qt_mac_NSStringToQString([delegate->mSavePanel directory]);
#endif
}
@@ -622,7 +622,7 @@ QStringList QFileDialogPrivate::selectedFiles_sys() const
}
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return [delegate selectedFiles];
#endif
}
@@ -633,7 +633,7 @@ void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters)
Q_UNUSED(filters);
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
bool hideDetails = q_func()->testOption(QFileDialog::HideNameFilterDetails);
[delegate setNameFilters:filters hideDetails:hideDetails];
#endif
@@ -645,7 +645,7 @@ void QFileDialogPrivate::setFilter_sys()
#else
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
*(delegate->mQDirFilter) = model->filter();
delegate->mFileMode = fileMode;
[delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())];
@@ -668,7 +668,7 @@ void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
NavCustomControl(mDialog, kNavCtlSelectCustomType, &navSpec);
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate->mPopUpButton selectItemAtIndex:index];
[delegate filterChanged:nil];
#endif
@@ -681,7 +681,7 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const
int index = filterInfo.currentSelection;
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
int index = [delegate->mPopUpButton indexOfSelectedItem];
#endif
return index != -1 ? nameFilters.at(index) : QString();
@@ -696,7 +696,7 @@ void QFileDialogPrivate::deleteNativeDialog_sys()
mDialogStarted = false;
#else
QMacCocoaAutoReleasePool pool;
- [reinterpret_cast<QNSOpenSavePanelDelegate *>(mDelegate) release];
+ [reinterpret_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate) release];
mDelegate = 0;
#endif
nativeDialogInUse = false;
@@ -1034,7 +1034,7 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate()
bool selectDir = q->selectedFiles().isEmpty();
QString selection(selectDir ? q->directory().absolutePath() : q->selectedFiles().value(0));
- QNSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegate alloc]
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc]
initWithAcceptMode:acceptMode
title:q->windowTitle()
nameFilters:q->nameFilters()
@@ -1055,7 +1055,7 @@ bool QFileDialogPrivate::showCocoaFilePanel()
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
createNSOpenSavePanelDelegate();
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
if (qt_mac_is_macsheet(q))
[delegate showWindowModalSheet:q->parentWidget()];
else
@@ -1071,7 +1071,7 @@ bool QFileDialogPrivate::hideCocoaFilePanel()
return false;
} else {
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate closePanel];
// Even when we hide it, we are still using a
// native dialog, so return true:
@@ -1104,7 +1104,7 @@ void QFileDialogPrivate::_q_macRunNativeAppModalPanel()
#else
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate runApplicationModalPanel];
dialogResultCode_sys() == QDialog::Accepted ? q->accept() : q->reject();
#endif
@@ -1119,7 +1119,7 @@ QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys()
else
return QDialog::Accepted;
#else
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return [delegate dialogResultCode];
#endif
}
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 919790b..bb8ef3f 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -82,7 +82,7 @@ const CGFloat DialogSideMargin = 9.0;
const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
-@class QCocoaFontPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate);
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
@@ -93,7 +93,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
#endif
-@interface QCocoaFontPanelDelegate : NSObject <NSWindowDelegate> {
+@interface QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) : NSObject <NSWindowDelegate> {
NSFontPanel *mFontPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -156,7 +156,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
return newFont;
}
-@implementation QCocoaFontPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate)
- (id)initWithFontPanel:(NSFontPanel *)panel
stolenContentView:(NSView *)stolenContentView
okButton:(NSButton *)okButton
@@ -478,7 +478,7 @@ QT_BEGIN_NAMESPACE
void QFontDialogPrivate::closeCocoaFontPanel()
{
QMacCocoaAutoReleasePool pool;
- QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
NSWindow *ourPanel = [theDelegate actualPanel];
[ourPanel close];
[theDelegate cleanUpAfterMyself];
@@ -519,7 +519,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
}
[mgr setSelectedFont:nsFont isMultiple:NO];
- [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font];
}
void QFontDialogPrivate::createNSFontPanelDelegate()
@@ -584,7 +584,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate()
}
// create the delegate and set it
- QCocoaFontPanelDelegate *del = [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel
stolenContentView:stolenContentView
okButton:okButton
cancelButton:cancelButton
@@ -637,7 +637,7 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp()
void QFontDialogPrivate::_q_macRunNativeAppModalPanel()
{
createNSFontPanelDelegate();
- QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
[del runApplicationModalPanel];
}
@@ -649,7 +649,7 @@ bool QFontDialogPrivate::showCocoaFontPanel()
Q_Q(QFontDialog);
QMacCocoaAutoReleasePool pool;
createNSFontPanelDelegate();
- QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
if (qt_mac_is_macsheet(q))
[del showWindowModalSheet:q->parentWidget()];
else
diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/gui/dialogs/qnspanelproxy_mac.mm
index 3229a4d..0bd5c63 100644
--- a/src/gui/dialogs/qnspanelproxy_mac.mm
+++ b/src/gui/dialogs/qnspanelproxy_mac.mm
@@ -52,9 +52,9 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@class QNSPanelProxy;
+@class QT_MANGLE_NAMESPACE(QNSPanelProxy);
-@interface QNSPanelProxy : NSWindow {
+@interface QT_MANGLE_NAMESPACE(QNSPanelProxy) : NSWindow {
}
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
@@ -66,7 +66,7 @@ QT_USE_NAMESPACE
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen;
@end
-@implementation QNSPanelProxy
+@implementation QT_MANGLE_NAMESPACE(QNSPanelProxy)
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
@@ -108,15 +108,15 @@ QT_USE_NAMESPACE
}
@end
-@class QNSWindowProxy;
+@class QT_MANGLE_NAMESPACE(QNSWindowProxy);
-@interface QNSWindowProxy : NSWindow {
+@interface QT_MANGLE_NAMESPACE(QNSWindowProxy) : NSWindow {
}
- (void)setTitle:(NSString *)title;
- (void)qt_fakeSetTitle:(NSString *)title;
@end
-@implementation QNSWindowProxy
+@implementation QT_MANGLE_NAMESPACE(QNSWindowProxy)
- (void)setTitle:(NSString *)title
{
QCFString cftitle(currentWindow->windowTitle());
@@ -190,10 +190,10 @@ void macStartInterceptNSPanelCtor()
{
macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
}
/*
@@ -203,10 +203,10 @@ void macStopInterceptNSPanelCtor()
{
macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
}
/*
@@ -217,7 +217,7 @@ void macStartInterceptWindowTitle(QWidget *window)
{
currentWindow = window;
macStartIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:),
- [NSWindow class], [QNSWindowProxy class]);
+ [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]);
}
/*
@@ -227,7 +227,7 @@ void macStopInterceptWindowTitle()
{
currentWindow = 0;
macStopIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:),
- [NSWindow class], [QNSWindowProxy class]);
+ [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]);
}
/*
diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm
index cfcde0f..0302be4 100644
--- a/src/gui/dialogs/qpagesetupdialog_mac.mm
+++ b/src/gui/dialogs/qpagesetupdialog_mac.mm
@@ -50,9 +50,9 @@
QT_USE_NAMESPACE
-@class QCocoaPageLayoutDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate);
-@interface QCocoaPageLayoutDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject {
QMacPrintEnginePrivate *pe;
}
- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine;
@@ -60,7 +60,7 @@ QT_USE_NAMESPACE
returnCode:(int)returnCode contextInfo:(void *)contextInfo;
@end
-@implementation QCocoaPageLayoutDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate)
- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine;
{
self = [super init];
@@ -213,7 +213,7 @@ void QPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality)
pageLayout = [NSPageLayout pageLayout];
// Keep a copy to this since we plan on using it for a bit.
[pageLayout retain];
- QCocoaPageLayoutDelegate *delegate = [[QCocoaPageLayoutDelegate alloc] initWithMacPrintEngine:ep];
+ QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithMacPrintEngine:ep];
if (modality == Qt::ApplicationModal) {
int rval = [pageLayout runModalWithPrintInfo:ep->printInfo];
diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm
index 6a8d6a4..84a72db 100644
--- a/src/gui/dialogs/qprintdialog_mac.mm
+++ b/src/gui/dialogs/qprintdialog_mac.mm
@@ -124,15 +124,15 @@ QT_USE_NAMESPACE
#ifdef QT_MAC_USE_COCOA
-@class QCocoaPrintPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate);
-@interface QCocoaPrintPanelDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject {
}
- (void)printPanelDidEnd:(NSPrintPanel *)printPanel
returnCode:(int)returnCode contextInfo:(void *)contextInfo;
@end
-@implementation QCocoaPrintPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate)
- (void)printPanelDidEnd:(NSPrintPanel *)printPanel
returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
@@ -313,7 +313,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality)
macStartInterceptWindowTitle(q);
printPanel = [NSPrintPanel printPanel];
- QCocoaPrintPanelDelegate *delegate = [[QCocoaPrintPanelDelegate alloc] init];
+ QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init];
[printPanel setOptions:macOptions];
if (modality == Qt::ApplicationModal) {
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 1390b21..e406cba 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -237,7 +237,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
*/
QVistaHelper::QVistaHelper(QWizard *wizard)
- : pressed(false)
+ : QObject(wizard)
+ , pressed(false)
, wizard(wizard)
, backButton_(0)
{
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 326f130..7fcf4d2 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1423,6 +1423,13 @@ QGraphicsItem::~QGraphicsItem()
d_ptr->inDestructor = 1;
d_ptr->removeExtraItemCache();
+ if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) {
+ QGraphicsObject *o = static_cast<QGraphicsObject *>(this);
+ QGestureManager *manager = QGestureManager::instance();
+ foreach (Qt::GestureType type, d_ptr->gestureContext.keys())
+ manager->cleanupCachedGestures(o, type);
+ }
+
clearFocus();
// Update focus scope item ptr.
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index ec635d4..7b62de1 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -788,6 +788,10 @@ void QApplicationPrivate::construct(
qt_gui_eval_init(application_type);
#endif
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ symbianInit();
+#endif
+
#ifndef QT_NO_LIBRARY
if(load_testability) {
QLibrary testLib(QLatin1String("qttestability"));
@@ -2364,6 +2368,19 @@ bool QApplication::event(QEvent *e)
if (!(w->windowType() == Qt::Desktop))
postEvent(w, new QEvent(QEvent::LanguageChange));
}
+#ifndef Q_OS_WIN
+ } else if (e->type() == QEvent::LocaleChange) {
+ // on Windows the event propagation is taken care by the
+ // WM_SETTINGCHANGE event handler.
+ QWidgetList list = topLevelWidgets();
+ for (int i = 0; i < list.size(); ++i) {
+ QWidget *w = list.at(i);
+ if (!(w->windowType() == Qt::Desktop)) {
+ if (!w->testAttribute(Qt::WA_SetLocale))
+ w->d_func()->setLocale_helper(QLocale(), true);
+ }
+ }
+#endif
} else if (e->type() == QEvent::Timer) {
QTimerEvent *te = static_cast<QTimerEvent*>(e);
Q_ASSERT(te != 0);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index fb2837e..50b9759 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1936,6 +1936,8 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
QLocalePrivate::updateSystemPrivate();
if (!widget->testAttribute(Qt::WA_SetLocale))
widget->dptr()->setLocale_helper(QLocale(), true);
+ QEvent e(QEvent::LocaleChange);
+ QApplication::sendEvent(qApp, &e);
}
}
else if (msg.wParam == SPI_SETICONTITLELOGFONT) {
diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp
index e47de00..7e5afc7 100644
--- a/src/gui/kernel/qdnd_qws.cpp
+++ b/src/gui/kernel/qdnd_qws.cpp
@@ -192,6 +192,10 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e)
return false;
switch(e->type()) {
+ case QEvent::ShortcutOverride:
+ // prevent accelerators from firing while dragging
+ e->accept();
+ return true;
case QEvent::KeyPress:
case QEvent::KeyRelease:
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 0a05d8e..2b12317 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1299,6 +1299,12 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e)
return true;
}
+ if (e->type() == QEvent::ShortcutOverride) {
+ // prevent accelerators from firing while dragging
+ e->accept();
+ return true;
+ }
+
if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) {
QKeyEvent *ke = ((QKeyEvent*)e);
if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index aa6720e..9495f40 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -132,20 +132,21 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
if (list.contains(recognizer)) {
m_deletedRecognizers.insert(g, recognizer);
- m_gestureToRecognizer.remove(g);
}
}
- foreach (QGestureRecognizer *recognizer, list) {
- QList<QGesture *> obsoleteGestures;
- QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
- while (iter != m_objectGestures.end()) {
- ObjectGesture objectGesture = iter.key();
- if (objectGesture.gesture == type)
- obsoleteGestures << iter.value();
- ++iter;
+ QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type) {
+ foreach (QGesture *g, iter.value()) {
+ if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)) {
+ m_gestureToRecognizer.remove(g);
+ m_obsoleteGestures[recognizer].insert(g);
+ }
+ }
}
- m_obsoleteGestures.insert(recognizer, obsoleteGestures);
+ ++iter;
}
}
@@ -155,7 +156,14 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
while (iter != m_objectGestures.end()) {
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type && target == objectGesture.object.data()) {
- qDeleteAll(iter.value());
+ QSet<QGesture *> gestures = iter.value().toSet();
+ for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
+ it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
+ it.value() -= gestures;
+ }
+ foreach (QGesture *g, gestures)
+ m_deletedRecognizers.remove(g);
+ qDeleteAll(gestures);
iter = m_objectGestures.erase(iter);
} else {
++iter;
@@ -177,6 +185,9 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
#ifndef QT_NO_GRAPHICSVIEW
} else {
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
+ QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
+ if (graphicsObject->QGraphicsItem::d_func()->inDestructor)
+ return 0;
#endif
}
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index a0ff83f..c105c9b 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -127,7 +127,7 @@ private:
int m_lastCustomGestureId;
- QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures;
+ QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures;
QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm
index 71fd663..2aff44d 100644
--- a/src/gui/kernel/qsound_mac.mm
+++ b/src/gui/kernel/qsound_mac.mm
@@ -88,14 +88,14 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@interface QMacSoundDelegate : NSObject<NSSoundDelegate> {
+@interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject<NSSoundDelegate> {
QSound *qSound; // may be null.
QAuServerMac* server;
}
-(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server;
@end
-@implementation QMacSoundDelegate
+@implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate)
-(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv {
self = [super init];
if(self) {
@@ -172,7 +172,7 @@ NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound)
{
NSString *nsFileName = const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(fileName)));
NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
- QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this];
+ QT_MANGLE_NAMESPACE(QMacSoundDelegate) * const delegate = [[QT_MANGLE_NAMESPACE(QMacSoundDelegate) alloc] initWithQSound:qSound:this];
[nsSound setDelegate:delegate];
[nsFileName release];
return nsSound;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 20d1d30..0334d47 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1388,6 +1388,9 @@ QWidget::~QWidget()
qWarning("QWidget: %s (%s) deleted while being painted", className(), name());
#endif
+ foreach (Qt::GestureType type, d->gestureContext.keys())
+ ungrabGesture(type);
+
// force acceptDrops false before winId is destroyed.
d->registerDropSite(false);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index e29b755..f12c956 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3824,9 +3824,35 @@ void QWidgetPrivate::raise_sys()
#if QT_MAC_USE_COCOA
QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
- // Calling orderFront shows the window on Cocoa too.
+ // With the introduction of spaces it is not as simple as just raising the window.
+ // First we need to check if we are in the right space. If we are, then we just continue
+ // as usual. The problem comes when we are not in the active space. There are two main cases:
+ // 1. Our parent was moved to a new space. In this case we want the window to be raised
+ // in the same space as its parent.
+ // 2. We don't have a parent. For this case we will just raise the window and let Cocoa
+ // switch to the corresponding space.
+ // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if
+ // required we will introduce special handling for some of them.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
- [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)];
+ OSWindowRef window = qt_mac_window_for(q);
+ // isOnActiveSpace is available only from 10.6 onwards, so we need to check if it is
+ // available before calling it.
+ if([window respondsToSelector:@selector(isOnActiveSpace)]) {
+ if(![window performSelector:@selector(isOnActiveSpace)]) {
+ QWidget *parentWidget = q->parentWidget();
+ if(parentWidget) {
+ OSWindowRef parentWindow = qt_mac_window_for(parentWidget);
+ if(parentWindow && [parentWindow isOnActiveSpace]) {
+ // The window was created in a different space. Therefore if we want
+ // to show it in the current space we need to recreate it in the new
+ // space.
+ recreateMacWindow();
+ window = qt_mac_window_for(q);
+ }
+ }
+ }
+ }
+ [window orderFront:window];
}
if (qt_mac_raise_process) { //we get to be the active process now
ProcessSerialNumber psn;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 7d647b7..4912291 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -512,8 +512,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
DestroyWindow(destroyw);
}
+#ifndef QT_NO_TABLETEVENT
if (q != qt_tablet_widget && QWidgetPrivate::mapper)
qt_tablet_init();
+#endif // QT_NO_TABLETEVENT
if (q->testAttribute(Qt::WA_DropSiteRegistered))
registerDropSite(true);
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index 509847b..e352f5c 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -358,8 +358,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
DestroyWindow(destroyw);
}
+#ifndef QT_NO_TABLETEVENT
if (q != qt_tablet_widget && QWidgetPrivate::mapper)
qt_tablet_init_wce();
+#endif // QT_NO_TABLETEVENT
if (q->testAttribute(Qt::WA_DropSiteRegistered))
registerDropSite(true);
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index b8bf15e..2955e39 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -931,29 +931,16 @@ void QPdfEnginePrivate::writeHeader()
void QPdfEnginePrivate::writeInfo()
{
info = addXrefEntry(-1);
-
- // The 'text string' type in PDF is encoded either as PDFDocEncoding, or
- // Unicode UTF-16 with a Unicode byte order mark as the first character
- // (0xfeff), with the high-order byte first.
- QByteArray array("<<\n/Title (\xfe\xff");
- const ushort *utf16Title = title.utf16();
- for (int i=0; i < title.size(); ++i) {
- array.append((*(utf16Title + i)) >> 8);
- array.append((*(utf16Title + i)) & 0xff);
- }
- array.append(")\n/Creator (\xfe\xff");
- const ushort *utf16Creator = creator.utf16();
- for (int i=0; i < creator.size(); ++i) {
- array.append((*(utf16Creator + i)) >> 8);
- array.append((*(utf16Creator + i)) & 0xff);
- }
- array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n");
- write(array);
-
+ xprintf("<<\n/Title ");
+ printString(title);
+ xprintf("\n/Creator ");
+ printString(creator);
+ xprintf("\n/Producer ");
+ printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies)"));
QDateTime now = QDateTime::currentDateTime().toUTC();
QTime t = now.time();
QDate d = now.date();
- xprintf("/CreationDate (D:%d%02d%02d%02d%02d%02d)\n",
+ xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n",
d.year(),
d.month(),
d.day(),
@@ -1230,6 +1217,25 @@ int QPdfEnginePrivate::addXrefEntry(int object, bool printostr)
return object;
}
+void QPdfEnginePrivate::printString(const QString &string) {
+ // The 'text string' type in PDF is encoded either as PDFDocEncoding, or
+ // Unicode UTF-16 with a Unicode byte order mark as the first character
+ // (0xfeff), with the high-order byte first.
+ QByteArray array("(\xfe\xff");
+ const ushort *utf16 = string.utf16();
+
+ for (int i=0; i < string.size(); ++i) {
+ char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)};
+ for(int j=0; j < 2; ++j) {
+ if (part[j] == '(' || part[j] == ')' || part[j] == '\\')
+ array.append('\\');
+ array.append(part[j]);
+ }
+ }
+ array.append(")");
+ write(array);
+}
+
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/gui/painting/qprintengine_pdf_p.h
index cb6c59d..e0ca56f 100644
--- a/src/gui/painting/qprintengine_pdf_p.h
+++ b/src/gui/painting/qprintengine_pdf_p.h
@@ -170,6 +170,7 @@ private:
void writePage();
int addXrefEntry(int object, bool printostr = true);
+ void printString(const QString &string);
void xprintf(const char* fmt, ...);
inline void write(const QByteArray &data) {
stream->writeRawData(data.constData(), data.size());
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 0f39b23..d9f7df0 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1397,7 +1397,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
dark.lighter(135), 60);
QColor highlight = option->palette.highlight().color();
- QColor highlightText = option->palette.highlightedText().color();
switch(element) {
case CE_RadioButton: //fall through
@@ -2723,7 +2722,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
{
// Fill title bar gradient
QColor titlebarColor = QColor(active ? highlight: palette.background().color());
- QColor titleBarGradientStop(active ? highlight.darker(150): palette.background().color().darker(120));
QLinearGradient gradient(option->rect.center().x(), option->rect.top(),
option->rect.center().x(), option->rect.bottom());
@@ -2986,7 +2984,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->fillRect(option->rect, option->palette.background());
- QRect rect = scrollBar->rect;
QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
@@ -3714,6 +3711,9 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option
{
int ret = -1;
switch (metric) {
+ case PM_ToolTipLabelFrameWidth:
+ ret = 2;
+ break;
case PM_ButtonDefaultIndicator:
ret = 0;
break;
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 9c61023..6c8d561 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1163,7 +1163,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
QRect tabRect = tbb->rect;
- QRegion region(tabRect);
painter->save();
painter->setPen(QPen(option->palette.dark().color().dark(110), 0));
switch (tbb->shape) {
@@ -1245,8 +1244,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else
alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline);
- QPalette palette = option->palette;
-
switch (control) {
case CC_TitleBar:
@@ -1333,11 +1330,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
bool isEnabled = (comboBox->state & State_Enabled);
bool focus = isEnabled && (comboBox->state & State_HasFocus);
- QColor buttonShadow = option->palette.dark().color();
GtkStateType state = gtkPainter.gtkState(option);
int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
- QPixmap cache;
- QString pixmapName;
QStyleOptionComboBox comboBoxCopy = *comboBox;
comboBoxCopy.rect = option->rect;
@@ -1345,8 +1339,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect rect = option->rect;
QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxArrow, widget);
- QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
- SC_ComboBoxEditField, widget);
GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
GTK_SHADOW_IN : GTK_SHADOW_OUT;
@@ -1414,9 +1406,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else if (option->state & State_MouseOver && comboBox->activeSubControls & SC_ComboBoxArrow)
buttonState = GTK_STATE_PRELIGHT;
- QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y,
- gtkToggleButton->allocation.width, gtkToggleButton->allocation.height);
-
Q_ASSERT(gtkToggleButton);
gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
shadow, gtkToggleButton->style, buttonPath.toString() +
@@ -1436,8 +1425,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
- : QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
// Draw the separator between label and arrows
QHashableLatin1Literal vSeparatorPath = comboBox->editable
@@ -1643,6 +1630,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
style = scrollbarWidget->style;
gboolean trough_under_steppers = true;
gboolean trough_side_details = false;
+ gboolean activate_slider = false;
gboolean stepper_size = 14;
gint trough_border = 1;
if (!d->gtk_check_version(2, 10, 0)) {
@@ -1650,6 +1638,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
"trough-border", &trough_border,
"trough-side-details", &trough_side_details,
"trough-under-steppers", &trough_under_steppers,
+ "activate-slider", &activate_slider,
"stepper-size", &stepper_size, NULL);
}
if (trough_under_steppers) {
@@ -1695,6 +1684,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (!(option->state & State_Enabled))
state = GTK_STATE_INSENSITIVE;
+ else if (activate_slider &&
+ option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider))
+ state = GTK_STATE_ACTIVE;
else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider))
state = GTK_STATE_PRELIGHT;
@@ -1932,14 +1924,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
- QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight);
- QPixmap cache;
QBrush oldBrush = painter->brush();
QPen oldPen = painter->pen();
@@ -1948,6 +1937,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QColor highlightAlpha(Qt::white);
highlightAlpha.setAlpha(80);
+ QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
+ GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
style = scaleWidget->style;
@@ -1981,11 +1972,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect lowerGroove = grooveRect;
if (horizontal) {
- upperGroove.setLeft(handle.center().x());
- lowerGroove.setRight(handle.center().x());
+ if (slider->upsideDown) {
+ lowerGroove.setLeft(handle.center().x());
+ upperGroove.setRight(handle.center().x());
+ } else {
+ upperGroove.setLeft(handle.center().x());
+ lowerGroove.setRight(handle.center().x());
+ }
} else {
- upperGroove.setBottom(handle.center().y());
- lowerGroove.setTop(handle.center().y());
+ if (!slider->upsideDown) {
+ lowerGroove.setBottom(handle.center().y());
+ upperGroove.setTop(handle.center().y());
+ } else {
+ upperGroove.setBottom(handle.center().y());
+ lowerGroove.setTop(handle.center().y());
+ }
}
gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state,
@@ -2543,7 +2544,6 @@ void QGtkStyle::drawControl(ControlElement element,
d->gtkWidget("GtkMenu.GtkMenuItem");
style = gtkPainter.getStyle(gtkMenuItem);
- QColor borderColor = option->palette.background().color().darker(160);
QColor shadow = option->palette.dark().color();
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
@@ -2768,8 +2768,6 @@ void QGtkStyle::drawControl(ControlElement element,
// Arrow
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
- QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
QFontMetrics fm(menuitem->font);
int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
@@ -3116,7 +3114,6 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
case CC_ComboBox:
if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
// We employ the gtk widget to position arrows and separators for us
- QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox");
GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry")
: d->gtkWidget("GtkComboBox");
d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 8e7ec80..05fe744 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -873,7 +873,7 @@ void QCompleterPrivate::showPopup(const QRect& rect)
const QRect screen = QApplication::desktop()->availableGeometry(widget);
Qt::LayoutDirection dir = widget->layoutDirection();
QPoint pos;
- int rw, rh, w;
+ int rh, w;
int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3;
QScrollBar *hsb = popup->horizontalScrollBar();
if (hsb && hsb->isVisible())
@@ -881,21 +881,30 @@ void QCompleterPrivate::showPopup(const QRect& rect)
if (rect.isValid()) {
rh = rect.height();
- w = rw = rect.width();
+ w = rect.width();
pos = widget->mapToGlobal(dir == Qt::RightToLeft ? rect.bottomRight() : rect.bottomLeft());
} else {
rh = widget->height();
- rw = widget->width();
pos = widget->mapToGlobal(QPoint(0, widget->height() - 2));
w = widget->width();
}
- if ((pos.x() + rw) > (screen.x() + screen.width()))
+ if (w > screen.width())
+ w = screen.width();
+ if ((pos.x() + w) > (screen.x() + screen.width()))
pos.setX(screen.x() + screen.width() - w);
if (pos.x() < screen.x())
pos.setX(screen.x());
- if (((pos.y() + rh) > (screen.y() + screen.height())) && ((pos.y() - h - rh) >= 0))
- pos.setY(pos.y() - qMax(h, popup->minimumHeight()) - rh + 2);
+
+ int top = pos.y() - rh - screen.top() + 2;
+ int bottom = screen.bottom() - pos.y();
+ h = qMax(h, popup->minimumHeight());
+ if (h > bottom) {
+ h = qMin(qMax(top, bottom), h);
+
+ if (top > bottom)
+ pos.setY(pos.y() - h - rh + 2);
+ }
popup->setGeometry(pos.x(), pos.y(), w, h);
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index d943c8c..8aaaa0f 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -75,8 +75,6 @@
#define QT_MAC_SYSTEMTRAY_USE_GROWL
-@class QNSMenu;
-
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qsystemtrayicon_p.h>
#include <qtemporaryfile.h>
@@ -98,13 +96,14 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@class QNSImageView;
+@class QT_MANGLE_NAMESPACE(QNSMenu);
+@class QT_MANGLE_NAMESPACE(QNSImageView);
-@interface QNSStatusItem : NSObject {
+@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject {
NSStatusItem *item;
QSystemTrayIcon *icon;
QSystemTrayIconPrivate *iconPrivate;
- QNSImageView *imageCell;
+ QT_MANGLE_NAMESPACE(QNSImageView) *imageCell;
}
-(id)initWithIcon:(QSystemTrayIcon*)icon iconPrivate:(QSystemTrayIconPrivate *)iprivate;
-(void)dealloc;
@@ -115,11 +114,11 @@ QT_USE_NAMESPACE
- (void)doubleClickSelector:(id)sender;
@end
-@interface QNSImageView : NSImageView {
+@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
BOOL down;
- QNSStatusItem *parent;
+ QT_MANGLE_NAMESPACE(QNSStatusItem) *parent;
}
--(id)initWithParent:(QNSStatusItem*)myParent;
+-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent;
-(QSystemTrayIcon*)icon;
-(void)menuTrackingDone:(NSNotification*)notification;
-(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton;
@@ -134,7 +133,7 @@ QT_USE_NAMESPACE
#endif
-@interface QNSMenu : NSMenu <NSMenuDelegate> {
+@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> {
QMenu *qmenu;
}
-(QMenu*)menu;
@@ -148,14 +147,14 @@ class QSystemTrayIconSys
public:
QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d) {
QMacCocoaAutoReleasePool pool;
- item = [[QNSStatusItem alloc] initWithIcon:icon iconPrivate:d];
+ item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d];
}
~QSystemTrayIconSys() {
QMacCocoaAutoReleasePool pool;
[[[item item] view] setHidden: YES];
[item release];
}
- QNSStatusItem *item;
+ QT_MANGLE_NAMESPACE(QNSStatusItem) *item;
};
void QSystemTrayIconPrivate::install_sys()
@@ -299,8 +298,8 @@ QT_END_NAMESPACE
@implementation NSStatusItem (Qt)
@end
-@implementation QNSImageView
--(id)initWithParent:(QNSStatusItem*)myParent {
+@implementation QT_MANGLE_NAMESPACE(QNSImageView)
+-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent {
self = [super init];
parent = myParent;
down = NO;
@@ -400,7 +399,7 @@ QT_END_NAMESPACE
}
@end
-@implementation QNSStatusItem
+@implementation QT_MANGLE_NAMESPACE(QNSStatusItem)
-(id)initWithIcon:(QSystemTrayIcon*)i iconPrivate:(QSystemTrayIconPrivate *)iPrivate
{
@@ -409,7 +408,7 @@ QT_END_NAMESPACE
icon = i;
iconPrivate = iPrivate;
item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
- imageCell = [[QNSImageView alloc] initWithParent:self];
+ imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self];
[item setView: imageCell];
}
return self;
@@ -453,7 +452,7 @@ QT_END_NAMESPACE
[[[self item] view] removeAllToolTips];
iconPrivate->updateToolTip_sys();
#endif
- NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()];
+ NSMenu *m = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:icon->contextMenu()];
[m setAutoenablesItems: NO];
[[NSNotificationCenter defaultCenter] addObserver:imageCell
selector:@selector(menuTrackingDone:)
@@ -481,7 +480,7 @@ private:
QSystemTrayIconQMenu();
};
-@implementation QNSMenu
+@implementation QT_MANGLE_NAMESPACE(QNSMenu)
-(id)initWithQMenu:(QMenu*)qm {
self = [super init];
if(self) {
@@ -494,7 +493,7 @@ private:
return qmenu;
}
-(void)menuNeedsUpdate:(NSMenu*)nsmenu {
- QNSMenu *menu = static_cast<QNSMenu *>(nsmenu);
+ QT_MANGLE_NAMESPACE(QNSMenu) *menu = static_cast<QT_MANGLE_NAMESPACE(QNSMenu) *>(nsmenu);
emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow();
for(int i = [menu numberOfItems]-1; i >= 0; --i)
[menu removeItemAtIndex:i];
@@ -539,7 +538,7 @@ private:
[nsimage release];
}
if(action->menu()) {
- QNSMenu *sub = [[QNSMenu alloc] initWithQMenu:action->menu()];
+ QT_MANGLE_NAMESPACE(QNSMenu) *sub = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:action->menu()];
[item setSubmenu:sub];
} else {
[item setAction:@selector(selectedAction:)];
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
index b2a0e0c..e68ee7c 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
@@ -58,7 +58,7 @@ QT_FORWARD_DECLARE_CLASS(QMainWindowLayout);
QT_FORWARD_DECLARE_CLASS(QToolBar);
QT_FORWARD_DECLARE_CLASS(QCFString);
-@implementation QCocoaToolBarDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate)
- (id)initWithMainWindowLayout:(QMainWindowLayout *)layout
{
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
index 8e3d06f..b4af54f 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
@@ -61,7 +61,7 @@ QT_END_NAMESPACE
@class NSToolbarItem;
-@interface QCocoaToolBarDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) : NSObject {
QT_PREPEND_NAMESPACE(QMainWindowLayout) *mainWindowLayout;
NSToolbarItem *toolbarItem;
}
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 9527057..b8cef93 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -410,7 +410,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
macToolbar = [[NSToolbar alloc] initWithIdentifier:(NSString *)kQMainWindowMacToolbarID];
[macToolbar setDisplayMode:NSToolbarDisplayModeIconOnly];
[macToolbar setSizeMode:NSToolbarSizeModeRegular];
- [macToolbar setDelegate:[[QCocoaToolBarDelegate alloc] initWithMainWindowLayout:this]];
+ [macToolbar setDelegate:[[QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) alloc] initWithMainWindowLayout:this]];
[window setToolbar:macToolbar];
[macToolbar release];
}
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 559124f..31c64f0 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -343,9 +343,16 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
copyCredentials(i, auth, isProxy);
QMetaObject::invokeMethod(q, "_q_restartAuthPendingRequests", Qt::QueuedConnection);
}
+ } else if (priv->phase == QAuthenticatorPrivate::Start) {
+ // If the url's authenticator has a 'user' set we will end up here (phase is only set to 'Done' by
+ // parseHttpResponse above if 'user' is empty). So if credentials were supplied with the request,
+ // such as in the case of an XMLHttpRequest, this is our only opportunity to cache them.
+ emit q->cacheCredentials(reply->request(), auth, q);
}
- // changing values in QAuthenticator will reset the 'phase'
- if (priv->phase == QAuthenticatorPrivate::Done) {
+ // - Changing values in QAuthenticator will reset the 'phase'.
+ // - If withCredentials has been set to false (e.g. by QtWebKit for a cross-origin XMLHttpRequest) then
+ // we need to bail out if authentication is required.
+ if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
// authentication is cancelled, send the current contents to the user.
emit channels[i].reply->headerChanged();
emit channels[i].reply->readyRead();
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index b5bd300..51666d6 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -133,6 +133,8 @@ Q_SIGNALS:
#endif
void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *authenticator,
const QHttpNetworkConnection *connection = 0);
+ void cacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *authenticator,
+ const QHttpNetworkConnection *connection = 0);
void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString());
private:
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 3b7bc9e..d24eb1f 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -173,7 +173,7 @@ bool QHttpNetworkConnectionChannel::sendRequest()
pendingEncrypt = false;
// if the url contains authentication parameters, use the new ones
// both channels will use the new authentication parameters
- if (!request.url().userInfo().isEmpty()) {
+ if (!request.url().userInfo().isEmpty() && request.withCredentials()) {
QUrl url = request.url();
QAuthenticator &auth = authenticator;
if (url.userName() != auth.user()
@@ -187,7 +187,10 @@ bool QHttpNetworkConnectionChannel::sendRequest()
url.setUserInfo(QString());
request.setUrl(url);
}
- connection->d_func()->createAuthorization(socket, request);
+ // Will only be false if QtWebKit is performing a cross-origin XMLHttpRequest
+ // and withCredentials has not been set to true.
+ if (request.withCredentials())
+ connection->d_func()->createAuthorization(socket, request);
#ifndef QT_NO_NETWORKPROXY
QByteArray header = QHttpNetworkRequestPrivate::header(request,
(connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy));
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 9eb2399..639025e 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false)
+ autoDecompress(false), pipeliningAllowed(false), withCredentials(true)
{
}
@@ -62,6 +62,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
autoDecompress = other.autoDecompress;
pipeliningAllowed = other.pipeliningAllowed;
customVerb = other.customVerb;
+ withCredentials = other.withCredentials;
}
QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate()
@@ -274,6 +275,16 @@ void QHttpNetworkRequest::setPipeliningAllowed(bool b)
d->pipeliningAllowed = b;
}
+bool QHttpNetworkRequest::withCredentials() const
+{
+ return d->withCredentials;
+}
+
+void QHttpNetworkRequest::setWithCredentials(bool b)
+{
+ d->withCredentials = b;
+}
+
void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd)
{
d->uploadByteDevice = bd;
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index 1b35a84..15cab73 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -113,6 +113,9 @@ public:
bool isPipeliningAllowed() const;
void setPipeliningAllowed(bool b);
+ bool withCredentials() const;
+ void setWithCredentials(bool b);
+
void setUploadByteDevice(QNonContiguousByteDevice *bd);
QNonContiguousByteDevice* uploadByteDevice() const;
@@ -142,6 +145,7 @@ public:
mutable QNonContiguousByteDevice* uploadByteDevice;
bool autoDecompress;
bool pipeliningAllowed;
+ bool withCredentials;
};
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index f188bd5..2a02c99 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -327,6 +327,11 @@ void QNetworkAccessBackend::authenticationRequired(QAuthenticator *authenticator
manager->authenticationRequired(this, authenticator);
}
+void QNetworkAccessBackend::cacheCredentials(QAuthenticator *authenticator)
+{
+ manager->addCredentials(this->reply->url, authenticator);
+}
+
void QNetworkAccessBackend::metaDataChanged()
{
reply->metaDataChanged();
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 4ce37a6..4fe6de6 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -188,6 +188,7 @@ protected slots:
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth);
#endif
void authenticationRequired(QAuthenticator *auth);
+ void cacheCredentials(QAuthenticator *auth);
void metaDataChanged();
void redirectionRequested(const QUrl &destination);
void sslErrors(const QList<QSslError> &errors);
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp
index 4560153..710c258 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -65,10 +65,15 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op,
}
QUrl url = request.url();
- if (url.scheme() == QLatin1String("qrc") || !url.toLocalFile().isEmpty())
+ if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0 || url.isLocalFile()) {
return new QNetworkAccessFileBackend;
- else if (!url.isEmpty() && url.authority().isEmpty()) {
- // check if QFile could, in theory, open this URL
+ } else if (!url.scheme().isEmpty() && url.authority().isEmpty()) {
+ // check if QFile could, in theory, open this URL via the file engines
+ // it has to be in the format:
+ // prefix:path/to/file
+ // or prefix:/path/to/file
+ //
+ // this construct here must match the one below in open()
QFileInfo fi(url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery));
if (fi.exists() || (op == QNetworkAccessManager::PutOperation && fi.dir().exists()))
return new QNetworkAccessFileBackend;
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index 1a59011..da336d0 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -77,7 +77,7 @@ QNetworkAccessFtpBackendFactory::create(QNetworkAccessManager::Operation op,
}
QUrl url = request.url();
- if (url.scheme() == QLatin1String("ftp"))
+ if (url.scheme().compare(QLatin1String("ftp"), Qt::CaseInsensitive) == 0)
return new QNetworkAccessFtpBackend;
return 0;
}
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 3154ed6..a6c5c02 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -346,6 +346,8 @@ void QNetworkAccessHttpBackend::setupConnection()
#endif
connect(http, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)),
SLOT(httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)));
+ connect(http, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)),
+ SLOT(httpCacheCredentials(QHttpNetworkRequest,QAuthenticator*)));
connect(http, SIGNAL(error(QNetworkReply::NetworkError,QString)),
SLOT(httpError(QNetworkReply::NetworkError,QString)));
#ifndef QT_NO_OPENSSL
@@ -578,6 +580,11 @@ void QNetworkAccessHttpBackend::postRequest()
if (request().attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true)
httpRequest.setPipeliningAllowed(true);
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request().attribute(QNetworkRequest::AuthenticationReuseAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
+ httpRequest.setWithCredentials(false);
+
httpReply = http->sendRequest(httpRequest);
httpReply->setParent(this);
#ifndef QT_NO_OPENSSL
@@ -861,6 +868,12 @@ void QNetworkAccessHttpBackend::httpAuthenticationRequired(const QHttpNetworkReq
authenticationRequired(auth);
}
+void QNetworkAccessHttpBackend::httpCacheCredentials(const QHttpNetworkRequest &,
+ QAuthenticator *auth)
+{
+ cacheCredentials(auth);
+}
+
void QNetworkAccessHttpBackend::httpError(QNetworkReply::NetworkError errorCode,
const QString &errorString)
{
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index e5cc0ab..254907f 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -107,6 +107,7 @@ private slots:
void replyFinished();
void replyHeaderChanged();
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth);
+ void httpCacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *auth);
void httpError(QNetworkReply::NetworkError error, const QString &errorString);
bool sendCacheContents(const QNetworkCacheMetaData &metaData);
void finished(); // override
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index feb9d99..10fdc6f 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -907,21 +907,20 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
{
Q_D(QNetworkAccessManager);
+ bool isLocalFile = req.url().isLocalFile();
+
// fast path for GET on file:// URLs
- // Also if the scheme is empty we consider it a file.
// The QNetworkAccessFileBackend will right now only be used
// for PUT or qrc://
if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation)
- && (req.url().scheme() == QLatin1String("file")
- || req.url().scheme().isEmpty())) {
+ && isLocalFile) {
return new QFileNetworkReply(this, req, op);
}
#ifndef QT_NO_BEARERMANAGEMENT
// Return a disabled network reply if network access is disabled.
// Except if the scheme is empty or file://.
- if (!d->networkAccessible && !(req.url().scheme() == QLatin1String("file") ||
- req.url().scheme().isEmpty())) {
+ if (!d->networkAccessible && !isLocalFile) {
return new QDisabledNetworkReply(this, req, op);
}
@@ -948,17 +947,22 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// but the data that is outgoing is random-access
request.setHeader(QNetworkRequest::ContentLengthHeader, outgoingData->size());
}
- if (d->cookieJar) {
- QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
- if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::CookieLoadControlAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) {
+ if (d->cookieJar) {
+ QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
+ if (!cookies.isEmpty())
+ request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+ }
}
// first step: create the reply
QUrl url = request.url();
QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
#ifndef QT_NO_BEARERMANAGEMENT
- if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) {
+ if (!isLocalFile) {
connect(this, SIGNAL(networkSessionConnected()),
reply, SLOT(_q_networkSessionConnected()));
}
@@ -967,11 +971,15 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
priv->manager = this;
// second step: fetch cached credentials
- QNetworkAuthenticationCredential *cred = d->fetchCachedCredentials(url);
- if (cred) {
- url.setUserName(cred->user);
- url.setPassword(cred->password);
- priv->urlForLastAuthentication = url;
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::AuthenticationReuseAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) {
+ QNetworkAuthenticationCredential *cred = d->fetchCachedCredentials(url);
+ if (cred) {
+ url.setUserName(cred->user);
+ url.setPassword(cred->password);
+ priv->urlForLastAuthentication = url;
+ }
}
// third step: find a backend
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 128d18f..31ee2a4 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -673,8 +673,12 @@ void QNetworkReplyImplPrivate::error(QNetworkReplyImpl::NetworkError code, const
void QNetworkReplyImplPrivate::metaDataChanged()
{
Q_Q(QNetworkReplyImpl);
- // do we have cookies?
- if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader) && !manager.isNull()) {
+ // 1. do we have cookies?
+ // 2. are we allowed to set them?
+ if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader) && !manager.isNull()
+ && (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::CookieSaveControlAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic)) {
QList<QNetworkCookie> cookies =
qvariant_cast<QList<QNetworkCookie> >(cookedHeaders.value(QNetworkRequest::SetCookieHeader));
QNetworkCookieJar *jar = manager->cookieJar();
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 61c116d..911eadc 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -190,6 +190,46 @@ QT_BEGIN_NAMESPACE
of other verbs than GET, POST, PUT and DELETE). This verb is set
when calling QNetworkAccessManager::sendCustomRequest().
+ \value CookieLoadControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to send 'Cookie' headers in the request.
+
+ This attribute is set to false by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
+ \value CookieSaveControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to save 'Cookie' headers received from the server in reply
+ to the request.
+
+ This attribute is set to false by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
+ \value AuthenticationReuseControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to use cached authorization credentials in the request,
+ if available. If this is set to QNetworkRequest::Manual and the authentication
+ mechanism is 'Basic' or 'Digest', Qt will not send an an 'Authorization' HTTP
+ header with any cached credentials it may have for the request's URL.
+
+ This attribute is set to QNetworkRequest::Manual by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
@@ -222,6 +262,18 @@ QT_BEGIN_NAMESPACE
if the item was not cached (i.e., off-line mode)
*/
+/*!
+ \enum QNetworkRequest::LoadControl
+ \since 4.7
+
+ Indicates if an aspect of the request's loading mechanism has been
+ manually overridden, e.g. by QtWebKit.
+
+ \value Automatic default value: indicates default behaviour.
+
+ \value Manual indicates behaviour has been manually overridden.
+*/
+
class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate
{
public:
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index a0ef1a6..d2945c4 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -79,6 +79,9 @@ public:
HttpPipeliningAllowedAttribute,
HttpPipeliningWasUsedAttribute,
CustomVerbAttribute,
+ CookieLoadControlAttribute,
+ AuthenticationReuseAttribute,
+ CookieSaveControlAttribute,
User = 1000,
UserMax = 32767
@@ -89,6 +92,10 @@ public:
PreferCache,
AlwaysCache
};
+ enum LoadControl {
+ Automatic = 0,
+ Manual
+ };
enum Priority {
HighPriority = 1,
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index f287630..28a6c84 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -471,6 +471,18 @@ void QHostInfoRunnable::run()
hostInfo.setLookupId(id);
resultEmitter.emitResultsReady(hostInfo);
+ // now also iterate through the postponed ones
+ QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups);
+ while (iterator.hasNext()) {
+ QHostInfoRunnable* postponed = iterator.next();
+ if (toBeLookedUp == postponed->toBeLookedUp) {
+ // we can now emit
+ iterator.remove();
+ hostInfo.setLookupId(postponed->id);
+ postponed->resultEmitter.emitResultsReady(hostInfo);
+ }
+ }
+
manager->lookupFinished(this);
// thread goes back to QThreadPool
@@ -596,6 +608,23 @@ void QHostInfoLookupManager::abortLookup(int id)
return;
QMutexLocker locker(&this->mutex);
+
+ // is postponed? delete and return
+ for (int i = 0; i < postponedLookups.length(); i++) {
+ if (postponedLookups.at(i)->id == id) {
+ delete postponedLookups.takeAt(i);
+ return;
+ }
+ }
+
+ // is scheduled? delete and return
+ for (int i = 0; i < scheduledLookups.length(); i++) {
+ if (scheduledLookups.at(i)->id == id) {
+ delete scheduledLookups.takeAt(i);
+ return;
+ }
+ }
+
if (!abortedLookups.contains(id))
abortedLookups.append(id);
}
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index e11766b..85d14c2 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -84,7 +84,7 @@ public Q_SLOTS:
}
Q_SIGNALS:
- void resultsReady(const QHostInfo info);
+ void resultsReady(const QHostInfo &info);
};
// needs to be QObject because fromName calls tr()
@@ -173,6 +173,8 @@ public:
bool wasAborted(int id);
QHostInfoCache cache;
+
+ friend class QHostInfoRunnable;
protected:
QList<QHostInfoRunnable*> currentLookups; // in progress
QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 932126d..55f926d 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -562,7 +562,7 @@ QTcpSocket *QTcpServer::nextPendingConnection()
to the other thread and create the QTcpSocket object there and
use its setSocketDescriptor() method.
- \sa newConnection(), nextPendingConnection()
+ \sa newConnection(), nextPendingConnection(), addPendingConnection()
*/
void QTcpServer::incomingConnection(int socketDescriptor)
{
@@ -572,6 +572,22 @@ void QTcpServer::incomingConnection(int socketDescriptor)
QTcpSocket *socket = new QTcpSocket(this);
socket->setSocketDescriptor(socketDescriptor);
+ addPendingConnection(socket);
+}
+
+/*!
+ This function is called by QTcpServer::incomingConnection()
+ to add a socket to the list of pending incoming connections.
+
+ \note Don't forget to call this member from reimplemented
+ incomingConnection() if you do not want to break the
+ Pending Connections mechanism.
+
+ \sa incomingConnection()
+ \since 4.7
+*/
+void QTcpServer::addPendingConnection(QTcpSocket* socket)
+{
d_func()->pendingConnections.append(socket);
}
diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h
index 7aebffe..b206678 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -93,6 +93,7 @@ public:
protected:
virtual void incomingConnection(int handle);
+ void addPendingConnection(QTcpSocket* socket);
Q_SIGNALS:
void newConnection();