From a5834ce3f97c1a8e01f1c7cad51ff02d21a20c68 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 21 Jan 2010 08:27:20 +0100 Subject: uic3: Introduced option to preserve layout object names of Designer 3. Introduce options flag mask for better handling in UI3Reader. Pass on layout name. Task-number: QTBUG-7404 Reviewed-by: Jarek Kobus Initial-patch-by: Andy Shaw --- src/tools/uic3/converter.cpp | 20 ++++++++++++++------ src/tools/uic3/form.cpp | 8 ++++---- src/tools/uic3/main.cpp | 18 ++++++++---------- src/tools/uic3/ui3reader.cpp | 22 +++++++--------------- src/tools/uic3/ui3reader.h | 16 +++++++++------- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/tools/uic3/converter.cpp b/src/tools/uic3/converter.cpp index 8fe2a24..2bf293d 100644 --- a/src/tools/uic3/converter.cpp +++ b/src/tools/uic3/converter.cpp @@ -121,7 +121,7 @@ static inline bool isKDEClass(const QString &className) return className.at(1) .isUpper() && className.at(2).isLower(); } -DomUI *Ui3Reader::generateUi4(const QDomElement &widget, bool implicitIncludes) +DomUI *Ui3Reader::generateUi4(const QDomElement &widget) { QDomNodeList nl; candidateCustomWidgets.clear(); @@ -474,7 +474,7 @@ DomUI *Ui3Reader::generateUi4(const QDomElement &widget, bool implicitIncludes) // Magic header generation feature for legacy KDE forms // (for example, filesharing/advanced/kcm_sambaconf/share.ui) - if (implicitIncludes && isKDEClass(customClass)) { + if ((m_options & ImplicitIncludes) && isKDEClass(customClass)) { QString header = customClass.toLower(); header += QLatin1String(".h"); DomHeader *domHeader = new DomHeader; @@ -710,10 +710,13 @@ DomWidget *Ui3Reader::createWidget(const QDomElement &w, const QString &widgetCl ui_action_list.append(a); } else if (t == QLatin1String("property")) { // skip the property it is already handled by createProperties - - QString name = e.attribute(QLatin1String("name")); // change the varname this widget - if (name == QLatin1String("name")) - ui_widget->setAttributeName(DomTool::readProperty(w, QLatin1String("name"), QVariant()).toString()); + const QString name = e.attribute(QLatin1String("name")); // change the varname this widget + if (name == QLatin1String("name")) { + // Do not name QLayoutWidget if layout names are to be used. + const bool applyName = !(m_options & PreserveLayoutNames) || className != QLatin1String("QLayoutWidget"); + if (applyName) + ui_widget->setAttributeName(DomTool::readProperty(w, QLatin1String("name"), QVariant()).toString()); + } } else if (t == QLatin1String("row")) { DomRow *row = new DomRow(); row->read(e); @@ -797,6 +800,11 @@ DomLayout *Ui3Reader::createLayout(const QDomElement &w) createProperties(w, &ui_property_list, className); createAttributes(w, &ui_attribute_list, className); + if (m_options & PreserveLayoutNames) { + const QString layoutName = getLayoutName(w); + if (!layoutName.isEmpty()) + lay->setAttributeName(layoutName); + } QDomElement e = w.firstChild().toElement(); while (!e.isNull()) { diff --git a/src/tools/uic3/form.cpp b/src/tools/uic3/form.cpp index ac2668b..df1314f 100644 --- a/src/tools/uic3/form.cpp +++ b/src/tools/uic3/form.cpp @@ -100,7 +100,7 @@ QByteArray combinePath(const char *infile, const char *outfile) \sa createFormImpl() */ -void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) +void Ui3Reader::createFormDecl(const QDomElement &e) { QDomElement body = e; @@ -138,7 +138,7 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) QString tagName = n3.tagName().toLower(); if (tagName == QLatin1String("class")) { cl = n3.firstChild().toText().data(); - if (!nofwd) + if (m_options & CustomWidgetForwardDeclarations) forwardDecl << cl; customWidgets.insert(cl, 0); } else if (tagName == QLatin1String("header")) { @@ -257,10 +257,10 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) d.option().copyrightHeader = false; d.option().extractImages = m_extractImages; d.option().qrcOutputFile = m_qrcOutputFile; - d.option().implicitIncludes = implicitIncludes; + d.option().implicitIncludes = (m_options & ImplicitIncludes) ? 1 : 0; if (trmacro.size()) d.option().translateFunction = trmacro; - DomUI *ui = generateUi4(e, implicitIncludes); + DomUI *ui = generateUi4(e); d.uic(fileName, ui, &out); delete ui; diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index ecc345e..6acc94f 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -78,13 +78,11 @@ int runUic3(int argc, char * argv[]) QByteArray image_tmpfile; const char* projectName = 0; const char* trmacro = 0; - bool nofwd = false; bool fix = false; bool deps = false; - bool implicitIncludes = true; + unsigned readerOptions = Ui3Reader::ImplicitIncludes|Ui3Reader::CustomWidgetForwardDeclarations; QByteArray pchFile; - QApplication app(argc, argv, false); for (int n = 1; n < argc && error == 0; n++) { @@ -146,9 +144,11 @@ int runUic3(int argc, char * argv[]) } else if (opt == "d") { deps = true; } else if (opt == "no-implicit-includes") { - implicitIncludes = false; + readerOptions &= ~Ui3Reader::ImplicitIncludes; } else if (opt == "nofwd") { - nofwd = true; + readerOptions &= ~Ui3Reader::CustomWidgetForwardDeclarations; + } else if (opt == "layout-names") { + readerOptions |= Ui3Reader::PreserveLayoutNames; } else if (opt == "nounload") { // skip } else if (opt == "convert") { @@ -253,6 +253,7 @@ int runUic3(int argc, char * argv[]) "\t-extract qrcFile Create resource file and extract embedded images into \"image\" dir\n" "\t-pch file Add #include \"file\" as the first statement in implementation\n" "\t-nofwd Omit forward declarations of custom classes\n" + "\t-layout-names Preserve layout names of Qt Designer 3\n" "\t-no-implicit-includes Do not generate #include-directives for custom classes\n" "\t-nounload Do not unload plugins after processing\n" "\t-tr func Use func() instead of tr() for i18n\n" @@ -289,9 +290,8 @@ int runUic3(int argc, char * argv[]) QTextStream out(&fileOut); - Ui3Reader ui3(out); + Ui3Reader ui3(out, readerOptions); ui3.setExtractImages(extract, qrcOutputFile); - if (projectName && imagecollection) { out.setEncoding(QTextStream::Latin1); ui3.embed(projectName, images); @@ -349,7 +349,7 @@ int runUic3(int argc, char * argv[]) return 0; } else if (convert) { - ui3.generateUi4(QFile::decodeName(fileName), QFile::decodeName(outputFile), doc, implicitIncludes); + ui3.generateUi4(QFile::decodeName(fileName), QFile::decodeName(outputFile), doc); return 0; } @@ -388,8 +388,6 @@ int runUic3(int argc, char * argv[]) subcl, QString::fromUtf8(trmacro), QString::fromUtf8(className), - nofwd, - implicitIncludes, convertedUi); if (!protector.isEmpty()) { diff --git a/src/tools/uic3/ui3reader.cpp b/src/tools/uic3/ui3reader.cpp index 6c5bda3..fd50a19 100644 --- a/src/tools/uic3/ui3reader.cpp +++ b/src/tools/uic3/ui3reader.cpp @@ -176,7 +176,6 @@ void Ui3Reader::init() { outputFileName.clear(); trmacro.clear(); - nofwd = false; fileName.clear(); writeFunctImpl = true; @@ -241,11 +240,10 @@ QDomElement Ui3Reader::parse(const QDomDocument &doc) return widget; } -Ui3Reader::Ui3Reader(QTextStream &outStream) - : out(outStream), trout(&languageChangeBody) +Ui3Reader::Ui3Reader(QTextStream &outStream, unsigned options) : + m_options(options), out(outStream), trout(&languageChangeBody), + m_porting(new Porting), m_extractImages(false) { - m_porting = new Porting(); - m_extractImages = false; } Ui3Reader::~Ui3Reader() @@ -255,14 +253,13 @@ Ui3Reader::~Ui3Reader() void Ui3Reader::generate(const QString &fn, const QString &outputFn, QDomDocument doc, bool decl, bool subcl, const QString &trm, - const QString& subClass, bool omitForwardDecls, bool implicitIncludes, const QString &convertedUiFile) + const QString& subClass, const QString &convertedUiFile) { init(); fileName = fn; outputFileName = outputFn; trmacro = trm; - nofwd = omitForwardDecls; QDomElement e = parse(doc); @@ -281,21 +278,21 @@ void Ui3Reader::generate(const QString &fn, const QString &outputFn, createSubImpl(e, subClass); } else { if (decl) - createFormDecl(e, implicitIncludes); + createFormDecl(e); else createFormImpl(e); } } -void Ui3Reader::generateUi4(const QString &fn, const QString &outputFn, QDomDocument doc, bool implicitIncludes) +void Ui3Reader::generateUi4(const QString &fn, const QString &outputFn, QDomDocument doc) { init(); fileName = fn; outputFileName = outputFn; - DomUI *ui = generateUi4(parse(doc), implicitIncludes); + DomUI *ui = generateUi4(parse(doc)); if (!ui) return; @@ -317,11 +314,6 @@ void Ui3Reader::setTrMacro(const QString &trmacro) this->trmacro = trmacro; } -void Ui3Reader::setForwardDeclarationsEnabled(bool b) -{ - nofwd = !b; -} - void Ui3Reader::setOutputFileName(const QString &fileName) { outputFileName = fileName; diff --git a/src/tools/uic3/ui3reader.h b/src/tools/uic3/ui3reader.h index cd17835..144ef05 100644 --- a/src/tools/uic3/ui3reader.h +++ b/src/tools/uic3/ui3reader.h @@ -68,23 +68,24 @@ typedef QList > ColorGroup; class Ui3Reader { public: - Ui3Reader(QTextStream &stream); + enum Options { CustomWidgetForwardDeclarations = 0x1, ImplicitIncludes = 0x2, PreserveLayoutNames = 0x4 }; + + explicit Ui3Reader(QTextStream &stream, unsigned options); ~Ui3Reader(); void computeDeps(const QDomElement &e, QStringList &globalIncludes, QStringList &localIncludes, bool impl = false); - void generateUi4(const QString &fn, const QString &outputFn, QDomDocument doc, bool implicitIncludes); + void generateUi4(const QString &fn, const QString &outputFn, QDomDocument doc); void generate(const QString &fn, const QString &outputFn, QDomDocument doc, bool decl, bool subcl, const QString &trm, - const QString& subclname, bool omitForwardDecls, bool implicitIncludes, const QString &convertedUiFile); + const QString& subclname, const QString &convertedUiFile); void embed(const char *project, const QStringList &images); void setTrMacro(const QString &trmacro); - void setForwardDeclarationsEnabled(bool b); void setOutputFileName(const QString &fileName); - void createFormDecl(const QDomElement &e, bool implicitIncludes); + void createFormDecl(const QDomElement &e); void createFormImpl(const QDomElement &e); void createWrapperDecl(const QDomElement &e, const QString &convertedUiFile); @@ -125,7 +126,7 @@ private: void errorInvalidSlot(const QString &slot, const QString &widgetName, const QString &widgetClass, int line, int col); - DomUI *generateUi4(const QDomElement &e, bool implicitIncludes); + DomUI *generateUi4(const QDomElement &e); DomWidget *createWidget(const QDomElement &w, const QString &widgetClass = QString()); void createProperties(const QDomElement &e, QList *properties, const QString &className); void createAttributes(const QDomElement &e, QList *properties, const QString &className); @@ -145,6 +146,8 @@ private: void fixLayoutMargin(DomLayout *ui_layout); + const unsigned m_options; + QTextStream &out; QTextOStream trout; QString languageChangeBody; @@ -157,7 +160,6 @@ private: QString formName; QString lastItem; QString trmacro; - bool nofwd; struct Buddy { -- cgit v0.12 From f6f4e2b73391dcc24382583f9c52f09bb4ced37a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 21 Jan 2010 08:35:49 +0100 Subject: Designer: Fixed a crash when previewing in a non-existent style. Task-number: QTBUG-7432 Reviewed-by: Jarek Kobus --- tools/designer/src/lib/shared/widgetfactory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/designer/src/lib/shared/widgetfactory.cpp b/tools/designer/src/lib/shared/widgetfactory.cpp index eda551d..c7b13a1 100644 --- a/tools/designer/src/lib/shared/widgetfactory.cpp +++ b/tools/designer/src/lib/shared/widgetfactory.cpp @@ -774,6 +774,8 @@ void WidgetFactory::applyStyleTopLevel(const QString &styleName, QWidget *w) void WidgetFactory::applyStyleToTopLevel(QStyle *style, QWidget *widget) { + if (!style) + return; const QPalette standardPalette = style->standardPalette(); if (widget->style() == style && widget->palette() == standardPalette) return; -- cgit v0.12 From aa2d3eb0f05dc87347e30fc0a6c843fc3d1b4855 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 21 Jan 2010 08:49:12 +0100 Subject: Don't use a mutex lock in QPainter::redirection unless strictly required --- src/gui/painting/qpainter.cpp | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a9dcea0..764ec68 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7385,10 +7385,15 @@ struct QPaintDeviceRedirection typedef QList QPaintDeviceRedirectionList; Q_GLOBAL_STATIC(QPaintDeviceRedirectionList, globalRedirections) Q_GLOBAL_STATIC(QMutex, globalRedirectionsMutex) +Q_GLOBAL_STATIC(QAtomicInt, globalRedirectionAtomic) /*! \threadsafe + \obsolete + + Please use QWidget::render() instead. + Redirects all paint commands for the given paint \a device, to the \a replacement device. The optional point \a offset defines an offset within the source device. @@ -7398,9 +7403,10 @@ Q_GLOBAL_STATIC(QMutex, globalRedirectionsMutex) device's painter (if any) before redirecting. Call restoreRedirected() to restore the previous redirection. - In general, you'll probably find that calling - QPixmap::grabWidget() or QPixmap::grabWindow() is an easier - solution. + \warning Making use of redirections in the QPainter API implies + that QPainter::begin() and QPaintDevice destructors need to hold + a mutex for a short period. This can impact performance. Use of + QWidget::render is strongly encouraged. \sa redirected(), restoreRedirected() */ @@ -7432,14 +7438,24 @@ void QPainter::setRedirected(const QPaintDevice *device, Q_ASSERT(redirections != 0); *redirections += QPaintDeviceRedirection(device, rdev ? rdev : replacement, offset + roffset, hadInternalWidgetRedirection ? redirections->size() - 1 : -1); + globalRedirectionAtomic()->ref(); } /*! \threadsafe + \obsolete + + Using QWidget::render() obsoletes the use of this function. + Restores the previous redirection for the given \a device after a call to setRedirected(). + \warning Making use of redirections in the QPainter API implies + that QPainter::begin() and QPaintDevice destructors need to hold + a mutex for a short period. This can impact performance. Use of + QWidget::render is strongly encouraged. + \sa redirected() */ void QPainter::restoreRedirected(const QPaintDevice *device) @@ -7450,6 +7466,7 @@ void QPainter::restoreRedirected(const QPaintDevice *device) Q_ASSERT(redirections != 0); for (int i = redirections->size()-1; i >= 0; --i) { if (redirections->at(i) == device) { + globalRedirectionAtomic()->deref(); const int internalWidgetRedirectionIndex = redirections->at(i).internalWidgetRedirectionIndex; redirections->removeAt(i); // Restore the internal widget redirection, i.e. remove it from the global @@ -7471,21 +7488,34 @@ void QPainter::restoreRedirected(const QPaintDevice *device) /*! \threadsafe + \obsolete + + Using QWidget::render() obsoletes the use of this function. + Returns the replacement for given \a device. The optional out parameter \a offset returns the offset within the replaced device. + \warning Making use of redirections in the QPainter API implies + that QPainter::begin() and QPaintDevice destructors need to hold + a mutex for a short period. This can impact performance. Use of + QWidget::render is strongly encouraged. + \sa setRedirected(), restoreRedirected() */ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) { Q_ASSERT(device != 0); + if (*globalRedirectionAtomic() == 0) + return 0; + if (device->devType() == QInternal::Widget) { const QWidgetPrivate *widgetPrivate = static_cast(device)->d_func(); if (widgetPrivate->redirectDev) return widgetPrivate->redirected(offset); } + QMutexLocker locker(globalRedirectionsMutex()); QPaintDeviceRedirectionList *redirections = globalRedirections(); Q_ASSERT(redirections != 0); @@ -7503,6 +7533,9 @@ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) void qt_painter_removePaintDevice(QPaintDevice *dev) { + if (*globalRedirectionAtomic() == 0) + return; + QMutex *mutex = 0; QT_TRY { mutex = globalRedirectionsMutex(); -- cgit v0.12 From 984c931c4a7385281d0acbc22adb22e49ded768e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 21 Jan 2010 09:40:24 +0100 Subject: Merge TRK client changes from upstream (QtCreator) commit 1b77161e7183cdd4b5493698b4cddc727468f0f5 Author: hjk Date: Fri Jan 15 12:01:26 2010 +0100 debugger: clean up verbosity settings in trk adapter commit 4d7341becac684f5feb908e45d8b1756b4823c20 Author: hjk Date: Wed Jan 13 14:48:29 2010 +0100 debugger: whitespace commit d3cdfe813444b6afca483c7d13ac80c4c8eda62b Author: hjk Date: Wed Jan 13 14:46:13 2010 +0100 debugger: add some debug output to trk device commit 7cd27f2eecd5f77bc35f6b705c6f0422b09e534d Author: hjk Date: Mon Jan 4 13:17:38 2010 +0100 debugger: add list of thread ids to TRK session state object Reviewed-by: Shane Kearns --- tools/runonphone/trk/trkdevice.cpp | 34 ++++++++++++++++++++++++++++++---- tools/runonphone/trk/trkutils.h | 7 ++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/tools/runonphone/trk/trkdevice.cpp b/tools/runonphone/trk/trkdevice.cpp index 53f4490..fe3261b 100644 --- a/tools/runonphone/trk/trkdevice.cpp +++ b/tools/runonphone/trk/trkdevice.cpp @@ -99,6 +99,8 @@ QString winErrorMessage(unsigned long error) #endif +enum { verboseTrk = 0 }; + namespace trk { /////////////////////////////////////////////////////////////////////// @@ -128,6 +130,12 @@ TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) : { } +QDebug operator<<(QDebug d, const TrkMessage &msg) +{ + return d << "Message: Code: " << msg.code + << " Token: " << msg.token << " " << msg.data.toHex(); +} + } // namespace trk Q_DECLARE_METATYPE(trk::TrkMessage) @@ -204,6 +212,8 @@ byte TrkWriteQueue::nextTrkWriteToken() ++m_trkWriteToken; if (m_trkWriteToken == 0) ++m_trkWriteToken; + if (verboseTrk) + qDebug() << "Write token: " << m_trkWriteToken; return m_trkWriteToken; } @@ -334,7 +344,8 @@ DeviceContext::DeviceContext() : /////////////////////////////////////////////////////////////////////// -class WriterThread : public QThread { +class WriterThread : public QThread +{ Q_OBJECT Q_DISABLE_COPY(WriterThread) public: @@ -400,15 +411,18 @@ int WriterThread::writePendingMessage() m_waitMutex.unlock(); if (m_terminate) return 1; + // Send off message m_dataMutex.lock(); TrkMessage message; const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message); m_dataMutex.unlock(); + switch (pr) { case TrkWriteQueue::NoMessage: break; case TrkWriteQueue::PendingMessage: { + //qDebug() << "Write pending message " << message; // Untested: try to re-send a few times bool success = false; for (int r = 0; !success && (r < MaxAttempts); r++) { @@ -428,6 +442,8 @@ int WriterThread::writePendingMessage() break; case TrkWriteQueue::NoopMessageDequeued: // Sync with thread that owns us via a blocking signal + if (verboseTrk) + qDebug() << "Noop message dequeued" << message; emit internalNoopMessageDequeued(message); break; } // switch @@ -499,6 +515,8 @@ static inline bool overlappedSyncWrite(HANDLE file, bool WriterThread::write(const QByteArray &data, QString *errorMessage) { + if (verboseTrk) + qDebug() << "Write raw data: " << data.toHex(); QMutexLocker locker(&m_context->mutex); #ifdef Q_OS_WIN DWORD charsWritten; @@ -557,6 +575,7 @@ void WriterThread::slotHandleResult(const TrkResult &result) tryWrite(); // Have messages been enqueued in-between? } + /////////////////////////////////////////////////////////////////////// // // ReaderThreadBase: Base class for a thread that reads data from @@ -566,7 +585,8 @@ void WriterThread::slotHandleResult(const TrkResult &result) // /////////////////////////////////////////////////////////////////////// -class ReaderThreadBase : public QThread { +class ReaderThreadBase : public QThread +{ Q_OBJECT Q_DISABLE_COPY(ReaderThreadBase) public: @@ -625,7 +645,8 @@ void ReaderThreadBase::readMessages() // /////////////////////////////////////////////////////////////////////// -class WinReaderThread : public ReaderThreadBase { +class WinReaderThread : public ReaderThreadBase +{ Q_OBJECT Q_DISABLE_COPY(WinReaderThread) public: @@ -835,7 +856,8 @@ void UnixReaderThread::terminate() { // Trigger select() by writing to the pipe char c = 0; - write(m_terminatePipeFileDescriptors[1], &c, 1); + int written = write(m_terminatePipeFileDescriptors[1], &c, 1); + // FIXME: Use result. wait(); } @@ -1021,6 +1043,8 @@ void TrkDevice::setVerbose(int b) void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData) { d->writerThread->slotHandleResult(result); + if (d->verbose > 1) + qDebug() << "Received: " << result.toString(); emit messageReceived(result); if (!rawData.isEmpty()) emit rawDataReceived(rawData); @@ -1057,6 +1081,8 @@ bool TrkDevice::sendTrkAck(byte token) TrkMessage msg(0x80, token); msg.token = token; msg.data.append('\0'); + if (verboseTrk) + qDebug() << "Write synchroneous message: " << msg; return d->writerThread->trkWriteRawMessage(msg); // 01 90 00 07 7e 80 01 00 7d 5e 7e } diff --git a/tools/runonphone/trk/trkutils.h b/tools/runonphone/trk/trkutils.h index c636ac0..328dd2b 100644 --- a/tools/runonphone/trk/trkutils.h +++ b/tools/runonphone/trk/trkutils.h @@ -119,7 +119,8 @@ struct Library uint dataseg; }; -struct TrkAppVersion { +struct TrkAppVersion +{ TrkAppVersion(); void reset(); @@ -153,6 +154,10 @@ struct Session typedef QList Libraries; Libraries libraries; + typedef uint Thread; + typedef QList Threads; + Threads threads; + // Gdb request uint currentThread; QStringList modules; -- cgit v0.12 From 1d83d3028320bcc071de1ad65e94f821850bd9be Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Tue, 12 Jan 2010 11:05:41 +0100 Subject: Changelog. Adding my changes to the changelog for 4.6.1. --- dist/changes-4.6.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 3df6887..4a567bb 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -247,6 +247,8 @@ QtSvg * [QTBUG-6867] Fixed regression in the parsing of paths with relative offsets. * [QTBUG-6899] Fixed crash when parsing invalid coordinate list. + - QtXmlPatterns + * [QTBUG-6771] Fixed static builds. Qt Plugins ---------- -- cgit v0.12 From 0481c2dfbbcc59b76bde3f72fbe6d1e4003c913a Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Thu, 21 Jan 2010 10:17:29 +0100 Subject: Menubar and dock disappear after hiding a fullscreen widget on Cocoa. The problem here was exiting the full screen mode. In Cocoa we don't activate windows as we do in Carbon, therefore we were not exiting from the full screen mode. This patch adds a check when hiding a window, if the window is in full screen mode then we go through the list of top level windows checking if there are any other visible and not-minimized windows that are also in full screen mode. If none if found, the we exit the full screen mode. Task-number: QTBUG-7312 Reviewed-by: Prasanth --- src/gui/kernel/qwidget_mac.mm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b18830f..3dbc843 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3414,6 +3414,38 @@ void QWidgetPrivate::hide_sys() ShowHide(window, false); #else [window orderOut:window]; + // Unfortunately it is not as easy as just hiding the window, we need + // to find out if we were in full screen mode. If we were and this is + // the last window in full screen mode then we need to unset the full screen + // mode. If this is not the last visible window in full screen mode then we + // don't change the full screen mode. + if(q->isFullScreen()) + { + bool keepFullScreen = false; + QWidgetList windowList = qApp->topLevelWidgets(); + int windowCount = windowList.count(); + for(int i = 0; i < windowCount; i++) + { + QWidget *w = windowList[i]; + // If it is the same window, we don't need to check :-) + if(q == w) + continue; + // If they are not visible or if they are minimized then + // we just ignore them. + if(!w->isVisible() || w->isMinimized()) + continue; + // Is it full screen? + // Notice that if there is one window in full screen mode then we + // cannot switch the full screen mode off, therefore we just abort. + if(w->isFullScreen()) { + keepFullScreen = true; + break; + } + } + // No windows in full screen mode, so let just unset that flag. + if(!keepFullScreen) + qt_mac_set_fullscreen_mode(false); + } #endif toggleDrawers(false); #ifndef QT_MAC_USE_COCOA -- cgit v0.12 From d83e82e5c8a7fa0f6b1dcc4b1ab56f22afd942f6 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 21 Jan 2010 11:10:36 +0100 Subject: Fix pro file error affecting windows builds Reviewed-by: axis --- tools/runonphone/runonphone.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro index cb27d1b..2c1be98 100644 --- a/tools/runonphone/runonphone.pro +++ b/tools/runonphone/runonphone.pro @@ -18,7 +18,7 @@ windows { -luuid \ -ladvapi32 } -unix:!symbian { +else:unix:!symbian { SOURCES += serenum_unix.cpp } else { -- cgit v0.12 From a6165c5ec3b16d3f778a2da38d90a8afe8d58cd8 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 21 Jan 2010 11:26:14 +0100 Subject: Fix missing focus rect for check and radio buttons in some GTK+ themes Some themes such as Nodoka does not draw a focus rect but instead reads the focus flag on the widget itself. Hence we have to set this flag before drawing. Task-number: QTBUG-7504 Reviewed-by: thorbjorn --- src/gui/styles/qgtkstyle.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 211f4ce..b5f052b 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1106,8 +1106,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // ### Note: Ubuntulooks breaks when the proper widget is passed // Murrine engine requires a widget not to get RGBA check - warnings GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); - gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, QLS("radiobutton")); - + QString key(QLS("radiobutton")); + if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag + key += QLatin1Char('f'); + GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); + } + gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, key); + if (option->state & State_HasFocus) + GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); } break; @@ -1128,6 +1134,11 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, int spacing; GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); + QString key(QLS("checkbutton")); + if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag + key += QLatin1Char('f'); + GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); + } // Some styles such as aero-clone assume they can paint in the spacing area gtkPainter.setClipRect(option->rect); @@ -1137,7 +1148,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); gtkPainter.paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtkCheckButton->style, - QLS("checkbutton")); + key); + if (option->state & State_HasFocus) + GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); + } break; -- cgit v0.12 From 967b6980372b3a3b988d2284bdd10b8154482680 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 21 Jan 2010 12:30:31 +0100 Subject: Add qttracereplay.exe to gitignore Reviewed-by: TrustMe --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2069ad5..c8153fc 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ bin/qmake* bin/qdoc3* bin/qt3to4* bin/qtdemo* +bin/qttracereplay* bin/rcc* bin/uic* bin/patternist* -- cgit v0.12 From af30aeb6a1ebb7307f06c122c0c93d152f4d958c Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 21 Jan 2010 12:46:38 +0100 Subject: QtHelp: Enable dynamic translation. Task-number: QTBUG-7420 Reviewed-by: kh1 --- tools/assistant/lib/qhelpsearchquerywidget.cpp | 71 ++++++++++++++++++------- tools/assistant/lib/qhelpsearchquerywidget.h | 3 +- tools/assistant/lib/qhelpsearchresultwidget.cpp | 8 +++ tools/assistant/lib/qhelpsearchresultwidget.h | 1 + 4 files changed, 63 insertions(+), 20 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index a2b3ca2..b614cb4 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -120,6 +120,22 @@ private: // nothing todo } + void retranslate() + { + simpleSearchLabel->setText(tr("Search for:")); + prevQueryButton->setToolTip(tr("Previous search")); + nextQueryButton->setToolTip(tr("Next search")); + searchButton->setText(tr("Search")); +#ifdef QT_CLUCENE_SUPPORT + advancedSearchLabel->setText(tr("Advanced search")); + similarLabel->setText(tr("words similar to:")); + withoutLabel->setText(tr("without the words:")); + exactLabel->setText(tr("with exact phrase:")); + allLabel->setText(tr("with all of the words:")); + atLeastLabel->setText(tr("with at least one of the words:")); +#endif + } + QString escapeString(const QString &text) { QString retValue = text; @@ -360,6 +376,13 @@ private: friend class QHelpSearchQueryWidget; bool simpleSearch; + QLabel *simpleSearchLabel; + QLabel *advancedSearchLabel; + QLabel *similarLabel; + QLabel *withoutLabel; + QLabel *exactLabel; + QLabel *allLabel; + QLabel *atLeastLabel; QPushButton *searchButton; QWidget* advancedSearchWidget; QToolButton *showHideAdvancedSearchButton; @@ -408,19 +431,17 @@ QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent) vLayout->setMargin(0); QHBoxLayout* hBoxLayout = new QHBoxLayout(); - QLabel *label = new QLabel(tr("Search for:"), this); + d->simpleSearchLabel = new QLabel(this); d->defaultQuery = new QLineEdit(this); d->defaultQuery->setCompleter(&d->searchCompleter); d->prevQueryButton = new QToolButton(this); d->prevQueryButton->setArrowType(Qt::LeftArrow); - d->prevQueryButton->setToolTip(tr("Previous search")); d->prevQueryButton->setEnabled(false); d->nextQueryButton = new QToolButton(this); d->nextQueryButton->setArrowType(Qt::RightArrow); - d->nextQueryButton->setToolTip(tr("Next search")); d->nextQueryButton->setEnabled(false); - d->searchButton = new QPushButton(tr("Search"), this); - hBoxLayout->addWidget(label); + d->searchButton = new QPushButton(this); + hBoxLayout->addWidget(d->simpleSearchLabel); hBoxLayout->addWidget(d->defaultQuery); hBoxLayout->addWidget(d->prevQueryButton); hBoxLayout->addWidget(d->nextQueryButton); @@ -439,15 +460,15 @@ QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent) d->showHideAdvancedSearchButton->setText(QLatin1String("+")); d->showHideAdvancedSearchButton->setMinimumSize(25, 20); - label = new QLabel(tr("Advanced search"), this); + d->advancedSearchLabel = new QLabel(this); QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth()); - label->setSizePolicy(sizePolicy); + sizePolicy.setHeightForWidth(d->advancedSearchLabel->sizePolicy().hasHeightForWidth()); + d->advancedSearchLabel->setSizePolicy(sizePolicy); QFrame* hLine = new QFrame(this); hLine->setFrameStyle(QFrame::HLine); hBoxLayout->addWidget(d->showHideAdvancedSearchButton); - hBoxLayout->addWidget(label); + hBoxLayout->addWidget(d->advancedSearchLabel); hBoxLayout->addWidget(hLine); vLayout->addLayout(hBoxLayout); @@ -457,32 +478,32 @@ QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent) QGridLayout *gLayout = new QGridLayout(d->advancedSearchWidget); gLayout->setMargin(0); - label = new QLabel(tr("words similar to:"), this); - gLayout->addWidget(label, 0, 0); + d->similarLabel = new QLabel(this); + gLayout->addWidget(d->similarLabel, 0, 0); d->similarQuery = new QLineEdit(this); d->similarQuery->setCompleter(&d->searchCompleter); gLayout->addWidget(d->similarQuery, 0, 1); - label = new QLabel(tr("without the words:"), this); - gLayout->addWidget(label, 1, 0); + d->withoutLabel = new QLabel(this); + gLayout->addWidget(d->withoutLabel, 1, 0); d->withoutQuery = new QLineEdit(this); d->withoutQuery->setCompleter(&d->searchCompleter); gLayout->addWidget(d->withoutQuery, 1, 1); - label = new QLabel(tr("with exact phrase:"), this); - gLayout->addWidget(label, 2, 0); + d->exactLabel = new QLabel(this); + gLayout->addWidget(d->exactLabel, 2, 0); d->exactQuery = new QLineEdit(this); d->exactQuery->setCompleter(&d->searchCompleter); gLayout->addWidget(d->exactQuery, 2, 1); - label = new QLabel(tr("with all of the words:"), this); - gLayout->addWidget(label, 3, 0); + d->allLabel = new QLabel(this); + gLayout->addWidget(d->allLabel, 3, 0); d->allQuery = new QLineEdit(this); d->allQuery->setCompleter(&d->searchCompleter); gLayout->addWidget(d->allQuery, 3, 1); - label = new QLabel(tr("with at least one of the words:"), this); - gLayout->addWidget(label, 4, 0); + d->atLeastLabel = new QLabel(this); + gLayout->addWidget(d->atLeastLabel, 4, 0); d->atLeastQuery = new QLineEdit(this); d->atLeastQuery->setCompleter(&d->searchCompleter); gLayout->addWidget(d->atLeastQuery, 4, 1); @@ -490,6 +511,8 @@ QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent) vLayout->addWidget(d->advancedSearchWidget); d->advancedSearchWidget->hide(); + d->retranslate(); + connect(d->exactQuery, SIGNAL(returnPressed()), this, SIGNAL(search())); connect(d->similarQuery, SIGNAL(returnPressed()), this, SIGNAL(search())); connect(d->withoutQuery, SIGNAL(returnPressed()), this, SIGNAL(search())); @@ -531,4 +554,14 @@ void QHelpSearchQueryWidget::focusInEvent(QFocusEvent *focusEvent) } } +/*! \reimp +*/ +void QHelpSearchQueryWidget::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + d->retranslate(); + else + QWidget::changeEvent(event); +} + QT_END_NAMESPACE diff --git a/tools/assistant/lib/qhelpsearchquerywidget.h b/tools/assistant/lib/qhelpsearchquerywidget.h index a99bae0..2afc4b4 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.h +++ b/tools/assistant/lib/qhelpsearchquerywidget.h @@ -74,7 +74,8 @@ Q_SIGNALS: void search(); private: - void focusInEvent(QFocusEvent *focusEvent); + virtual void focusInEvent(QFocusEvent *focusEvent); + virtual void changeEvent(QEvent *event); private: QHelpSearchQueryWidgetPrivate *d; diff --git a/tools/assistant/lib/qhelpsearchresultwidget.cpp b/tools/assistant/lib/qhelpsearchresultwidget.cpp index 3cac880..a3f5aed 100644 --- a/tools/assistant/lib/qhelpsearchresultwidget.cpp +++ b/tools/assistant/lib/qhelpsearchresultwidget.cpp @@ -408,6 +408,14 @@ QHelpSearchResultWidget::QHelpSearchResultWidget(QHelpSearchEngine *engine) connect(engine, SIGNAL(searchingFinished(int)), d, SLOT(setResults(int))); } +/*! \reimp +*/ +void QHelpSearchResultWidget::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + d->setResults(d->searchEngine->hitCount()); +} + /*! Destroys the search result widget. */ diff --git a/tools/assistant/lib/qhelpsearchresultwidget.h b/tools/assistant/lib/qhelpsearchresultwidget.h index d078079..ff29adc 100644 --- a/tools/assistant/lib/qhelpsearchresultwidget.h +++ b/tools/assistant/lib/qhelpsearchresultwidget.h @@ -75,6 +75,7 @@ private: QHelpSearchResultWidgetPrivate *d; QHelpSearchResultWidget(QHelpSearchEngine *engine); + virtual void changeEvent(QEvent *event); }; QT_END_NAMESPACE -- cgit v0.12 From 694be5a31be7e24761753ab9eccd87e8d08607e0 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 21 Jan 2010 11:28:00 +0100 Subject: qUncompress: Fix terminating \0 Task-number: 6666 Reviewed-by: Harald Fernengel --- src/corelib/tools/qbytearray.cpp | 1 + tests/auto/qbytearray/tst_qbytearray.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 4049925..556093f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -561,6 +561,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) d->ref = 1; d->alloc = d->size = len; d->data = d->array; + d->array[len] = 0; return QByteArray(d.take(), 0, 0); diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp index 35e4463..5c72c7a 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/qbytearray/tst_qbytearray.cpp @@ -76,6 +76,7 @@ private slots: void qCompress(); void qUncompress_data(); void qUncompress(); + void qCompressionZeroTermination(); #endif void constByteArray(); void leftJustified(); @@ -261,6 +262,14 @@ void tst_QByteArray::qUncompress() } QCOMPARE(res, out); } + +void tst_QByteArray::qCompressionZeroTermination() +{ + QString s = "Hello, I'm a string."; + QByteArray ba = ::qUncompress(::qCompress(s.toLocal8Bit())); + QVERIFY((int) *(ba.data() + ba.size()) == 0); +} + #endif void tst_QByteArray::constByteArray() -- cgit v0.12 From 0a9e29a58bd501af2e52f868386b27b29ebb1a72 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 20 Jan 2010 22:37:03 +0100 Subject: QNAM HTTP: make it give some better error messages in case of socket failure. Reviewed-By: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 7 ++++--- src/network/access/qhttpnetworkconnection_p.h | 3 ++- src/network/access/qhttpnetworkconnectionchannel.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 20baac8..fff7097 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -564,7 +564,8 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList &queue, } -QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket* socket) +QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket* socket, + const QString &extraDetail) { Q_ASSERT(socket); @@ -581,7 +582,7 @@ QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError e errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection closed")); break; case QNetworkReply::TimeoutError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "HTTP request failed")); + errorString = QLatin1String(QT_TRANSLATE_NOOP("QAbstractSocket", "Socket operation timed out")); break; case QNetworkReply::ProxyAuthenticationRequiredError: errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Proxy requires authentication")); @@ -600,7 +601,7 @@ QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError e break; default: // all other errors are treated as QNetworkReply::UnknownNetworkError - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "HTTP request failed")); + errorString = extraDetail; break; } return errorString; diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 76da883..03cf09c 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -185,7 +185,8 @@ public: void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); - QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket); + QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, + const QString &extraDetail = QString()); #ifndef QT_NO_COMPRESS bool expand(QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 1955dba..b80ae9a 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -872,7 +872,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket break; } QPointer that = connection; - QString errorString = connection->d_func()->errorDetail(errorCode, socket); + QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); if (send2Reply) { if (reply) { reply->d_func()->errorString = errorString; -- cgit v0.12 From b9ef8332db374ef22ebd1045560c4cca1301e2c3 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 21 Jan 2010 14:03:43 +0100 Subject: doc: Documented the return value for QDomNode::appendChild(). Task-number: QTBUG-7498 --- src/xml/dom/qdom.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 657c79a..cae959b 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -2596,11 +2596,15 @@ QDomNode QDomNode::removeChild(const QDomNode& oldChild) already has an element node as a child, \a newChild is not added as a child and a null node is returned. - Calling this function on a null node(created, for example, with the - default constructor) does nothing. + Returns a new reference to \a newChild on success or a \link + isNull() null node\endlink on failure. - The DOM specification disallow inserting attribute nodes, but due - to historical reasons QDom accept them nevertheless. + Calling this function on a null node(created, for example, with + the default constructor) does nothing and returns a \link isNull() + null node\endlink. + + The DOM specification disallow inserting attribute nodes, but for + historical reasons, QDom accepts them anyway. \sa insertBefore() insertAfter() replaceChild() removeChild() */ -- cgit v0.12 From c86ab3fcedd3bcfa195d42d45fb732cb8315319d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 20 Jan 2010 21:06:32 +0100 Subject: SSL Certificate: don't crash when the END CERTIFICATE line ends without CRLF If the file/data ends in the END CERTIFICATE line without a newline, the certificate is still valid. If it's followed by anything other than a newline, then it's no longer valid. Also add another test for the BEGIN CERTIFICATE ending without newline, to ensure we don't crash there either. Reviewed-By: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 8 ++++---- .../more-certificates/malformed-just-begin-no-newline.pem | 1 + .../more-certificates/malformed-just-begin.pem | 1 + .../qsslcertificate/more-certificates/no-ending-newline.pem | 13 +++++++++++++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 3 +++ 5 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 8993e72..9a9b1b5 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -696,11 +696,11 @@ QSslCertificate QSslCertificatePrivate::QSslCertificate_from_X509(X509 *x509) static bool matchLineFeed(const QByteArray &pem, int *offset) { - char ch = pem.at(*offset); + char ch; // ignore extra whitespace at the end of the line - while (ch == ' ' && *offset < pem.size()) - ch = pem.at(++*offset); + while (*offset < pem.size() && (ch = pem.at(*offset)) == ' ') + ++*offset; if (ch == '\n') { *offset += 1; @@ -732,7 +732,7 @@ QList QSslCertificatePrivate::certificatesFromPem(const QByteAr break; offset = endPos + sizeof(ENDCERTSTRING) - 1; - if (!matchLineFeed(pem, &offset)) + if (offset < pem.size() && !matchLineFeed(pem, &offset)) break; QByteArray decoded = QByteArray::fromBase64( diff --git a/tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem b/tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem new file mode 100644 index 0000000..75f3c32 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem @@ -0,0 +1 @@ +-----BEGIN CERTIFICATE----- \ No newline at end of file diff --git a/tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem b/tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem new file mode 100644 index 0000000..a71aecf --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem @@ -0,0 +1 @@ +-----BEGIN CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem b/tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem new file mode 100644 index 0000000..f8056c7 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB8zCCAVwCAREwDQYJKoZIhvcNAQEFBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV +BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD +VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNMDcwNDE3MDc0MDI2WhcNMDcwNTE3 +MDc0MDI2WjApMRowGAYDVQQDExFuYW1lL3dpdGgvc2xhc2hlczELMAkGA1UEBhMC +Tk8wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOud6QOsME+pWANExxgmL0iT +1ayg++hTxHsqAYnm/FoMxfUh+NdKkgJn2/GfNppinfPOSI667VqonU+7JBZDTLV5 +CPbZIo9fFQpDJQN6naev4yaxU1VeYFfI7S8c8zYKeGSR+RenNNeLvfH80YxPpZZ1 +snv8IfDH2V8MVxiyr7lLAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAleaU4pgzV6KY ++q9QuXapUYMsC2GiNtDmkG3k+MTHUO8XlE4hqPrIM6rRf7zKQdZ950R2wL9FSnYl +Qm1Tdv38dCka6ivMBqvRuOt9axH3m0G7nzHL7U3zaCbtEx3yVln+b3yYtiVpTuq0 +3MLrt7tQGAW6ra8ISf6YY1W65/uVXZE= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 44f8522..c76c11f 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -543,6 +543,9 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; + QTest::newRow("no-ending-newline") << QString("more-certificates/no-ending-newline.pem") << int(QRegExp::FixedString) << true << 1; + QTest::newRow("malformed-just-begin") << QString("more-certificates/malformed-just-begin.pem") << int(QRegExp::FixedString) << true << 0; + QTest::newRow("malformed-just-begin-no-newline") << QString("more-certificates/malformed-just-begin-no-newline.pem") << int(QRegExp::FixedString) << true << 0; } void tst_QSslCertificate::fromPath() -- cgit v0.12 From e96c1d6ea945c12fb5de929709ab33c476a63cb5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 21 Jan 2010 11:57:42 +0100 Subject: Revert "Make an empty QUrl also be considered non-detached (d == 0)." as agreed with Warwick. This reverts commit 089ee7094eabb2058b478f5d2f306a69f6c0b3bf. --- src/corelib/io/qurl.cpp | 2 +- tests/auto/qurl/tst_qurl.cpp | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 74e5f74..a131d6c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -5932,7 +5932,7 @@ void QUrl::detach() */ bool QUrl::isDetached() const { - return d && d->ref == 1; + return !d || d->ref == 1; } diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index ecd6f09..33812fe 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -90,7 +90,6 @@ public slots: private slots: void getSetCheck(); void constructing(); - void isDetached(); void assignment(); void comparison(); void copying(); @@ -319,25 +318,6 @@ void tst_QUrl::constructing() QVERIFY(!buildUNC.isEmpty()); } -void tst_QUrl::isDetached() -{ - QUrl url; - QVERIFY(!url.isDetached()); - - url = "http://qt.nokia.com/"; - QVERIFY(url.isDetached()); - - url.clear(); - QVERIFY(!url.isDetached()); - - url.setHost("qt.nokia.com"); - QVERIFY(url.isDetached()); - - QUrl url2 = url; - QVERIFY(!url.isDetached()); - QVERIFY(!url2.isDetached()); -} - void tst_QUrl::assignment() { QUrl url("http://qt.nokia.com/"); -- cgit v0.12 From c2573f74fb8a09484b385e4469d887bb0fea8cb9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 21 Jan 2010 14:48:34 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 8f5ca3ba5da63a47d4f90bbd867d3e8453443dd3 ) Changes in WebKit/qt since the last update: * Girish: Fix positioning of ComboBox popup in QGraphicsWebView. -- https://bugs.webkit.org/show_bug.cgi?id=33887 --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/platform/PopupMenu.h | 2 ++ .../webkit/WebCore/platform/qt/PopupMenuQt.cpp | 21 +++++++++++++++++++-- .../webkit/WebCore/platform/qt/QWebPopup.cpp | 5 +++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 9dd9377..6fe71d6 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - e15bd5454732bab9ffff4e1e5a755f41fd4e2eff + 8f5ca3ba5da63a47d4f90bbd867d3e8453443dd3 diff --git a/src/3rdparty/webkit/WebCore/platform/PopupMenu.h b/src/3rdparty/webkit/WebCore/platform/PopupMenu.h index 2315f02..f2fffb5 100644 --- a/src/3rdparty/webkit/WebCore/platform/PopupMenu.h +++ b/src/3rdparty/webkit/WebCore/platform/PopupMenu.h @@ -44,6 +44,7 @@ typedef struct HBITMAP__* HBITMAP; namespace WebCore { class QWebPopup; } +class QGraphicsProxyWidget; #elif PLATFORM(GTK) typedef struct _GtkMenu GtkMenu; typedef struct _GtkMenuItem GtkMenuItem; @@ -147,6 +148,7 @@ private: void clear(); void populate(const IntRect&); QWebPopup* m_popup; + QGraphicsProxyWidget* m_proxy; #elif PLATFORM(WIN) // ScrollBarClient virtual void valueChanged(Scrollbar*); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp index f6ec4f7..989b34c 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp @@ -1,6 +1,7 @@ /* * This file is part of the popup menu implementation for