summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Use single truth to track file dialog current directoryTor Arne Vestbø2023-12-111-0/+1
| | | | | | | | | | | | | | | | | | | | | Unfortunately we can not rely on the file dialog panel for this, via the directoryURL property, as that property has not yet been updated during a panel:directoryDidChange: callback, resulting in the directory reported to the user being the previous directory. Since we already have to store the current directory for the case where we haven't yet created the file dialog panel we re-use this variable as the single place to store the current directory. It's not clear whether we still need to normalize the strings we get from the NSSavePanel, but the code has been left in, even if the old callback code didn't normalize the path that we then emitted as directoryEntered(). Fixes: QTBUG-119371 Pick-to: 6.7 6.5 6.6 6.2 Change-Id: I379a47053302e73d5e06a2b941f40365c17390d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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>
* macOS: Reduce duplicated code for showing file dialogsTor Arne Vestbø2021-02-021-1/+1
| | | | | | | | | | The initialization was duplicated across the different modes. We now do the setup once, in a shared showPanel:withParent function. This also simplifies and removes the need to store the return code. Change-Id: I3c4da48cfef92bcc59c76cffa15b40150de1a9e1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean up QCocoaFileDialogHelperTor Arne Vestbø2021-01-261-10/+5
| | | | | | | | | | | | | | | | | | | - Remove indirections via helper functions that did nothing but redirect. - Remove unneeded checks of !m_helper in delegate. The helper is always valid for a delegate. - Use m_ prefix for member variables, as in the rest of Qt. - Implement init: as per modern Objective-C recommendations. - Remove respondsToSelector checks that were not needed. - Use modern Objective-C property syntax. - Fix code style issues/formatting. - Remove unused functions. - Reorder and remove unused includes. - Class-initialize member variables. Change-Id: Iedc084b67bb496b2ef13001a0e6aa46d4574eb57 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Don't exec file dialogs via runModal unless they are app modalTor Arne Vestbø2021-01-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | Non-modal or window modal dialogs are shown at show(), via AppKit APIs that are non-blocking. If we want to block execution at this point, we need to spin our own event loop. The runModal API of NSSavePanel is not meant to be used for blocking execution for already shown dialogs, but is reserved for application modal dialogs. This means we no longer trip over AppKit's understanding of what state the dialog is in, which would result in the dialog not reporting back any files. It also allows us to remove the guard for closing dialogs twice. We now also correctly close and end the application modal session if the dialog is closed programmatically using Qt APIs. Task-number: QTBUG-89959 Fixes: QTBUG-85547 Pick-to: 6.0 5.15 Change-Id: Ida3dc404417789d4823822ecfbf0935591c23878 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Clean up headersTor Arne Vestbø2020-06-051-6/+1
| | | | | | | | | | | | | | The headers are now C++ clean and can be used outside of Objective-C code. All includes of Objective-C frameworks have been moved to the implementation files. Header guards have been added in the few places they were missing. All includes are now done via #include, instead of sometimes using the #import variant. Change-Id: Ibb0a9c0bcfefbda4347737212e40e300a3184982 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Remove QtWidget dependency from platform pluginTor Arne Vestbø2020-06-041-3/+0
| | | | | | | | | The dialog helpers don't depend on widgets themselves, and should be built regardless of whether the widget dialogs are enabled, as these helpers can (and should) be used by other layers, such as Qt Quick. Change-Id: I1c66b474ab2f29748f1256aea90229c51c12a16f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Simplify Objective-C namespacingTor Arne Vestbø2019-10-151-2/+8
| | | | | | | | | | | | | | | | We only need to use the QT_MANGLE_NAMESPACE macro when declaring the interface of the class. As long as we couple that with an alias declaration using QT_NAMESPACE_ALIAS_OBJC_CLASS, any further uses of the class name can be un-namespaced, including declaring categories on the class. The only snag with QT_NAMESPACE_ALIAS_OBJC_CLASS is that it can only be used once per class and translation unit, so forward declarations get hairy, but we can avoid that by just including the headers instead. Change-Id: I333bcd18fe1e18d81fbd560b0941c98b1c32460e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-11/+11
| | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Convert features.filedialog to QT_[REQUIRE_]CONFIGStephan Binner2017-06-291-0/+3
| | | | | Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@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>
* Merge remote-tracking branch 'origin/5.5.0' into 5.5Liang Qi2015-06-271-1/+0
|\ | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoafiledialoghelper.h Manually fixed src/testlib/qtestcase.cpp to return the right type. Change-Id: Id1634dbe3d73fefe9431b9f5378846cb187624e4
| * OSX: show file dialog in showCocoaFilePanel, don't wait for exec()Shawn Rutledge2015-06-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 21e6c7ae4745a76b676dfaa9fe17a2dd40fc0c5c because in QtQuick.Controls, we do not call exec(): we just set the dialog visible. If it is a sheet, then it is already acting as a modal dialog, basically. Task-number: QTBUG-46691 Change-Id: I7fe89f2a2ade0d4ddcf540c9bfc4f5963a077471 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* | Add missing Q_DECL_OVERRIDE in Cocoa specific header filesGabriel de Dietrich2015-06-241-8/+8
|/ | | | | | Change-Id: I91831390e9e0d97ab28f0e34ca0573fb2c84e954 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cocoa integration - implement Qt::WindowModal file dialogsTimur Pocheptsov2015-05-131-0/+1
| | | | | | | | | | | | Previously, for Qt::WindowModal dialogs we were creating modal sheet with beginSheetModalForWindow: and later (from exec) calling -runModal, essentially making a window modal dialog into (now) application modal sheet, which is not right- it's centered relative to desktop and the jump from window modal sheet's position (centered relative to a window) to application modal was quite visible. Now, instead of [panel runModal] (== [NSApp runModalForWindow:panel]) we call [NSApp runModalForWindow:theRequiredWindow]. Change-Id: I793dc72c7d1fe96497bb35754f4d0eac9a5e00e5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Utilize Q_FORWARD_DECLARE_OBJC_CLASS in QCocoaFileDialogHelper.Jake Petroules2014-10-081-1/+3
| | | | | | Change-Id: I94ae91ac8fb625de4a328c6628ce0ab45919708f Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QCocoaFileDialogHelper: Cache directory until delegate has been createdGabriel de Dietrich2013-11-271-0/+1
| | | | | | | | Task-number: QTBUG-34393 Change-Id: Idee9e879e586afe25fd099d157ed7af88c17c4a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Have QFileDialog use QUrl internallyKevin Ottens2013-07-181-4/+4
| | | | | | | | | | | | When using the native dialog and through the helper, we use QUrl in QFileDialog. It is preparatory work for having QUrl based methods on QFileDialog interface itself. Done-with: sean.harmer@kdab.com Done-with: faure@kde.org Change-Id: I61e99d498252241f38ec05724702a90ba050c4bb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* 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>
* qpa: Remove QPlatformDialogHelper::deleteNativeDialog()Bradley T. Hughes2012-05-101-1/+0
| | | | | | | | | | | | | | | | This function isn't really needed. The QDialogPrivate destructor deletes the platform helper, so the QDialog destructor does not need to do it. Subclasses of QPlatformDialogHelper are now responsible for deleting any native resources they create. The one place in QFileDialog that needs to recreate the native dialog can simply recreate the helper. QDialogPrivate::deleteNativeDialog() now becomes QDialogPrivate::deletePlatformHelper(), which resets all state to allow the platform helper to be recreated. Change-Id: I58adfe8801e02e63b3cb4a9a3a0b8cb5b3c7b161 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* qpa: Clean up QPlatformDialogHelper APIBradley T. Hughes2012-05-101-11/+11
| | | | | | | | | | Remove the _sys suffix from all members of QPlatformDialogHelper and its subclasses. The QPlatform* class prefix already implies that these methods are system specific, we don't need the method suffix as well. Change-Id: I5ad1f928fab3a989992951acc244915e7fa48d32 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QPA: Cleanup native dialog modal executionBradley T. Hughes2012-05-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the _q_platformRunNativeAppModalPanel() function, together with the launchNativeAppModalPanel() signal and emitLaunchNativeAppModalPanel() slot, which were previously used to run the modal loop inside the QDialog::exec() loop. This trick isn't necessary anymore, so remove the mechanism and code related to it. Rename QPlatformDialogHelper::platformNativeDialogModalHelp() to exec_sys(). This function is now responsible for both showing the native dialog and running the modal loop. QDialog:exec() now calls this function if a native dialog is in use (it does not call QEventLoop::exec() anymore). The dialogResultCode_sys() function was unused, so it has also been removed. This commit also removes some unused private slots that were left over from the port to QPA. Note that the comments in the Cocoa plugin are still valid and relevant, but this commit does not fix the scenarios mentioned. This will be done in a future commit. The Windows plugin needs minor changes. The QueuedConnections to accept() and reject() cause the deliver to come too late, resulting in crashes, hence the change to AutoConnection (which ends up being a DirectConnection). Change-Id: Ifc90325c945ca78737e60bf331929f03ecc52e0a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Expose QPA API under qpa/*Girish Ramakrishnan2012-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += <module>-private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Support all modality types in QPlatformDialogHelperBradley T. Hughes2012-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Modality is not a boolean property in Qt. There are 2 types: window modality and application modality. Native dialogs can support both of these types as well (e.g. on Cocoa, a window modal file dialog should be displayed as a Sheet). Remove the QPlatformDialogHelper::ShowFlags enum and instead pass a Qt::WindowModality parameter to QPlatformDialogHelper::show_sys(). The Windows implementation has been updated to check for Qt::ApplicationModal instead of the ShowModal flag (since only Qt::ApplicationModal dialogs are blocking). The Cocoa implementation has been updated to only use non-modal and application modal native color and font dialogs (which restores Qt 4 behavior). These are shared Cocoa panels that cannot be shown as sheets, however. If the programmer asks for window modal color/font dialogs, we use the Qt versions, not the native ones. The file dialog can be shown either as a Sheet (but we need to pass an NSWindow parent for it to work properly) or as an application modal dialog. This change has been tested on Mac OS X with tests/manual/windowmodality. Change-Id: I9064987433895c55f68aac979ef8e8207fb24bbe Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> 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>
* Decouple QPlatformTheme from QDialog.Friedemann Kleint2012-01-271-2/+1
| | | | | | | | | | - Use an enumeration for the dialog type. - Implemented on Windows and Mac Reviewed-by: Morten Johan Sorvig <morten.sorvig@nokia.com> Change-Id: I213748a08168efbabc2ac0106308e97ff19d19c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* QPlatformDialogHelpers: Reduce dependency on QDialog.Friedemann Kleint2011-12-141-3/+2
| | | | | | | | | | For each QDialog-derived class, introduce a Q[X]Options class containing the options of the dialog. An instance is shared between the QDialog (or dialog desktop component) and the helper. Change-Id: Ibabf508a4b9eaea25615638a47a4c1b8f93c019e Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Fixed Qtbase OSX specific namespace compilation.Toby Tomkins2011-11-291-0/+4
| | | | | | Change-Id: Idacfa679df7aa6417f8017f80928907830d15df2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QPlatformDialogHelper: Split class hierarchy, decouple from DialogFriedemann Kleint2011-11-111-3/+5
| | | | | | | | | | | | | | | | | | | | | - Introduce hierarchy of QPlatformDialogHelper-derived classes for font, color and file dialogs. - Start reducing dependencies on QDialog: * Remove QDialog-specifics from interface, introduce enumeration for DialogCode * Make the helpers Q_OBJECTS to be able to add the signals passed on to the QDialogs * Remove QDialogPrivate pointer - Split setVisible_sys() in show_sys() (factory method for native dialogs) and hide_sys(). Pass parent window to show_sys(), removing the necessity to query the QDialog for it - Introduce a styleHint() similar to QGuiApplication's for platform-specific - Fix compile in cocoa/windows, reduce depency on QDialog (-private) classes. Change-Id: Ic1cb715e1edf767f2cb18b9780341d189339ef1d Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Native file dialog support for MacMorten Sorvig2011-10-271-0/+88
* New API: QPlatformDialogHelper to support native dialog on QPA. (Currently, It supports only file dialog.) * Modify QDialog* and QFileDialog* to support native dialog. * Add native file dialog support to cocoa platform plugin. Change-Id: I957f046748a27a33fd9f8af3c525feabd1b0f582 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>