summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-06-23 10:32:42 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-06-23 10:32:42 (GMT)
commite1eceedaa635d0180eb798b00c3da93156d7af63 (patch)
tree04325155309fd225d68a4cf118be34c2378cb26a /src
parent2c96aeb45320ade7e2c074433560185f16631374 (diff)
parent71be46c61c582d2f4635a1e420e44d57ddb5857a (diff)
downloadQt-e1eceedaa635d0180eb798b00c3da93156d7af63.zip
Qt-e1eceedaa635d0180eb798b00c3da93156d7af63.tar.gz
Qt-e1eceedaa635d0180eb798b00c3da93156d7af63.tar.bz2
Merge commit 'origin/4.5'
Conflicts: src/sql/drivers/psql/qsql_psql.cpp
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp5
-rw-r--r--src/gui/dialogs/qwizard.cpp25
-rw-r--r--src/gui/dialogs/qwizard.h1
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/gui/itemviews/qlistview.cpp2
-rw-r--r--src/gui/painting/qbackingstore.cpp5
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp23
-rw-r--r--src/gui/text/qfontengine_mac.mm5
-rw-r--r--src/opengl/qpaintengine_opengl.cpp20
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp8
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp2
-rw-r--r--src/qt_install.pri16
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp20
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp29
15 files changed, 104 insertions, 61 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index c80d73b..896e3b8 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -36,7 +36,10 @@
#include <QMetaEnum>
#include <QUrl>
#include <QEvent>
-#include <phonon>
+
+#include <Phonon/AudioOutput>
+#include <Phonon/MediaObject>
+#include <Phonon/VideoWidget>
using namespace Phonon;
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 2c1c2e3..a2dfa52 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -560,6 +560,7 @@ public:
void enableUpdates();
void _q_emitCustomButtonClicked();
void _q_updateButtonStates();
+ void _q_handleFieldObjectDestroyed(QObject *);
void setStyle(QStyle *style);
#ifdef Q_WS_MAC
static QPixmap findDefaultBackgroundPixmap();
@@ -731,6 +732,8 @@ void QWizardPrivate::cleanupPagesNotInHistory()
void QWizardPrivate::addField(const QWizardField &field)
{
+ Q_Q(QWizard);
+
QWizardField myField = field;
myField.resolve(defaultPropertyTable);
@@ -744,15 +747,23 @@ void QWizardPrivate::addField(const QWizardField &field)
if (myField.mandatory && !myField.changedSignal.isEmpty())
QObject::connect(myField.object, myField.changedSignal,
myField.page, SLOT(_q_maybeEmitCompleteChanged()));
+ QObject::connect(
+ myField.object, SIGNAL(destroyed(QObject *)), q,
+ SLOT(_q_handleFieldObjectDestroyed(QObject *)));
}
void QWizardPrivate::removeFieldAt(int index)
{
+ Q_Q(QWizard);
+
const QWizardField &field = fields.at(index);
fieldIndexMap.remove(field.name);
if (field.mandatory && !field.changedSignal.isEmpty())
QObject::disconnect(field.object, field.changedSignal,
field.page, SLOT(_q_maybeEmitCompleteChanged()));
+ QObject::disconnect(
+ field.object, SIGNAL(destroyed(QObject *)), q,
+ SLOT(_q_handleFieldObjectDestroyed(QObject *)));
fields.remove(index);
}
@@ -1595,6 +1606,20 @@ void QWizardPrivate::_q_updateButtonStates()
enableUpdates();
}
+void QWizardPrivate::_q_handleFieldObjectDestroyed(QObject *object)
+{
+ QVector<QWizardField>::iterator it = fields.begin();
+ while (it != fields.end()) {
+ const QWizardField &field = *it;
+ if (field.object == object) {
+ fieldIndexMap.remove(field.name);
+ it = fields.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
void QWizardPrivate::setStyle(QStyle *style)
{
for (int i = 0; i < QWizard::NButtons; i++)
diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h
index 1d1a9b5..d1f9cf7 100644
--- a/src/gui/dialogs/qwizard.h
+++ b/src/gui/dialogs/qwizard.h
@@ -197,6 +197,7 @@ private:
Q_DECLARE_PRIVATE(QWizard)
Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked())
Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates())
+ Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *))
friend class QWizardPage;
};
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 57269ce..07ebb8c 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -839,7 +839,7 @@ bool QGraphicsProxyWidget::event(QEvent *event)
// ### Qt 4.5: this code must also go into a reimplementation
// of inputMethodEvent().
QWidget *focusWidget = d->widget->focusWidget();
- if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
+ if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
QApplication::sendEvent(focusWidget, event);
break;
}
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index f1b0d19..4652b91 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -2238,7 +2238,7 @@ QListViewItem QStaticListViewBase::indexToListViewItem(const QModelIndex &index)
{
if (flowPositions.isEmpty()
|| segmentPositions.isEmpty()
- || index.row() > flowPositions.count())
+ || index.row() >= flowPositions.count())
return QListViewItem();
const int segment = qBinarySearch<int>(segmentStartRows, index.row(),
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index d3b4157..34bc578 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -258,7 +258,10 @@ void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn)
bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget)
{
const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
- return windowSurface->scroll(QRect(pos, rect.size()), dx, dy);
+ const QRect tlwRect(QRect(pos, rect.size()));
+ if (dirty.intersects(tlwRect))
+ return false; // We don't want to scroll junk.
+ return windowSurface->scroll(tlwRect, dx, dy);
}
void QWidgetBackingStore::releaseBuffer()
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 37f7b6d..37a88a3 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1322,6 +1322,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
delete s->clip;
s->clip = clip;
+ s->clip->enabled = true;
s->flags.has_clip_ownership = true;
} else { // intersect clip with current clip
@@ -1338,6 +1339,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
s->clip->setClipRect(base->clipRect & clipRect);
else
s->clip->setClipRegion(base->clipRegion & clipRect);
+ s->clip->enabled = true;
} else {
QPaintEngineEx::clip(rect, op);
return;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 6953e04..34305c2 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2545,6 +2545,9 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op)
Q_D(QPainter);
if (d->extended) {
+ if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ op = Qt::ReplaceClip;
+
if (!d->engine) {
qWarning("QPainter::setClipRect: Painter not active");
return;
@@ -2598,6 +2601,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
return;
}
+ if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ op = Qt::ReplaceClip;
+
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(rect, op);
@@ -2606,9 +2612,6 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
return;
}
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
- op = Qt::ReplaceClip;
-
d->state->clipRegion = rect;
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
@@ -2651,6 +2654,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
return;
}
+ if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ op = Qt::ReplaceClip;
+
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(r, op);
@@ -2659,9 +2665,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
return;
}
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
- op = Qt::ReplaceClip;
-
d->state->clipRegion = r;
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
@@ -3048,6 +3051,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
return;
}
+ if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
+ op = Qt::ReplaceClip;
+
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(path, op);
@@ -3056,11 +3062,6 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
return;
}
-
-
- if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip))
- op = Qt::ReplaceClip;
-
d->state->clipPath = path;
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index b80e52d..a545148 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -1019,11 +1019,6 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph
| kATSLineDisableAllJustification
;
- if (!(flags & QTextEngine::DesignMetrics)) {
- layopts |= kATSLineFractDisable | kATSLineUseDeviceMetrics
- | kATSLineDisableAutoAdjustDisplayPos;
- }
-
if (fontDef.styleStrategy & QFont::NoAntialias)
layopts |= kATSLineNoAntiAliasing;
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index e173a8d..638bfb3 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -768,7 +768,7 @@ public:
bool isFastRect(const QRectF &r);
void drawImageAsPath(const QRectF &r, const QImage &img, const QRectF &sr);
- void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy);
+ void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, const QPointF &offset);
void drawOffscreenPath(const QPainterPath &path);
@@ -4222,13 +4222,15 @@ void QOpenGLPaintEnginePrivate::drawImageAsPath(const QRectF &r, const QImage &i
brush_origin = old_brush_origin;
}
-void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy)
+void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy,
+ const QPointF &offset)
{
QBrush old_brush = cbrush;
QPointF old_brush_origin = brush_origin;
QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top());
brush_matrix.scale(sx, sy);
+ brush_matrix.translate(-offset.x(), -offset.y());
cbrush = QBrush(img);
cbrush.setTransform(brush_matrix);
@@ -4305,7 +4307,7 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR
}
}
-void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &)
+void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset)
{
Q_D(QOpenGLPaintEngine);
@@ -4315,7 +4317,7 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
int rw = qCeil(r.width());
int rh = qCeil(r.height());
if (rw < pm.width() && rh < pm.height()) {
- drawTiledPixmap(r, pm.copy(0, 0, rw, rh), QPointF());
+ drawTiledPixmap(r, pm.copy(0, 0, rw, rh), offset);
return;
}
@@ -4324,11 +4326,11 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) {
if (scaled.isNull())
- d->drawTiledImageAsPath(r, pm.toImage(), 1, 1);
+ d->drawTiledImageAsPath(r, pm.toImage(), 1, 1, offset);
else {
const qreal sx = pm.width() / qreal(scaled.width());
const qreal sy = pm.height() / qreal(scaled.height());
- d->drawTiledImageAsPath(r, scaled, sx, sy);
+ d->drawTiledImageAsPath(r, scaled, sx, sy, offset);
}
} else {
d->flushDrawQueue();
@@ -4359,8 +4361,12 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
q_vertexType vertexArray[4*2];
q_vertexType texCoordArray[4*2];
+ double offset_x = offset.x() / pm.width();
+ double offset_y = offset.y() / pm.height();
+
qt_add_rect_to_array(r, vertexArray);
- qt_add_texcoords_to_array(0, 0, tc_w, tc_h, texCoordArray);
+ qt_add_texcoords_to_array(offset_x, offset_y,
+ tc_w + offset_x, tc_h + offset_y, texCoordArray);
glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray);
glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 2e18b48..1b499b6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -686,8 +686,11 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (!d->unsupportedCompositionMode && d->dfbCanHandleClip(rect) && !d->matrixRotShear) {
switch (brush.style()) {
case Qt::SolidPattern: {
+ const QColor color = brush.color();
+ if (!color.isValid())
+ return;
d->unlock();
- d->setDFBColor(brush.color());
+ d->setDFBColor(color);
const QRect r = d->transform.mapRect(rect).toRect();
d->surface->FillRectangle(d->surface, r.x(), r.y(),
r.width(), r.height());
@@ -711,6 +714,8 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
{
+ if (!color.isValid())
+ return;
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear) {
@@ -892,7 +897,6 @@ void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device)
setCompositionMode(q->state()->compositionMode());
dirtyClip = true;
setPen(q->state()->pen);
- setDFBColor(pen.color());
}
void QDirectFBPaintEnginePrivate::end()
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 62fef5b..76064ad 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -725,7 +725,7 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args)
const QStringList flips = flipRegexp.cap(1).split(QLatin1Char(','),
QString::SkipEmptyParts);
flipFlags = DSFLIP_NONE;
- foreach (QString flip, flips) {
+ foreach(const QString &flip, flips) {
if (flip == QLatin1String("wait"))
flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_WAIT);
else if (flip == QLatin1String("blit"))
diff --git a/src/qt_install.pri b/src/qt_install.pri
index 6dd2074..ebeac8d 100644
--- a/src/qt_install.pri
+++ b/src/qt_install.pri
@@ -15,11 +15,19 @@ qt_install_headers {
$$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH/arch
}
- flat_headers.files = $$INSTALL_HEADERS
- flat_headers.path = $$[QT_INSTALL_HEADERS]/Qt
- INSTALLS += flat_headers
+ equals(TARGET, phonon) {
+ class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET/Phonon
+ } else {
+ flat_headers.files = $$INSTALL_HEADERS
+ flat_headers.path = $$[QT_INSTALL_HEADERS]/Qt
+ INSTALLS += flat_headers
- targ_headers.files = $$INSTALL_HEADERS $$SYNCQT.HEADER_CLASSES
+ class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET
+ }
+ class_headers.files = $$SYNCQT.HEADER_CLASSES
+ INSTALLS += class_headers
+
+ targ_headers.files = $$INSTALL_HEADERS
targ_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET
INSTALLS += targ_headers
}
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index b70868d..7bda969 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -91,7 +91,6 @@ public:
: hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false),
isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false)
{
- sql_char_type = sql_varchar_type = sql_longvarchar_type = QVariant::ByteArray;
unicode = false;
}
@@ -100,9 +99,6 @@ public:
uint unicode :1;
uint useSchema :1;
- QVariant::Type sql_char_type;
- QVariant::Type sql_varchar_type;
- QVariant::Type sql_longvarchar_type;
int disconnectCount;
bool isMySqlServer;
bool isMSSqlServer;
@@ -129,7 +125,6 @@ public:
QODBCPrivate()
: hEnv(0), hDbc(0), hStmt(0), useSchema(false), hasSQLFetchScroll(true)
{
- sql_char_type = sql_varchar_type = sql_longvarchar_type = QVariant::ByteArray;
unicode = false;
}
@@ -142,9 +137,6 @@ public:
uint unicode :1;
uint useSchema :1;
- QVariant::Type sql_char_type;
- QVariant::Type sql_varchar_type;
- QVariant::Type sql_longvarchar_type;
QSqlRecord rInf;
QVector<QVariant> fieldCache;
@@ -294,14 +286,10 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi
break;
#endif
case SQL_CHAR:
- type = p->sql_char_type;
- break;
case SQL_VARCHAR:
case SQL_GUID:
- type = p->sql_varchar_type;
- break;
case SQL_LONGVARCHAR:
- type = p->sql_longvarchar_type;
+ type = QVariant::String;
break;
default:
type = QVariant::ByteArray;
@@ -818,9 +806,6 @@ QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p)
d->hDbc = p->hDbc;
d->unicode = p->unicode;
d->useSchema = p->useSchema;
- d->sql_char_type = p->sql_char_type;
- d->sql_varchar_type = p->sql_varchar_type;
- d->sql_longvarchar_type = p->sql_longvarchar_type;
d->disconnectCount = p->disconnectCount;
d->hasSQLFetchScroll = p->hasSQLFetchScroll;
}
@@ -1875,7 +1860,6 @@ void QODBCDriverPrivate::checkUnicode()
sizeof(fFunc),
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WCHAR)) {
- sql_char_type = QVariant::String;
unicode = true;
}
@@ -1885,7 +1869,6 @@ void QODBCDriverPrivate::checkUnicode()
sizeof(fFunc),
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WVARCHAR)) {
- sql_varchar_type = QVariant::String;
unicode = true;
}
@@ -1895,7 +1878,6 @@ void QODBCDriverPrivate::checkUnicode()
sizeof(fFunc),
NULL);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WLONGVARCHAR)) {
- sql_longvarchar_type = QVariant::String;
unicode = true;
}
}
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 1ab8214..d197388 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -531,7 +531,7 @@ bool QPSQLResult::prepare(const QString &query)
{
if (!d->preparedQueriesEnabled)
return QSqlResult::prepare(query);
-
+
cleanup();
if (!d->preparedStmtId.isEmpty())
@@ -821,7 +821,20 @@ bool QPSQLDriver::commitTransaction()
return false;
}
PGresult* res = PQexec(d->connection, "COMMIT");
- if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
+
+ bool transaction_failed = false;
+
+ // XXX
+ // This hack is used to tell if the transaction has succeeded for the protocol versions of
+ // PostgreSQL below. For 7.x and other protocol versions we are left in the dark.
+ // This hack can dissapear once there is an API to query this sort of information.
+ if (d->pro == QPSQLDriver::Version8 ||
+ d->pro == QPSQLDriver::Version81 ||
+ d->pro == QPSQLDriver::Version82) {
+ transaction_failed = QByteArray(PQcmdStatus(res)) == QByteArray("ROLLBACK")?true:false;
+ }
+
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK || transaction_failed) {
PQclear(res);
setLastError(qMakeError(tr("Could not commit transaction"),
QSqlError::TransactionError, d));
@@ -1189,12 +1202,12 @@ bool QPSQLDriver::subscribeToNotificationImplementation(const QString &name)
qPrintable(name));
return false;
}
-
+
int socket = PQsocket(d->connection);
if (socket) {
QString query = QLatin1String("LISTEN ") + escapeIdentifier(name, QSqlDriver::TableName);
- if (PQresultStatus(PQexec(d->connection,
- d->isUtf8 ? query.toUtf8().constData()
+ if (PQresultStatus(PQexec(d->connection,
+ d->isUtf8 ? query.toUtf8().constData()
: query.toLocal8Bit().constData())
) != PGRES_COMMAND_OK) {
setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d));
@@ -1225,8 +1238,8 @@ bool QPSQLDriver::unsubscribeFromNotificationImplementation(const QString &name)
}
QString query = QLatin1String("UNLISTEN ") + escapeIdentifier(name, QSqlDriver::TableName);
- if (PQresultStatus(PQexec(d->connection,
- d->isUtf8 ? query.toUtf8().constData()
+ if (PQresultStatus(PQexec(d->connection,
+ d->isUtf8 ? query.toUtf8().constData()
: query.toLocal8Bit().constData())
) != PGRES_COMMAND_OK) {
setLastError(qMakeError(tr("Unable to unsubscribe"), QSqlError::StatementError, d));
@@ -1259,7 +1272,7 @@ void QPSQLDriver::_q_handleNotification(int)
if (d->seid.contains(name))
emit notification(name);
else
- qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.",
+ qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.",
qPrintable(name));
qPQfreemem(notify);