diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-14 20:07:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-14 20:07:36 (GMT) |
commit | d39f3980f5ba449a43d25d46a3c0eee81001856a (patch) | |
tree | bd58b28e5f9f088b5a2e8b755f8787aa78a292e3 | |
parent | cfee61fd74d7fe73f0de13356fe683bc8ae91f92 (diff) | |
parent | 2d0bd1a13328d5a5ed6c4d1e768937a6627f1086 (diff) | |
download | Qt-d39f3980f5ba449a43d25d46a3c0eee81001856a.zip Qt-d39f3980f5ba449a43d25d46a3c0eee81001856a.tar.gz Qt-d39f3980f5ba449a43d25d46a3c0eee81001856a.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
QFile::remove: don't fail for unrelated errors
Fix tst_qmlgraphicstext::letterSpacing tst_qmlgraphicstext::wordSpacing Sent for review into 4.6.
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 8f6992f4e8f027818429d428393b08068eca9ffa )
network internals: fix uploading of data
File dialog mode is not correctly updated in Mac (Cocoa).
add tests for QFlags behavior in QtScript
-rw-r--r-- | src/corelib/io/qfile.cpp | 1 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 15 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog_mac.mm | 7 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 10 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp | 57 | ||||
-rw-r--r-- | tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 36 |
7 files changed, 119 insertions, 9 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 6395cc7..4c7f3f0 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -643,6 +643,7 @@ QFile::remove() qWarning("QFile::remove: Empty or null file name"); return false; } + unsetError(); close(); if(error() == QFile::NoError) { if(fileEngine()->remove()) { diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 3d59463..21650bb 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1222,12 +1222,6 @@ QFileDialog::ViewMode QFileDialog::viewMode() const void QFileDialog::setFileMode(QFileDialog::FileMode mode) { Q_D(QFileDialog); - if (d->nativeDialogInUse){ - d->model->setFilter(d->filterForMode(filter())); - d->setFilter_sys(); - return; - } - d->fileMode = mode; d->retranslateWindowTitle(); @@ -1263,6 +1257,11 @@ void QFileDialog::setFileMode(QFileDialog::FileMode mode) } } setLabelText(Accept, buttonText); + if (d->nativeDialogInUse){ + d->setFilter_sys(); + return; + } + d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly)); d->_q_updateOkButton(); } @@ -1300,6 +1299,10 @@ void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode) d->qFileDialogUi->lookInCombo->setEditable(false); } d->retranslateWindowTitle(); +#if defined(Q_WS_MAC) + d->deleteNativeDialog_sys(); + setAttribute(Qt::WA_DontShowOnScreen, false); +#endif } /* diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index db5c356..67daced 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -639,9 +639,16 @@ void QFileDialogPrivate::setFilter_sys() { #ifndef QT_MAC_USE_COCOA #else + Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); *(delegate->mQDirFilter) = model->filter(); + delegate->mFileMode = fileMode; + [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())]; + [delegate->mSavePanel setPrompt:[delegate strip:acceptLabel]]; + if (fileNameLabelExplicitlySat) + [delegate->mSavePanel setNameFieldLabel:[delegate strip:qFileDialogUi->fileNameLabel->text()]]; + [delegate updateProperties]; #endif } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4c57dff..bbd35f1 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1614,7 +1614,11 @@ bool QFont::operator==(const QFont &f) const && f.d->overline == d->overline && f.d->strikeOut == d->strikeOut && f.d->kerning == d->kerning - && f.d->capital == d->capital)); + && f.d->capital == d->capital + && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute + && f.d->letterSpacing == d->letterSpacing + && f.d->wordSpacing == d->wordSpacing + )); } @@ -1648,6 +1652,10 @@ bool QFont::operator<(const QFont &f) const #endif // Q_WS_X11 if (f.d->capital != d->capital) return f.d->capital < d->capital; + if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute; + if (f.d->letterSpacing != d->letterSpacing) return f.d->letterSpacing < d->letterSpacing; + if (f.d->wordSpacing != d->wordSpacing) return f.d->wordSpacing < d->wordSpacing; + int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; return f1attrs < f2attrs; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 39d09aa..1955dba 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -260,7 +260,7 @@ bool QHttpNetworkConnectionChannel::sendRequest() // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called // this is needed if the sends an reply before we have finished sending the request. In that // case receiveReply had been called before but ignored the server reply - QMetaObject::invokeMethod(connection, "_q_receiveReply", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); break; } case QHttpNetworkConnectionChannel::ReadingState: diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index 73e4fb6..3415163 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -112,6 +112,7 @@ class MyQObject : public QObject Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(CustomType propWithCustomType READ propWithCustomType WRITE setPropWithCustomType) Q_PROPERTY(Policy enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(Ability flagsProperty READ flagsProperty WRITE setFlagsProperty) Q_ENUMS(Policy Strategy) Q_FLAGS(Ability) @@ -150,6 +151,7 @@ public: m_writeOnlyValue(789), m_readOnlyValue(987), m_enumValue(BarPolicy), + m_flagsValue(FooAbility), m_qtFunctionInvoked(-1) { } @@ -216,6 +218,11 @@ public: void setEnumProperty(Policy policy) { m_enumValue = policy; } + Ability flagsProperty() const + { return m_flagsValue; } + void setFlagsProperty(Ability ability) + { m_flagsValue = ability; } + int qtFunctionInvoked() const { return m_qtFunctionInvoked; } @@ -316,6 +323,10 @@ public: { m_qtFunctionInvoked = 56; return arg; } Q_INVOKABLE QObject* myInvokableReturningMyQObjectAsQObject() { m_qtFunctionInvoked = 57; return this; } + Q_INVOKABLE Ability myInvokableWithFlagsArg(Ability arg) + { m_qtFunctionInvoked = 58; m_actuals << int(arg); return arg; } + Q_INVOKABLE MyQObject::Ability myInvokableWithQualifiedFlagsArg(MyQObject::Ability arg) + { m_qtFunctionInvoked = 59; m_actuals << int(arg); return arg; } Q_INVOKABLE QObjectList findObjects() const { return findChildren<QObject *>(); } @@ -433,6 +444,7 @@ protected: QKeySequence m_shortcut; CustomType m_customType; Policy m_enumValue; + Ability m_flagsValue; int m_qtFunctionInvoked; QVariantList m_actuals; QByteArray m_connectedSignal; @@ -826,7 +838,7 @@ void tst_QScriptExtQObject::getSetStaticProperty() { QScriptValue val = m_engine->evaluate("myObject.enumProperty"); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), (int)MyQObject::BarPolicy); + QCOMPARE(val.toInt32(), int(MyQObject::BarPolicy)); } m_engine->evaluate("myObject.enumProperty = 2"); QCOMPARE(m_myObject->enumProperty(), MyQObject::BazPolicy); @@ -846,6 +858,25 @@ void tst_QScriptExtQObject::getSetStaticProperty() m_engine->evaluate("myObject.enumProperty = 'nada'"); QCOMPARE(m_myObject->enumProperty(), (MyQObject::Policy)-1); + // flags property + QCOMPARE(m_myObject->flagsProperty(), MyQObject::FooAbility); + { + QScriptValue val = m_engine->evaluate("myObject.flagsProperty"); + QVERIFY(val.isNumber()); + QCOMPARE(val.toInt32(), int(MyQObject::FooAbility)); + } + m_engine->evaluate("myObject.flagsProperty = 0x80"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::BarAbility); + m_engine->evaluate("myObject.flagsProperty = 0x81"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::Ability(MyQObject::FooAbility | MyQObject::BarAbility)); + m_engine->evaluate("myObject.flagsProperty = 123"); // bogus values are accepted + QCOMPARE(int(m_myObject->flagsProperty()), 123); + m_engine->evaluate("myObject.flagsProperty = 'BazAbility'"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::BazAbility); + m_engine->evaluate("myObject.flagsProperty = 'ScoobyDoo'"); + // ### ouch! Shouldn't QMetaProperty::write() rather not change the value...? + QCOMPARE(m_myObject->flagsProperty(), (MyQObject::Ability)-1); + // auto-dereferencing of pointers { QBrush b = QColor(0xCA, 0xFE, 0xBA, 0xBE); @@ -2017,6 +2048,7 @@ void tst_QScriptExtQObject::classEnums() QScriptValue myClass = m_engine->newQMetaObject(m_myObject->metaObject(), m_engine->undefinedValue()); m_engine->globalObject().setProperty("MyQObject", myClass); + QVERIFY(m_engine->evaluate("MyQObject.FooPolicy").isNumber()); // no strong typing QCOMPARE(static_cast<MyQObject::Policy>(m_engine->evaluate("MyQObject.FooPolicy").toInt32()), MyQObject::FooPolicy); QCOMPARE(static_cast<MyQObject::Policy>(m_engine->evaluate("MyQObject.BarPolicy").toInt32()), @@ -2031,6 +2063,7 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(static_cast<MyQObject::Strategy>(m_engine->evaluate("MyQObject.BazStrategy").toInt32()), MyQObject::BazStrategy); + QVERIFY(m_engine->evaluate("MyQObject.NoAbility").isNumber()); // no strong typing QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.NoAbility").toInt32()), MyQObject::NoAbility); QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.FooAbility").toInt32()), @@ -2042,6 +2075,9 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.AllAbility").toInt32()), MyQObject::AllAbility); + // Constructors for flags are not provided + QVERIFY(m_engine->evaluate("MyQObject.Ability").isUndefined()); + QScriptValue::PropertyFlags expectedEnumFlags = QScriptValue::ReadOnly | QScriptValue::Undeletable; QCOMPARE(myClass.propertyFlags("FooPolicy"), expectedEnumFlags); QCOMPARE(myClass.propertyFlags("BarPolicy"), expectedEnumFlags); @@ -2094,6 +2130,25 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(ret.isNumber(), true); } + m_myObject->resetQtFunctionInvoked(); + { + QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithFlagsArg(MyQObject.FooAbility)"); + QCOMPARE(m_myObject->qtFunctionInvoked(), 58); + QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); + QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::FooAbility)); + QCOMPARE(ret.isNumber(), true); + QCOMPARE(ret.toInt32(), int(MyQObject::FooAbility)); + } + m_myObject->resetQtFunctionInvoked(); + { + QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithQualifiedFlagsArg(MyQObject.BarAbility)"); + QCOMPARE(m_myObject->qtFunctionInvoked(), 59); + QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); + QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::BarAbility)); + QCOMPARE(ret.isNumber(), true); + QCOMPARE(ret.toInt32(), int(MyQObject::BarAbility)); + } + // enum properties are not deletable or writable QVERIFY(!m_engine->evaluate("delete MyQObject.BazPolicy").toBool()); myClass.setProperty("BazPolicy", QScriptValue()); diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index c781108..1304f4e 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -95,6 +95,7 @@ private slots: void keepOpenMode(); void resetTemplateAfterError(); void setTemplateAfterOpen(); + void autoRemoveAfterFailedRename(); public: }; @@ -558,5 +559,40 @@ void tst_QTemporaryFile::setTemplateAfterOpen() QCOMPARE( temp.fileTemplate(), newTemplate ); } +void tst_QTemporaryFile::autoRemoveAfterFailedRename() +{ + struct CleanOnReturn + { + ~CleanOnReturn() + { + if (!tempName.isEmpty()) + QFile::remove(tempName); + } + + void reset() + { + tempName.clear(); + } + + QString tempName; + }; + + CleanOnReturn cleaner; + + { + QTemporaryFile file; + QVERIFY( file.open() ); + cleaner.tempName = file.fileName(); + + QVERIFY( QFile::exists(cleaner.tempName) ); + QVERIFY( !QFileInfo("i-do-not-exist").isDir() ); + QVERIFY( !file.rename("i-do-not-exist/file.txt") ); + QVERIFY( QFile::exists(cleaner.tempName) ); + } + + QVERIFY( !QFile::exists(cleaner.tempName) ); + cleaner.reset(); +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" |