summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs/qprintdialog_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* printsupport: use string view types moreAnton Kudryavtsev2023-09-121-3/+3
| | | | | | | | sizeof(QStringView) == 16 sizeof(QString) == 24 Change-Id: I3edf0d6869e92c47472980e5f99b9bf9c8a3b7cd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix build with -no-feature-messageboxTasuku Suzuki2023-01-171-2/+2
| | | | | | Pick-to: 6.5 Change-Id: I4c34f6aa2106afc528f182d7925442acf82b7000 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtPrintSupport: Disambiguate static functionsFriedemann Kleint2023-01-121-2/+2
| | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: If3029d5b99499fd0e216fc080ade9842c2d11ea4 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@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>
* Printsupport: stop using QL1Char constructor for creating char literalsSona Kurazyan2022-04-191-4/+4
| | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: Ia186ed178239796bdf19db5b35a36ea606baf937 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Unix: Correctly update options pane for PDF printerAlexander Volkov2022-03-151-2/+2
| | | | | | | | | | Update printer and m_currentPrintDevice before calling QPrintDialogPrivate::selectPrinter() to show values for PDF printer instead of the previously selected printer. Pick-to: 6.3 6.2 5.15 Change-Id: Iacc34ca4460ec4de0b4b373cd875628733df01bd Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* Fix UI mismatch when QPrinter::setDuplexZhang Hao2022-02-181-3/+4
| | | | | | | | | | | | | | | | | | Amends fa854f214a3c812e5548ff55d179dd07ef99053b. If user call QPrinter::setDuplex method, the QPrintDialog explicitDuplexMode value won't update. Fix this by: 1) handle device-specific default and value set in QPrinter in QCupsPrintEngine(Private) 2) handle the explicitly user-selected value in QPrintDialog(Private) Done-with: Michael Weghorn <m.weghorn@posteo.de> Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99504 Change-Id: I1a471a8554e83aa4bec8bb95fcc95f9135b0ac8c Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make sure _q_printerChanged is called even if only pdf printer is availableAlbert Astals Cid2021-05-211-0/+2
| | | | | | | | Otherwise things like the pagesRadioButton don't get properly disabled Change-Id: Idc0693b6747f13da5afb22e2187af310a5b454f8 Pick-to: 6.1 5.15 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Silence warning in QPrintDialogSzabolcs David2021-05-011-4/+4
| | | | | | | | | | | | | | | | 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>
* Add nullptr checkOliver Eftevaag2021-03-161-1/+2
| | | | | | | | Adding a nullptr check before dereferencing in case q is null. Pick-to: 6.0 6.1 Change-Id: Ia440e2ed41cbaf06a5919930c2e1615bb3916ff3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QRangeCollection to QPageRanges, make it a proper value typeVolker Hilsheimer2020-11-081-5/+7
| | | | | | | | | | | | | | | | | | | | | | | The type is specific about printing, so give it a name in line with QPageLayout and QPageSize. As per API review comment, it's not clear why this type should not be a regular, copyable and movable value type. It stores a list of intervals. Give it value-type semantics, as an implicitly shared class. Convert the parse method into a static factory function. Add a Range type and use it instead of the semantic-free QPair. Move QPrinter getter into QPagedPainteDevice, make it return a copy rather than a pointer, and add a setter. Extend test case to cover all members and more merge cases. Fix bugs found that way. Fixes: QTBUG-88113 Change-Id: If17ea4d410d49f16b097e88b7979db5d72add820 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove obsolete APIs and comments from QAbstractPrintDialogVolker Hilsheimer2020-09-101-19/+19
| | | | | | | | | | | | | Merging QAbstractPrintDialog with QPrintDialog, as proposed in the removed comment, seems to have little value, given that the platform specific implementations rely on the current abstraction. Adjust examples and tests; with the QAbstractPrintDialog test now testing the QPrintDialog::options API, the corresponding test function can be removed from the QPrinter test. Change-Id: Ia8906627898332e8590ea9b27e3d71dfcc6e8d71 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move QFileSystemModel into QtGuiVolker Hilsheimer2020-08-251-1/+1
| | | | | | | | | | | | | | This requires a QAbstractFileIconProvider in QtGui, as the standard QFileIconProvider depends on QStyle, and cannot be moved out of QtWidgets. QAbstractFileIconProvider returns strings for file types, but returns no icons yet. Support for a default icon set might be added in a follow-up commit. Change-Id: Ib9d095cd612fdcf04db62f2e40709fcffe3dc2b7 Fixes: QTBUG-66177 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in printsupportJarek Kobus2020-07-061-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: I540b5574e358b100a595eb1676b051dfe25cb640 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Get rid of QTextCodec in the cups supportLars Knoll2020-05-141-9/+11
| | | | | | | | This should all be utf-8 anyway, but right now simply exchange the text codec with a string converter. Change-Id: If0a230776824598b6378bb402d692c941e371104 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support multiple page ranges in QPrinterSzabolcs David2020-04-091-85/+5
| | | | | | | | | | | | | | | | Add a new QRangeCollection type to store and manage multiple page ranges. This moves out the parser and validator logic from the platform dependent (UNIX) dialog and makes it publicly available from QPrinter. This improves the usability of QPrinter in those applications which doesn't use print dialog to configure printer. (e.g.: QTextDocument, QWebEnginePage) Change-Id: I0be5a8a64781c411f83b96a24f216605a84958e5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Remove QRegExp usage from Qt PrintSupportLars Knoll2020-03-171-3/+10
| | | | | Change-Id: I32daae8e5028084dd12f0aba4da7920f995d919f Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* QComboBox: remove currentIndexChanged(const QString&)Vitaly Fanaskov2020-02-191-1/+1
| | | | | | | Fixes: QTBUG-81913 Task-number: QTBUG-81845 Change-Id: I8f24b858ce4e35b495440001d7734cc8f169cd5f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-271-3/+5
|\ | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/platforms/xcb/qxcbscreen.cpp src/widgets/accessible/qaccessiblewidget.cpp Change-Id: Ib3138e61ba7981610940509a7ff02ba2dd281bf0
| * QPrintDialog: don't access dangling pointer when cups is disabledChristian Ehrlicher2019-12-231-3/+5
| | | | | | | | | | | | | | | | | | | | When no cups support is available, ui.pagesRadioButton is destroyed in QPrintDialogPrivate::init() but was accessed later on. Fix it by moving the cups check one line above. Fixes: QTBUG-80945 Change-Id: Ieb062b39e1461f39665ef612dfea1d7757274b7e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Replace usages of QVariant::value by qvariant_castOlivier Goffart2019-12-151-9/+9
| | | | | | | | | | | | | | This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
|/ | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-08-151-0/+5
|\ | | | | | | Change-Id: Icc80dacbca8613f2996be75553ff15d0ad242b7e
| * Unix: Disable complex page ranges widget when printing to pdfAlbert Astals Cid2019-08-131-0/+5
| | | | | | | | | | | | | | | | | | It doesn't work since it relies on cups to do the heavy lifting and cups is not used when printing to PDF Task-number: QTBUG-77351 Change-Id: I1bdda58b50112b9bb3d7991f3cfd860d6b4f4fc4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QPrintSupport: do not bypass a base class' virtualGiuseppe D'Angelo2019-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractPrintDialog (a QDialog subclass) has an interesting override of exec(): a pure virtual, without a body. The UNIX subclass was therefore forced to override it, but since it did not need to do anything with it, it had to call QDialog::exec (bypassing the direct base, otherwise it would cause a pure virtual call). Eliminate the pure virtual override. This should be BC; the layout of the vtable does not change, merely its contents. Change-Id: I84ac23c938f1934f699df032ef1bde0d6df77784 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove remaining Q_DECL_NOEXCEPT/Q_DECL_NOTHROW usageAllan Sandfeld Jensen2019-04-041-5/+5
|/ | | | | Change-Id: I91ac9e714a465cab226b211812aa46e8fe5ff2ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass non-trivial types by const-ref in range-loop [-Wclazy-range-loop]Sergio Martins2018-12-051-1/+1
| | | | | | | | | | | | | corelib/serialization/qcbormap.h:176:14: warning: Missing reference in range-for with non trivial type (QPair<QCborValue, QCborValue>) corelib/serialization/qjsoncbor.cpp:820:10: warning: Missing reference in range-for with non trivial type (QJsonValue) gui/kernel/qguiapplication.cpp:1171:10: warning: Missing reference in range-for with non trivial type (QString) printsupport/dialogs/qprintdialog_unix.cpp:741:10: warning: Missing reference in range-for with non trivial type (QString) printsupport/kernel/qprinter.cpp:1851:10: warning: Missing reference in range-for with non trivial type (QVariant) tools/qlalr/cppgenerator.cpp:463:8: warning: Missing reference in range-for with non trivial type (Name) Change-Id: I327b0f116e329e55952ed5740a5f5af4b2918392 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix clang develop buildAllan Sandfeld Jensen2018-05-311-1/+1
| | | | | | | | A mismatch of enums after a rename. Change-Id: Ib28e4607f20583afcb9210fdef7f52d95c63e3dd Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-241-0/+4
|\ | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_common.prf src/corelib/tools/qstring.cpp src/plugins/platforms/windows/qwindowsmousehandler.cpp src/widgets/widgets/qmainwindowlayout_p.h Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
| * Fix build for Android with android-clangLiang Qi2018-05-161-0/+4
| | | | | | | | | | | | | | | | | | | | dialogs/qprintdialog_unix.cpp:149:15: error: private field 'm_printer' is not used [-Werror,-Wunused-private-field] QPrinter *m_printer; ^ Change-Id: Idce515a3e66019756b6ad2d305072e0a89bb823b Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | cups: Fix UI mismatch when a default printer option choice is not availableAlbert Astals Cid2018-05-091-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can happen that the user sets a default printer option choice, using lpoptions or similar, and that is a mistake since that choice is not available because it needs an installable option that is not in the printer. We need to check that and set the internal ppd option not to the value the user gave to lpoptions but to something sane Also rename foundMarkedOption to foundMarkedChoice since we're going through all the choices of a given option in that loop Change-Id: Ic9362d9b4fba33025c4d45eed8ddd203c95836bf Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Unix print dialog: Properly initialize duplexMichael Weghorn2018-05-021-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case the user has explicitly selected a value for the duplex mode in the print dialog before, select this one when another printer is selected and the newly selected printer supports it. Otherwise, always set to the default value of the respective device that was selected. This way, default values that the user (or admin) has set for a CUPS printer (or printer instance) are honored, but an explicit user choice made in the dialog takes precedence. Previously, the duplex values was always reset to "None" every time the printer was changed. Change-Id: Id9683a05b10cf7a4b842f8b6c8452e80cdc6ff91 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | cups: Take conflicts for duplex and page size into accountAlbert Astals Cid2018-03-271-6/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Duplex and Page Size are not shown in the "Advanced" options tag since they are more important options, this means we were not taking them into account for ppd conflicts since we never set their values in the ppd, we do use the new-style cups options for them when printing With this patch we add m_pageSizePpdOption and m_duplexPpdOption to set the values to the ppd struct behind the scenes. Change-Id: I48bd9fe93d0c08b7b8dd9620a07c56fc79cce13b Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Initialize m_cupsCodecJesus Fernandez2018-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | Ensure initialization of m_cupsCodec to nullptr. The codec is checking the value of m_cupsCodec; but the initialization was conditional before this patch. Change-Id: I81751b7743e9956f31f17cead01dc05e268db7eb Coverity-Id: 188700 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Linux/cups: Better advanced options UIAlbert Astals Cid2018-03-191-562/+208
|/ | | | | | | | | | Previously we were using a treeview that wasn't very clear it was editable, now we simply use QComboBoxes that are much more clear the user can change the values Change-Id: Ied9bca195f4cb275115213631e21cd6a15544311 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* cups: Clear cups options at the start of QPrintPropertiesDialog::setupPrinterAlbert Astals Cid2018-01-241-0/+4
| | | | | | | | | | | | | | | | | | For some reason the cups options are kept globally instead of per printer at QCupsPrintEnginePrivate so when setting the printer options on accepting the print dialog, we first need to clear them and then call the other functions that set them, otherwise, we will "reuse" cups option set on the previous print. How to reproduce: * Open print dialog, set some advanced option to a non default value, easiest one is print in grayscale * Print * Check it prints in grayscale * Open print dialog, check the advanced options are all on default values * Print * Check it incorrectly prints in grayscale Change-Id: I59aacaf30db844ad40887d6b771f9354557852b6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Cups Print Dialog: Change the message box titles to CapsFriedemann Kleint2018-01-171-2/+2
| | | | | | | | | Amends 608301d4c81ce65804a088aaebbd5433a56d69d7. Task-number: QTBUG-1311 Change-Id: I01cd60f0676f4e0501d411151492b4f867653053 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QPrintDialog/Unix: compile with gcc 4.8Christian Ehrlicher2018-01-171-1/+2
| | | | | | | | | Passing parameters via auto to a lambda function is a c++14 extension which is not supported by gcc4.8. Change-Id: I335b2a2f5ba02f5440c2e7ccc81d4156e8b29484 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Move color/grayscale option to cups advanced panelRenato Araujo Oliveira Filho2018-01-161-1/+18
| | | | | | | | | | | CUPS has a complex way to configure colors for printers, and this can not be represented only by radio buttons. Because of that all colors related options will be available only in the advanced panel. The color/grayscale option will still be available when printing to a file. Change-Id: I1592e779009bd80b6dfc18dde760db4154e46439 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* CUPS: Don't show choices that conflict with the printer installed optionsAlbert Astals Cid2018-01-121-16/+30
| | | | | | | | | | Some options only make sense if the printer has installed some extensions, e.g. we should not shown "Staple" options if the Stapler addon is not installed, so with this change we use ppdInstallableConflict to know whether an option should be shown to the user or not. Change-Id: I5733e1ac8b667c26b292aeafc90a10c155b751a4 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* CUPS: Rework set/clearCupsOption APIAlbert Astals Cid2018-01-121-3/+1
| | | | | | | | | | | | Previously it was a bit awkward to use, you had to do QStringList cupsOptions = QCUPSSupport::cupsOptionsList(printer); QCUPSSupport::setCupsOption(cupsOptions, option, value); QCUPSSupport::setCupsOptions(printer, cupsOptions); now you simply have to do QCUPSSupport::setCupsOption(printer, option, value); Change-Id: Id31583f1ec72644791d82776debbae5583a2be54 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* CUPS: Enable printing arbitrary pages and page rangesAlbert Astals Cid2018-01-121-0/+104
| | | | | | Task-number: QTBUG-1311 Change-Id: I8e09def0e0d8c1404d3ee86845d98a30c23b6485 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* cups: Don't show InstallableOptions in the advanced propertiesAlbert Astals Cid2018-01-121-8/+17
| | | | | | | | | | According to CUPS maintainer it is recommended to not show them[1]. GTK and Libreoffice behave like that. [1] https://lists.cups.org/pipermail/cups/2015-September/027124.html Change-Id: I82614003490554d41e38a125d44e3a599c2e7342 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Unix: Fix usability of the print properties dialogAlbert Astals Cid2018-01-121-41/+66
| | | | | | | | | | | | | | Previous behavior: * Open, change setting, cancel, open again, setting was as originally (i.e. unchanged) * Open, change setting, accept, open, change setting, cancel, open again, the setting would be as before pressing cancel * Open, change setting, accept, open, press cancel without changing anything, print, the initially changed setting is not applied New behavior: * Pressing cancel just cancels the changes since you opened the dialog, everything you accepted previously stays correctly selected Change-Id: I483647504682f26d3d21c5229cc6530bf14fe519 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* QUnixPrintWidgetPrivate::_q_printerChanged: Update state correctlyAlbert Astals Cid2018-01-091-0/+6
| | | | | | | | | We need to update the printer output format and the current print device when changing the printer so that if the user opens the properties dialog for that printer it reflects correctly the selected printer. Change-Id: Ib6767a74b74b8eebe43ff17006b6105c483a08b6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Validate printer duplex modeRenato Araujo Oliveira Filho2018-01-091-1/+7
| | | | | | | | Disable unavailable duplex options Remove redundant option on advanced tab Change-Id: Ie09c9ffd637b521210e3d7d4f15300792f910996 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Fix build due to missing QDebug includeSérgio Martins2018-01-091-0/+1
| | | | | | | The build just passes on Qt CI by chance. Change-Id: I3bfef12b48df22fa64d92af9cd345bfc984c9923 Reviewed-by: David Faure <david.faure@kdab.com>