summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs/qprintdialog_mac.mm
Commit message (Collapse)AuthorAgeFilesLines
* QPrintDialog on macOS: Don't crash when parent is not a windowVolker Hilsheimer2023-09-051-2/+3
| | | | | | | | | | | The test case is an incomplete version of the test that will be added to verify the fix for the referenced bug report. The test crashes already when showing the dialog without this fix. Task-number: QTBUG-116277 Pick-to: 6.6 6.5 6.2 Change-Id: I969a723157f6453b78bafae5cb24a6b37b1eea50 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Stop using the deprecated [NSWorkspace openFile:] APITor Arne Vestbø2023-01-021-1/+1
| | | | | | | | | We can use openURL instead, which also opens local files in the associated application. Pick-to: 6.5 Change-Id: Ieddc6fb68d6b9e64195ed261953b9fffb6b0b73e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: set print dialog up with page attributes when no printer is installedVolker Hilsheimer2022-06-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When the print dialog is opened without a printer installed, then the printer's output format is PDF rather than native. In this case, we need to set the NSPrintInfo with some page atttributes explicitly, and not default to the application-wide NSPrintInfo.sharedPrintInfo. Otherwise, the print dialog will show the wrong page size and orientation, and the printer will not have the previously set values when the dialog returns. The dialog always shows the wrong values for the page margins (only available through the presets dialog), but the printer's values are not overridden. Also, the print range is taken care of correctly by the code further down in this function, irrespective of the printer's output format. Note: this cannot be unit tested as we need to open the native print dialog on a system without printer installed, and compare the values we set on the printer before opening the dialog with the values after the dialog was successfully finished via PDF->Save as PDF. Fixes: QTBUG-100188 Pick-to: 6.4 6.3 6.2 Change-Id: I8f1561e054f6a867b131111845c9b061778e4eb0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Printsupport: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-191-2/+4
| | | | | | Task-number: QTBUG-98434 Change-Id: I415132ed381c25313e7fcccd050e522667eb6c22 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Silence warning in QPrintDialogSzabolcs David2021-05-011-1/+1
| | | | | | | | | | | | | | | | Selecting "Print all" at page range options and accepting the dialog prints a warning message: "QPageRanges::addRange: 'from' and 'to' must be greater than 0" This happens because QPrintDialog tries to clear the printer's range collection by setting 'from' and 'to' to zero - which is an invalid page number. Avoid the validation method by setting QPageRanges directly to a clean instance. Pick-to: 6.1 Change-Id: I23b66a97b36aa23506904e93688cb60a9d496bfb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Mark obsolete QPrinter functions as deprecated from 5.15 onVolker Hilsheimer2020-09-031-1/+1
| | | | | | | | | | | Some of the methods are overrides of virtuals in QPagedPaintDevice, so document and mark those as obsolete as well. Adjust code that calls those APIs to use the recommended replacement. Change-Id: I3cd1980609ea20808d17379a5f97ca595e869875 Pick-to: 5.15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move macOS print support from platform plugin into QtPrintSupportTor Arne Vestbø2020-06-041-7/+3
| | | | | | Task-number: QTBUG-83256 Change-Id: I29044b6c3f952c259f501f94a175c8ef2cbaae55 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Support printing when no printers are installedTor Arne Vestbø2020-03-091-35/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Even if there are no printers installed, we can still show the print dialog, which gives the user feedback about no printers being installed, allows them to install one, or allows them to print to PDF as a fallback. The code for printing to PDF has been re-enabled, and the conditions of QTBUG-38820 have been removed as the problem is no longer present. The code also takes into account the possibility that the user chose to print to PostScript, which we don't yet support, but warn about. We now also support opening the printed document in Preview. This requires a minor assumption about the print operation being done synchronously after the print dialog is accepted, but this is something we can improve in the future with internal APIs if it turns out to be a problem. Printing workflows such as sending the printed document via mail or messenger are not not supported, and will give a warning. Fixes: QTBUG-36112 Change-Id: I8ba9e2c5ce31a5a06542c4a7126d005e4b27f2be Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Clean up our Objective-C usageJake Petroules2018-02-201-10/+9
| | | | | | | | | | | | | | | | - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Convert features.printdialog to QT_[REQUIRE_]CONFIGStephan Binner2017-05-301-4/+0
| | | | | Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Fix deprecated API usageJake Petroules2017-01-241-2/+2
| | | | | | Change-Id: I62448507f80daf6be72994ee99f0fb1aa107eb78 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-0/+5
|\ | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| * macOS: Clear event dispatcher interrupt stateGabriel de Dietrich2016-11-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A pending interrupt of a QEventLoop may interfere with native runModal calls, resulting in Cocoa's main event loop to be stopped unexpectedly. After commit 9ab60b9c processEvents() no longer resets the event dispatcher interrupt flag. Add QCocoaEventDispatcher::clearCurrentThreadCocoa EventDispatcherInterruptFlag(). Use it to clear the interrupt state before calling runModal and variants. Work around the inability to use platform API in the print support code. Change-Id: I52f26f99a63cbb46969db42f65b09a3c3119ad15 Task-number: QTBUG-56746 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Link to AppKit instead of Cocoa.Jake Petroules2015-09-051-1/+1
|/ | | | | | | | | | | | | Cocoa is basically just AppKit + CoreData. Since we do not use CoreData in Qt, there is no reason to link to it or (transitively) import its headers. This is just a mechanical replacement of -framework Cocoa with -framework AppKit and <Cocoa/Cocoa.h> with <AppKit/AppKit.h> Change-Id: Ibcfc8a03c0ddff27a67fbc87dd7bd58a4b648956 Reviewed-by: Mika Lindqvist <postmaster@raasu.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Add shared implementation of a NSAutoreleasePool wrapper to qglobalTor Arne Vestbø2015-05-271-2/+1
| | | | | | | | | | | We have at least 5 different (but equal) implementations of a wrapper in Qt, and some code uses explicit NSAutoreleasePools. Having a shared implementation lets us clean up things a bit and makes it easier to reason about which pools are actually needed. Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-5/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/gui/painting/qdrawhelper.cpp src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/testlib/qtestblacklist.cpp src/tools/qdoc/node.cpp src/tools/qdoc/node.h tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
| * QPrintDialog - Let OSX handle PDF printingJohn Layt2015-04-171-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user selects to Save as PDF in the native print dialog, then let OSX generate the PDF. Primarily this is to fix QTBUG-38820 where by setting the output mode to PdfFormat we prevent the native print dialog from being called again. This was a regression in 5.1. It also allows for smaller, better quality PDFs with the ability to select text until QTBUG-13826 / QTBUG-10094 fixes the font rendering. Once QTBUG-36112 is also fixed we can consider changing back to Qt's internal PDF support. See also QTBUG-36687 and QTBUG-26054 which are related. Task-number: QTBUG-38820 Change-Id: I74bd885902860ac70068ab25e95765c7f0ee911c Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Remove <qhash.h> where it's not usedMarc Mutz2015-04-201-1/+0
|/ | | | | | | | To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5) in public headers. Change-Id: I6117e8a6b11200d2f1a0a94a0e87d5c27538218e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QPrintDialog OSX: Fix qApp->processEvents argumentsDyami Caliri2014-05-221-1/+1
| | | | | | | | | The call to processEvents had the flags separated by a comma instead of bitwise OR. This worked because processEvents has an optional second argument that is an int. Change-Id: I6dc74bc44b1d782aa7206f106c51c16eab5f2a76 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* QPrintDialog - Fix Mac reference counting error.Morten Johan Sørvig2014-04-181-3/+3
| | | | | | | | | | "key" is accessed with a "Get" function and should not be released. Switch from using QCFString to a CFStringsRef. Change-Id: Id4eecc642de8698314fc57d44af05c202966b11c Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: John Layt <jlayt@kde.org>
* QPrintDialog - Fix mac change of printer nameJohn Layt2014-04-181-5/+5
| | | | | | | | | If the user changes the printer name in the Mac print dialog then update the print device in QPrint to reflect this. Task-number: QTBUG-37808 Change-Id: I3aaf27e2db7277ab083dc8f8d59f0f80ecd424f1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* QtPrintSupport - Fix QT_NO_PRINTER buildJohn Layt2014-03-171-2/+2
| | | | | | | | Fix the QT_NO_PRINTER build for issues that have accumulated over last few months, and in the new changes already approved. Change-Id: I9aed21dee861837fd1a68a96692c873a4f5be293 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Use QPageSize and QPageLayoutJohn Layt2014-03-171-0/+41
| | | | | | | | | | | | | | | | | Use QPageSize and QPageMargins to get/set values in the print engines, add api to directly set the values, and rewrite the docs to make the paper-based api obsolete instead of the page-based api. Add new PPK keys to pass QPageSize, QPageMargins and QPageLayout to the print engines to ensure no level of detail is lost, e.g. for custom sizes passed to QPrinter. [ChangeLog][QtPrintSupport][QPrinter] QPrinter can now use QPageSize and QPageLayout in the public api to control the page layout for a print job. Change-Id: Iee39a4042bcd6141d29b0a82b49066d7a7a78120 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Switch Mac to QPageLayoutJohn Layt2014-03-171-0/+3
| | | | | | | Use QPageLayout in the Mac QPaintEngine. Change-Id: I4c160e3875d69879160e289c371c10b1ac028748 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QT_NO_PRINTER build on MacVitalii Shastun2013-09-261-2/+2
| | | | | | | | On Mac the QT_NO_PRINTER build was not implemented. Task-number: QTBUG-33565 Change-Id: I118472f9400aa0a0d0e192ae39a11ea38a66f340 Reviewed-by: John Layt <jlayt@kde.org>
* Initialize the print panel with the NSPrintInfo we have createdAndy Shaw2013-09-171-1/+1
| | | | | | | | | | | Since the Cocoa Print Panel was not initialized with the NSPrintInfo we had created, it meant that it did get any of the settings from the print dialog as it was trying to access an invalid NSPrintInfo. Task-number: QTBUG-32734 Change-Id: I23c766eb13281f4c494656a54d37c5bf28fb68fd Reviewed-by: John Layt <jlayt@kde.org>
* QPrintDialog OSX: don't crash if ApplicationModal and no parentShawn Rutledge2013-07-251-1/+3
| | | | | | | Task-number: QTBUG-32464 Change-Id: I5ee2741735255254c17555dfb977ce73941d3e22 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cocoa: QPrintDialog does not show/closes down immediatlyRichard Moe Gustavsen2012-11-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This happends if an event loop recursion ends before the native print dialog gets executed (in the same scope). The reason is that the event dispatcher gets interrupted as the first recursion ends. And (because of the big difference between how AppKit implements modal windows compared to Qt) this sets a flag in the dispatcher that gets handled on the next callback to QCocoaEventDispatcher::processPostedEvents. This will tell the dispatcher to break out of the current modal session. But since it cannot detect that an alien (native) session is now running, it closes down that session by accident instead. While code can be written in the event dispatcher to detect this problem, it ends up more clean to just work around the problem from the native dialogs instead. This to avoid making the dispatcher more complex than it already is. Native dialogs is a bit messy already, and the work-arounds needed should be isolated inside those components, and not inside the dispatcher. Change-Id: Ibfde9db4c98401562e7628da1db18d6bed619245 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QtPrintSupport - Cleanup QPrintDialog headerJohn Layt2012-06-011-11/+0
| | | | | | | | | | | | | | Move QUnixPrintWidget from the header to the UNIX implementation as it is not used anywhere else and doesn't need to be exported. Make the private slots only compile under UNIX, remove the Mac and Win stubs for them as unneeded. Add some documentation to the UNIX dialog Change-Id: I8f30504285df877e17ac8eeace875f666f43d94d Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com> Reviewed-by: John Layt <jlayt@kde.org>
* Cocoa: use specified window modality in native print dialogsBradley T. Hughes2012-04-121-2/+6
| | | | | | | | | | Don't pick the modality type based on the presences of a parent widget, use QWidget::windowModality() instead. If modality hasn't been specified, then use presence of the parent to chose an appropriate modality type. Change-Id: Ib39c166ba3293174c55748f63222367e3e1c56bc Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* printing: Make sure window modality works with native print dialogsBradley T. Hughes2012-04-041-0/+9
| | | | | | | | | | | | | Make the native QPrintDialogs and QPageSetupDialogs participate in the Qt modality system. Even though we are overriding QDialog::setVisible() and exec() to show the native dialgos, we want to still call into QDialog::setVisible() so that modality state and events are properly handled. We do this by setting the WA_DontShowOnScreen attribute on QPrintDialog and QPageSetupDialog, and call QDialog::setVisible() at the appropriate places. Change-Id: I7d800790c40ba1f467c3315e29abb79a7fa0eb34 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Cocoa: fix crash when using QPrintDialogBradley T. Hughes2012-03-211-2/+2
| | | | | | | | The contextInfo passed to printPanelDidEnd should be a QPrintDialog*, not a QPrintDialogPrivate*. Change-Id: I8f9aae2f27b483b4669f9d39cdafd0ddeb37fd22 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Re-enable native print/pagesetup dialogs on Mac OS XBradley T. Hughes2012-03-151-56/+63
| | | | | | | | | | | | | | | | | | | | | | | | | Since QtPrintSupport does not have access to the internals of the print engine on Mac OS X (it lives in the platform plugin). We instead use the NSPrintInfoFromPrintEngine() invokable method in QPlatformNativeInterface to return an NSPrintInfo* that we can use where needed, or we use QPrintEngine::property()/setProperty() to communicate with the engine. This commit disables the generic UNIX dialogs and CUPS support on Mac OS X, ensuring that the default format on Mac OS X is the QPrinter::NativeFormat (previously qprinter.cpp would force PdfFormat as default on Q_OS_UNIX which is also defined on Mac OS X). The rest of the changes are straight forward porting. The methods: extern void macStartInterceptWindowTitle(QWidget *window); extern void macStopInterceptWindowTitle(); don't exist anymore, so don't use them. QMacCocoaAutoReleasePool also doens't work, so use NSAutoreleasePool directly. Change-Id: I341609e5efa53cadf8d174e4b282cbcae93e39e8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Clean-up a macro for CocoaMorten Sorvig2011-10-101-124/+0
| | | | | | | | | Remove the usage of Q_MAC_USE_COCOA and Carbon code paths. Change-Id: Ib569ad8c6d9ffe258f454b3c3b06e95294a10112 Reviewed-on: http://codereview.qt-project.org/5100 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Sanity-Review: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove the remaining traces of QT3_SUPPORTLars Knoll2011-10-031-7/+0
| | | | | | | | | | The only place that now still knows about it is moc, so it can still parse old headers. Change-Id: Iafec080f99c67560974e9ebc0cbfb27d9a4b2d6f Reviewed-on: http://codereview.qt-project.org/5755 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Move printing into it's own libraryLars Knoll2011-08-191-0/+429
Create a libQtPrintSupport library that contains our current printing infrastructure. Long term this will get replaced with a libQtPrint, as the current architecture is not really maintainable. Change-Id: I7362fff6786b58c5b4e9213c23eda36d15048aa2 Reviewed-on: http://codereview.qt.nokia.com/3209 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>