diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-05 22:26:44 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-06-05 22:26:44 +0200 |
commit | 0fcce50af009f97efa2a5c5f2c74415c92830962 (patch) | |
tree | f8abf0e4f445fed9480b426b2f856b50911f1210 /src/printsupport | |
parent | 74d46a669badc5bf32187686102ca4e644a3c0af (diff) | |
parent | c54f7720d09e7d00f3309736bbeaaa6a81967ec1 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
mkspecs/features/qt.prf
src/plugins/platforms/xcb/qxcbwindow.h
src/tools/qdoc/qdocindexfiles.cpp
src/widgets/kernel/qwidget_qpa.cpp
Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
Diffstat (limited to 'src/printsupport')
-rw-r--r-- | src/printsupport/dialogs/qprintdialog_mac.mm | 2 | ||||
-rw-r--r-- | src/printsupport/kernel/qprintengine_win.cpp | 48 |
2 files changed, 33 insertions, 17 deletions
diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index ef3e88be39..ba3837d497 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -239,7 +239,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) // Call processEvents in case the event dispatcher has been interrupted, and needs to do // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup (QTBUG-17913): - qApp->processEvents(QEventLoop::ExcludeUserInputEvents, QEventLoop::ExcludeSocketNotifiers); + qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] initWithNSPrintInfo:printInfo]; if (modality == Qt::ApplicationModal || !q->parentWidget()) { diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 8fbf20529c..1adfcfa630 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -978,6 +978,24 @@ void QWin32PrintEnginePrivate::doReinit() } } +static int indexOfId(const QList<QPrint::InputSlot> &inputSlots, QPrint::InputSlotId id) +{ + for (int i = 0; i < inputSlots.size(); ++i) { + if (inputSlots.at(i).id == id) + return i; + } + return -1; +} + +static int indexOfWindowsId(const QList<QPrint::InputSlot> &inputSlots, int windowsId) +{ + for (int i = 0; i < inputSlots.size(); ++i) { + if (inputSlots.at(i).windowsId == windowsId) + return i; + } + return -1; +} + void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) { Q_D(QWin32PrintEngine); @@ -1120,14 +1138,12 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & case PPK_PaperSource: { if (!d->devMode) break; - QPrint::InputSlotId inputSlotId = QPrint::InputSlotId(value.toInt()); - foreach (const QPrint::InputSlot &inputSlot, d->m_printDevice.supportedInputSlots()) { - if (inputSlot.id == inputSlotId) { - d->devMode->dmDefaultSource = inputSlot.windowsId; - d->doReinit(); - break; - } - } + const QList<QPrint::InputSlot> inputSlots = d->m_printDevice.supportedInputSlots(); + const int paperSource = value.toInt(); + const int index = paperSource >= DMBIN_USER ? + indexOfWindowsId(inputSlots, paperSource) : indexOfId(inputSlots, QPrint::InputSlotId(paperSource)); + d->devMode->dmDefaultSource = index >= 0 ? inputSlots.at(index).windowsId : DMBIN_AUTO; + d->doReinit(); break; } @@ -1343,12 +1359,12 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = d->m_printDevice.defaultInputSlot().id; } else { - value = QPrint::Auto; - foreach (const QPrint::InputSlot inputSlot, d->m_printDevice.supportedInputSlots()) { - if (inputSlot.windowsId == d->devMode->dmDefaultSource) { - value = inputSlot.id; - break; - } + if (d->devMode->dmDefaultSource >= DMBIN_USER) { + value = int(d->devMode->dmDefaultSource); + } else { + const QList<QPrint::InputSlot> inputSlots = d->m_printDevice.supportedInputSlots(); + const int index = indexOfWindowsId(inputSlots, d->devMode->dmDefaultSource); + value = index >= 0 ? inputSlots.at(index).id : QPrint::Auto; } } break; @@ -1377,7 +1393,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const case PPK_PaperSources: { QList<QVariant> out; foreach (const QPrint::InputSlot inputSlot, d->m_printDevice.supportedInputSlots()) - out << inputSlot.id; + out << QVariant(inputSlot.id == QPrint::CustomInputSlot ? inputSlot.windowsId : int(inputSlot.id)); value = out; break; } |