summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure1
-rw-r--r--doc/src/datastreamformat.qdoc10
-rw-r--r--src/dbus/qdbuspendingcall.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp4
-rw-r--r--src/gui/kernel/qapplication_win.cpp15
-rw-r--r--src/gui/kernel/qlayout.cpp9
-rw-r--r--src/gui/painting/qbackingstore.cpp5
-rw-r--r--src/gui/painting/qdrawhelper.cpp3
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp19
-rw-r--r--src/gui/painting/qprinter.cpp10
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp4
-rw-r--r--src/gui/styles/qmacstyle_mac.mm96
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/widgets/qmenu_wince.cpp16
-rw-r--r--src/network/access/qnetworkcookie.cpp33
-rw-r--r--src/network/access/qnetworkcookie_p.h1
-rw-r--r--src/network/kernel/qnetworkproxy.cpp22
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp9
-rw-r--r--src/opengl/qglpixelbuffer_mac.mm3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp12
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp1
-rw-r--r--src/xmlpatterns/expr/qapplytemplate.cpp3
-rw-r--r--src/xmlpatterns/functions/qsequencefns.cpp3
-rw-r--r--tests/arthur/data/qps/borderimage.qps19
-rw-r--r--tests/arthur/data/qps/borderimage_qps.pngbin90704 -> 91838 bytes
-rw-r--r--tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp73
-rw-r--r--tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp33
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp2
-rw-r--r--tools/assistant/tools/assistant/cmdlineparser.cpp9
-rw-r--r--tools/assistant/tools/assistant/cmdlineparser.h2
-rw-r--r--tools/assistant/tools/assistant/main.cpp35
-rw-r--r--tools/assistant/tools/assistant/preferencesdialog.cpp175
32 files changed, 471 insertions, 168 deletions
diff --git a/configure b/configure
index 740f95a..ea1bc34 100755
--- a/configure
+++ b/configure
@@ -2718,7 +2718,6 @@ if [ "$PLATFORM_MAC" = "yes" ]; then
# Build commmand line arguments we can pass to the compiler during configure tests
# by prefixing each arch with "-arch".
CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}"
- CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/i386_64/x86_64}"
for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do
MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH"
done
diff --git a/doc/src/datastreamformat.qdoc b/doc/src/datastreamformat.qdoc
index 3c651fb..67a3794 100644
--- a/doc/src/datastreamformat.qdoc
+++ b/doc/src/datastreamformat.qdoc
@@ -69,6 +69,10 @@
the application happens to be running on.
\table
+ \row \o bool
+ \o \list
+ \o boolean
+ \endlist
\row \o qint8
\o \list
\o signed byte
@@ -297,6 +301,12 @@
\o \list
\o Milliseconds since midnight (quint32)
\endlist
+
+ \row \o QUrl
+ \o \list
+ \o Holds an URL (QString)
+ \endlist
+
\row \o QVariant
\o \list
\o The type of the data (quint32)
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 9753bbe..955f4a0 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -432,9 +432,14 @@ inline void QDBusPendingCallWatcherPrivate::_q_finished()
QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent)
: QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call)
{
- if (d) {
- if (!d->watcherHelper)
+ if (d) { // QDBusPendingCall::d
+ if (!d->watcherHelper) {
d->watcherHelper = new QDBusPendingCallWatcherHelper;
+ if (isFinished()) {
+ // cause a signal emission anyways
+ QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection);
+ }
+ }
d->watcherHelper->add(this);
}
}
@@ -464,6 +469,7 @@ void QDBusPendingCallWatcher::waitForFinished()
d->waitForFinished();
// our signals were queued, so deliver them
+ QCoreApplication::sendPostedEvents(d->watcherHelper, QEvent::MetaCall);
QCoreApplication::sendPostedEvents(this, QEvent::MetaCall);
}
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7be7df5..743c16d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1263,8 +1263,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
return;
// Flags that alter the geometry of the item (or its children).
- int geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations);
- bool fullUpdate = (flags & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask);
+ const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations);
+ bool fullUpdate = (quint32(flags) & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask);
if (fullUpdate)
d_ptr->fullUpdateHelper(false, true);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index ac17a93..6237657 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1722,6 +1722,21 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// fall-through intended
case WM_KEYUP:
case WM_SYSKEYUP:
+#if Q_OS_WINCE_WM
+ case WM_HOTKEY:
+ if(HIWORD(msg.lParam) == VK_TBACK) {
+ const bool hotKeyDown = !(LOWORD(msg.lParam) & MOD_KEYUP);
+ msg.lParam = 0x69 << 16;
+ msg.wParam = VK_BACK;
+ if (hotKeyDown) {
+ msg.message = WM_KEYDOWN;
+ qt_keymapper_private()->updateKeyMap(msg);
+ } else {
+ msg.message = WM_KEYUP;
+ }
+ }
+ // fall-through intended
+#endif
case WM_IME_CHAR:
case WM_IME_KEYDOWN:
case WM_CHAR: {
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp
index 1d5a70d..4463aab 100644
--- a/src/gui/kernel/qlayout.cpp
+++ b/src/gui/kernel/qlayout.cpp
@@ -1028,8 +1028,13 @@ void QLayout::freeze(int w, int h)
void QLayout::setMenuBar(QWidget *widget)
{
Q_D(QLayout);
- if (widget)
- addChildWidget(widget);
+
+#ifdef Q_OS_WINCE_WM
+ if (widget && widget->size().height() > 0)
+#else
+ if (widget)
+#endif
+ addChildWidget(widget);
d->menubar = widget;
}
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 341331b..0a3a8dd 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -491,8 +491,9 @@ static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately)
if (!widget)
return;
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately) {
+#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
+ if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately
+ && !widget->testAttribute(Qt::WA_DontShowOnScreen)) {
// Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events
// are blocked until the mouse button is released. See task 146849.
const QRegion rgn(qt_dirtyRegion(widget));
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index ec4737c..fdd0c21 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2106,8 +2106,7 @@ static inline int color_burn_op(int dst, int src, int da, int sa)
if (src == 0 || src_da + dst_sa <= sa_da)
return qt_div_255(temp);
- else
- return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
+ return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
}
template <typename T>
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 3428faf..c986e99 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2579,9 +2579,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (!aa && sr.size() == QSize(1, 1)) {
// as fillRect will apply the aliased coordinate delta we need to
// subtract it here as we don't use it for image drawing
- const QRectF targetRect = r.translated(-aliasedCoordinateDelta,
- -aliasedCoordinateDelta);
- fillRect(targetRect, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+ QTransform old = s->matrix;
+ s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
+ fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+ s->matrix = old;
return;
}
@@ -2615,6 +2616,18 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
return;
d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
+ if (!aa && s->matrix.type() == QTransform::TxScale) {
+ QRectF rr = s->matrix.mapRect(r);
+
+ const int x1 = qRound(rr.x());
+ const int y1 = qRound(rr.y());
+ const int x2 = qRound(rr.right());
+ const int y2 = qRound(rr.bottom());
+
+ fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d);
+ return;
+ }
+
#ifdef QT_FAST_SPANS
ensureState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 5161e32..5efe0be 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -284,8 +284,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke
to send PostScript or PDF output to the printer. As an alternative,
the printProgram() function can be used to specify the command or utility
to use instead of the system default.
-
- Note that setting parameters like paper size and resolution on an
+
+ Note that setting parameters like paper size and resolution on an
invalid printer is undefined. You can use QPrinter::isValid() to
verify this before changing any parameters.
@@ -744,7 +744,7 @@ void QPrinter::setOutputFormat(OutputFormat format)
#ifndef QT_NO_PDF
Q_D(QPrinter);
- if (d->outputFormat == format)
+ if (d->validPrinter && d->outputFormat == format)
return;
d->outputFormat = format;
@@ -773,8 +773,8 @@ void QPrinter::setOutputFormat(OutputFormat format)
if (def_engine)
delete oldPrintEngine;
- d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
-
+ d->validPrinter = (d->outputFormat == QPrinter::PdfFormat
+ || d->outputFormat == QPrinter::PostScriptFormat);
#else
Q_UNUSED(format);
#endif
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index dd4f7fd..3e7b015 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -142,8 +142,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn)
p.fillRect(*it, blank);
}
}
-#endif
-#if defined(Q_WS_WINCE)
+#else
Q_UNUSED(rgn);
#endif
}
@@ -250,6 +249,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
// d->image->image.save("flush.png");
+ Q_UNUSED(offset);
// Get a context for the widget.
#ifndef QT_MAC_USE_COCOA
CGContextRef context;
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 2558625..64ec29a 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -564,7 +564,6 @@ extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
QMacCGStyle globals
*****************************************************************************/
const int qt_mac_hitheme_version = 0; //the HITheme version we speak
-const int macSpinBoxSep = 5; // distance between spinwidget and the lineedit
const int macItemFrame = 2; // menu item frame width
const int macItemHMargin = 3; // menu item hor text margin
const int macItemVMargin = 2; // menu item ver text margin
@@ -2391,7 +2390,14 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
break;
case PM_SpinBoxFrameWidth:
GetThemeMetric(kThemeMetricEditTextFrameOutset, &ret);
- ret += 2;
+ switch (d->aquaSizeConstrain(opt, widget)) {
+ default:
+ ret += 2;
+ break;
+ case QAquaSizeMini:
+ ret += 1;
+ break;
+ }
break;
case PM_ButtonShiftHorizontal:
case PM_ButtonShiftVertical:
@@ -5064,11 +5070,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bdi.kind = kThemeIncDecButton;
break;
case QAquaSizeMini:
+ bdi.kind = kThemeIncDecButtonMini;
+ break;
case QAquaSizeSmall:
- if (aquaSize == QAquaSizeMini)
- bdi.kind = kThemeIncDecButtonMini;
- else
- bdi.kind = kThemeIncDecButtonSmall;
+ bdi.kind = kThemeIncDecButtonSmall;
break;
}
if (!(sb->stepEnabled & (QAbstractSpinBox::StepUpEnabled
@@ -5088,8 +5093,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
- QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp,
- widget);
+ QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
+
updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
HIRect newRect = qt_hirectForQRect(updown);
QRect off_rct;
@@ -5100,15 +5105,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
int(outRect.size.width - newRect.size.width),
int(outRect.size.height - newRect.size.height));
- // HIThemeGetButtonBackgroundBounds offsets non-focused normal sized
- // buttons by one in de y direction, account for that here.
- if (bdi.adornment == kThemeAdornmentNone && bdi.kind == kThemeIncDecButton)
- off_rct.adjust(0, 1, 0, 0);
-
- // Adjust the rect for small buttos also.
- if (bdi.adornment == kThemeAdornmentFocus && bdi.kind == kThemeIncDecButtonSmall)
- off_rct.adjust(0, 0, 0, -1);
-
newRect = qt_hirectForQRect(updown, off_rct);
HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
}
@@ -5784,39 +5780,61 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
- const int spinner_w = 14,
- fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
+ QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
+ int spinner_w;
+ int spinBoxSep;
+ int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
+ switch (aquaSize) {
+ default:
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ spinner_w = 14;
+ spinBoxSep = 2;
+ break;
+ case QAquaSizeSmall:
+ spinner_w = 12;
+ spinBoxSep = 2;
+ break;
+ case QAquaSizeMini:
+ spinner_w = 10;
+ spinBoxSep = 1;
+ break;
+ }
+
switch (sc) {
case SC_SpinBoxUp:
case SC_SpinBoxDown: {
if (spin->buttonSymbols == QAbstractSpinBox::NoButtons)
break;
- const int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
- const int spinner_w = 18;
- const int y = frameWidth;
- const int x = spin->rect.width() - spinner_w + frameWidth;
+
+ const int y = fw;
+ const int x = spin->rect.width() - spinner_w;
ret.setRect(x + spin->rect.x(), y + spin->rect.y(), spinner_w, spin->rect.height() - y * 2);
HIThemeButtonDrawInfo bdi;
bdi.version = qt_mac_hitheme_version;
bdi.kind = kThemeIncDecButton;
- QAquaWidgetSize aquaSize = d->aquaSizeConstrain(opt, widget);
+ int hackTranslateX;
switch (aquaSize) {
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- bdi.kind = kThemeIncDecButton;
- break;
- case QAquaSizeMini:
- case QAquaSizeSmall:
- if (aquaSize == QAquaSizeMini)
- bdi.kind = kThemeIncDecButtonMini;
- else
- bdi.kind = kThemeIncDecButtonSmall;
- break;
+ default:
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ bdi.kind = kThemeIncDecButton;
+ hackTranslateX = 0;
+ break;
+ case QAquaSizeSmall:
+ bdi.kind = kThemeIncDecButtonSmall;
+ hackTranslateX = -2;
+ break;
+ case QAquaSizeMini:
+ bdi.kind = kThemeIncDecButtonMini;
+ hackTranslateX = -1;
+ break;
}
bdi.state = kThemeStateActive;
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
HIRect hirect = qt_hirectForQRect(ret);
+
HIRect outRect;
HIThemeGetButtonBackgroundBounds(&hirect, &bdi, &outRect);
ret = qt_qrectForHIRect(outRect);
@@ -5831,13 +5849,13 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
Q_ASSERT(0);
break;
}
- ret.translate(-1, -2); // hack: position the buttons correctly (weird that we need this)
+ ret.translate(hackTranslateX, 0); // hack: position the buttons correctly (weird that we need this)
ret = visualRect(spin->direction, spin->rect, ret);
break;
}
case SC_SpinBoxEditField:
ret.setRect(fw, fw,
- spin->rect.width() - spinner_w - fw * 2 - macSpinBoxSep + 1,
+ spin->rect.width() - spinner_w - fw * 2 - spinBoxSep,
spin->rect.height() - fw * 2);
ret = visualRect(spin->direction, spin->rect, ret);
break;
@@ -5869,8 +5887,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
switch (ct) {
case QStyle::CT_SpinBox:
- sz.setWidth(sz.width() + macSpinBoxSep);
- sz.setHeight(sz.height() - 3); // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ sz.setHeight(sz.height() - 3);
break;
case QStyle::CT_TabBarTab:
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 24ff10b..f73ffb5 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -913,7 +913,7 @@ void QFont::setPointSize(int pointSize)
void QFont::setPointSizeF(qreal pointSize)
{
if (pointSize <= 0) {
- qWarning("QFont::setPointSizeF: Point size <= 0 (%d), must be greater than 0", pointSize);
+ qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize);
return;
}
diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
index 315bd51..9a7374a 100644
--- a/src/gui/widgets/qmenu_wince.cpp
+++ b/src/gui/widgets/qmenu_wince.cpp
@@ -58,6 +58,9 @@
#include <QtCore/qlibrary.h>
#include <commctrl.h>
+#if Q_OS_WINCE_WM
+# include <windowsm.h>
+#endif
#include "qguifunctions_wince.h"
@@ -71,6 +74,12 @@
#define SHCMBM_GETSUBMENU (WM_USER + 401)
#endif
+#ifdef Q_OS_WINCE_WM
+# define SHMBOF_NODEFAULT 0x00000001
+# define SHMBOF_NOTIFY 0x00000002
+# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193)
+#endif
+
extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp
extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp
@@ -204,8 +213,13 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i
mbi.dwFlags = flags;
mbi.nToolBarId = toolbarID;
- if (ptrCreateMenuBar(&mbi))
+ if (ptrCreateMenuBar(&mbi)) {
+ // Tell the menu bar that we want to override hot key behaviour.
+ LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
+ SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
+ SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam);
return mbi.hwndMB;
+ }
}
return 0;
}
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 82c9344..67df526 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -913,6 +913,17 @@ static QDateTime parseDateString(const QByteArray &dateString)
*/
QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieString)
{
+ // cookieString can be a number of set-cookie header strings joined together
+ // by \n, parse each line separately.
+ QList<QNetworkCookie> cookies;
+ QList<QByteArray> list = cookieString.split('\n');
+ for (int a = 0; a < list.size(); a++)
+ cookies += QNetworkCookiePrivate::parseSetCookieHeaderLine(list.at(a));
+ return cookies;
+}
+
+QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByteArray &cookieString)
+{
// According to http://wp.netscape.com/newsref/std/cookie_spec.html,<
// the Set-Cookie response header is of the format:
//
@@ -930,12 +941,6 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
while (position < length) {
QNetworkCookie cookie;
- // When there are multiple SetCookie headers they are join with a new line
- // \n will always be the start of a new cookie
- int endOfSetCookie = cookieString.indexOf('\n', position);
- if (endOfSetCookie == -1)
- endOfSetCookie = length;
-
// The first part is always the "NAME=VALUE" part
QPair<QByteArray,QByteArray> field = nextField(cookieString, position);
if (field.first.isEmpty() || field.second.isNull())
@@ -946,7 +951,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
position = nextNonWhitespace(cookieString, position);
bool endOfCookie = false;
- while (!endOfCookie && position < endOfSetCookie)
+ while (!endOfCookie && position < length) {
switch (cookieString.at(position++)) {
case ',':
// end of the cookie
@@ -969,9 +974,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
position = end;
QDateTime dt = parseDateString(dateString.toLower());
if (!dt.isValid()) {
- cookie = QNetworkCookie();
- endOfCookie = true;
- continue;
+ return result;
}
cookie.setExpirationDate(dt);
} else if (field.first == "domain") {
@@ -988,8 +991,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
bool ok = false;
int secs = field.second.toInt(&ok);
if (!ok)
- // invalid cookie string
- return QList<QNetworkCookie>();
+ return result;
cookie.setExpirationDate(now.addSecs(secs));
} else if (field.first == "path") {
QString path = QUrl::fromPercentEncoding(field.second);
@@ -1003,9 +1005,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
} else if (field.first == "version") {
if (field.second != "1") {
// oops, we don't know how to handle this cookie
- cookie = QNetworkCookie();
- endOfCookie = true;
- continue;
+ return result;
}
} else {
// got an unknown field in the cookie
@@ -1013,9 +1013,8 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
}
position = nextNonWhitespace(cookieString, position);
- if (position > endOfSetCookie)
- endOfCookie = true;
}
+ }
if (!cookie.name().isEmpty())
result += cookie;
diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h
index 83ef14a..0c41322 100644
--- a/src/network/access/qnetworkcookie_p.h
+++ b/src/network/access/qnetworkcookie_p.h
@@ -61,6 +61,7 @@ class QNetworkCookiePrivate: public QSharedData
{
public:
inline QNetworkCookiePrivate() : secure(false), httpOnly(false) { }
+ static QList<QNetworkCookie> parseSetCookieHeaderLine(const QByteArray &cookieString);
QDateTime expirationDate;
QString domain;
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index f4ece97..62bdfc7 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -86,10 +86,11 @@
The SOCKS5 support in Qt 4 is based on \l{RFC 1928} and \l{RFC 1929}.
The supported authentication methods are no authentication and
username/password authentication. Both IPv4 and IPv6 are
- supported, but domain name resolution via the SOCKS server is not
- supported; i.e. all domain names are resolved locally. There are
- several things to remember when using SOCKS5 with QUdpSocket and
- QTcpServer:
+ supported. Domain names are resolved through the SOCKS5 server if
+ the QNetworkProxy::HostNameLookupCapability is enabled, otherwise
+ they are resolved locally and the IP address is sent to the
+ server. There are several things to remember when using SOCKS5
+ with QUdpSocket and QTcpServer:
With QUdpSocket, a call to \l {QUdpSocket::bind()}{bind()} may fail
with a timeout error. If a port number other than 0 is passed to
@@ -365,7 +366,8 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro
int(QNetworkProxy::HostNameLookupCapability)),
};
- Q_ASSERT(int(type) >= 0 && int(type) <= int(QNetworkProxy::FtpCachingProxy));
+ if (int(type) < 0 && int(type) > int(QNetworkProxy::FtpCachingProxy))
+ type = QNetworkProxy::DefaultProxy;
return QNetworkProxy::Capabilities(defaults[int(type)]);
}
@@ -378,6 +380,7 @@ public:
QNetworkProxy::Capabilities capabilities;
quint16 port;
QNetworkProxy::ProxyType type;
+ bool capabilitiesSet;
inline QNetworkProxyPrivate(QNetworkProxy::ProxyType t = QNetworkProxy::DefaultProxy,
const QString &h = QString(), quint16 p = 0,
@@ -387,7 +390,8 @@ public:
password(pw),
capabilities(defaultCapabilitiesForType(t)),
port(p),
- type(t)
+ type(t),
+ capabilitiesSet(false)
{ }
inline bool operator==(const QNetworkProxyPrivate &other) const
@@ -490,13 +494,16 @@ QNetworkProxy &QNetworkProxy::operator=(const QNetworkProxy &other)
Sets the proxy type for this instance to be \a type.
Note that changing the type of a proxy does not change
- the set of capabilities this QNetworkProxy object holds.
+ the set of capabilities this QNetworkProxy object holds if any
+ capabilities have been set with setCapabilities().
\sa type(), setCapabilities()
*/
void QNetworkProxy::setType(QNetworkProxy::ProxyType type)
{
d->type = type;
+ if (!d->capabilitiesSet)
+ d->capabilities = defaultCapabilitiesForType(type);
}
/*!
@@ -519,6 +526,7 @@ QNetworkProxy::ProxyType QNetworkProxy::type() const
void QNetworkProxy::setCapabilities(Capabilities capabilities)
{
d->capabilities = capabilities;
+ d->capabilitiesSet = true;
}
/*!
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index e09e764..42c09f5 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -364,11 +364,14 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
// DT_RPATH tags on our library header as well as other system-specific search
// paths. See the man page for dlopen(3) on your system for more information.
+#ifdef Q_OS_OPENBSD
+ libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint);
+#endif
#ifdef SHLIB_VERSION_NUMBER
// first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER));
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER));
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
return pair;
} else {
@@ -380,7 +383,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
// second attempt: find the development files libssl.so and libcrypto.so
libssl->setFileNameAndVersion(QLatin1String("ssl"), -1);
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1);
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.0 and libcrypto.so.0 found
return pair;
} else {
@@ -395,7 +398,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
crypto.replace(QLatin1String("ssl"), QLatin1String("crypto"));
libssl->setFileNameAndVersion(ssl, -1);
libcrypto->setFileNameAndVersion(crypto, -1);
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.0 and libcrypto.so.0 found
return pair;
} else {
diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm
index 9a679b1..e95e36b 100644
--- a/src/opengl/qglpixelbuffer_mac.mm
+++ b/src/opengl/qglpixelbuffer_mac.mm
@@ -299,9 +299,8 @@ void QGLPixelBuffer::releaseFromDynamicTexture()
GLuint QGLPixelBuffer::generateDynamicTexture() const
{
- Q_D(const QGLPixelBuffer);
-
#ifdef QT_MAC_USE_COCOA
+ Q_D(const QGLPixelBuffer);
NSOpenGLContext *oldContext = [NSOpenGLContext currentContext];
if (d->share_ctx != oldContext)
[static_cast<NSOpenGLContext *>(d->share_ctx) makeCurrentContext];
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index f1e3c84..cd8796b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -178,15 +178,7 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
"Unable to get DirectFB handle!");
}
- DFBSurfaceDescription description;
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH |
- DSDESC_HEIGHT |
- DSDESC_PIXELFORMAT);
- description.width = rect.width();
- description.height = rect.height();
- QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description,
- screen->pixelFormat());
- dfbSurface = screen->createDFBSurface(description, false);
+ dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface);
forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32);
} else {
Q_ASSERT(dfbSurface);
@@ -340,7 +332,7 @@ inline bool isWidgetOpaque(const QWidget *w)
return false;
}
void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
+ const QPoint &offset)
{
Q_UNUSED(widget);
#ifdef QT_NO_DIRECTFB_WM
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 9932463..ee500a0 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -563,7 +563,6 @@ QChar QODBCDriverPrivate::quoteChar() const
static QChar quote = QChar::fromLatin1('"');
if (!isQuoteInitialized) {
char driverResponse[4];
- SQLUSMALLINT casing;
SQLSMALLINT length;
int r = SQLGetInfo(hDbc,
SQL_IDENTIFIER_QUOTE_CHAR,
diff --git a/src/xmlpatterns/expr/qapplytemplate.cpp b/src/xmlpatterns/expr/qapplytemplate.cpp
index 95f4fdf..b91c2f0 100644
--- a/src/xmlpatterns/expr/qapplytemplate.cpp
+++ b/src/xmlpatterns/expr/qapplytemplate.cpp
@@ -160,8 +160,7 @@ Item::Iterator::Ptr ApplyTemplate::evaluateSequence(const DynamicContext::Ptr &c
focus->setFocusIterator(focusIterator);
return makeSequenceMappingIterator<Item>(ConstPtr(this), focusIterator, focus);
}
- else
- return CommonValues::emptyIterator;
+ return CommonValues::emptyIterator;
}
}
diff --git a/src/xmlpatterns/functions/qsequencefns.cpp b/src/xmlpatterns/functions/qsequencefns.cpp
index f6d5391..faa787e 100644
--- a/src/xmlpatterns/functions/qsequencefns.cpp
+++ b/src/xmlpatterns/functions/qsequencefns.cpp
@@ -246,8 +246,7 @@ Item::Iterator::Ptr SubsequenceFN::evaluateSequence(const DynamicContext::Ptr &c
if(length < 1 && length != -1)
return CommonValues::emptyIterator;
- else
- return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length));
+ return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length));
}
Item SubsequenceFN::evaluateSingleton(const DynamicContext::Ptr &context) const
diff --git a/tests/arthur/data/qps/borderimage.qps b/tests/arthur/data/qps/borderimage.qps
index 14073fe..8d2e54b 100644
--- a/tests/arthur/data/qps/borderimage.qps
+++ b/tests/arthur/data/qps/borderimage.qps
@@ -123,6 +123,21 @@ end_block one_pixel_border
resetMatrix
+translate 205.1 626.1
+scale 0.4 0.4
+
+repeat_block one_pixel_border
+
+resetMatrix
+
+translate 255.1 624.1
+scale 0.4 0.4
+rotate 10
+
+repeat_block one_pixel_border
+
+resetMatrix
+
setPen red
drawRect 0 0 70 680
@@ -145,5 +160,5 @@ drawText 174 114 "smoothpixmaptransform off"
drawRect 164 128 224 134
drawText 174 252 "smoothpixmaptransform on"
-drawRect 200 520 97 128
-drawText 210 638 "1x1 edges"
+drawRect 200 520 97 188
+drawText 210 698 "1x1 edges"
diff --git a/tests/arthur/data/qps/borderimage_qps.png b/tests/arthur/data/qps/borderimage_qps.png
index a4ec6cb..ed51d5f 100644
--- a/tests/arthur/data/qps/borderimage_qps.png
+++ b/tests/arthur/data/qps/borderimage_qps.png
Binary files differ
diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
index 58707f1..947e8d6 100644
--- a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
+++ b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
@@ -90,6 +90,8 @@ private Q_SLOTS:
void watcher();
void watcher_error();
void watcher_waitForFinished();
+ void watcher_waitForFinished_alreadyFinished();
+ void watcher_waitForFinished_alreadyFinished_eventLoop();
void watcher_waitForFinished_error();
void callInsideWaitForFinished();
@@ -375,6 +377,77 @@ void tst_QDBusPendingCall::watcher_waitForFinished()
QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
}
+void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished()
+{
+ QDBusPendingCall ac = sendMessage();
+ QVERIFY(!ac.isFinished());
+ QVERIFY(!ac.isError());
+ QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
+
+ ac.waitForFinished();
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ callCount = 0;
+ watchArgument = 0;
+
+ // create a watcher on an already-finished reply
+ QDBusPendingCallWatcher watch(ac);
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(finished(QDBusPendingCallWatcher*)));
+
+ watch.waitForFinished();
+
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ QCOMPARE(callCount, 1);
+ QCOMPARE(slotCalled, (int)FinishCalled);
+ QCOMPARE(watchArgument, &watch);
+ QVERIFY(!watch.isError());
+
+ const QVariantList args2 = ac.reply().arguments();
+ QVERIFY(!args2.isEmpty());
+ QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
+}
+
+void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop()
+{
+ QDBusPendingCall ac = sendMessage();
+ QVERIFY(!ac.isFinished());
+ QVERIFY(!ac.isError());
+ QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
+
+ ac.waitForFinished();
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ callCount = 0;
+ watchArgument = 0;
+
+ // create a watcher on an already-finished reply
+ QDBusPendingCallWatcher watch(ac);
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(finished(QDBusPendingCallWatcher*)));
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ QCOMPARE(callCount, 1);
+ QCOMPARE(slotCalled, (int)FinishCalled);
+ QCOMPARE(watchArgument, &watch);
+ QVERIFY(!watch.isError());
+
+ const QVariantList args2 = ac.reply().arguments();
+ QVERIFY(!args2.isEmpty());
+ QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
+}
+
void tst_QDBusPendingCall::watcher_waitForFinished_error()
{
QDBusPendingCall ac = sendError();
diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
index 31a5391..0760ce8 100644
--- a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
+++ b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
@@ -59,6 +59,7 @@ public:
private slots:
void getSetCheck();
+ void capabilitiesPerType();
};
tst_QNetworkProxy::tst_QNetworkProxy()
@@ -79,6 +80,38 @@ void tst_QNetworkProxy::getSetCheck()
QCOMPARE(quint16(0), obj1.port());
obj1.setPort(quint16(0xffff));
QCOMPARE(quint16(0xffff), obj1.port());
+
+ obj1.setType(QNetworkProxy::DefaultProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy);
+ obj1.setType(QNetworkProxy::HttpProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy);
+ obj1.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QNetworkProxy::capabilitiesPerType()
+{
+ QNetworkProxy proxy(QNetworkProxy::Socks5Proxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::NoProxy);
+ // verify that the capabilities changed
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability));
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::HttpProxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability));
+
+ // now set the capabilities on stone:
+ proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+
+ // changing the type shouldn't change the capabilities any more
+ proxy.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
}
QTEST_MAIN(tst_QNetworkProxy)
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index ec54d0c..b78f346 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -810,7 +810,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
}
}
- if (QTabBar *tabBar = qobject_cast<QTabBar*>(object)) {
+ if (qobject_cast<QTabBar*>(object)) {
const bool dblClick = e->type() == QEvent::MouseButtonDblClick;
if ((e->type() == QEvent::MouseButtonRelease) || dblClick) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e);
diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp
index 0dae785..67eaa44 100644
--- a/tools/assistant/tools/assistant/cmdlineparser.cpp
+++ b/tools/assistant/tools/assistant/cmdlineparser.cpp
@@ -56,6 +56,7 @@ CmdLineParser::CmdLineParser()
m_bookmarks(Untouched),
m_search(Untouched),
m_register(None),
+ m_removeSearchIndex(false),
m_copy(false),
m_quiet(false)
{
@@ -83,6 +84,7 @@ CmdLineParser::CmdLineParser()
" (.qch) from the give collection\n"
" file.\n"
"-setCurrentFilter filter Set the filter as the active filter.\n"
+ "-remove-search-index Removes the full text search index.\n"
"-quiet Does not display any error or\n"
" status message.\n"
"-help Displays this help.\n"
@@ -217,6 +219,8 @@ CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments)
error = QObject::tr("Missing filter argument!");
break;
}
+ } else if (arg == QLatin1String("-remove-search-index")) {
+ m_removeSearchIndex = true;
} else if (arg == QLatin1String("-quiet")) {
continue;
} else if (arg == QLatin1String("-help")) {
@@ -307,6 +311,11 @@ QString CmdLineParser::currentFilter() const
return m_currentFilter;
}
+bool CmdLineParser::removeSearchIndex() const
+{
+ return m_removeSearchIndex;
+}
+
CmdLineParser::RegisterState CmdLineParser::registerRequest() const
{
return m_register;
diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h
index 332d464..263138b 100644
--- a/tools/assistant/tools/assistant/cmdlineparser.h
+++ b/tools/assistant/tools/assistant/cmdlineparser.h
@@ -67,6 +67,7 @@ public:
ShowState bookmarks() const;
ShowState search() const;
QString currentFilter() const;
+ bool removeSearchIndex() const;
RegisterState registerRequest() const;
QString helpFile() const;
@@ -90,6 +91,7 @@ private:
ShowState m_search;
RegisterState m_register;
QString m_currentFilter;
+ bool m_removeSearchIndex;
bool m_copy;
bool m_quiet;
};
diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp
index 794be02..75955ec 100644
--- a/tools/assistant/tools/assistant/main.cpp
+++ b/tools/assistant/tools/assistant/main.cpp
@@ -52,6 +52,8 @@
#include <QtHelp/QHelpEngineCore>
+#include <QtNetwork/QLocalSocket>
+
#include <QtSql/QSqlDatabase>
#include "mainwindow.h"
@@ -166,6 +168,17 @@ referencedHelpFilesExistAll(QHelpEngineCore& user, QStringList& nameSpaces)
return (counter != nameSpaces.count()) ? false : true;
}
+QString indexFilesFolder(const QString &collectionFile)
+{
+ QString indexFilesFolder = QLatin1String(".fulltextsearch");
+ if (!collectionFile.isEmpty()) {
+ QFileInfo fi(collectionFile);
+ indexFilesFolder = QLatin1Char('.') +
+ fi.fileName().left(fi.fileName().lastIndexOf(QLatin1String(".qhc")));
+ }
+ return indexFilesFolder;
+}
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@@ -212,6 +225,28 @@ int main(int argc, char *argv[])
return 0;
}
+ if (cmd.removeSearchIndex()) {
+ QString file = cmdCollectionFile;
+ if (file.isEmpty())
+ file = MainWindow::defaultHelpCollectionFileName();
+ QString path = QFileInfo(file).path();
+ path += QLatin1String("/") + indexFilesFolder(file);
+
+ QLocalSocket localSocket;
+ localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
+ .arg(QLatin1String(QT_VERSION_STR)));
+
+ QDir dir(path); // check if there is no other instance ruinning
+ if (!localSocket.waitForConnected() && dir.exists()) {
+ QStringList lst = dir.entryList(QDir::Files | QDir::Hidden);
+ foreach (const QString &item, lst)
+ dir.remove(item);
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+
{
QSqlDatabase db;
QStringList sqlDrivers(db.drivers());
diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp
index 094bd9c..74f7ba8 100644
--- a/tools/assistant/tools/assistant/preferencesdialog.cpp
+++ b/tools/assistant/tools/assistant/preferencesdialog.cpp
@@ -44,6 +44,7 @@
#include "installdialog.h"
#include "fontpanel.h"
#include "centralwidget.h"
+#include "aboutdialog.h"
#include <QtAlgorithms>
@@ -52,6 +53,8 @@
#include <QtGui/QMessageBox>
#include <QtGui/QMenu>
#include <QtGui/QFontDatabase>
+#include <QtGui/QApplication>
+#include <QtGui/QDesktopWidget>
#include <QtHelp/QHelpEngineCore>
@@ -59,36 +62,38 @@ QT_BEGIN_NAMESPACE
PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent)
: QDialog(parent)
+ , m_helpEngine(helpEngine)
, m_appFontChanged(false)
, m_browserFontChanged(false)
{
- m_helpEngine = helpEngine;
m_ui.setupUi(this);
- connect(m_ui.buttonBox->button(QDialogButtonBox::Ok),
- SIGNAL(clicked()), this, SLOT(applyChanges()));
- connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel),
- SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
+ this, SLOT(applyChanges()));
+ connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
+ this, SLOT(reject()));
- m_hideFiltersTab = !m_helpEngine->customValue(QLatin1String("EnableFilterFunctionality"),
- true).toBool();
- m_hideDocsTab = !m_helpEngine->customValue(QLatin1String("EnableDocumentationManager"),
- true).toBool();
+ QLatin1String key("EnableFilterFunctionality");
+ m_hideFiltersTab = !m_helpEngine->customValue(key, true).toBool();
+
+ key = QLatin1String("EnableDocumentationManager");
+ m_hideDocsTab = !m_helpEngine->customValue(key, true).toBool();
if (!m_hideFiltersTab) {
m_ui.attributeWidget->header()->hide();
m_ui.attributeWidget->setRootIsDecorated(false);
+
connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
this, SLOT(updateFilterMap()));
connect(m_ui.filterWidget,
- SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
- this, SLOT(updateAttributes(QListWidgetItem*)));
+ SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this,
+ SLOT(updateAttributes(QListWidgetItem*)));
- connect(m_ui.filterAddButton, SIGNAL(clicked()),
- this, SLOT(addFilter()));
- connect(m_ui.filterRemoveButton, SIGNAL(clicked()),
- this, SLOT(removeFilter()));
+ connect(m_ui.filterAddButton, SIGNAL(clicked()), this,
+ SLOT(addFilter()));
+ connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this,
+ SLOT(removeFilter()));
updateFilterPage();
} else {
@@ -106,22 +111,34 @@ PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *paren
} else {
m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.docsTab));
}
+
updateFontSettingsPage();
updateOptionsPage();
}
PreferencesDialog::~PreferencesDialog()
{
+ QLatin1String key("");
if (m_appFontChanged) {
- m_helpEngine->setCustomValue(QLatin1String("appFont"), m_appFontPanel->selectedFont());
- m_helpEngine->setCustomValue(QLatin1String("useAppFont"), m_appFontPanel->isChecked());
- m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), m_appFontPanel->writingSystem());
+ key = QLatin1String("appFont");
+ m_helpEngine->setCustomValue(key, m_appFontPanel->selectedFont());
+
+ key = QLatin1String("useAppFont");
+ m_helpEngine->setCustomValue(key, m_appFontPanel->isChecked());
+
+ key = QLatin1String("appWritingSystem");
+ m_helpEngine->setCustomValue(key, m_appFontPanel->writingSystem());
}
if (m_browserFontChanged) {
- m_helpEngine->setCustomValue(QLatin1String("browserFont"), m_browserFontPanel->selectedFont());
- m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), m_browserFontPanel->isChecked());
- m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), m_browserFontPanel->writingSystem());
+ key = QLatin1String("browserFont");
+ m_helpEngine->setCustomValue(key, m_browserFontPanel->selectedFont());
+
+ key = QLatin1String("useBrowserFont");
+ m_helpEngine->setCustomValue(key, m_browserFontPanel->isChecked());
+
+ key = QLatin1String("browserWritingSystem");
+ m_helpEngine->setCustomValue(key, m_browserFontPanel->writingSystem());
}
if (m_appFontChanged || m_browserFontChanged) {
@@ -129,8 +146,10 @@ PreferencesDialog::~PreferencesDialog()
emit updateBrowserFont();
}
- if (!m_ui.homePageLineEdit->text().isEmpty())
- m_helpEngine->setCustomValue(QLatin1String("homepage"), m_ui.homePageLineEdit->text());
+ if (!m_ui.homePageLineEdit->text().isEmpty()) {
+ key = QLatin1String("homepage");
+ m_helpEngine->setCustomValue(key, m_ui.homePageLineEdit->text());
+ }
}
void PreferencesDialog::showDialog()
@@ -173,7 +192,7 @@ void PreferencesDialog::updateAttributes(QListWidgetItem *item)
if (item)
checkedList = m_filterMap.value(item->text());
QTreeWidgetItem *itm;
- for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) {
+ for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) {
itm = m_ui.attributeWidget->topLevelItem(i);
if (checkedList.contains(itm->text(0)))
itm->setCheckState(0, Qt::Checked);
@@ -192,7 +211,7 @@ void PreferencesDialog::updateFilterMap()
QStringList newAtts;
QTreeWidgetItem *itm = 0;
- for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) {
+ for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) {
itm = m_ui.attributeWidget->topLevelItem(i);
if (itm->checkState(0) == Qt::Checked)
newAtts.append(itm->text(0));
@@ -219,8 +238,8 @@ void PreferencesDialog::addFilter()
void PreferencesDialog::removeFilter()
{
- QListWidgetItem *item = m_ui.filterWidget
- ->takeItem(m_ui.filterWidget->currentRow());
+ QListWidgetItem *item =
+ m_ui.filterWidget ->takeItem(m_ui.filterWidget->currentRow());
if (!item)
return;
@@ -238,25 +257,48 @@ void PreferencesDialog::addDocumentationLocal()
if (fileNames.isEmpty())
return;
+ QStringList invalidFiles;
+ QStringList alreadyRegistered;
foreach (const QString &fileName, fileNames) {
- const QString ns = QHelpEngineCore::namespaceName(fileName);
- if (ns.isEmpty()) {
- QMessageBox::warning(this, tr("Add Documentation"),
- tr("The specified file is not a valid Qt Help File!"));
+ const QString nameSpace = QHelpEngineCore::namespaceName(fileName);
+ if (nameSpace.isEmpty()) {
+ invalidFiles.append(fileName);
continue;
}
- if (m_ui.registeredDocsListWidget->findItems(ns, Qt::MatchFixedString).count()) {
- QMessageBox::warning(this, tr("Add Documentation"),
- tr("The namespace %1 is already registered!").arg(ns));
- continue;
+ if (m_ui.registeredDocsListWidget->findItems(nameSpace,
+ Qt::MatchFixedString).count()) {
+ alreadyRegistered.append(nameSpace);
+ continue;
}
m_helpEngine->registerDocumentation(fileName);
- m_ui.registeredDocsListWidget->addItem(ns);
- m_regDocs.append(ns);
- m_unregDocs.removeAll(ns);
+ m_ui.registeredDocsListWidget->addItem(nameSpace);
+ m_regDocs.append(nameSpace);
+ m_unregDocs.removeAll(nameSpace);
+ }
+
+ if (!invalidFiles.isEmpty() || !alreadyRegistered.isEmpty()) {
+ QString message;
+ if (!alreadyRegistered.isEmpty()) {
+ foreach (const QString &ns, alreadyRegistered) {
+ message += tr("The namespace %1 is already registered!")
+ .arg(QString("<b>%1</b>").arg(ns)) + QLatin1String("<br>");
+ }
+ if (!invalidFiles.isEmpty())
+ message.append(QLatin1String("<br>"));
+ }
+
+ if (!invalidFiles.isEmpty()) {
+ message += tr("The specified file is not a valid Qt Help File!");
+ message.append(QLatin1String("<ul>"));
+ foreach (const QString &file, invalidFiles)
+ message += QLatin1String("<li>") + file + QLatin1String("</li>");
+ message.append(QLatin1String("</ul>"));
+ }
+ QMessageBox::warning(this, tr("Add Documentation"), message);
}
+
updateFilterPage();
}
@@ -362,35 +404,50 @@ void PreferencesDialog::updateFontSettingsPage()
m_ui.stackedWidget_2->setCurrentIndex(0);
const QString customSettings(tr("Use custom settings"));
- QFont font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("appFont")));
- QFontDatabase::WritingSystem writingSystem = static_cast<QFontDatabase::WritingSystem>
- (m_helpEngine->customValue(QLatin1String("appWritingSystem")).toInt());
-
m_appFontPanel->setTitle(customSettings);
+
+ QLatin1String key = QLatin1String("appFont");
+ QFont font = qVariantValue<QFont>(m_helpEngine->customValue(key));
m_appFontPanel->setSelectedFont(font);
- m_appFontPanel->setWritingSystem(writingSystem);
- m_appFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useAppFont")).toBool());
- QFont font2 = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("browserFont")));
- writingSystem = static_cast<QFontDatabase::WritingSystem>
- (m_helpEngine->customValue(QLatin1String("browserWritingSystem")).toInt());
+ key = QLatin1String("appWritingSystem");
+ QFontDatabase::WritingSystem system = static_cast<QFontDatabase::WritingSystem>
+ (m_helpEngine->customValue(key).toInt());
+ m_appFontPanel->setWritingSystem(system);
+
+ key = QLatin1String("useAppFont");
+ m_appFontPanel->setChecked(m_helpEngine->customValue(key).toBool());
m_browserFontPanel->setTitle(customSettings);
- m_browserFontPanel->setSelectedFont(font2);
- m_browserFontPanel->setWritingSystem(writingSystem);
- m_browserFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useBrowserFont")).toBool());
- connect(m_appFontPanel, SIGNAL(toggled(bool)), this, SLOT(appFontSettingToggled(bool)));
- connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, SLOT(browserFontSettingToggled(bool)));
+ key = QLatin1String("browserFont");
+ font = qVariantValue<QFont>(m_helpEngine->customValue(key));
+ m_browserFontPanel->setSelectedFont(font);
+
+ key = QLatin1String("browserWritingSystem");
+ system = static_cast<QFontDatabase::WritingSystem>
+ (m_helpEngine->customValue(key).toInt());
+ m_browserFontPanel->setWritingSystem(system);
+
+ key = QLatin1String("useBrowserFont");
+ m_browserFontPanel->setChecked(m_helpEngine->customValue(key).toBool());
+
+ connect(m_appFontPanel, SIGNAL(toggled(bool)), this,
+ SLOT(appFontSettingToggled(bool)));
+ connect(m_browserFontPanel, SIGNAL(toggled(bool)), this,
+ SLOT(browserFontSettingToggled(bool)));
QList<QComboBox*> allCombos = qFindChildren<QComboBox*>(m_appFontPanel);
- foreach (QComboBox* box, allCombos)
- connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(appFontSettingChanged(int)));
+ foreach (QComboBox* box, allCombos) {
+ connect(box, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(appFontSettingChanged(int)));
+ }
- allCombos.clear();
allCombos = qFindChildren<QComboBox*>(m_browserFontPanel);
- foreach (QComboBox* box, allCombos)
- connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(browserFontSettingChanged(int)));
+ foreach (QComboBox* box, allCombos) {
+ connect(box, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(browserFontSettingChanged(int)));
+ }
}
void PreferencesDialog::appFontSettingToggled(bool on)
@@ -436,8 +493,8 @@ void PreferencesDialog::updateOptionsPage()
void PreferencesDialog::restoreDefaultHomepage()
{
- QString homepage = m_helpEngine->customValue(
- QLatin1String("defaultHomepage"), QLatin1String("help")).toString();
+ QString homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"),
+ QLatin1String("help")).toString();
m_ui.homePageLineEdit->setText(homepage);
}