summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/symbianpkgrules.pri3
-rw-r--r--doc/src/frameworks-technologies/activeqt.qdoc17
-rw-r--r--examples/symbianpkgrules.pri3
-rw-r--r--mkspecs/common/symbian/symbian.conf7
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp45
-rw-r--r--qmake/generators/symbian/symmake.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro2
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp13
-rw-r--r--src/corelib/tools/qchar.cpp8
-rw-r--r--src/gui/dialogs/qmessagebox.cpp14
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp13
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp10
-rw-r--r--src/gui/inputmethod/inputmethod.pri2
-rw-r--r--src/gui/inputmethod/qinputcontextfactory.cpp47
-rw-r--r--src/gui/styles/qs60style.cpp42
-rw-r--r--src/gui/styles/qs60style.h3
-rw-r--r--src/gui/styles/qs60style_p.h6
-rw-r--r--src/gui/styles/qs60style_s60.cpp18
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp32
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h20
-rw-r--r--src/openvg/qpaintengine_vg.cpp2
-rw-r--r--src/openvg/qpixmapdata_vg.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp25
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp157
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp178
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp91
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp13
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp9
-rw-r--r--util/s60pixelmetrics/pixel_metrics.cpp11
-rw-r--r--util/s60pixelmetrics/pixel_metrics.h4
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp9
32 files changed, 569 insertions, 250 deletions
diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri
index c511836..68a82cd 100644
--- a/demos/symbianpkgrules.pri
+++ b/demos/symbianpkgrules.pri
@@ -10,6 +10,7 @@ vendorinfo = \
":\"Nokia, Qt\"" \
" "
-default_deployment.pkg_prerules += vendorinfo
+demos_deployment.pkg_prerules += vendorinfo
+DEPLOYMENT += demos_deployment
isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc
index e24959d..a79430d 100644
--- a/doc/src/frameworks-technologies/activeqt.qdoc
+++ b/doc/src/frameworks-technologies/activeqt.qdoc
@@ -57,6 +57,7 @@
\brief An overview of Qt's ActiveX and COM integration on Windows.
\ingroup platform-specific
+ \ingroup frameworks-technologies
\keyword ActiveQt
Qt's ActiveX and COM support allows Qt for Windows developers to:
@@ -69,19 +70,23 @@
controls.
\endlist
- The ActiveQt framework consists of two modules:
+ The ActiveQt framework consists of two frameworks:
\list
- \o The \l QAxContainer module is a static
- library implementing QObject and QWidget subclasses, QAxObject and
- QAxWidget, that act as containers for COM objects and ActiveX
- controls.
- \o The \l QAxServer module is a static library that implements
+ \o The \l{Using ActiveX controls and COM objects in Qt}{QAxContainer}
+ module is a static library implementing QObject and QWidget subclasses,
+ QAxObject and QAxWidget, that act as containers for COM objects and
+ ActiveX controls.
+ \o The \l{Building ActiveX servers and controls with Qt}{QAxServer}
+ module is a static library that implements
functionality for in-process and executable COM servers. This
module provides the QAxAggregated, QAxBindable and QAxFactory
classes.
\endlist
+ A set of \l{Tools for ActiveQt}{tools} is provided to simplify the
+ developing and building of Qt projects that use ActiveX.
+
To build the static libraries, change into the \c activeqt directory
(usually \c QTDIR/src/activeqt), and run \c qmake and your make
tool in both the \c container and the \c control subdirectory.
diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri
index 35edbfb..a1b6634 100644
--- a/examples/symbianpkgrules.pri
+++ b/examples/symbianpkgrules.pri
@@ -10,6 +10,7 @@ vendorinfo = \
":\"Nokia, Qt\"" \
" "
-default_deployment.pkg_prerules += vendorinfo
+examples_deployment.pkg_prerules += vendorinfo
+DEPLOYMENT += examples_deployment
isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index a9d7dca..bd5768b 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -26,6 +26,8 @@ QMAKE_CFLAGS_RELEASE =
QMAKE_CFLAGS_DEBUG =
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
+
+VERSION_FLAGS.ARMCC = ARMCC_4_0
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
# Symbian build system applies -cwd source on the MWCC command line.
# this causes problems with include paths, -cwd include uses the same
@@ -33,7 +35,8 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
# This should really be fixed in raptor, as using CXXFLAGS means we pass
# both on the command line and rely on the compiler using the last specified
QMAKE_CXXFLAGS.CW = -cwd include
-QMAKE_CXXFLAGS.ARMCC = --visibility_inlines_hidden
+QMAKE_CXXFLAGS.ARMCC = --visibility_inlines_hidden
+QMAKE_CXXFLAGS.ARMCC_4_0 = --import_all_vtbl
QMAKE_CXXFLAGS.GCCE = -fvisibility-inlines-hidden
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
@@ -107,7 +110,5 @@ QMAKE_TAR = tar -cf
QMAKE_GZIP = gzip -9f
QT_ARCH = symbian
-
load(qt_config)
load(symbian/platform_paths)
-
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index 1de4b65..54b60be 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -180,17 +180,36 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment
tw << headerComment.arg(wrapperPkgFilename).arg(dateStr);
// Construct QStringList from pkg_prerules since we need search it before printed to file
+ // Note: Though there can't be more than one language or header line, use stringlists
+ // in case user wants comments to go with the rules.
QStringList rawPkgPreRules;
+ QStringList languageRules;
+ QStringList headerRules;
foreach(QString deploymentItem, project->values("DEPLOYMENT")) {
foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) {
QStringList pkgrulesValue = project->values(pkgrulesItem);
// If there is no stringlist defined for a rule, use rule name directly
// This is convenience for defining single line mmp statements
if (pkgrulesValue.isEmpty()) {
- rawPkgPreRules << pkgrulesItem;
+ if (pkgrulesItem.startsWith("&"))
+ languageRules << pkgrulesItem;
+ else if (pkgrulesItem.startsWith("#"))
+ headerRules << pkgrulesItem;
+ else
+ rawPkgPreRules << pkgrulesItem;
} else {
- foreach(QString pkgrule, pkgrulesValue) {
- rawPkgPreRules << pkgrule;
+ if (containsStartWithItem('&', pkgrulesValue)) {
+ foreach(QString pkgrule, pkgrulesValue) {
+ languageRules << pkgrule;
+ }
+ } else if (containsStartWithItem('#', pkgrulesValue)) {
+ foreach(QString pkgrule, pkgrulesValue) {
+ headerRules << pkgrule;
+ }
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ rawPkgPreRules << pkgrule;
+ }
}
}
}
@@ -198,17 +217,17 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment
// Apply some defaults if specific data does not exist in PKG pre-rules
- if (!containsStartWithItem('&', rawPkgPreRules)) {
+ if (languageRules.isEmpty()) {
// language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
- QString languageCode = "; Language\n&EN\n\n";
- t << languageCode;
- tw << languageCode;
- } else {
+ languageRules << "; Language\n&EN\n\n";
+ } else if (headerRules.isEmpty()) {
// In case user defines langs, he must take care also about SIS header
- if (!containsStartWithItem('#', rawPkgPreRules))
- fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n");
+ fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n");
}
+ t << languageRules.join("\n") << endl;
+ tw << languageRules.join("\n") << endl;
+
// name of application, UID and version
QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ',');
QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n";
@@ -222,9 +241,11 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment
} else {
tw << installerSisHeader << endl;
}
- if (!containsStartWithItem('#', rawPkgPreRules)) {
+
+ if (headerRules.isEmpty())
t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion);
- }
+ else
+ t << headerRules.join("\n") << endl;
// Localized vendor name
QString vendorName;
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index af85a2a..0fcd26d 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -873,6 +873,16 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t)
t << MMP_OPTION_CW " " << cw << endl;
if (!armcc.isEmpty())
t << MMP_OPTION_ARMCC " " << armcc << endl;
+
+ foreach(QString armccVersion, project->values("VERSION_FLAGS.ARMCC")) {
+ QStringList currentValues = project->values("QMAKE_CXXFLAGS." + armccVersion);
+ if (currentValues.size()) {
+ t << "#if defined(" << armccVersion << ")" << endl;
+ t << MMP_OPTION_ARMCC " " << currentValues.join(" ") << endl;
+ t << "#endif" << endl;
+ }
+ }
+
if (!gcce.isEmpty())
t << MMP_OPTION_GCCE " " << gcce << endl;
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index e24e9e2..5fe9703 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -11,7 +11,7 @@ symbian: {
} else {
TARGET.UID3 = 0xE00267C2
}
- webkitlibs.sources = QtWebKit$${QT_LIBINFIX}.dll
+ webkitlibs.sources = $$QMAKE_LIBDIR_QT/QtWebKit$${QT_LIBINFIX}.dll
webkitlibs.path = /sys/bin
vendorinfo = \
"; Localised Vendor name" \
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 191be6c..ca44264 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -50,6 +50,13 @@
QT_BEGIN_NAMESPACE
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+// when the system UI is Qt based, priority drop is not needed as CPU starved processes will not be killed.
+#undef QT_SYMBIAN_PRIORITY_DROP
+#else
+#define QT_SYMBIAN_PRIORITY_DROP
+#endif
+
#define WAKE_UP_PRIORITY CActive::EPriorityStandard
#define TIMER_PRIORITY CActive::EPriorityHigh
#define NULLTIMER_PRIORITY CActive::EPriorityLow
@@ -697,6 +704,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
bool handledSymbianEvent = false;
m_interrupt = false;
+#ifdef QT_SYMBIAN_PRIORITY_DROP
/*
* This QTime variable is used to measure the time it takes to finish
* the event loop. If we take too long in the loop, other processes
@@ -714,6 +722,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
} timeState = FirstRun;
TProcessPriority priority;
+#endif
while (1) {
if (block) {
@@ -727,10 +736,12 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
CActiveScheduler::Current()->WaitForAnyRequest();
}
+#ifdef QT_SYMBIAN_PRIORITY_DROP
if (timeState == SubsequentRun) {
time.start();
timeState = TimeStarted;
}
+#endif
TInt error;
handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt);
@@ -747,6 +758,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
break;
}
block = false;
+#ifdef QT_SYMBIAN_PRIORITY_DROP
if (timeState == TimeStarted && time.elapsed() > 100) {
priority = m_processHandle.Priority();
m_processHandle.SetPriority(EPriorityBackground);
@@ -759,6 +771,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla
}
if (timeState == FirstRun)
timeState = SubsequentRun;
+#endif
};
emit awake();
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 2bc5347..67ea00d 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -380,8 +380,12 @@ QT_BEGIN_NAMESPACE
\value Null A QChar with this value isNull().
\value Nbsp Non-breaking space.
- \value ReplacementCharacter
- \value ObjectReplacementCharacter The character shown when a font has no glyph for a certain codepoint. The square character is normally used.
+ \value ReplacementCharacter The character shown when a font has no glyph
+ for a certain codepoint. A special question mark character is often
+ used. Codecs use this codepoint when input data cannot be
+ represented in Unicode.
+ \value ObjectReplacementCharacter Used to represent an object such as an
+ image when such objects cannot be presented.
\value ByteOrderMark
\value ByteOrderSwapped
\value ParagraphSeparator
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index df8b525..fe25b0f 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -65,6 +65,10 @@
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
+#ifndef QT_NO_STYLE_S60
+#include <qs60style.h>
+#endif
+
#ifdef Q_WS_WINCE
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp
@@ -383,6 +387,16 @@ void QMessageBoxPrivate::updateSize()
int height = (layout->hasHeightForWidth())
? layout->totalHeightForWidth(width)
: layout->totalMinimumSize().height();
+
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+ s60Style = qobject_cast<QS60Style *>(QApplication::style());
+
+ //use custom pixel metric to deduce the minimum height of the messagebox
+ if (s60Style)
+ height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight));
+#endif
+
q->setFixedSize(width, height);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 36203de..e5471b0 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1884,7 +1884,8 @@ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize)
d_ptr->cacheMode = mode;
bool noVisualChange = (mode == NoCache && lastMode == NoCache)
|| (mode == NoCache && lastMode == DeviceCoordinateCache)
- || (mode == DeviceCoordinateCache && lastMode == NoCache);
+ || (mode == DeviceCoordinateCache && lastMode == NoCache)
+ || (mode == DeviceCoordinateCache && lastMode == DeviceCoordinateCache);
if (mode == NoCache) {
d_ptr->removeExtraItemCache();
} else {
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 29a4be8..4b612f4 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4301,12 +4301,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
if (!subPix.isNull()) {
// Blit the subpixmap into the main pixmap.
pixmapPainter.begin(pix);
- if (item->cacheMode() == QGraphicsItem::DeviceCoordinateCache
- && itemToPixmap.type() > QTransform::TxTranslate) {
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
- } else {
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
- }
+ pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
pixmapPainter.setClipRegion(pixmapExposed);
pixmapPainter.drawPixmap(br.topLeft(), subPix);
pixmapPainter.end();
@@ -4472,6 +4467,8 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
}
// Create or reuse offscreen pixmap, possibly scroll/blit from the old one.
+ // If the world transform is rotated we always recreate the cache to avoid
+ // wrong blending.
bool pixModified = false;
QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget];
bool invertable = true;
@@ -4479,7 +4476,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
if (invertable)
diff *= painter->worldTransform();
deviceData->lastTransform = painter->worldTransform();
- if (!invertable || diff.type() > QTransform::TxTranslate) {
+ if (!invertable
+ || diff.type() > QTransform::TxTranslate
+ || painter->worldTransform().type() > QTransform::TxScale) {
pixModified = true;
itemCache->allExposed = true;
itemCache->exposed.clear();
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index a94e103..c5ec01c 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -342,7 +342,7 @@ void QGraphicsWidget::resize(const QSizeF &size)
A side effect of calling this function is that the widget will receive
a move event and a resize event. Also, if the widget has a layout
assigned, the layout will activate.
-
+
\sa geometry(), resize()
*/
void QGraphicsWidget::setGeometry(const QRectF &rect)
@@ -580,7 +580,7 @@ void QGraphicsWidget::getWindowFrameMargins(qreal *left, qreal *top, qreal *righ
void QGraphicsWidget::unsetWindowFrameMargins()
{
Q_D(QGraphicsWidget);
- if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup &&
+ if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup &&
(d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) {
QStyleOptionTitleBar bar;
d->initStyleOptionTitleBar(&bar);
@@ -1187,7 +1187,7 @@ bool QGraphicsWidget::sceneEvent(QEvent *event)
Returns true if \a event has been recognized and processed; otherwise,
returns false.
-
+
\sa event()
*/
bool QGraphicsWidget::windowFrameEvent(QEvent *event)
@@ -1244,7 +1244,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos)
const QRectF r = windowFrameRect();
if (!r.contains(pos))
return Qt::NoSection;
-
+
const qreal left = r.left();
const qreal top = r.top();
const qreal right = r.right();
@@ -2371,6 +2371,4 @@ void QGraphicsWidget::dumpFocusChain()
QT_END_NAMESPACE
-#include "moc_qgraphicswidget.cpp"
-
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri
index 6d9f748..02e3e57 100644
--- a/src/gui/inputmethod/inputmethod.pri
+++ b/src/gui/inputmethod/inputmethod.pri
@@ -26,6 +26,6 @@ mac:!embedded {
symbian:contains(QT_CONFIG, s60) {
HEADERS += inputmethod/qcoefepinputcontext_p.h
SOURCES += inputmethod/qcoefepinputcontext_s60.cpp
- LIBS += -lfepbase
+ LIBS += -lfepbase -lakninputlanguage
}
diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp
index 501a36e..d47e343 100644
--- a/src/gui/inputmethod/qinputcontextfactory.cpp
+++ b/src/gui/inputmethod/qinputcontextfactory.cpp
@@ -73,6 +73,7 @@
#endif
#ifdef Q_WS_S60
#include "qcoefepinputcontext_p.h"
+#include "akninputlanguageinfo.h"
#endif
#include "private/qfactoryloader_p.h"
@@ -198,6 +199,42 @@ QStringList QInputContextFactory::keys()
return result;
}
+#if defined(Q_WS_S60)
+/*!
+ \internal
+
+ This function contains pure Symbian exception handling code for
+ getting S60 language list.
+ Returned object ownership is transfered to caller.
+*/
+static CAknInputLanguageList* s60LangListL()
+{
+ CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL();
+ CleanupStack::PushL(langInfo);
+ // In rare phone there is more than 7 languages installed -> use 7 as an array granularity
+ CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7);
+ CleanupStack::PushL(langList);
+ langInfo->AppendAvailableLanguagesL(langList);
+ CleanupStack::Pop(langList);
+ CleanupStack::PopAndDestroy(langInfo);
+ return langList;
+}
+
+/*!
+ \internal
+
+ This function utility function return S60 language list.
+ Returned object ownership is transfered to caller.
+*/
+static CAknInputLanguageList* s60LangList()
+{
+ CAknInputLanguageList *langList = NULL;
+ TRAP_IGNORE(langList = s60LangListL());
+ q_check_ptr(langList);
+ return langList;
+}
+#endif
+
/*!
Returns the languages supported by the QInputContext object
specified by \a key.
@@ -229,7 +266,15 @@ QStringList QInputContextFactory::languages( const QString &key )
#endif
#if defined(Q_WS_S60)
if (key == QLatin1String("coefep"))
- return QStringList(QString());
+ {
+ CAknInputLanguageList *langList = s60LangList();
+ int count = langList->Count();
+ for (int i = 0; i < count; ++i)
+ {
+ result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode())));
+ }
+ delete langList;
+ }
#endif
#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Q_UNUSED(key);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index af37e6e..65191a4 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -50,6 +50,7 @@
#include "qcalendarwidget.h"
#include "qdial.h"
#include "qdialog.h"
+#include "qmessagebox.h"
#include "qgroupbox.h"
#include "qheaderview.h"
#include "qlist.h"
@@ -91,10 +92,10 @@ static const qreal goldenRatio = 1.618;
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
-{240,320,1,16,"QVGA Landscape"},
-{320,240,1,16,"QVGA Portrait"},
-{360,640,1,16,"NHD Landscape"},
-{640,360,1,16,"NHD Portrait"},
+{240,320,1,17,"QVGA Landscape"},
+{320,240,1,17,"QVGA Portrait"},
+{360,640,1,17,"NHD Landscape"},
+{640,360,1,17,"NHD Portrait"},
{352,800,1,12,"E90 Landscape"}
// *** End of generated data ***
};
@@ -103,11 +104,11 @@ const int QS60StylePrivate::m_numberOfLayouts =
const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
-{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
-{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}
+{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106},
+{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106},
+{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135},
+{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135},
+{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106}
// *** End of generated data ***
};
@@ -126,7 +127,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed},
{SE_FrameLineEdit, QS60StyleEnums::SP_QsnFrInputCenter},
{SE_ListHighlight, QS60StyleEnums::SP_QsnFrListCenter},
- {SE_OptionsMenu, QS60StyleEnums::SP_QsnFrPopupCenter},
+ {SE_PopupBackground, QS60StyleEnums::SP_QsnFrPopupCenter},
{SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter},
{SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter},
{SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter},
@@ -249,8 +250,8 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
case SE_ListHighlight:
drawFrame(SF_ListHighlight, painter, rect, flags | SF_PointNorth);
break;
- case SE_OptionsMenu:
- drawFrame(SF_OptionsMenu, painter, rect, flags | SF_PointNorth);
+ case SE_PopupBackground:
+ drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth);
break;
case SE_SettingsList:
drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth);
@@ -636,6 +637,8 @@ void QS60StylePrivate::setFont(QWidget *widget) const
fontCategory = QS60StyleEnums::FC_Secondary;
} else if (qobject_cast<QGroupBox *>(widget)){
fontCategory = QS60StyleEnums::FC_Title;
+ } else if (qobject_cast<QMessageBox *>(widget)){
+ fontCategory = QS60StyleEnums::FC_Primary;
}
if (fontCategory != QS60StyleEnums::FC_Undefined) {
const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont)
@@ -2215,7 +2218,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) &&
option->palette.window().texture().cacheKey() ==
QS60StylePrivate::m_themePalette->window().texture().cacheKey())
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags);
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags);
else
commonStyleDraws = true;
}
@@ -2386,13 +2389,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
if (metricValue == KNotFound)
metricValue = QCommonStyle::pixelMetric(metric, option, widget);
- if (metric == PM_SubMenuOverlap && widget) {
- const QMenu *menu = qobject_cast<const QMenu *>(widget);
- if (menu && menu->activeAction() && menu->activeAction()->menu()) {
- const int menuWidth = menu->activeAction()->menu()->sizeHint().width();
- metricValue = -menuWidth;
- }
- }
//if layout direction is mirrored, switch left and right border margins
if (option && option->direction == Qt::RightToLeft) {
if (metric == PM_LayoutLeftMargin)
@@ -2400,6 +2396,12 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
else if (metric == PM_LayoutRightMargin)
metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin);
}
+
+ if (widget && (metric == PM_LayoutTopMargin))
+ if (widget->windowType() == Qt::Dialog)
+ //double the top layout margin for dialogs, it is very close to real value
+ //without having to define custom pixel metric
+ metricValue *= 2;
return metricValue;
}
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index af17843..c878538 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -58,7 +58,8 @@ enum {
PM_FrameCornerWidth = QStyle::PM_CustomBase + 1,
PM_FrameCornerHeight,
PM_BoldLineWidth,
- PM_ThinLineWidth
+ PM_ThinLineWidth,
+ PM_MessageBoxHeight
};
class QS60StylePrivate;
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 8bb2f7b..6ce4960 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
const int MAX_NON_CUSTOM_PIXELMETRICS = 92;
-const int CUSTOMVALUESCOUNT = 4;
+const int CUSTOMVALUESCOUNT = 5;
const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT;
@@ -411,7 +411,7 @@ public:
SE_TabBarTabWestActive,
SE_TabBarTabWestInactive,
SE_ListHighlight,
- SE_OptionsMenu,
+ SE_PopupBackground,
SE_SettingsList,
SE_TableItem,
SE_TableHeaderItem,
@@ -432,7 +432,7 @@ public:
SF_ButtonPressed,
SF_FrameLineEdit,
SF_ListHighlight,
- SF_OptionsMenu,
+ SF_PopupBackground,
SF_SettingsList,
SF_TableItem,
SF_TableHeaderItem,
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 2ea0ccd..6a552e0 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -859,11 +859,9 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
-#ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
frame->LockHeap();
memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
frame->UnlockHeap();
-#endif
const TRect outerRect(TPoint(0, 0), targetSize);
const TRect innerRect = innerRectFromElement(frameElement, outerRect);
@@ -983,16 +981,20 @@ TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameEl
switch(frameElement) {
case QS60StylePrivate::SF_PanelBackground:
// panel should have slightly slimmer border to enable thin line of background graphics between closest component
- widthShrink = widthShrink-2;
- heightShrink = heightShrink-2;
+ widthShrink = widthShrink - 2;
+ heightShrink = heightShrink - 2;
break;
case QS60StylePrivate::SF_ToolTip:
- widthShrink = widthShrink>>1;
- heightShrink = heightShrink>>1;
+ widthShrink = widthShrink >> 1;
+ heightShrink = heightShrink >> 1;
break;
case QS60StylePrivate::SF_ListHighlight:
- widthShrink = widthShrink-2;
- heightShrink = heightShrink-2;
+ widthShrink = widthShrink - 2;
+ heightShrink = heightShrink - 2;
+ break;
+ case QS60StylePrivate::SF_PopupBackground:
+ widthShrink = widthShrink + 5;
+ heightShrink = heightShrink + 5;
break;
default:
break;
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 82bc14f..bc7684a 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -58,6 +58,28 @@ QT_BEGIN_NAMESPACE
// TODO: Put channel specific stuff here so it does not polute qhttpnetworkconnection.cpp
+QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel()
+ : socket(0)
+ , state(IdleState)
+ , reply(0)
+ , written(0)
+ , bytesTotal(0)
+ , resendCurrent(false)
+ , lastStatus(0)
+ , pendingEncrypt(false)
+ , reconnectAttempts(2)
+ , authMehtod(QAuthenticatorPrivate::None)
+ , proxyAuthMehtod(QAuthenticatorPrivate::None)
+#ifndef QT_NO_OPENSSL
+ , ignoreAllSslErrors(false)
+#endif
+ , pipeliningSupported(PipeliningSupportUnknown)
+ , connection(0)
+{
+ // Inlining this function in the header leads to compiler error on
+ // release-armv5, on at least timebox 9.2 and 10.1.
+}
+
void QHttpNetworkConnectionChannel::init()
{
#ifndef QT_NO_OPENSSL
@@ -939,7 +961,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
errorCode = QNetworkReply::UnknownNetworkError;
break;
}
- QPointer<QObject> that = connection;
+ QPointer<QHttpNetworkConnection> that = connection;
QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString());
if (send2Reply) {
if (reply) {
@@ -994,8 +1016,16 @@ void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes)
sendRequest();
// otherwise we do nothing
}
+
#endif
+void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c)
+{
+ // Inlining this function in the header leads to compiler error on
+ // release-armv5, on at least timebox 9.2 and 10.1.
+ connection = c;
+}
+
QT_END_NAMESPACE
#include "moc_qhttpnetworkconnectionchannel_p.cpp"
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 5032d2b..51cb5e8 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -65,6 +65,7 @@
#include <private/qhttpnetworkrequest_p.h>
#include <private/qhttpnetworkreply_p.h>
+#include "qhttpnetworkconnection_p.h"
#ifndef QT_NO_HTTP
@@ -80,7 +81,6 @@ QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
class QHttpNetworkReply;
class QByteArray;
-class QHttpNetworkConnection;
#ifndef HttpMessagePair
typedef QPair<QHttpNetworkRequest, QHttpNetworkReply*> HttpMessagePair;
@@ -127,18 +127,10 @@ public:
QList<HttpMessagePair> alreadyPipelinedRequests;
- QHttpNetworkConnectionChannel() : socket(0), state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false),
- lastStatus(0), pendingEncrypt(false), reconnectAttempts(2),
- authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None)
-#ifndef QT_NO_OPENSSL
- , ignoreAllSslErrors(false)
-#endif
- , pipeliningSupported(PipeliningSupportUnknown)
- , connection(0)
- {}
-
- void setConnection(QHttpNetworkConnection *c) {connection = c;}
- QHttpNetworkConnection *connection;
+ QHttpNetworkConnectionChannel();
+
+ void setConnection(QHttpNetworkConnection *c);
+ QPointer<QHttpNetworkConnection> connection;
void init();
void close();
@@ -187,8 +179,6 @@ public:
#endif
};
-
-
QT_END_NAMESPACE
#endif // QT_NO_HTTP
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 4902cbd..b3b923d 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -537,7 +537,7 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
// adds 0.5 to each co-ordinate.
QTransform viewport2(1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
- 0.0f, devh, 1.0f);
+ 0.0f, devh + 1, 1.0f);
imageTransform = transform * viewport2;
// Calculate the scaling factor to use for turning cosmetic pens
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 4cdbfdc..ab8f26d 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -45,8 +45,10 @@
#include "qvg_p.h"
#include "qvgimagepool_p.h"
+#if defined(Q_OS_SYMBIAN)
#include <private/qt_s60_p.h>
#include <fbs.h>
+#endif
#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
#include <sgresource/sgimage.h>
typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 4219f6f..80366d1 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -290,27 +290,22 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti
void QDirectFBPixmapData::fromImage(const QImage &img,
Qt::ImageConversionFlags flags)
{
- if (img.depth() == 1 || img.format() == QImage::Format_RGB32) {
- fromImage(img.convertToFormat(screen->alphaPixmapFormat()), flags);
- return;
- }
-
- if (img.hasAlphaChannel()
+ if (img.depth() == 1) {
+ alpha = true;
#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img))
-#endif
- ) {
+ } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) {
alpha = true;
- imageFormat = screen->alphaPixmapFormat();
- } else {
- alpha = false;
- imageFormat = screen->pixelFormat();
+#else
+ } else if (img.hasAlphaChannel()) {
+ alpha = true;
+#endif
}
+ imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
QImage image;
- if (flags != Qt::AutoColor) {
+ if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) {
image = img.convertToFormat(imageFormat, flags);
flags = Qt::AutoColor;
- } else if (img.format() == QImage::Format_RGB32) {
+ } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) {
image = img.convertToFormat(imageFormat, flags);
} else {
image = img;
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index ee22bc3..6fd1725 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -124,11 +124,10 @@ class QODBCDriverPrivate
public:
enum DefaultCase{Lower, Mixed, Upper, Sensitive};
QODBCDriverPrivate()
- : hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false),
- isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false),
- isQuoteInitialized(false), quote(QLatin1Char('"'))
+ : hEnv(0), hDbc(0), unicode(false), useSchema(false), disconnectCount(0), isMySqlServer(false),
+ isMSSqlServer(false), isFreeTDSDriver(false), hasSQLFetchScroll(true),
+ hasMultiResultSets(false), isQuoteInitialized(false), quote(QLatin1Char('"'))
{
- unicode = false;
}
SQLHANDLE hEnv;
@@ -139,6 +138,7 @@ public:
int disconnectCount;
bool isMySqlServer;
bool isMSSqlServer;
+ bool isFreeTDSDriver;
bool hasSQLFetchScroll;
bool hasMultiResultSets;
@@ -165,7 +165,10 @@ public:
QODBCPrivate(QODBCDriverPrivate *dpp)
: hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp), userForwardOnly(false)
{
- unicode = false;
+ unicode = dpp->unicode;
+ useSchema = dpp->useSchema;
+ disconnectCount = dpp->disconnectCount;
+ hasSQLFetchScroll = dpp->hasSQLFetchScroll;
}
inline void clearValues()
@@ -340,7 +343,9 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi
break;
case SQL_CHAR:
case SQL_VARCHAR:
+#if (ODBCVER >= 0x0350)
case SQL_GUID:
+#endif
case SQL_LONGVARCHAR:
type = QVariant::String;
break;
@@ -365,44 +370,88 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
} else {
colSize++; // make sure there is room for more than the 0 termination
}
- r = SQLGetData(hStmt,
- column+1,
- SQL_C_TCHAR,
- NULL,
- 0,
- &lengthIndicator);
- if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0)
- colSize = lengthIndicator/sizeof(SQLTCHAR) + 1;
- QVarLengthArray<SQLTCHAR> buf(colSize);
- while (true) {
+ if(unicode) {
r = SQLGetData(hStmt,
column+1,
SQL_C_TCHAR,
- (SQLPOINTER)buf.data(),
- colSize*sizeof(SQLTCHAR),
+ NULL,
+ 0,
&lengthIndicator);
- if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
- if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) {
+ if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0)
+ colSize = lengthIndicator/sizeof(SQLTCHAR) + 1;
+ QVarLengthArray<SQLTCHAR> buf(colSize);
+ memset(buf.data(), 0, colSize*sizeof(SQLTCHAR));
+ while (true) {
+ r = SQLGetData(hStmt,
+ column+1,
+ SQL_C_TCHAR,
+ (SQLPOINTER)buf.data(),
+ colSize*sizeof(SQLTCHAR),
+ &lengthIndicator);
+ if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
+ if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) {
+ fieldVal.clear();
+ break;
+ }
+ // if SQL_SUCCESS_WITH_INFO is returned, indicating that
+ // more data can be fetched, the length indicator does NOT
+ // contain the number of bytes returned - it contains the
+ // total number of bytes that CAN be fetched
+ // colSize-1: remove 0 termination when there is more data to fetch
+ int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR);
+ fieldVal += fromSQLTCHAR(buf, rSize);
+ if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) {
+ // workaround for Drivermanagers that don't return SQL_NO_DATA
+ break;
+ }
+ } else if (r == SQL_NO_DATA) {
+ break;
+ } else {
+ qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')';
fieldVal.clear();
break;
}
- // if SQL_SUCCESS_WITH_INFO is returned, indicating that
- // more data can be fetched, the length indicator does NOT
- // contain the number of bytes returned - it contains the
- // total number of bytes that CAN be fetched
- // colSize-1: remove 0 termination when there is more data to fetch
- int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR);
- fieldVal += fromSQLTCHAR(buf, rSize);
- if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) {
- // workaround for Drivermanagers that don't return SQL_NO_DATA
+ }
+ } else {
+ r = SQLGetData(hStmt,
+ column+1,
+ SQL_C_CHAR,
+ NULL,
+ 0,
+ &lengthIndicator);
+ if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0)
+ colSize = lengthIndicator + 1;
+ QVarLengthArray<SQLCHAR> buf(colSize);
+ while (true) {
+ r = SQLGetData(hStmt,
+ column+1,
+ SQL_C_CHAR,
+ (SQLPOINTER)buf.data(),
+ colSize,
+ &lengthIndicator);
+ if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
+ if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) {
+ fieldVal.clear();
+ break;
+ }
+ // if SQL_SUCCESS_WITH_INFO is returned, indicating that
+ // more data can be fetched, the length indicator does NOT
+ // contain the number of bytes returned - it contains the
+ // total number of bytes that CAN be fetched
+ // colSize-1: remove 0 termination when there is more data to fetch
+ int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator;
+ fieldVal += QString::fromUtf8((const char *)buf.constData(), rSize);
+ if (lengthIndicator < (unsigned int)colSize) {
+ // workaround for Drivermanagers that don't return SQL_NO_DATA
+ break;
+ }
+ } else if (r == SQL_NO_DATA) {
+ break;
+ } else {
+ qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')';
+ fieldVal.clear();
break;
}
- } else if (r == SQL_NO_DATA) {
- break;
- } else {
- qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')';
- fieldVal.clear();
- break;
}
}
return fieldVal;
@@ -847,10 +896,6 @@ QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p)
: QSqlResult(db)
{
d = new QODBCPrivate(p);
- d->unicode = p->unicode;
- d->useSchema = p->useSchema;
- d->disconnectCount = p->disconnectCount;
- d->hasSQLFetchScroll = p->hasSQLFetchScroll;
}
QODBCResult::~QODBCResult()
@@ -1825,6 +1870,7 @@ bool QODBCDriver::open(const QString & db,
SQLSMALLINT cb;
QVarLengthArray<SQLTCHAR> connOut(1024);
+ memset(connOut.data(), 0, connOut.size() * sizeof(SQLTCHAR));
r = SQLDriverConnect(d->hDbc,
NULL,
#ifdef UNICODE
@@ -1917,6 +1963,7 @@ void QODBCDriverPrivate::checkUnicode()
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WCHAR)) {
unicode = true;
+ return;
}
r = SQLGetInfo(hDbc,
@@ -1926,6 +1973,7 @@ void QODBCDriverPrivate::checkUnicode()
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WVARCHAR)) {
unicode = true;
+ return;
}
r = SQLGetInfo(hDbc,
@@ -1935,7 +1983,25 @@ void QODBCDriverPrivate::checkUnicode()
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WLONGVARCHAR)) {
unicode = true;
+ return;
+ }
+ SQLHANDLE hStmt;
+ r = SQLAllocHandle(SQL_HANDLE_STMT,
+ hDbc,
+ &hStmt);
+
+ r = SQLExecDirect(hStmt, toSQLTCHAR(QLatin1String("select 'test'")).data(), SQL_NTS);
+ if(r == SQL_SUCCESS) {
+ r = SQLFetch(hStmt);
+ if(r == SQL_SUCCESS) {
+ QVarLengthArray<SQLWCHAR> buffer(10);
+ r = SQLGetData(hStmt, 1, SQL_C_WCHAR, buffer.data(), buffer.size() * sizeof(SQLWCHAR), NULL);
+ if(r == SQL_SUCCESS && fromSQLTCHAR(buffer) == QLatin1String("test")) {
+ unicode = true;
+ }
+ }
}
+ r = SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
}
bool QODBCDriverPrivate::checkDriver() const
@@ -2027,6 +2093,21 @@ void QODBCDriverPrivate::checkSqlServer()
isMySqlServer = serverType.contains(QLatin1String("mysql"), Qt::CaseInsensitive);
isMSSqlServer = serverType.contains(QLatin1String("Microsoft SQL Server"), Qt::CaseInsensitive);
}
+ r = SQLGetInfo(hDbc,
+ SQL_DRIVER_NAME,
+ serverString.data(),
+ serverString.size() * sizeof(SQLTCHAR),
+ &t);
+ if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
+ QString serverType;
+#ifdef UNICODE
+ serverType = fromSQLTCHAR(serverString, t/sizeof(SQLTCHAR));
+#else
+ serverType = QString::fromUtf8((const char *)serverString.constData(), t);
+#endif
+ isFreeTDSDriver = serverType.contains(QLatin1String("tdsodbc"), Qt::CaseInsensitive);
+ unicode = isFreeTDSDriver == false;
+ }
}
void QODBCDriverPrivate::checkHasSQLFetchScroll()
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index f837564..f3c2c09 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -44,7 +44,7 @@
#include <q3sqlcursor.h>
#include <qsqlfield.h>
#include <qsqldriver.h>
-
+#include <QSet>
#include "../qsqldatabase/tst_databases.h"
@@ -122,7 +122,7 @@ void tst_Q3SqlCursor::generic_data(const QString &engine)
{
if ( dbs.fillTestTable(engine) == 0 ) {
if(engine.isEmpty())
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
else
QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
}
@@ -131,7 +131,7 @@ void tst_Q3SqlCursor::generic_data(const QString &engine)
void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
{
if ( !db.isValid() )
- return;
+ return;
QSqlQuery q( db );
if (tst_Databases::isSqlServer(db)) {
@@ -143,20 +143,20 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
// please never ever change this table; otherwise fix all tests ;)
if ( tst_Databases::isMSAccess( db ) ) {
- QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null,"
- "t_char char(40), t_numeric number, primary key (id, t_varchar) )" ));
+ QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null,"
+ "t_char char(40), t_numeric number, primary key (id, t_varchar) )" ));
} else {
- QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null,"
- "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" ));
+ QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null,"
+ "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" ));
}
if ( tst_Databases::isSqlServer( db ) ) {
- //workaround for SQL SERVER since he can store unicode only in nvarchar fields
- QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, "
- "t_varchar nvarchar(80) not null, t_char nchar(80) )" ));
+ //workaround for SQL SERVER since he can store unicode only in nvarchar fields
+ QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, "
+ "t_varchar nvarchar(80) not null, t_char nchar(80) )" ));
} else {
- QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, "
- "t_varchar varchar(100) not null," "t_char char(100))" ));
+ QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, "
+ "t_varchar varchar(100) not null," "t_char char(100))" ));
}
if (tst_Databases::isMSAccess(db)) {
@@ -169,7 +169,7 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
void tst_Q3SqlCursor::dropTestTables( QSqlDatabase db )
{
if ( !db.isValid() )
- return;
+ return;
QStringList tableNames;
tableNames << qtest
<< qTableName( "qtest_unicode", __FILE__ )
@@ -183,7 +183,7 @@ void tst_Q3SqlCursor::dropTestTables( QSqlDatabase db )
void tst_Q3SqlCursor::populateTestTables( QSqlDatabase db )
{
if (!db.isValid())
- return;
+ return;
QSqlQuery q( db );
q.exec( "delete from " + qtest ); //not fatal
@@ -200,21 +200,21 @@ void tst_Q3SqlCursor::initTestCase()
dbs.open();
for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) {
- QSqlDatabase db = QSqlDatabase::database( (*it) );
- CHECK_DATABASE( db );
+ QSqlDatabase db = QSqlDatabase::database( (*it) );
+ CHECK_DATABASE( db );
- dropTestTables( db ); //in case of leftovers
- createTestTables( db );
- populateTestTables( db );
+ dropTestTables( db ); //in case of leftovers
+ createTestTables( db );
+ populateTestTables( db );
}
}
void tst_Q3SqlCursor::cleanupTestCase()
{
for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) {
- QSqlDatabase db = QSqlDatabase::database( (*it) );
- CHECK_DATABASE( db );
- dropTestTables( db );
+ QSqlDatabase db = QSqlDatabase::database( (*it) );
+ CHECK_DATABASE( db );
+ dropTestTables( db );
}
dbs.close();
@@ -230,9 +230,9 @@ void tst_Q3SqlCursor::cleanup()
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
if ( QTest::currentTestFailed() ) {
- //since Oracle ODBC totally craps out on error, we init again
- db.close();
- db.open();
+ //since Oracle ODBC totally craps out on error, we init again
+ db.close();
+ db.open();
}
}
@@ -244,10 +244,10 @@ void tst_Q3SqlCursor::copyConstructor()
Q3SqlCursor cur2;
{
- Q3SqlCursor cur( qtest, true, db );
- QVERIFY_SQL(cur, select( cur.index( QString("id") ) ));
- cur2 = Q3SqlCursor( cur );
- // let "cur" run out of scope...
+ Q3SqlCursor cur( qtest, true, db );
+ QVERIFY_SQL(cur, select( cur.index( QString("id") ) ));
+ cur2 = Q3SqlCursor( cur );
+ // let "cur" run out of scope...
}
QSqlRecord* rec = cur2.primeUpdate();
@@ -256,8 +256,8 @@ void tst_Q3SqlCursor::copyConstructor()
int i = 0;
while ( cur2.next() ) {
- QVERIFY( cur2.value("id").toInt() == i );
- i++;
+ QVERIFY( cur2.value("id").toInt() == i );
+ i++;
}
}
@@ -271,8 +271,8 @@ void tst_Q3SqlCursor::value()
QVERIFY_SQL(cur, select( cur.index( QString("id") ) ));
int i = 0;
while ( cur.next() ) {
- QCOMPARE(cur.value("id").toInt(), i);
- i++;
+ QCOMPARE(cur.value("id").toInt(), i);
+ i++;
}
}
@@ -285,11 +285,11 @@ void tst_Q3SqlCursor::primaryIndex()
Q3SqlCursor cur( qtest, true, db );
QSqlIndex index = cur.primaryIndex();
if ( tst_Databases::isMSAccess( db ) ) {
- QCOMPARE( index.fieldName(1).upper(), QString( "ID" ) );
- QCOMPARE( index.fieldName(0).upper(), QString( "T_VARCHAR" ) );
+ QCOMPARE( index.fieldName(1).upper(), QString( "ID" ) );
+ QCOMPARE( index.fieldName(0).upper(), QString( "T_VARCHAR" ) );
} else {
- QCOMPARE( index.fieldName(0).upper(), QString( "ID" ) );
- QCOMPARE( index.fieldName(1).upper(), QString( "T_VARCHAR" ) );
+ QCOMPARE( index.fieldName(0).upper(), QString( "ID" ) );
+ QCOMPARE( index.fieldName(1).upper(), QString( "T_VARCHAR" ) );
}
QVERIFY(!index.isDescending(0));
QVERIFY(!index.isDescending(1));
@@ -308,10 +308,10 @@ void tst_Q3SqlCursor::insert()
// check that primeInsert returns a valid QSqlRecord
QCOMPARE( (int)irec->count(), 4 );
if ( ( irec->field( 0 ).type() != QVariant::Int ) &&
- ( irec->field( 0 ).type() != QVariant::String ) &&
+ ( irec->field( 0 ).type() != QVariant::String ) &&
( irec->field( 0 ).type() != QVariant::Double ) ) {
- QFAIL( QString( "Wrong datatype %1 for field 'ID'"
- " (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) );
+ QFAIL( QString( "Wrong datatype %1 for field 'ID'"
+ " (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) );
}
QCOMPARE( QVariant::typeToName( irec->field( 1 ).type() ), QVariant::typeToName( QVariant::String ) );
QCOMPARE( QVariant::typeToName( irec->field( 2 ).type() ), QVariant::typeToName( QVariant::String ) );
@@ -327,7 +327,9 @@ void tst_Q3SqlCursor::insert()
irec->setValue( "t_char", "SomeChar" );
irec->setValue( "t_numeric", 400.400 );
- QCOMPARE( cur.insert(), 1 );
+ QSet<int> validReturns(QSet<int>() << -1 << 1);
+
+ QVERIFY( validReturns.contains(cur.insert()) );
// restore old test-tables
populateTestTables( db );
@@ -338,6 +340,7 @@ void tst_Q3SqlCursor::insertSpecial()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
+ QSet<int> validReturns(QSet<int>() << -1 << 1);
Q3SqlCursor cur( qtest, true, db );
QSqlRecord* irec = cur.primeInsert();
@@ -355,25 +358,25 @@ void tst_Q3SqlCursor::insertSpecial()
// INSERT the strings
QStringList::Iterator it;
for ( it = strings.begin(); it != strings.end(); ++it ) {
- QSqlRecord* irec = cur.primeInsert();
- QVERIFY( irec != 0 );
- irec->setValue( "id", i );
- irec->setValue( "t_varchar", (*it) );
- irec->setValue( "t_char", (*it) );
- irec->setValue( "t_numeric", (double)i );
- ++i;
- QCOMPARE( cur.insert(), 1 );
+ QSqlRecord* irec = cur.primeInsert();
+ QVERIFY( irec != 0 );
+ irec->setValue( "id", i );
+ irec->setValue( "t_varchar", (*it) );
+ irec->setValue( "t_char", (*it) );
+ irec->setValue( "t_numeric", (double)i );
+ ++i;
+ QVERIFY( validReturns.contains(cur.insert()) );
}
QVERIFY( cur.select( "id >= 800 and id < 900" ) );
int i2 = 800;
while( cur.next() ) {
- QCOMPARE( cur.value( "id" ).toInt(), i2 );
- QCOMPARE( cur.value( "t_varchar" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) );
- QCOMPARE( cur.value( "t_char" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) );
- QCOMPARE( cur.value( "t_numeric" ).toDouble(), (double)i2 );
- ++i2;
+ QCOMPARE( cur.value( "id" ).toInt(), i2 );
+ QCOMPARE( cur.value( "t_varchar" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) );
+ QCOMPARE( cur.value( "t_char" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) );
+ QCOMPARE( cur.value( "t_numeric" ).toDouble(), (double)i2 );
+ ++i2;
}
QCOMPARE( i, i2 );
@@ -385,6 +388,7 @@ void tst_Q3SqlCursor::batchInsert()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
+ QSet<int> validReturns(QSet<int>() << -1 << 1);
QSqlQuery q( db );
q.exec( "delete from " + qtest );
@@ -393,16 +397,16 @@ void tst_Q3SqlCursor::batchInsert()
int i = 0;
for ( ; i < 100; ++i ) {
- QSqlRecord* irec = cur.primeInsert();
- Q_ASSERT( irec );
- irec->setValue( "id", i );
- irec->setValue( "t_varchar", "blah" );
- irec->setValue( "t_char", "blah" );
- irec->setValue( "t_numeric", 1.1 );
- if ( db.driverName().startsWith( "QSQLITE" ) ) {
- QVERIFY( cur.insert( true ) );
- } else {
- QCOMPARE( cur.insert( true ), 1 );
+ QSqlRecord* irec = cur.primeInsert();
+ Q_ASSERT( irec );
+ irec->setValue( "id", i );
+ irec->setValue( "t_varchar", "blah" );
+ irec->setValue( "t_char", "blah" );
+ irec->setValue( "t_numeric", 1.1 );
+ if ( db.driverName().startsWith( "QSQLITE" ) ) {
+ QVERIFY( cur.insert( true ) );
+ } else {
+ QVERIFY( validReturns.contains(cur.insert( true )) );
}
}
@@ -413,18 +417,18 @@ void tst_Q3SqlCursor::batchInsert()
irec->setValue( "t_varchar", "blah" );
irec->setValue( "t_char", "blah" );
irec->setValue( "t_numeric", 1.1 );
- if ( db.driverName().startsWith( "QSQLITE" ) ) {
- QVERIFY( cur.insert( false ) );
- } else {
- QCOMPARE( cur.insert( false ), 1 );
+ if ( db.driverName().startsWith( "QSQLITE" ) ) {
+ QVERIFY( cur.insert( false ) );
+ } else {
+ QVERIFY( validReturns.contains(cur.insert( false )) );
}
}
i = 0;
QVERIFY_SQL(q, exec( "select * from " + qtest + " order by id" ));
while ( q.next() ) {
- QCOMPARE( q.value( 0 ).toInt(), i );
- i++;
+ QCOMPARE( q.value( 0 ).toInt(), i );
+ i++;
}
QCOMPARE( i, 200 );
@@ -436,7 +440,7 @@ static QString dumpUtf8( const QString& str )
{
QString res;
for ( int i = 0; i < (int)str.length(); ++i ) {
- res += "0x" + QString::number( str[ i ].unicode(), 16 ) + ' ';
+ res += "0x" + QString::number( str[ i ].unicode(), 16 ) + ' ';
}
return res;
}
@@ -448,7 +452,7 @@ void tst_Q3SqlCursor::insertORA()
CHECK_DATABASE( db );
if (tst_Databases::getOraVersion(db) < 9)
- QSKIP("Need Oracle >= 9", SkipSingle);
+ QSKIP("Need Oracle >= 9", SkipSingle);
/****** CHARSET TEST ******/
@@ -466,8 +470,8 @@ void tst_Q3SqlCursor::insertORA()
QVERIFY_SQL(cur, select());
QVERIFY( cur.next() );
if ( cur.value( "t_char" ).toString() != val1 )
- qDebug( QString( "Wrong value for t_char: expected '%1', got '%2'" ).arg( val1 ).arg(
- cur.value( "t_char" ).toString() ) );
+ qDebug( QString( "Wrong value for t_char: expected '%1', got '%2'" ).arg( val1 ).arg(
+ cur.value( "t_char" ).toString() ) );
static const unsigned short utf8arr[] = { 0xd792,0xd79c,0xd792,0xd79c,0xd799,0x00 };
static const QString utf8str = QString::fromUcs2( utf8arr );
@@ -524,7 +528,7 @@ void tst_Q3SqlCursor::unicode()
static const QString utf8str = QString::fromUtf8( "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." );
if ( !db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
- QSKIP( "DBMS not Unicode capable", SkipSingle );
+ QSKIP( "DBMS not Unicode capable", SkipSingle );
}
// ascii in the data storage, can't transliterate properly. invalid test.
if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb"))
@@ -640,11 +644,11 @@ void tst_Q3SqlCursor::select()
QSqlIndex idx = cur4.primaryIndex( false );
QCOMPARE( (int)idx.count(), 2 );
if ( tst_Databases::isMSAccess( db ) ) {
- QCOMPARE( idx.field( 1 ).name().upper(), QString("ID") );
- QCOMPARE( idx.field( 0 ).name().upper(), QString("T_VARCHAR") );
+ QCOMPARE( idx.field( 1 ).name().upper(), QString("ID") );
+ QCOMPARE( idx.field( 0 ).name().upper(), QString("T_VARCHAR") );
} else {
- QCOMPARE( idx.field( 0 ).name().upper(), QString("ID") );
- QCOMPARE( idx.field( 1 ).name().upper(), QString("T_VARCHAR") );
+ QCOMPARE( idx.field( 0 ).name().upper(), QString("ID") );
+ QCOMPARE( idx.field( 1 ).name().upper(), QString("T_VARCHAR") );
}
#ifdef QT_DEBUG
@@ -688,17 +692,18 @@ void tst_Q3SqlCursor::updateNoPK()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
-
+ QSet<int> validReturns(QSet<int>() << -1 << 1);
+
QSqlQuery q(db);
QVERIFY_SQL(q, exec("create table " + qTableName( "qtestPK", __FILE__ ) + " (id int, name varchar(20), num numeric)"));
-
+
Q3SqlCursor cur(qTableName("qtestPK", __FILE__), true, db);
QSqlRecord* rec = cur.primeInsert();
Q_ASSERT(rec);
rec->setNull(0);
rec->setNull(1);
rec->setNull(2);
- QVERIFY_SQL(cur, insert() == 1);
+ QVERIFY(validReturns.contains(cur.insert()));
if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) {
// Only QPSQL, QMYSQL, QODBC and QOCI drivers currently use escape identifiers for column names
@@ -713,8 +718,8 @@ void tst_Q3SqlCursor::updateNoPK()
+ " values (NULL,NULL,NULL)");
QCOMPARE(cur.lastQuery(), query);
} else {
- QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) +
- " (\"id\",\"name\",\"num\") values (NULL,NULL,NULL)"));
+ QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) +
+ " (\"id\",\"name\",\"num\") values (NULL,NULL,NULL)"));
}
}
@@ -733,7 +738,7 @@ void tst_Q3SqlCursor::updateNoPK()
qTableName("qtestPK", __FILE__) + ".num IS NULL";
if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) {
if (!db.driverName().startsWith("QSQLITE")) {
- QCOMPARE(cur.lastQuery(), expect);
+ QCOMPARE(cur.lastQuery(), expect);
}
}
QVERIFY(cur.select(cur.index(QString("id"))));
@@ -750,6 +755,7 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() {
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
+ QSet<int> validReturns(QSet<int>() << -1 << 1);
// The bugfix (and this test) depends on QSqlDriver::escapeIdentifier(...)
// to be implemented, which is currently only the case for the
@@ -778,7 +784,7 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() {
r->setValue("firsT NaMe", "Kong");
r->setValue("lastNaMe", "Harald");
- QVERIFY(cur.insert() == 1);
+ QVERIFY(validReturns.contains(cur.insert()));
cur.select();
cur.next();
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index f4fdacc..01ef9a2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -384,6 +384,7 @@ private slots:
void tabChangesFocus();
void tabChangesFocus_data();
void cacheMode();
+ void cacheMode2();
void updateCachedItemAfterMove();
void deviceTransform_data();
void deviceTransform();
@@ -6824,6 +6825,9 @@ void tst_QGraphicsItem::cacheMode()
QTRY_COMPARE(tester->repaints, 4);
QCOMPARE(testerChild->repaints, 4);
QCOMPARE(testerChild2->repaints, 3);
+ tester->resetTransform();
+ testerChild->resetTransform();
+ testerChild2->resetTransform();
// Explicit update causes a repaint.
tester->update(0, 0, 5, 5);
@@ -6897,23 +6901,24 @@ void tst_QGraphicsItem::cacheMode()
// because the parent is rotated with a perspective.
testerChild->setPos(1, 1);
QTest::qWait(25);
- QTRY_COMPARE(tester->repaints, 10);
+ QTRY_COMPARE(tester->repaints, 11);
QCOMPARE(testerChild->repaints, 10);
QCOMPARE(testerChild2->repaints, 5);
+ tester->resetTransform();
// Make a huge item
tester->setGeometry(QRectF(-4000, -4000, 8000, 8000));
QTest::qWait(25);
- QTRY_COMPARE(tester->repaints, 11);
- QCOMPARE(testerChild->repaints, 10);
+ QTRY_COMPARE(tester->repaints, 12);
+ QCOMPARE(testerChild->repaints, 11);
QCOMPARE(testerChild2->repaints, 5);
// Move the large item - will cause a repaint as the
// cache is clipped.
tester->setPos(5, 0);
QTest::qWait(25);
- QTRY_COMPARE(tester->repaints, 12);
- QCOMPARE(testerChild->repaints, 10);
+ QTRY_COMPARE(tester->repaints, 13);
+ QCOMPARE(testerChild->repaints, 11);
QCOMPARE(testerChild2->repaints, 5);
// Hiding and showing should invalidate the cache
@@ -6921,11 +6926,83 @@ void tst_QGraphicsItem::cacheMode()
QTest::qWait(25);
tester->show();
QTest::qWait(25);
- QTRY_COMPARE(tester->repaints, 13);
- QCOMPARE(testerChild->repaints, 11);
+ QTRY_COMPARE(tester->repaints, 14);
+ QCOMPARE(testerChild->repaints, 12);
QCOMPARE(testerChild2->repaints, 6);
}
+void tst_QGraphicsItem::cacheMode2()
+{
+ QGraphicsScene scene(0, 0, 100, 100);
+ QGraphicsView view(&scene);
+ view.resize(150, 150);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+
+ // Increase the probability of window activation
+ // not causing another repaint of test items.
+ QTest::qWait(50);
+
+ EventTester *tester = new EventTester;
+ scene.addItem(tester);
+ QTest::qWait(10);
+ QTRY_COMPARE(tester->repaints, 1);
+
+ // Switching from NoCache to NoCache (no repaint)
+ tester->setCacheMode(QGraphicsItem::NoCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 1);
+
+ // Switching from NoCache to DeviceCoordinateCache (no repaint)
+ tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 1);
+
+ // Switching from DeviceCoordinateCache to DeviceCoordinateCache (no repaint)
+ tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 1);
+
+ // Switching from DeviceCoordinateCache to NoCache (no repaint)
+ tester->setCacheMode(QGraphicsItem::NoCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 1);
+
+ // Switching from NoCache to ItemCoordinateCache (repaint)
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 2);
+
+ // Switching from ItemCoordinateCache to ItemCoordinateCache (no repaint)
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 2);
+
+ // Switching from ItemCoordinateCache to ItemCoordinateCache with different size (repaint)
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(100, 100));
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 3);
+
+ // Switching from ItemCoordinateCache to NoCache (repaint)
+ tester->setCacheMode(QGraphicsItem::NoCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 4);
+
+ // Switching from DeviceCoordinateCache to ItemCoordinateCache (repaint)
+ tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 4);
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 5);
+
+ // Switching from ItemCoordinateCache to DeviceCoordinateCache (repaint)
+ tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ QTest::qWait(50);
+ QTRY_COMPARE(tester->repaints, 6);
+}
+
void tst_QGraphicsItem::updateCachedItemAfterMove()
{
// A simple item that uses ItemCoordinateCache
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 4922a89..e269092 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -283,6 +283,9 @@ private Q_SLOTS:
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
#endif
+
+ // NOTE: This test must be last!
+ void parentingRepliesToTheApp();
};
QT_BEGIN_NAMESPACE
@@ -3931,7 +3934,7 @@ void tst_QNetworkReply::httpConnectionCount()
for (int i = 0; i < 10; i++) {
QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i)));
QNetworkReply* reply = manager.get(request);
- reply->setParent(this);
+ reply->setParent(&server);
}
int pendingConnectionCount = 0;
@@ -4205,5 +4208,13 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot()
#endif // QT_NO_OPENSSL
+// NOTE: This test must be last testcase in tst_qnetworkreply!
+void tst_QNetworkReply::parentingRepliesToTheApp()
+{
+ QNetworkRequest request (QUrl("http://" + QtNetworkSettings::serverName()));
+ manager.get(request)->setParent(this); // parent to this object
+ manager.get(request)->setParent(qApp); // parent to the app
+}
+
QTEST_MAIN(tst_QNetworkReply)
#include "tst_qnetworkreply.moc"
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index b9ab73f..db3a929 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -1137,17 +1137,14 @@ void tst_QSqlQuery::last()
QVERIFY( q.last() );
- if ( !tst_Databases::isMSAccess( db ) )
- // Access doesn't return the correct position
- QCOMPARE( q.at(), ( i-1 ) );
+ QSet<int> validReturns(QSet<int>() << -1 << i-1);
+ QVERIFY( validReturns.contains(q.at()) );
QSqlQuery q2( "select * from " + qtest, db );
QVERIFY( q2.last() );
- if ( !tst_Databases::isMSAccess( db ) )
- // Access doesn't return the correct position
- QCOMPARE( q.at(), ( i-1 ) );
+ QVERIFY( validReturns.contains(q.at()) );
}
void tst_QSqlQuery::seek()
diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp
index beb785e..814e185 100644
--- a/util/s60pixelmetrics/pixel_metrics.cpp
+++ b/util/s60pixelmetrics/pixel_metrics.cpp
@@ -50,7 +50,7 @@
// so that we can keep dynamic and static values inline.
// Please adjust version data if correcting dynamic PM calculations.
const TInt KPMMajorVersion = 1;
-const TInt KPMMinorVersion = 16;
+const TInt KPMMinorVersion = 17;
TPixelMetricsVersion PixelMetrics::Version()
{
@@ -869,7 +869,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric)
// The difference of center piece from border tell the frame width.
if ( value == QStyle::PM_FocusFrameHMargin)
{
- //use topleft for horizontal as S60 uses different values for right and left borders
+ //use topleft for horizontal as S60 uses different values for right and left borders
value = listSinglePaneText.TextRect().iTl.iX - highlightRect.Rect().iTl.iX;
}
else
@@ -1003,6 +1003,13 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric)
case QStyle::PM_Custom_ThinLineWidth:
value = 1;
break;
+ case QStyle::PM_Custom_MessageBoxHeight:
+ {
+ TAknLayoutRect popupRect;
+ popupRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_window_general(0));
+ value = popupRect.Rect().Height();
+ }
+ break;
case QStyle::PM_ButtonShiftHorizontal:
case QStyle::PM_ButtonShiftVertical:
value = 0;
diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h
index 3536c0e..4b0f57e 100644
--- a/util/s60pixelmetrics/pixel_metrics.h
+++ b/util/s60pixelmetrics/pixel_metrics.h
@@ -185,7 +185,9 @@ NONSHARABLE_CLASS( QStyle )
// Bold line width
PM_Custom_BoldLineWidth,
// Thin line width
- PM_Custom_ThinLineWidth
+ PM_Custom_ThinLineWidth,
+ // Height of a popup info messagebox
+ PM_Custom_MessageBoxHeight
};
};
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
index acc6137..a88499d 100644
--- a/util/s60pixelmetrics/pm_mapperapp.cpp
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -155,7 +155,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
Exit();
break;
case ECmdSwitchOutput:
- {
+ {
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
@@ -166,7 +166,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
else
bufferPtr.Append(_L("screen."));
ShowL( *buffer, last );
- }
+ }
break;
case ECmdStatus:
{
@@ -323,7 +323,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
TInt myValue = KErrNotFound;
for (;;)
{
- if (index==QStyle::PM_Custom_ThinLineWidth)
+ if (index==QStyle::PM_Custom_MessageBoxHeight)
{
last = ETrue;
}
@@ -656,6 +656,9 @@ void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue
case QStyle::PM_Custom_BoldLineWidth:
bufferPtr.Append(_L("C_BoldLineWidth: "));
break;
+ case QStyle::PM_Custom_MessageBoxHeight:
+ bufferPtr.Append(_L("C_MsgBoxHeight: "));
+ break;
default:
bufferPtr.Append(_L("Default: "));
break;