summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/phonon/mediasource.cpp2
-rw-r--r--src/3rdparty/sqlite.pri4
-rw-r--r--src/corelib/global/qnamespace.qdoc5
-rw-r--r--src/corelib/io/qiodevice_p.h2
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp16
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp60
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp10
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/dialogs/qwizard_win.cpp42
-rw-r--r--src/gui/dialogs/qwizard_win_p.h21
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp71
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qapplication.h3
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm38
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qgesture.cpp29
-rw-r--r--src/gui/kernel/qgesture.h3
-rw-r--r--src/gui/kernel/qgesture_p.h1
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qstandardgestures.cpp7
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm7
-rw-r--r--src/gui/text/qtextcursor.cpp6
-rw-r--r--src/gui/text/qtextoption.cpp7
-rw-r--r--src/gui/text/qtexttable.cpp28
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp9
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp8
-rw-r--r--src/network/access/qnetworkrequest.cpp8
-rw-r--r--src/network/access/qnetworkrequest.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp408
-rw-r--r--src/network/kernel/qauthenticator.h5
-rw-r--r--src/network/kernel/qauthenticator_p.h6
-rw-r--r--src/network/socket/qtcpserver.cpp2
-rw-r--r--src/network/ssl/qsslsocket.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp89
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/qgl.cpp14
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro10
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.pro14
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.pro23
-rw-r--r--src/plugins/sqldrivers/oci/oci.pro13
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro19
-rw-r--r--src/plugins/sqldrivers/psql/psql.pro18
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro17
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.pro9
-rw-r--r--src/plugins/sqldrivers/tds/tds.pro15
-rw-r--r--src/script/api/qscriptvalue.cpp6
-rw-r--r--src/sql/drivers/db2/qsql_db2.pri8
-rw-r--r--src/sql/drivers/drivers.pri130
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.pri11
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.pri16
-rw-r--r--src/sql/drivers/oci/qsql_oci.pri9
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.pri13
-rw-r--r--src/sql/drivers/psql/qsql_psql.pri13
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.pri9
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.pri4
-rw-r--r--src/sql/drivers/tds/qsql_tds.pri10
65 files changed, 903 insertions, 424 deletions
diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp
index be22dc3..11d2428 100644
--- a/src/3rdparty/phonon/phonon/mediasource.cpp
+++ b/src/3rdparty/phonon/phonon/mediasource.cpp
@@ -50,7 +50,7 @@ MediaSource::MediaSource(const QString &filename)
const QFileInfo fileInfo(filename);
if (fileInfo.exists()) {
bool localFs = QAbstractFileEngine::LocalDiskFlag & QFSFileEngine(filename).fileFlags(QAbstractFileEngine::LocalDiskFlag);
- if (localFs) {
+ if (localFs && !filename.startsWith(QLatin1String(":/")) && !filename.startsWith(QLatin1String("qrc://"))) {
d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
} else {
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri
new file mode 100644
index 0000000..575412d
--- /dev/null
+++ b/src/3rdparty/sqlite.pri
@@ -0,0 +1,4 @@
+CONFIG(release, debug|release):DEFINES *= NDEBUG
+DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
+INCLUDEPATH += $$PWD/sqlite
+SOURCES += $$PWD/sqlite/sqlite3.c
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ed2ae6e..5cd7f0e 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -470,6 +470,7 @@
\value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces
\value TextJustificationForced Ensures that text lines are justified.
+ \omitvalue TextBypassShaping
\omitvalue BreakAnywhere
\omitvalue DontClip
\omitvalue DontPrint
@@ -1730,7 +1731,7 @@
\value Key_MediaLast
\value Key_unknown
- \value Key_Call A key to answer or initiate a call (see \l Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Call A key to answer or initiate a call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
\value Key_Camera A key to activate the camera shutter
\value Key_CameraFocus A key to focus the camera
\value Key_Context1
@@ -1738,7 +1739,7 @@
\value Key_Context3
\value Key_Context4
\value Key_Flip
- \value Key_Hangup A key to end an ongoing call (see \l Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Hangup A key to end an ongoing call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
\value Key_No
\value Key_Select
\value Key_Yes
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 4a25562..1dd51ea 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -155,10 +155,10 @@ public:
if ((first - buf) < size) {
// underflow, the existing valid data needs to move to the end of the (potentially bigger) buffer
makeSpace(len + size, freeSpaceAtStart);
- memcpy(first - size, block, size);
}
first -= size;
len += size;
+ memcpy(first, block, size);
}
private:
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 9bc4063..739ac4d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1399,10 +1399,10 @@ QString QProcess::nativeArguments() const
\since 4.7
\overload
- Sets additional native command line arguments for the program.
+ Sets additional native command line \a arguments for the program.
On operating systems where the system API for passing command line
- arguments to a subprocess natively uses a single string, one can
+ \a arguments to a subprocess natively uses a single string, one can
conceive command lines which cannot be passed via QProcess's portable
list-based API. In such cases this function must be used to set a
string which is \e appended to the string composed from the usual
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 8415259..e3fce18 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
\l{QAbstractItemModel::}{endInsertRows()} must be called.
\sa {Model Classes}, {Model Subclassing Reference}, QModelIndex,
- QAbstractItemView, {Using Drag and Drop with Item Views},
+ QAbstractItemView, {Using drag & drop with item views},
{Simple DOM Model Example}, {Simple Tree Model Example},
{Editable Tree Model Example}, {Fetch More Example}
*/
@@ -1761,7 +1761,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
where to place the data. This can occur in a tree when data is dropped on
a parent. Models will usually append the data to the parent in this case.
- \sa supportedDropActions(), {Using Drag and Drop with Item Views}
+ \sa supportedDropActions(), {Using drag & drop with item views}
*/
bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
@@ -1798,8 +1798,8 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
reimplement the dropMimeData() function to handle the additional
operations.
- \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item
- Views}
+ \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item
+ views}
*/
Qt::DropActions QAbstractItemModel::supportedDropActions() const
{
@@ -1815,7 +1815,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const
supportedDragActions() is used by QAbstractItemView::startDrag() as the
default values when a drag occurs.
- \sa Qt::DropActions, {Using Drag and Drop with Item Views}
+ \sa Qt::DropActions, {Using drag & drop with item views}
*/
Qt::DropActions QAbstractItemModel::supportedDragActions() const
{
@@ -1831,7 +1831,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const
Sets the supported drag \a actions for the items in the model.
- \sa supportedDragActions(), {Using Drag and Drop with Item Views}
+ \sa supportedDragActions(), {Using drag & drop with item views}
*/
void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
{
@@ -2547,7 +2547,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
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.
+ We move those items to above row 2 in the destination, so \a destinationChild is 2.
\snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6
@@ -2558,7 +2558,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
\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:
+ collection of 6 existing rows (ending in row 5), so \a destinationChild is 6:
\snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 57f79a0..b2cf49b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -6954,7 +6954,7 @@ bool QString::isRightToLeft() const
/*! \fn bool QString::isRightToLeft() const
- \internal
+ Returns true if the string is read right to left.
*/
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index ddaeb05..b9498f1 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1388,26 +1388,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
*/
/*!
- \property QDeclarativeItem::baseline
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::focus
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::wantsFocus
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::transformOrigin
- \internal
-*/
-
-/*!
\fn void QDeclarativeItem::childrenRectChanged(const QRectF &)
\internal
*/
@@ -1970,6 +1950,9 @@ QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const
return v;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
@@ -1980,6 +1963,9 @@ void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event)
d->doneEventPreHandler = true;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
@@ -1990,6 +1976,9 @@ void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event)
d->doneEventPreHandler = true;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event)
{
Q_D(QDeclarativeItem);
@@ -2000,7 +1989,6 @@ void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event)
d->doneEventPreHandler = true;
}
-
/*!
\internal
*/
@@ -2543,11 +2531,6 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi
\sa {qmlstates}{States}
*/
-/*!
- \property QDeclarativeItem::state
- \internal
-*/
-
/*! \internal */
QString QDeclarativeItemPrivate::state() const
{
@@ -2570,11 +2553,6 @@ void QDeclarativeItemPrivate::setState(const QString &state)
For more information see \l Transform.
*/
-/*!
- \property QDeclarativeItem::transform
- \internal
-*/
-
/*! \internal */
QDeclarativeListProperty<QGraphicsTransform> QDeclarativeItem::transform()
{
@@ -2863,6 +2841,26 @@ void QDeclarativeItem::setSmooth(bool smooth)
}
/*!
+ \property QDeclarativeItem::focus
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::transform
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::transformOrigin
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::wantsFocus
+ \internal
+*/
+
+/*!
\internal
Return the width of the item
*/
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index e745ca6..cc7f8e5 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -118,9 +118,9 @@ void QDeclarativeLoaderPrivate::initResize()
be instantiated may be specified directly by the \l sourceComponent
property, or loaded from a URL via the \l source property.
- Loader can be used to delay the creation of a component until it is required.
- For example, this loads "Page1.qml" as a component into the Loader element
- when the \l MouseArea is clicked:
+ Loader can be used to delay the creation of a component until it
+ is required. For example, this loads "Page1.qml" as a component
+ into the Loader element, when the \l MouseArea is clicked:
\code
import Qt 4.7
@@ -165,7 +165,6 @@ void QDeclarativeLoaderPrivate::initResize()
/*!
\internal
\class QDeclarativeLoader
- \qmlclass Loader
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index f3eef23..d13e139 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -202,8 +202,9 @@ QString QDeclarativeTextEdit::text() const
Sets the font size in pixels.
- Using this function makes the font device dependent.
- Use \l font.pointSize to set the size of the font in a device independent manner.
+ Using this function makes the font device dependent. Use
+ \l{TextEdit::font.pointSize} to set the size of the font in a
+ device independent manner.
*/
/*!
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 97ef99c..f2eb770 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -125,7 +125,7 @@ QT_BEGIN_NAMESPACE
QObject. See the QObject documentation for further details.
*/
/*!
- \qmlproperty string QtObject::objectName
+ \qmlproperty string QML:QtObject::objectName
This property allows you to give a name to this specific object instance.
See \l{scripting.html#accessing-child-qobjects}{Accessing Child QObjects}
@@ -237,8 +237,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
}
/*!
-\qmlmethod url Qt::resolvedUrl(url)
-Returns \c url resolved relative to the URL of the caller.
+ \qmlmethod url Qt::resolvedUrl(url)
+ Returns \c url resolved relative to the URL of the caller.
*/
QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url)
{
@@ -1090,8 +1090,6 @@ If you are certain the files will be local, you could simplify to:
To create a QML object from an arbitrary string of QML (instead of a file),
use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
-
-\sa {Dynamic Object Management}
*/
QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine)
@@ -1139,8 +1137,6 @@ Each object in this array has the members \c lineNumber, \c columnNumber, \c fil
Note that this function returns immediately, and therefore may not work if
the \a qml string loads new components (that is, external QML files that have not yet been loaded).
If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead.
-
-\sa {Dynamic Object Management}
*/
QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine)
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 9895ff2..9f4df22 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -596,7 +596,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
with a combined value of all key roles that is not already present in
the model.
- \sa {demos/declarative/rssnews}{RSS News demo}
+ \sa {RSS News}
*/
QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index e406cba..ad8801a 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -180,7 +180,8 @@ QVistaBackButton::QVistaBackButton(QWidget *widget)
QSize QVistaBackButton::sizeHint() const
{
ensurePolished();
- int width = 32, height = 32;
+ int size = int(QStyleHelper::dpiScaled(32));
+ int width = size, height = size;
/*
HANDLE theme = pOpenThemeData(0, L"Navigation");
SIZE size;
@@ -213,8 +214,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
HANDLE theme = pOpenThemeData(0, L"Navigation");
//RECT rect;
RECT clipRect;
- int xoffset = QWidget::mapToParent(r.topLeft()).x();
- int yoffset = QWidget::mapToParent(r.topLeft()).y();
+ int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1;
+ int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1;
clipRect.top = r.top() + yoffset;
clipRect.bottom = r.bottom() + yoffset;
@@ -245,6 +246,11 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
is_vista = resolveSymbols();
if (is_vista)
backButton_ = new QVistaBackButton(wizard);
+
+ // Handle diff between Windows 7 and Vista
+ iconSpacing = QStyleHelper::dpiScaled(7);
+ textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
+ iconSpacing : QStyleHelper::dpiScaled(20);
}
QVistaHelper::~QVistaHelper()
@@ -308,18 +314,15 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
void QVistaHelper::drawTitleBar(QPainter *painter)
{
- if (vistaState() == VistaAero)
- drawBlackRect(
- QRect(0, 0, wizard->width(), titleBarSize() + topOffset()),
- painter->paintEngine()->getDC());
+ HDC hdc = painter->paintEngine()->getDC();
+ if (vistaState() == VistaAero)
+ drawBlackRect(QRect(0, 0, wizard->width(),
+ titleBarSize() + topOffset()), hdc);
Q_ASSERT(backButton_);
const int btnTop = backButton_->mapToParent(QPoint()).y();
const int btnHeight = backButton_->size().height();
- const int verticalCenter = (btnTop + btnHeight / 2);
-
- wizard->windowIcon().paint(
- painter, QRect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()));
+ const int verticalCenter = (btnTop + btnHeight / 2) - 1;
const QString text = wizard->window()->windowTitle();
const QFont font = QApplication::font("QWorkspaceTitleBar");
@@ -327,14 +330,25 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
const QRect brect = fontMetrics.boundingRect(text);
int textHeight = brect.height();
int textWidth = brect.width();
+ int glowOffset = 0;
+
if (vistaState() == VistaAero) {
textHeight += 2 * glowSize();
textWidth += 2 * glowSize();
+ glowOffset = glowSize();
}
+
drawTitleText(
painter, text,
- QRect(titleOffset(), verticalCenter - textHeight / 2, textWidth, textHeight),
- painter->paintEngine()->getDC());
+ QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
+ hdc);
+
+ if (!wizard->windowIcon().isNull()) {
+ QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
+ HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON();
+ DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
+ DestroyIcon(hIcon);
+ }
}
void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
@@ -734,7 +748,7 @@ bool QVistaHelper::resolveSymbols()
int QVistaHelper::titleOffset()
{
- int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + padding();
+ int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
return leftMargin() + iconOffset;
}
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index 5f3b6c2..caf018d 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -61,6 +61,7 @@
#include <qwidget.h>
#include <qabstractbutton.h>
#include <QtGui/private/qwidget_p.h>
+#include <QtGui/private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
@@ -100,9 +101,14 @@ public:
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
static int titleBarSize() { return frameSize() + captionSize(); }
- static int topPadding() { return 8; }
- static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); }
-
+ static int topPadding() { // padding under text
+ return int(QStyleHelper::dpiScaled(
+ QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
+ }
+ static int topOffset() {
+ static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
+ QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
+ return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
private:
static HFONT getCaptionFont(HANDLE hTheme);
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
@@ -111,11 +117,10 @@ private:
static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
- static int backButtonSize() { return 31; } // ### should be queried from back button itself
+ static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
static int iconSize() { return 16; } // Standard Aero
- static int padding() { return 7; } // Standard Aero
- static int leftMargin() { return backButtonSize() + padding(); }
static int glowSize() { return 10; }
+ int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
int titleOffset();
bool resolveSymbols();
@@ -139,6 +144,10 @@ private:
QRect rtTitle;
QWizard *wizard;
QVistaBackButton *backButton_;
+
+ int titleBarOffset; // Extra spacing above the text
+ int iconSpacing; // Space between button and icon
+ int textSpacing; // Space between icon and text
};
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index fe2a84e..bf36d9b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -133,7 +133,8 @@
\img graphicsview-parentchild.png
- \section1 Transformation
+ \target Transformations
+ \section1 Transformations
QGraphicsItem supports projective transformations in addition to its base
position, pos(). There are several ways to change an item's transformation.
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4fb93fc..97499f3 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1363,7 +1363,7 @@ bool QAbstractItemView::dragEnabled() const
Note that the model used needs to provide support for drag and drop operations.
- \sa setDragDropMode() {Using Drag and Drop with Item Views}
+ \sa setDragDropMode() {Using drag & drop with item views}
*/
/*!
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 5dbd1f0..4748f89 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -100,69 +100,80 @@ public:
QIcon getMacIcon(const QFileInfo &fi) const;
#endif
QFileIconProvider *q_ptr;
- QString homePath;
+ const QString homePath;
private:
- QIcon file;
- QIcon fileLink;
- QIcon directory;
- QIcon directoryLink;
- QIcon harddisk;
- QIcon floppy;
- QIcon cdrom;
- QIcon ram;
- QIcon network;
- QIcon computer;
- QIcon desktop;
- QIcon trashcan;
- QIcon generic;
- QIcon home;
+ mutable QIcon file;
+ mutable QIcon fileLink;
+ mutable QIcon directory;
+ mutable QIcon directoryLink;
+ mutable QIcon harddisk;
+ mutable QIcon floppy;
+ mutable QIcon cdrom;
+ mutable QIcon ram;
+ mutable QIcon network;
+ mutable QIcon computer;
+ mutable QIcon desktop;
+ mutable QIcon trashcan;
+ mutable QIcon generic;
+ mutable QIcon home;
};
-QFileIconProviderPrivate::QFileIconProviderPrivate()
+QFileIconProviderPrivate::QFileIconProviderPrivate() :
+ homePath(QDir::home().absolutePath())
{
- QStyle *style = QApplication::style();
- file = style->standardIcon(QStyle::SP_FileIcon);
- directory = style->standardIcon(QStyle::SP_DirIcon);
- fileLink = style->standardIcon(QStyle::SP_FileLinkIcon);
- directoryLink = style->standardIcon(QStyle::SP_DirLinkIcon);
- harddisk = style->standardIcon(QStyle::SP_DriveHDIcon);
- floppy = style->standardIcon(QStyle::SP_DriveFDIcon);
- cdrom = style->standardIcon(QStyle::SP_DriveCDIcon);
- network = style->standardIcon(QStyle::SP_DriveNetIcon);
- computer = style->standardIcon(QStyle::SP_ComputerIcon);
- desktop = style->standardIcon(QStyle::SP_DesktopIcon);
- trashcan = style->standardIcon(QStyle::SP_TrashIcon);
- home = style->standardIcon(QStyle::SP_DirHomeIcon);
- homePath = QDir::home().absolutePath();
}
QIcon QFileIconProviderPrivate::getIcon(QStyle::StandardPixmap name) const
{
switch (name) {
case QStyle::SP_FileIcon:
+ if (file.isNull())
+ file = QApplication::style()->standardIcon(name);
return file;
case QStyle::SP_FileLinkIcon:
+ if (fileLink.isNull())
+ fileLink = QApplication::style()->standardIcon(name);
return fileLink;
case QStyle::SP_DirIcon:
+ if (directory.isNull())
+ directory = QApplication::style()->standardIcon(name);
return directory;
case QStyle::SP_DirLinkIcon:
+ if (directoryLink.isNull())
+ directoryLink = QApplication::style()->standardIcon(name);
return directoryLink;
case QStyle::SP_DriveHDIcon:
+ if (harddisk.isNull())
+ harddisk = QApplication::style()->standardIcon(name);
return harddisk;
case QStyle::SP_DriveFDIcon:
+ if (floppy.isNull())
+ floppy = QApplication::style()->standardIcon(name);
return floppy;
case QStyle::SP_DriveCDIcon:
+ if (cdrom.isNull())
+ cdrom = QApplication::style()->standardIcon(name);
return cdrom;
case QStyle::SP_DriveNetIcon:
+ if (network.isNull())
+ network = QApplication::style()->standardIcon(name);
return network;
case QStyle::SP_ComputerIcon:
+ if (computer.isNull())
+ computer = QApplication::style()->standardIcon(name);
return computer;
case QStyle::SP_DesktopIcon:
+ if (desktop.isNull())
+ desktop = QApplication::style()->standardIcon(name);
return desktop;
case QStyle::SP_TrashIcon:
+ if (trashcan.isNull())
+ trashcan = QApplication::style()->standardIcon(name);
return trashcan;
case QStyle::SP_DirHomeIcon:
+ if (home.isNull())
+ home = QApplication::style()->standardIcon(name);
return home;
default:
return QIcon();
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 94211fd..aaf479f 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5294,6 +5294,7 @@ bool QApplication::keypadNavigationEnabled()
\sa QCoreApplication::instance()
*/
+#ifndef QT_NO_IM
// ************************************************************************
// Input Method support
// ************************************************************************
@@ -5359,6 +5360,7 @@ QInputContext *QApplication::inputContext() const
#endif
return d->inputContext;
}
+#endif // QT_NO_IM
//Returns the current platform used by keyBindings
uint QApplicationPrivate::currentPlatform(){
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index d31d9e5..799d4c2 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -267,8 +267,11 @@ public:
virtual void commitData(QSessionManager& sm);
virtual void saveState(QSessionManager& sm);
#endif
+
+#ifndef QT_NO_IM
void setInputContext(QInputContext *);
QInputContext *inputContext() const;
+#endif
static QLocale keyboardInputLocale();
static Qt::LayoutDirection keyboardInputDirection();
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 8652816..6795149 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -85,6 +85,8 @@ QT_END_NAMESPACE
- (BOOL)canBecomeKeyWindow
{
QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
+ if (!widget)
+ return NO; // This should happen only for qt_root_win
bool isToolTip = (widget->windowType() == Qt::ToolTip);
bool isPopup = (widget->windowType() == Qt::Popup);
@@ -94,6 +96,8 @@ QT_END_NAMESPACE
- (BOOL)canBecomeMainWindow
{
QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
+ if (!widget)
+ return NO; // This should happen only for qt_root_win
bool isToolTip = (widget->windowType() == Qt::ToolTip);
bool isPopup = (widget->windowType() == Qt::Popup);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 5c90e2e..1935531 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -269,6 +269,28 @@ static int qCocoaViewCount = 0;
dropData = new QCocoaDropData(dropPasteboard);
}
+- (void)changeDraggingCursor:(NSDragOperation)newOperation
+{
+ static SEL action = nil;
+ static bool operationSupported = false;
+ if (action == nil) {
+ action = NSSelectorFromString(@"operationNotAllowedCursor");
+ if ([NSCursor respondsToSelector:action]) {
+ operationSupported = true;
+ }
+ }
+ if (operationSupported) {
+ NSCursor *notAllowedCursor = [NSCursor performSelector:action];
+ bool isNotAllowedCursor = ([NSCursor currentCursor] == notAllowedCursor);
+ if (newOperation == NSDragOperationNone && !isNotAllowedCursor) {
+ [notAllowedCursor push];
+ } else if (newOperation != NSDragOperationNone && isNotAllowedCursor) {
+ [notAllowedCursor pop];
+ }
+
+ }
+}
+
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
// NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
@@ -300,6 +322,7 @@ static int qCocoaViewCount = 0;
if (!qDEEvent.isAccepted()) {
// widget is not interested in this drag, so ignore this drop data.
[self removeDropData];
+ [self changeDraggingCursor:NSDragOperationNone];
return NSDragOperationNone;
} else {
// save the mouse position, used by draggingExited handler.
@@ -321,6 +344,7 @@ static int qCocoaViewCount = 0;
nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
}
QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent);
+ [self changeDraggingCursor:nsActions];
return nsActions;
}
}
@@ -335,16 +359,21 @@ static int qCocoaViewCount = 0;
if (dragEnterSequence != [sender draggingSequenceNumber])
[self draggingEntered:sender];
// drag enter event was rejected, so ignore the move event.
- if (dropData == 0)
+ if (dropData == 0) {
+ [self changeDraggingCursor:NSDragOperationNone];
return NSDragOperationNone;
+ }
// return last value, if we are still in the answerRect.
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
NSDragOperation nsActions = [sender draggingSourceOperationMask];
QPoint posDrag(localPoint.x, localPoint.y);
if (qt_mac_mouse_inside_answer_rect(posDrag)
- && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions)
- return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction));
+ && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) {
+ NSDragOperation operation = QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction));
+ [self changeDraggingCursor:operation];
+ return operation;
+ }
// send drag move event to the widget
QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions);
@@ -373,6 +402,7 @@ static int qCocoaViewCount = 0;
qDMEvent.setDropAction(Qt::IgnoreAction);
}
qt_mac_copy_answer_rect(qDMEvent);
+ [self changeDraggingCursor:operation];
return operation;
}
@@ -388,6 +418,8 @@ static int qCocoaViewCount = 0;
QApplication::sendEvent(qwidget, &de);
[self removeDropData];
}
+ [self changeDraggingCursor:NSDragOperationEvery];
+
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index 33aaa24..b6b63ca 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -106,6 +106,7 @@ Q_GUI_EXPORT
- (void) qt_clearQWidget;
- (BOOL)qt_leftButtonIsRightButton;
- (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped;
+- (void)changeDraggingCursor:(NSDragOperation)newOperation;
+ (DnDParams*)currentMouseEvent;
@end
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index f5688f4..6359ecf 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -41,6 +41,7 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
+#include "private/qstandardgestures_p.h"
#ifndef QT_NO_GESTURES
@@ -726,6 +727,34 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
d_func()->position = value;
}
+/*!
+ Set the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if \a msecs
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+void QTapAndHoldGesture::setTimeout(int msecs)
+{
+ QTapAndHoldGesturePrivate::Timeout = msecs;
+}
+
+/*!
+ Gets the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if timeout()
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+int QTapAndHoldGesture::timeout()
+{
+ return QTapAndHoldGesturePrivate::Timeout;
+}
+
+int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
+
QT_END_NAMESPACE
#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 8c10895..8f410b1 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -252,6 +252,9 @@ public:
QPointF position() const;
void setPosition(const QPointF &pos);
+ static void setTimeout(int msecs);
+ static int timeout();
+
friend class QTapAndHoldGestureRecognizer;
};
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index f5474c1..29b923e 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -177,6 +177,7 @@ public:
QPointF position;
int timerId;
+ static int Timeout;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index e43a560..fe9dd8a 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -71,7 +71,7 @@
QT_BEGIN_NAMESPACE
QGestureManager::QGestureManager(QObject *parent)
- : QObject(parent), state(NotGesture), m_lastCustomGestureId(0)
+ : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture)
{
qRegisterMetaType<Qt::GestureState>();
@@ -119,7 +119,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
if (type == Qt::CustomGesture) {
// generate a new custom gesture id
++m_lastCustomGestureId;
- type = Qt::GestureType(Qt::CustomGesture + m_lastCustomGestureId);
+ type = Qt::GestureType(m_lastCustomGestureId);
}
m_recognizers.insertMulti(type, recognizer);
delete dummy;
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 62d8a53..e05f8cc 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -517,7 +517,6 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
- enum { TimerInterval = 2000 };
enum { TapRadius = 40 };
switch (event->type()) {
@@ -526,21 +525,21 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::MouseButtonPress:
d->position = me->globalPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::TouchBegin:
d->position = ev->touchPoints().at(0).startScreenPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::GraphicsSceneMouseRelease:
case QEvent::MouseButtonRelease:
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 233df15..fed8d0a 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -338,8 +338,10 @@ QInputContext *QWidgetPrivate::inputContext() const
#ifndef QT_NO_IM
if (ic)
return ic;
-#endif
return qApp->inputContext();
+#else
+ return 0;
+#endif
}
/*!
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index e57ec77..c788711 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4389,6 +4389,13 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
data.window_state = data.window_state & ~Qt::WindowMaximized;
const bool visible = q->isVisible();
+ // Apply size restrictions, applicable for Windows & Widgets.
+ if (QWExtra *extra = extraData()) {
+ w = qMin(w, extra->maxw);
+ h = qMin(h, extra->maxh);
+ w = qMax(w, extra->minw);
+ h = qMax(h, extra->minh);
+ }
data.crect = QRect(x, y, w, h);
if (realWindow) {
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index daa40a1..769ab2f 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1283,7 +1283,7 @@ void QTextCursor::setVisualNavigation(bool b)
/*!
\since 4.7
- Sets the visual x position for vertical cursor movements.
+ Sets the visual x position for vertical cursor movements to \a x.
The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept
unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a
@@ -1335,8 +1335,8 @@ bool QTextCursor::keepPositionOnInsert() const
Defines whether the cursor should keep its current position when text gets inserted at the current position of the
cursor.
- If \b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor.
- If \b is false, the cursor moves along with the inserted text.
+ If \a b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor.
+ If \a b is false, the cursor moves along with the inserted text.
The default is false.
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 8f31e46..9eeec0b 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -392,7 +392,12 @@ QList<QTextOption::Tab> QTextOption::tabs() const
/*!
\fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar())
- Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter
+
+ Creates a tab with the given position, tab type, and delimiter
+ (\a pos, \a tabType, \a delim).
+
+ \note \a delim is only used when \a tabType is DelimiterTab.
+
\since 4.7
*/
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 5100176..e3985ce 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -754,19 +754,39 @@ void QTextTable::insertColumns(int pos, int num)
QTextFormatCollection *c = p->formatCollection();
p->beginEditBlock();
+ QList<int> extendedSpans;
for (int i = 0; i < d->nRows; ++i) {
int cell;
if (i == d->nRows - 1 && pos == d->nCols)
cell = d->fragment_end;
else
cell = d->grid[i*d->nCols + pos];
- QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
- QTextCharFormat fmt = c->charFormat(it->format);
if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) {
// cell spans the insertion place, extend it
- fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
- p->setCharFormat(it.position(), 1, fmt);
+ if (!extendedSpans.contains(cell)) {
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
+ fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
+ p->setCharFormat(it.position(), 1, fmt);
+ d->dirty = true;
+ extendedSpans << cell;
+ }
} else {
+ /* If the next cell is spanned from the row above, we need to find the right position
+ to insert to */
+ if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) {
+ int gridIndex = i*d->nCols + pos;
+ const int gridEnd = d->nRows * d->nCols - 1;
+ while (gridIndex < gridEnd && cell == d->grid[gridIndex]) {
+ ++gridIndex;
+ }
+ if (gridIndex == gridEnd)
+ cell = d->fragment_end;
+ else
+ cell = d->grid[gridIndex];
+ }
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
fmt.setTableCellRowSpan(1);
fmt.setTableCellColumnSpan(1);
Q_ASSERT(fmt.objectIndex() == objectIndex());
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 1afabec..9e2b85e 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -286,13 +286,8 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
resend = false;
//create the response header to be used with QAuthenticatorPrivate.
- QHttpResponseHeader responseHeader;
QList<QPair<QByteArray, QByteArray> > fields = reply->header();
- QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin();
- while (it != fields.constEnd()) {
- responseHeader.addValue(QString::fromLatin1(it->first), QString::fromUtf8(it->second));
- it++;
- }
+
//find out the type of authentication protocol requested.
QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy);
if (authMethod != QAuthenticatorPrivate::None) {
@@ -310,7 +305,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
if (auth->isNull())
auth->detach();
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
- priv->parseHttpResponse(responseHeader, isProxy);
+ priv->parseHttpResponse(fields, isProxy);
if (priv->phase == QAuthenticatorPrivate::Done) {
if ((isProxy && pendingProxyAuthSignal) ||(!isProxy && pendingAuthSignal)) {
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index a6c5c02..f617244 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -944,10 +944,10 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m
checkForRedirect(status);
- emit metaDataChanged();
-
- // invoke this asynchronously, else Arora/QtDemoBrowser don't like cached downloads
- // see task 250221 / 251801
+ // This needs to be emitted in the event loop because it can be reached at
+ // the direct code path of qnam.get(...) before the user has a chance
+ // to connect any signals.
+ QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
qRegisterMetaType<QIODevice*>("QIODevice*");
QMetaObject::invokeMethod(this, "writeDownstreamData", Qt::QueuedConnection, Q_ARG(QIODevice*, contents));
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index bccfec1..fa592c2 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -230,6 +230,14 @@ QT_BEGIN_NAMESPACE
\since 4.7
+ \omitvalue MaximumDownloadBufferSizeAttribute
+ \since 4.7
+ \internal
+
+ \omitvalue DownloadBufferAttribute
+ \since 4.7
+ \internal
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index d2945c4..cdadf0f 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -82,6 +82,8 @@ public:
CookieLoadControlAttribute,
AuthenticationReuseAttribute,
CookieSaveControlAttribute,
+ MaximumDownloadBufferSizeAttribute, // internal
+ DownloadBufferAttribute, // internal
User = 1000,
UserMax = 32767
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index e4023c8..d61c686 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -50,6 +50,8 @@
#include <qdatastream.h>
#include <qendian.h>
#include <qstring.h>
+#include <qdatetime.h>
+
QT_BEGIN_NAMESPACE
@@ -83,6 +85,44 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
Note that, in particular, NTLM version 2 is not supported.
+ \section1 Options
+
+ In addition to the username and password required for authentication, a
+ QAuthenticator object can also contain additional options. The
+ options() function can be used to query incoming options sent by
+ the server; the setOption() function can
+ be used to set outgoing options, to be processed by the authenticator
+ calculation. The options accepted and provided depend on the authentication
+ type (see method()).
+
+ The following tables list known incoming options as well as accepted
+ outgoing options. The list of incoming options is not exhaustive, since
+ servers may include additional information at any time. The list of
+ outgoing options is exhaustive, however, and no unknown options will be
+ treated or sent back to the server.
+
+ \section2 Basic
+
+ \table
+ \header \o Option \o Direction \o Description
+ \row \o \tt{realm} \o Incoming \o Contains the realm of the authentication, the same as realm()
+ \endtable
+
+ The Basic authentication mechanism supports no outgoing options.
+
+ \section2 NTLM version 1
+
+ The NTLM authentication mechanism currently supports no incoming or outgoing options.
+
+ \section2 Digest-MD5
+
+ \table
+ \header \o Option \o Direction \o Description
+ \row \o \tt{realm} \o Incoming \o Contains the realm of the authentication, the same as realm()
+ \endtable
+
+ The Digest-MD5 authentication mechanism supports no outgoing options.
+
\sa QSslSocket
*/
@@ -138,7 +178,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
return d->user == other.d->user
&& d->password == other.d->password
&& d->realm == other.d->realm
- && d->method == other.d->method;
+ && d->method == other.d->method
+ && d->options == other.d->options;
}
/*!
@@ -162,7 +203,18 @@ QString QAuthenticator::user() const
void QAuthenticator::setUser(const QString &user)
{
detach();
- d->user = user;
+
+ int separatorPosn = 0;
+ separatorPosn = user.indexOf(QLatin1String("\\"));
+
+ if (separatorPosn == -1) {
+ //No domain name present
+ d->user = user;
+ } else {
+ //domain name is present
+ d->realm = user.left(separatorPosn);
+ d->user = user.mid(separatorPosn+1);
+ }
}
/*!
@@ -205,9 +257,49 @@ QString QAuthenticator::realm() const
return d ? d->realm : QString();
}
+/*!
+ \since 4.7
+ Returns the value related to option \a opt if it was set by the server.
+ See \l{QAuthenticator#Options} for more information on incoming options.
+ If option \a opt isn't found, an invalid QVariant will be returned.
+
+ \sa options(), QAuthenticator#Options
+*/
+QVariant QAuthenticator::option(const QString &opt) const
+{
+ return d ? d->options.value(opt) : QVariant();
+}
/*!
- returns true if the authenticator is null.
+ \since 4.7
+ Returns all incoming options set in this QAuthenticator object by parsing
+ the server reply. See \l{QAuthenticator#Options} for more information
+ on incoming options.
+
+ \sa option(), QAuthenticator#Options
+*/
+QVariantHash QAuthenticator::options() const
+{
+ return d ? d->options : QVariantHash();
+}
+
+/*!
+ \since 4.7
+
+ Sets the outgoing option \a opt to value \a value.
+ See \l{QAuthenticator#Options} for more information on outgoing options.
+
+ \sa options(), option(), QAuthenticator#Options
+*/
+void QAuthenticator::setOption(const QString &opt, const QVariant &value)
+{
+ detach();
+ d->options.insert(opt, value);
+}
+
+
+/*!
+ Returns true if the authenticator is null.
*/
bool QAuthenticator::isNull() const
{
@@ -228,7 +320,20 @@ QAuthenticatorPrivate::QAuthenticatorPrivate()
#ifndef QT_NO_HTTP
void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, bool isProxy)
{
- QList<QPair<QString, QString> > values = header.values();
+ const QList<QPair<QString, QString> > values = header.values();
+ QList<QPair<QByteArray, QByteArray> > rawValues;
+
+ QList<QPair<QString, QString> >::const_iterator it, end;
+ for (it = values.constBegin(), end = values.constEnd(); it != end; ++it)
+ rawValues.append(qMakePair(it->first.toLatin1(), it->second.toUtf8()));
+
+ // continue in byte array form
+ parseHttpResponse(rawValues, isProxy);
+}
+#endif
+
+void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByteArray> > &values, bool isProxy)
+{
const char *search = isProxy ? "proxy-authenticate" : "www-authenticate";
method = None;
@@ -242,38 +347,40 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header,
authentication parameters.
*/
- QString headerVal;
+ QByteArray headerVal;
for (int i = 0; i < values.size(); ++i) {
- const QPair<QString, QString> &current = values.at(i);
- if (current.first.toLower() != QLatin1String(search))
+ const QPair<QByteArray, QByteArray> &current = values.at(i);
+ if (current.first.toLower() != search)
continue;
- QString str = current.second;
- if (method < Basic && str.startsWith(QLatin1String("Basic"), Qt::CaseInsensitive)) {
- method = Basic; headerVal = str.mid(6);
- } else if (method < Ntlm && str.startsWith(QLatin1String("NTLM"), Qt::CaseInsensitive)) {
+ QByteArray str = current.second.toLower();
+ if (method < Basic && str.startsWith("basic")) {
+ method = Basic;
+ headerVal = current.second.mid(6);
+ } else if (method < Ntlm && str.startsWith("ntlm")) {
method = Ntlm;
- headerVal = str.mid(5);
- } else if (method < DigestMd5 && str.startsWith(QLatin1String("Digest"), Qt::CaseInsensitive)) {
+ headerVal = current.second.mid(5);
+ } else if (method < DigestMd5 && str.startsWith("digest")) {
method = DigestMd5;
- headerVal = str.mid(7);
+ headerVal = current.second.mid(7);
}
}
- challenge = headerVal.trimmed().toLatin1();
+ challenge = headerVal.trimmed();
QHash<QByteArray, QByteArray> options = parseDigestAuthenticationChallenge(challenge);
switch(method) {
case Basic:
- realm = QString::fromLatin1(options.value("realm"));
+ if(realm.isEmpty())
+ this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (user.isEmpty())
phase = Done;
break;
case Ntlm:
// #### extract from header
- realm.clear();
break;
case DigestMd5: {
- realm = QString::fromLatin1(options.value("realm"));
+ if(realm.isEmpty())
+ this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (options.value("stale").toLower() == "true")
phase = Start;
if (user.isEmpty())
@@ -286,7 +393,6 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header,
phase = Invalid;
}
}
-#endif
QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMethod, const QByteArray &path)
{
@@ -661,6 +767,20 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge,
*/
#define NTLMSSP_NEGOTIATE_56 0x80000000
+/*
+ * AvId values
+ */
+#define AVTIMESTAMP 7
+
+//#define NTLMV1_CLIENT
+
+
+//************************Global variables***************************
+
+const int blockSize = 64; //As per RFC2104 Block-size is 512 bits
+const int nDigestLen = 16; //Trunctaion Length of the Hmac-Md5 digest
+const quint8 respversion = 1;
+const quint8 hirespversion = 1;
/* usage:
// fill up ctx with what we know.
@@ -803,6 +923,7 @@ public:
// extracted
QString targetNameStr, targetInfoStr;
+ QByteArray targetInfoBuff;
};
@@ -818,6 +939,7 @@ public:
// extracted
QByteArray lmResponseBuf, ntlmResponseBuf;
QString domainStr, userStr, workstationStr, sessionKeyStr;
+ QByteArray v2Hash;
};
@@ -899,7 +1021,7 @@ static QString qStringFromUcs2Le(const QByteArray& src)
return QString((const QChar *)src.data(), src.size()/2);
}
-
+#ifdef NTLMV1_CLIENT
static QByteArray qEncodeNtlmResponse(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block& ch)
{
QCryptographicHash md4(QCryptographicHash::Md4);
@@ -941,7 +1063,232 @@ static QByteArray qEncodeLmResponse(const QAuthenticatorPrivate *ctx, const QNtl
hash.fill(0);
return rc;
}
+#endif
+
+/*********************************************************************
+* Function Name: qEncodeHmacMd5
+* Params:
+* key: Type - QByteArray
+* - It is the Authentication key
+* message: Type - QByteArray
+* - This is the actual message which will be encoded
+* using HMacMd5 hash algorithm
+*
+* Return Value:
+* hmacDigest: Type - QByteArray
+*
+* Description:
+* This function will be used to encode the input message using
+* HMacMd5 hash algorithm.
+*
+* As per the RFC2104 the HMacMd5 algorithm can be specified
+* ---------------------------------------
+* MD5(K XOR opad, MD5(K XOR ipad, text))
+* ---------------------------------------
+*
+*********************************************************************/
+QByteArray qEncodeHmacMd5(QByteArray &key, const QByteArray &message)
+{
+ Q_ASSERT_X(!(message.isEmpty()),"qEncodeHmacMd5", "Empty message check");
+ Q_ASSERT_X(!(key.isEmpty()),"qEncodeHmacMd5", "Empty key check");
+
+ QCryptographicHash hash(QCryptographicHash::Md5);
+ QByteArray hMsg;
+
+ QByteArray iKeyPad(blockSize, 0x36);
+ QByteArray oKeyPad(blockSize, 0x5c);
+
+ hash.reset();
+ // Adjust the key length to blockSize
+
+ if(blockSize < key.length()) {
+ hash.addData(key);
+ key = hash.result(); //MD5 will always return 16 bytes length output
+ }
+
+ //Key will be <= 16 or 20 bytes as hash function (MD5 or SHA hash algorithms)
+ //key size can be max of Block size only
+ key = key.leftJustified(blockSize,0,true);
+
+ //iKeyPad, oKeyPad and key are all of same size "blockSize"
+
+ //xor of iKeyPad with Key and store the result into iKeyPad
+ for(int i = 0; i<key.size();i++) {
+ iKeyPad[i] = key[i]^iKeyPad[i];
+ }
+
+ //xor of oKeyPad with Key and store the result into oKeyPad
+ for(int i = 0; i<key.size();i++) {
+ oKeyPad[i] = key[i]^oKeyPad[i];
+ }
+
+ iKeyPad.append(message); // (K0 xor ipad) || text
+
+ hash.reset();
+ hash.addData(iKeyPad);
+ hMsg = hash.result();
+ //Digest gen after pass-1: H((K0 xor ipad)||text)
+
+ QByteArray hmacDigest;
+ oKeyPad.append(hMsg);
+ hash.reset();
+ hash.addData(oKeyPad);
+ hmacDigest = hash.result();
+ // H((K0 xor opad )|| H((K0 xor ipad) || text))
+
+ /*hmacDigest should not be less than half the length of the HMAC output
+ (to match the birthday attack bound) and not less than 80 bits
+ (a suitable lower bound on the number of bits that need to be
+ predicted by an attacker).
+ Refer RFC 2104 for more details on truncation part */
+
+ /*MD5 hash always returns 16 byte digest only and HMAC-MD5 spec
+ (RFC 2104) also says digest length should be 16 bytes*/
+ return hmacDigest;
+}
+
+static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx,
+ QNtlmPhase3Block *phase3)
+{
+ Q_ASSERT(phase3 != 0);
+ // since v2 Hash is need for both NTLMv2 and LMv2 it is calculated
+ // only once and stored and reused
+ if(phase3->v2Hash.size() == 0) {
+ QCryptographicHash md4(QCryptographicHash::Md4);
+ QByteArray passUnicode = qStringAsUcs2Le(ctx->password);
+ md4.addData(passUnicode.data(), passUnicode.size());
+
+ QByteArray hashKey = md4.result();
+ Q_ASSERT(hashKey.size() == 16);
+ // Assuming the user and domain is always unicode in challenge
+ QByteArray message =
+ qStringAsUcs2Le(ctx->user.toUpper()) +
+ qStringAsUcs2Le(ctx->realm);
+
+ phase3->v2Hash = qEncodeHmacMd5(hashKey, message);
+ }
+ return phase3->v2Hash;
+}
+
+static QByteArray clientChallenge(const QAuthenticatorPrivate *ctx)
+{
+ Q_ASSERT(ctx->cnonce.size() >= 8);
+ QByteArray clientCh = ctx->cnonce.right(8);
+ return clientCh;
+}
+
+// caller has to ensure a valid targetInfoBuff
+static bool qExtractServerTime(const QByteArray& targetInfoBuff,
+ quint64 *serverTime)
+{
+ Q_ASSERT(serverTime != 0);
+ bool retValue = false;
+ QDataStream ds(targetInfoBuff);
+ ds.setByteOrder(QDataStream::LittleEndian);
+
+ quint16 avId;
+ quint16 avLen;
+
+ ds >> avId;
+ ds >> avLen;
+ while(avId != 0) {
+ if(avId == AVTIMESTAMP) {
+ QByteArray timeArray(avLen, 0);
+ //avLen size of QByteArray is allocated
+ ds.readRawData(timeArray.data(), avLen);
+ bool ok;
+ *serverTime = timeArray.toHex().toLongLong(&ok, 16);
+ retValue = true;
+ break;
+ }
+ ds.skipRawData(avLen);
+ ds >> avId;
+ ds >> avLen;
+ }
+ return retValue;
+}
+
+static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx,
+ const QNtlmPhase2Block& ch,
+ QNtlmPhase3Block *phase3)
+{
+ Q_ASSERT(phase3 != 0);
+ // return value stored in phase3
+ qCreatev2Hash(ctx, phase3);
+
+ QByteArray temp;
+ QDataStream ds(&temp, QIODevice::WriteOnly);
+ ds.setByteOrder(QDataStream::LittleEndian);
+
+ ds << respversion;
+ ds << hirespversion;
+ //Reserved
+ QByteArray reserved1(6, 0);
+ ds.writeRawData(reserved1.constData(), reserved1.size());
+
+ quint64 time = 0;
+
+ //if server sends time, use it instead of current time
+ if(!(ch.targetInfo.len && qExtractServerTime(ch.targetInfoBuff, &time))) {
+ QDateTime currentTime(QDate::currentDate(),
+ QTime::currentTime(), Qt::UTC);
+
+ // number of seconds between 1601 and epoc(1970)
+ // 369 years, 89 leap years
+ // ((369 * 365) + 89) * 24 * 3600 = 11644473600
+
+ time = Q_UINT64_C(currentTime.toTime_t() + 11644473600);
+
+ // represented as 100 nano seconds
+ time = Q_UINT64_C(time * 10000000);
+ }
+ ds << time;
+
+ //8 byte client challenge
+ QByteArray clientCh = clientChallenge(ctx);
+ ds.writeRawData(clientCh.constData(), clientCh.size());
+
+ //Reserved
+ QByteArray reserved2(4, 0);
+ ds.writeRawData(reserved2.constData(), reserved2.size());
+
+ if (ch.targetInfo.len > 0) {
+ ds.writeRawData(ch.targetInfoBuff.constData(),
+ ch.targetInfoBuff.size());
+ }
+
+ //Reserved
+ QByteArray reserved3(4, 0);
+ ds.writeRawData(reserved3.constData(), reserved3.size());
+
+ QByteArray message((const char*)ch.challenge, sizeof(ch.challenge));
+ message.append(temp);
+
+ QByteArray ntChallengeResp = qEncodeHmacMd5(phase3->v2Hash, message);
+ ntChallengeResp.append(temp);
+
+ return ntChallengeResp;
+}
+
+static QByteArray qEncodeLmv2Response(const QAuthenticatorPrivate *ctx,
+ const QNtlmPhase2Block& ch,
+ QNtlmPhase3Block *phase3)
+{
+ Q_ASSERT(phase3 != 0);
+ // return value stored in phase3
+ qCreatev2Hash(ctx, phase3);
+
+ QByteArray message((const char*)ch.challenge, sizeof(ch.challenge));
+ QByteArray clientCh = clientChallenge(ctx);
+
+ message.append(clientCh);
+
+ QByteArray lmChallengeResp = qEncodeHmacMd5(phase3->v2Hash, message);
+ lmChallengeResp.append(clientCh);
+
+ return lmChallengeResp;
+}
static bool qNtlmDecodePhase2(const QByteArray& data, QNtlmPhase2Block& ch)
{
@@ -976,7 +1323,10 @@ static bool qNtlmDecodePhase2(const QByteArray& data, QNtlmPhase2Block& ch)
}
if (ch.targetInfo.len > 0) {
- // UNUSED right now
+ if (ch.targetInfo.len + ch.targetInfo.offset > (unsigned)data.size())
+ return false;
+
+ ch.targetInfoBuff = data.mid(ch.targetInfo.offset, ch.targetInfo.len);
}
return true;
@@ -996,7 +1346,8 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
bool unicode = ch.flags & NTLMSSP_NEGOTIATE_UNICODE;
- ctx->realm = ch.targetNameStr;
+ if(ctx->realm.isEmpty())
+ ctx->realm = ch.targetNameStr;
pb.flags = NTLMSSP_NEGOTIATE_NTLM;
if (unicode)
@@ -1010,6 +1361,7 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
offset = qEncodeNtlmString(pb.domain, offset, ctx->realm, unicode);
pb.domainStr = ctx->realm;
+
offset = qEncodeNtlmString(pb.user, offset, ctx->user, unicode);
pb.userStr = ctx->user;
@@ -1017,11 +1369,23 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
pb.workstationStr = ctx->workstation;
// Get LM response
+#ifdef NTLMV1_CLIENT
pb.lmResponseBuf = qEncodeLmResponse(ctx, ch);
+#else
+ if (ch.targetInfo.len > 0) {
+ pb.lmResponseBuf = QByteArray();
+ } else {
+ pb.lmResponseBuf = qEncodeLmv2Response(ctx, ch, &pb);
+ }
+#endif
offset = qEncodeNtlmBuffer(pb.lmResponse, offset, pb.lmResponseBuf);
// Get NTLM response
+#ifdef NTLMV1_CLIENT
pb.ntlmResponseBuf = qEncodeNtlmResponse(ctx, ch);
+#else
+ pb.ntlmResponseBuf = qEncodeNtlmv2Response(ctx, ch, &pb);
+#endif
offset = qEncodeNtlmBuffer(pb.ntlmResponse, offset, pb.ntlmResponseBuf);
diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h
index 13ce593..983b7c0 100644
--- a/src/network/kernel/qauthenticator.h
+++ b/src/network/kernel/qauthenticator.h
@@ -43,6 +43,7 @@
#define QAUTHENTICATOR_H
#include <QtCore/qstring.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_HEADER
@@ -73,6 +74,10 @@ public:
QString realm() const;
+ QVariant option(const QString &opt) const;
+ QVariantHash options() const;
+ void setOption(const QString &opt, const QVariant &value);
+
bool isNull() const;
void detach();
private:
diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
index e9ce9ac..1096601 100644
--- a/src/network/kernel/qauthenticator_p.h
+++ b/src/network/kernel/qauthenticator_p.h
@@ -57,12 +57,13 @@
#include <qbytearray.h>
#include <qstring.h>
#include <qauthenticator.h>
+#include <qvariant.h>
QT_BEGIN_NAMESPACE
class QHttpResponseHeader;
-class QAuthenticatorPrivate
+class Q_AUTOTEST_EXPORT QAuthenticatorPrivate
{
public:
enum Method { None, Basic, Plain, Login, Ntlm, CramMd5, DigestMd5 };
@@ -71,7 +72,7 @@ public:
QAtomicInt ref;
QString user;
QString password;
- QHash<QByteArray, QByteArray> options;
+ QVariantHash options;
Method method;
QString realm;
QByteArray challenge;
@@ -102,6 +103,7 @@ public:
#ifndef QT_NO_HTTP
void parseHttpResponse(const QHttpResponseHeader &, bool isProxy);
#endif
+ void parseHttpResponse(const QList<QPair<QByteArray, QByteArray> >&, bool isProxy);
};
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 55f926d..0640c7c 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -577,7 +577,7 @@ void QTcpServer::incomingConnection(int socketDescriptor)
/*!
This function is called by QTcpServer::incomingConnection()
- to add a socket to the list of pending incoming connections.
+ to add the \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
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index f85fa84..f73068e 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -574,7 +574,7 @@ void QSslSocket::setProtocol(QSsl::SslProtocol protocol)
certificate is valid.
The default mode is AutoVerifyPeer, which tells QSslSocket to use
- VerifyPeer for clients, QueryPeer for clients.
+ VerifyPeer for clients and QueryPeer for servers.
\sa setPeerVerifyMode(), peerVerifyDepth(), mode()
*/
@@ -594,7 +594,7 @@ QSslSocket::PeerVerifyMode QSslSocket::peerVerifyMode() const
certificate is valid.
The default mode is AutoVerifyPeer, which tells QSslSocket to use
- VerifyPeer for clients, QueryPeer for clients.
+ VerifyPeer for clients and QueryPeer for servers.
Setting this mode after encryption has started has no effect on the
current connection.
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 1d794ae..c297eea 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -475,27 +475,12 @@ bool QSslSocketPrivate::ensureLibraryLoaded()
void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
{
+ QMutexLocker locker(openssl_locks()->initLock());
if (s_loadedCiphersAndCerts)
return;
s_loadedCiphersAndCerts = true;
resetDefaultCiphers();
- setDefaultCaCertificates(systemCaCertificates());
-}
-
-/*!
- \internal
-
- Declared static in QSslSocketPrivate, makes sure the SSL libraries have
- been initialized.
-*/
-
-void QSslSocketPrivate::ensureInitialized()
-{
- if (!supportsSsl())
- return;
-
- ensureCiphersAndCertsLoaded();
//load symbols needed to receive certificates from system store
#if defined(Q_OS_MAC)
@@ -532,6 +517,22 @@ void QSslSocketPrivate::ensureInitialized()
qWarning("could not load crypt32 library"); // should never happen
}
#endif
+ setDefaultCaCertificates(systemCaCertificates());
+}
+
+/*!
+ \internal
+
+ Declared static in QSslSocketPrivate, makes sure the SSL libraries have
+ been initialized.
+*/
+
+void QSslSocketPrivate::ensureInitialized()
+{
+ if (!supportsSsl())
+ return;
+
+ ensureCiphersAndCertsLoaded();
}
/*!
@@ -970,8 +971,20 @@ void QSslSocketBackendPrivate::transmit()
#endif
plainSocket->disconnectFromHost();
break;
+ case SSL_ERROR_SYSCALL: // some IO error
+ case SSL_ERROR_SSL: // error in the SSL library
+ // we do not know exactly what the error is, nor whether we can recover from it,
+ // so just return to prevent an endless loop in the outer "while" statement
+ q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
+ q->setSocketError(QAbstractSocket::UnknownSocketError);
+ emit q->error(QAbstractSocket::UnknownSocketError);
+ return;
default:
- // ### Handle errors better.
+ // SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: can only happen with a
+ // BIO_s_connect() or BIO_s_accept(), which we do not call.
+ // SSL_ERROR_WANT_X509_LOOKUP: can only happen with a
+ // SSL_CTX_set_client_cert_cb(), which we do not call.
+ // So this default case should never be triggered.
q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
@@ -1105,17 +1118,16 @@ bool QSslSocketBackendPrivate::startHandshake()
QString peerName = (verificationPeerName.isEmpty () ? q->peerName() : verificationPeerName);
QString commonName = configuration.peerCertificate.subjectInfo(QSslCertificate::CommonName);
- QRegExp regexp(commonName, Qt::CaseInsensitive, QRegExp::Wildcard);
- if (!regexp.exactMatch(peerName)) {
+ if (!isMatchingHostname(commonName.toLower(), peerName.toLower())) {
bool matched = false;
foreach (const QString &altName, configuration.peerCertificate
.alternateSubjectNames().values(QSsl::DnsEntry)) {
- regexp.setPattern(altName);
- if (regexp.exactMatch(peerName)) {
+ if (isMatchingHostname(altName.toLower(), peerName.toLower())) {
matched = true;
break;
}
}
+
if (!matched) {
// No matches in common names or alternate names.
QSslError error(QSslError::HostNameMismatch, configuration.peerCertificate);
@@ -1245,4 +1257,39 @@ QList<QSslCertificate> QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates
return certificates;
}
+bool QSslSocketBackendPrivate::isMatchingHostname(const QString &cn, const QString &hostname)
+{
+ int wildcard = cn.indexOf(QLatin1Char('*'));
+
+ // Check this is a wildcard cert, if not then just compare the strings
+ if (wildcard < 0)
+ return cn == hostname;
+
+ int firstCnDot = cn.indexOf(QLatin1Char('.'));
+ int secondCnDot = cn.indexOf(QLatin1Char('.'), firstCnDot+1);
+
+ // Check at least 3 components
+ if ((-1 == secondCnDot) || (secondCnDot+1 >= cn.length()))
+ return false;
+
+ // Check * is last character of 1st component (ie. there's a following .)
+ if (wildcard+1 != firstCnDot)
+ return false;
+
+ // Check only one star
+ if (cn.lastIndexOf(QLatin1Char('*')) != wildcard)
+ return false;
+
+ // Check characters preceding * (if any) match
+ if (wildcard && (hostname.leftRef(wildcard) != cn.leftRef(wildcard)))
+ return false;
+
+ // Check characters following first . match
+ if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot))
+ return false;
+
+ // Ok, I guess this was a wildcard CN and the hostname matches.
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index 987dfae..7a4e6b6 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -116,6 +116,7 @@ public:
static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher);
static QList<QSslCertificate> STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509);
+ Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QString &cn, const QString &hostname);
};
#if defined(Q_OS_SYMBIAN)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index ee49a3d..d3f6a29 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1128,7 +1128,7 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
d->fill(path);
}
-extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
+extern Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index fc28a73..2fa33bf 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1334,6 +1334,10 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co
\value OpenGL_Version_3_2 OpenGL version 3.2 or higher is present.
+ \value OpenGL_Version_3_3 OpenGL version 3.3 or higher is present.
+
+ \value OpenGL_Version_4_0 OpenGL version 4.0 or higher is present.
+
\value OpenGL_ES_CommonLite_Version_1_0 OpenGL ES version 1.0 Common Lite or higher is present.
\value OpenGL_ES_Common_Version_1_0 OpenGL ES version 1.0 Common or higher is present.
@@ -5037,8 +5041,9 @@ void QGLWidget::deleteTexture(QMacCompatGLuint id)
/*!
\since 4.4
- Calls the corresponding QGLContext::drawTexture() on
- this widget's context.
+ Calls the corresponding QGLContext::drawTexture() with
+ \a target, \a textureId, and \a textureTarget for this
+ widget's context.
*/
void QGLWidget::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)
{
@@ -5058,8 +5063,9 @@ void QGLWidget::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QM
/*!
\since 4.4
- Calls the corresponding QGLContext::drawTexture() on
- this widget's context.
+ Calls the corresponding QGLContext::drawTexture() with
+ \a point, \a textureId, and \a textureTarget for this
+ widget's context.
*/
void QGLWidget::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)
{
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index 5223beb..e053f37 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -1,10 +1,6 @@
-TARGET = qsqldb2
+TARGET = qsqldb2
-HEADERS = ../../../sql/drivers/db2/qsql_db2.h
-SOURCES = main.cpp \
- ../../../sql/drivers/db2/qsql_db2.cpp
-
-unix:!contains( LIBS, .*db2.* ):LIBS *= -ldb2
-win32:!contains( LIBS, .*db2.* ):LIBS *= -ldb2cli
+SOURCES = main.cpp
+include(../../../sql/drivers/db2/qsql_db2.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro
index ec2bc7b..7870ec8 100644
--- a/src/plugins/sqldrivers/ibase/ibase.pro
+++ b/src/plugins/sqldrivers/ibase/ibase.pro
@@ -1,14 +1,6 @@
-TARGET = qsqlibase
+TARGET = qsqlibase
-HEADERS = ../../../sql/drivers/ibase/qsql_ibase.h
-SOURCES = main.cpp \
- ../../../sql/drivers/ibase/qsql_ibase.cpp
-
-unix:!contains( LIBS, .*gds.* ):!contains( LIBS, .*libfb.* ):LIBS *= -lgds
-
-win32:!contains( LIBS, .*gds.* ):!contains( LIBS, .*fbclient.* ) {
- !win32-borland:LIBS *= -lgds32_ms
- win32-borland:LIBS += gds32.lib
-}
+SOURCES = main.cpp
+include(../../../sql/drivers/ibase/qsql_ibase.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro
index 9f5c619..b6d42ff 100644
--- a/src/plugins/sqldrivers/mysql/mysql.pro
+++ b/src/plugins/sqldrivers/mysql/mysql.pro
@@ -1,23 +1,6 @@
-TARGET = qsqlmysql
+TARGET = qsqlmysql
-HEADERS = ../../../sql/drivers/mysql/qsql_mysql.h
-SOURCES = main.cpp \
- ../../../sql/drivers/mysql/qsql_mysql.cpp
-
-unix: {
- isEmpty(QT_LFLAGS_MYSQL) {
- !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
- use_libmysqlclient_r:LIBS *= -lmysqlclient_r
- else:LIBS *= -lmysqlclient
- }
- } else {
- LIBS *= $$QT_LFLAGS_MYSQL
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
- }
-}
-
-win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) {
- LIBS *= -llibmysql
-}
+SOURCES = main.cpp
+include(../../../sql/drivers/mysql/qsql_mysql.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro
index 3bf70a1..d7dcce9 100644
--- a/src/plugins/sqldrivers/oci/oci.pro
+++ b/src/plugins/sqldrivers/oci/oci.pro
@@ -1,13 +1,6 @@
-TARGET = qsqloci
+TARGET = qsqloci
-HEADERS = ../../../sql/drivers/oci/qsql_oci.h
-SOURCES = main.cpp \
- ../../../sql/drivers/oci/qsql_oci.cpp
-
-win32:LIBS *= -loci
-
-unix:!contains( LIBS, .*clnts.* ):LIBS *= -lclntsh
-
-macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
+SOURCES = main.cpp
+include(../../../sql/drivers/oci/qsql_oci.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 2bf85f1..677eb6e 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -1,19 +1,6 @@
-TARGET = qsqlodbc
+TARGET = qsqlodbc
-HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h
-SOURCES = main.cpp \
- ../../../sql/drivers/odbc/qsql_odbc.cpp
-
-unix {
- !contains( LIBS, .*odbc.* ) {
- LIBS *= $$QT_LFLAGS_ODBC
- }
- DEFINES += UNICODE
-}
-
-win32 {
- !win32-borland:LIBS *= -lodbc32
- win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib
-}
+SOURCES = main.cpp
+include(../../../sql/drivers/odbc/qsql_odbc.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
index 80a5348..8276c0a 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -1,18 +1,6 @@
-TARGET = qsqlpsql
+TARGET = qsqlpsql
-HEADERS = ../../../sql/drivers/psql/qsql_psql.h
-SOURCES = main.cpp \
- ../../../sql/drivers/psql/qsql_psql.cpp
-
-unix|win32-g++*: {
- !isEmpty(QT_LFLAGS_PSQL) {
- !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
- !static:LIBS *= $$QT_LFLAGS_PSQL
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
- }
- !contains(LIBS, .*pq.*):LIBS *= -lpq
-}
-
-win32:!win32-g++*:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
+SOURCES = main.cpp
+include(../../../sql/drivers/psql/qsql_psql.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index fb31233..f4c1671 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -1,18 +1,7 @@
-TARGET = qsqlite
+TARGET = qsqlite
-HEADERS = ../../../sql/drivers/sqlite/qsql_sqlite.h
-SOURCES = smain.cpp \
- ../../../sql/drivers/sqlite/qsql_sqlite.cpp
-
-!system-sqlite:!contains( LIBS, .*sqlite.* ) {
- CONFIG(release, debug|release):DEFINES *= NDEBUG
- DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
- INCLUDEPATH += ../../../3rdparty/sqlite
- SOURCES += ../../../3rdparty/sqlite/sqlite3.c
-} else {
- LIBS *= $$QT_LFLAGS_SQLITE
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
-}
+SOURCES = smain.cpp
+include(../../../sql/drivers/sqlite/qsql_sqlite.pri)
wince*: DEFINES += HAVE_LOCALTIME_S=0
diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
index 88db22a..e6197b9 100644
--- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro
+++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
@@ -1,9 +1,6 @@
-TARGET = qsqlite2
+TARGET = qsqlite2
-HEADERS = ../../../sql/drivers/sqlite2/qsql_sqlite2.h
-SOURCES = smain.cpp \
- ../../../sql/drivers/sqlite2/qsql_sqlite2.cpp
-
-!contains(LIBS, .*sqlite.*):LIBS *= -lsqlite
+SOURCES = smain.cpp
+include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
index 08a166b..b8e8ded 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -1,15 +1,6 @@
-TARGET = qsqltds
+TARGET = qsqltds
-HEADERS = ../../../sql/drivers/tds/qsql_tds.h
-
-SOURCES = main.cpp \
- ../../../sql/drivers/tds/qsql_tds.cpp
-
-unix:!contains( LIBS, .*sybdb.* ):LIBS *= -lsybdb
-
-win32 {
- !win32-borland:LIBS *= -lNTWDBLIB
- win32-borland:LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB
-}
+SOURCES = main.cpp
+include(../../../sql/drivers/tds/qsql_tds.pri)
include(../qsqldriverbase.pri)
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 451d1b0..f6390bb 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1268,6 +1268,7 @@ QDateTime QScriptValue::toDateTime() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return QDateTime();
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue);
}
@@ -1284,6 +1285,7 @@ QRegExp QScriptValue::toRegExp() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return QRegExp();
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue);
}
#endif // QT_NO_REGEXP
@@ -1303,6 +1305,7 @@ QObject *QScriptValue::toQObject() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return 0;
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue);
}
@@ -1317,6 +1320,7 @@ const QMetaObject *QScriptValue::toQMetaObject() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return 0;
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue);
}
@@ -1407,6 +1411,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex,
Q_D(const QScriptValue);
if (!d || !d->isObject())
return QScriptValue();
+ QScript::APIShim shim(d->engine);
return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode));
}
@@ -1434,6 +1439,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
"cannot set value created in a different engine");
return;
}
+ QScript::APIShim shim(d->engine);
JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value);
d->setProperty(arrayIndex, jsValue, flags);
}
diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri
new file mode 100644
index 0000000..16557f0
--- /dev/null
+++ b/src/sql/drivers/db2/qsql_db2.pri
@@ -0,0 +1,8 @@
+HEADERS += $$PWD/qsql_db2.h
+SOURCES += $$PWD/qsql_db2.cpp
+
+unix {
+ !contains(LIBS, .*db2.*):LIBS += -ldb2
+} else:!win32-borland {
+ !contains(LIBS, .*db2.*):LIBS += -ldb2cli
+}
diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri
index 05e7265..87cc0b1 100644
--- a/src/sql/drivers/drivers.pri
+++ b/src/sql/drivers/drivers.pri
@@ -1,119 +1,11 @@
-contains(sql-drivers, all ) {
- sql-driver += psql mysql odbc oci tds db2 sqlite ibase
-}
-
-contains(sql-drivers, psql) {
- HEADERS += drivers/psql/qsql_psql.h
- SOURCES += drivers/psql/qsql_psql.cpp
-
- unix|win32-g++* {
- !static:!isEmpty(QT_LFLAGS_PSQL) {
- !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
- !static:LIBS *= $$QT_LFLAGS_PSQL
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
- }
- !contains(LIBS, .*pq.*):LIBS *= -lpq
- } else:win32:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
-}
-
-contains(sql-drivers, mysql) {
- HEADERS += drivers/mysql/qsql_mysql.h
- SOURCES += drivers/mysql/qsql_mysql.cpp
-
- unix {
- isEmpty(QT_LFLAGS_MYSQL) {
- !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
- use_libmysqlclient_r:LIBS *= -lmysqlclient_r
- else:LIBS *= -lmysqlclient
- }
- } else {
- LIBS *= $$QT_LFLAGS_MYSQL
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
- }
- }
-
- win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) {
- !win32-g++*:LIBS *= -llibmysql
- else:LIBS *= -lmysql
- }
-}
-
-contains(sql-drivers, odbc) {
- HEADERS += drivers/odbc/qsql_odbc.h
- SOURCES += drivers/odbc/qsql_odbc.cpp
-
- mac:!contains( LIBS, .*odbc.* ):LIBS *= -liodbc
- unix:!contains( LIBS, .*odbc.* ):LIBS *= -lodbc
- unix:DEFINES += UNICODE
-
- win32 {
- !win32-borland:LIBS *= -lodbc32
- else:LIBS *= $(BCB)/lib/PSDK/odbc32.lib
- }
-}
-
-contains(sql-drivers, oci) {
- HEADERS += drivers/oci/qsql_oci.h
- SOURCES += drivers/oci/qsql_oci.cpp
-
- unix:!contains( LIBS, .*clnts.* ):LIBS += -lclntsh
-
- win32:LIBS += -loci
-}
-
-contains(sql-drivers, tds) {
- HEADERS += drivers/tds/qsql_tds.h
- SOURCES += drivers/tds/qsql_tds.cpp
-
- unix:LIBS += -L$SYBASE/lib -lsybdb
-
- win32 {
- !win32-borland:LIBS += -lNTWDBLIB
- else:LIBS += $(BCB)/lib/PSDK/NTWDBLIB.LIB
- }
-}
-
-contains(sql-drivers, db2) {
- HEADERS += drivers/db2/qsql_db2.h
- SOURCES += drivers/db2/qsql_db2.cpp
-
- unix:LIBS += -ldb2
-
- win32 {
- !win32-borland:LIBS += -ldb2cli
-# else:LIBS += $(BCB)/lib/PSDK/db2cli.lib
- }
-}
-
-contains(sql-drivers, ibase) {
- HEADERS += drivers/ibase/qsql_ibase.h
- SOURCES += drivers/ibase/qsql_ibase.cpp
-
- unix:LIBS *= -lgds
-
- win32 {
- !win32-borland:LIBS *= -lgds32_ms
- else:LIBS += gds32.lib
- }
-}
-
-contains(sql-drivers, sqlite2) {
- HEADERS += drivers/sqlite2/qsql_sqlite2.h
- SOURCES += drivers/sqlite2/qsql_sqlite2.cpp
- !contains(LIBS, .*sqlite.*):LIBS *= -lsqlite
-}
-
-contains(sql-drivers, sqlite) {
- !system-sqlite:!contains( LIBS, .*sqlite3.* ) {
- CONFIG(release, debug|release):DEFINES *= NDEBUG
- DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
- INCLUDEPATH += ../3rdparty/sqlite
- SOURCES += ../3rdparty/sqlite/sqlite3.c
- } else {
- LIBS *= $$QT_LFLAGS_SQLITE
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
- }
-
- HEADERS += drivers/sqlite/qsql_sqlite.h
- SOURCES += drivers/sqlite/qsql_sqlite.cpp
-}
+contains(sql-drivers, all):sql-driver += psql mysql odbc oci tds db2 sqlite ibase
+
+contains(sql-drivers, psql):include($$PWD/psql/qsql_psql.pri)
+contains(sql-drivers, mysql):include($$PWD/mysql/qsql_mysql.pri)
+contains(sql-drivers, odbc):include($$PWD/odbc/qsql_odbc.pri)
+contains(sql-drivers, oci):include($$PWD/oci/qsql_oci.pri)
+contains(sql-drivers, tds):include($$PWD/tds/qsql_tds.pri)
+contains(sql-drivers, db2):include($$PWD/db2/qsql_db2.pri)
+contains(sql-drivers, ibase):include($$PWD/ibase/qsql_ibase.pri)
+contains(sql-drivers, sqlite2):include($$PWD/sqlite2/qsql_sqlite2.pri)
+contains(sql-drivers, sqlite):include($$PWD/sqlite/qsql_sqlite.pri)
diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri
new file mode 100644
index 0000000..33fbb0d
--- /dev/null
+++ b/src/sql/drivers/ibase/qsql_ibase.pri
@@ -0,0 +1,11 @@
+HEADERS += $$PWD/qsql_ibase.h
+SOURCES += $$PWD/qsql_ibase.cpp
+
+unix {
+ !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds
+} else {
+ !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) {
+ win32-borland:LIBS += gds32.lib
+ else:LIBS += -lgds32_ms
+ }
+}
diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri
new file mode 100644
index 0000000..1b9c3dd
--- /dev/null
+++ b/src/sql/drivers/mysql/qsql_mysql.pri
@@ -0,0 +1,16 @@
+HEADERS += $$PWD/qsql_mysql.h
+SOURCES += $$PWD/qsql_mysql.cpp
+
+unix {
+ isEmpty(QT_LFLAGS_MYSQL) {
+ !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
+ use_libmysqlclient_r:LIBS += -lmysqlclient_r
+ else:LIBS += -lmysqlclient
+ }
+ } else {
+ LIBS *= $$QT_LFLAGS_MYSQL
+ QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
+ }
+} else {
+ !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql
+}
diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri
new file mode 100644
index 0000000..60ccc4c
--- /dev/null
+++ b/src/sql/drivers/oci/qsql_oci.pri
@@ -0,0 +1,9 @@
+HEADERS += $$PWD/qsql_oci.h
+SOURCES += $$PWD/qsql_oci.cpp
+
+unix {
+ !contains(LIBS, .*clnts.*):LIBS += -lclntsh
+} else {
+ LIBS *= -loci
+}
+macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri
new file mode 100644
index 0000000..66a8d51
--- /dev/null
+++ b/src/sql/drivers/odbc/qsql_odbc.pri
@@ -0,0 +1,13 @@
+HEADERS += $$PWD/qsql_odbc.h
+SOURCES += $$PWD/qsql_odbc.cpp
+
+unix {
+ DEFINES += UNICODE
+ !contains(LIBS, .*odbc.*) {
+ macx:LIBS += -liodbc
+ else:LIBS += $$QT_LFLAGS_ODBC
+ }
+} else {
+ win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib
+ else:LIBS *= -lodbc32
+}
diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri
new file mode 100644
index 0000000..97db4be
--- /dev/null
+++ b/src/sql/drivers/psql/qsql_psql.pri
@@ -0,0 +1,13 @@
+HEADERS += $$PWD/qsql_psql.h
+SOURCES += $$PWD/qsql_psql.cpp
+
+unix|win32-g++* {
+ !static:!isEmpty(QT_LFLAGS_PSQL) {
+ !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
+ LIBS *= $$QT_LFLAGS_PSQL
+ QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
+ }
+ !contains(LIBS, .*pq.*):LIBS += -lpq
+} else {
+ !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
+}
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri
new file mode 100644
index 0000000..7ad5936
--- /dev/null
+++ b/src/sql/drivers/sqlite/qsql_sqlite.pri
@@ -0,0 +1,9 @@
+HEADERS += $$PWD/qsql_sqlite.h
+SOURCES += $$PWD/qsql_sqlite.cpp
+
+!system-sqlite:!contains(LIBS, .*sqlite3.*) {
+ include($$PWD/../../../3rdparty/sqlite.pri)
+} else {
+ LIBS *= $$QT_LFLAGS_SQLITE
+ QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
+}
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri
new file mode 100644
index 0000000..9a9f6cd
--- /dev/null
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.pri
@@ -0,0 +1,4 @@
+HEADERS += $$PWD/qsql_sqlite2.h
+SOURCES += $$PWD/qsql_sqlite2.cpp
+
+!contains(LIBS, .*sqlite.*):LIBS += -lsqlite
diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri
new file mode 100644
index 0000000..c552ead
--- /dev/null
+++ b/src/sql/drivers/tds/qsql_tds.pri
@@ -0,0 +1,10 @@
+HEADERS += $$PWD/qsql_tds.h
+SOURCES += $$PWD/qsql_tds.cpp
+
+unix {
+ !contains(LIBS, .*sybdb.*):LIBS += -lsybdb
+} else:win32-borland {
+ LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB
+} else {
+ LIBS *= -lNTWDBLIB
+}