summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: clean up error handling and native methods registrationVolker Hilsheimer2023-11-011-7/+5
| | | | | | | | | | | | Emit log output and return false immediately if we fail to get both the Activity and the Service objects. Standardize the registerNative methods to return bool and take a QJniEnvironment, and adjust the macros accordingly. Simplify the startup routine to use QJniEnvironment. Change-Id: I11be35426520dc803f5a07bbb495e908592f254e Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* Android: don't rely on implicit cast of declared QtJniTypes to jobjectVolker Hilsheimer2023-10-271-1/+1
| | | | | | | | | | The operator jobject() should be removed from declared QtJniTypes in qtbase, as it's dangerous. Prepare for that by calling object(), which returns the wrapped jobject as well, or isValid() where previously the implicit conversion to jobject also enabled implicit conversion to bool. Change-Id: I00cf6f1463dd5ab5cbaf03d9e77bfff3bced9b15 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Android: replace QtAndroid::activity/service with QtAndroidPrivateVolker Hilsheimer2023-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There's no need for both, and QtAndroidPrivate is a documented namespace. Replace all calls to QtAndroid::activity/service with QtAndroidPrivate equivalents, and drop the QtAndroid version. Since we no longer store a global copy of the activity and service, we can drop the reference right away. This comes with a bit of overhead - QtAndroid::activity returned a copy of a global static QJniObject (62cb5589b3723fe8162e190cd54d9c78929b98d2, after which declared QtJniTypes became QJniObjects), while QtAndroidPrivate::activity returns a newly created QtJniTypes::Activity on each call. This however makes it also safer, as the QJniObject is then associated with the calling thread's JNI environment, and we can optimize critical code paths where it's safe to do so later. Also, QtAndroid's activity object was never updated, while QtAndroidPrivate's activity is updated in the updateNativeActivity native method. Change-Id: I36c5b504eac52d9e28b4c6b265daab8fedc877e2 Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* JNI: Explicitly convert QtJniType instances to jobject for variadic argumentsVolker Hilsheimer2023-09-201-1/+1
| | | | | | | | | | | | | | | | | | When calling the (old and outdated) variadic argument overloads of callMethod (as opposed to the variadic template overloads), then we cannot pass complex types. That types declared via the Q_DECLARE_JNI_CLASS macro are trivial was an implementation detail that we shouldn't rely on as long as those types are not part of the public API. Cast explicitly to jobject so that we can make those types proper QJniObjects. Updating this code to use the new variadic template overloads is for a follow-up commit. Change-Id: Ia9d610c84de6f989ef957c23401b1cbc64d2d1ef Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Plumb QMessageBox::setCheckBox() through QPlatformMessageDialogHelperTor Arne Vestbø2023-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Without this plumbing we have no way of knowing if the QMessageBox has a checkbox set, and can't decide to skip the native dialog, leaving the user without the expected checkbox. As the suppression checkbox on macOS can be customized, we can use this plumbing to actually provide native dialog support for generic check boxes. This mechanism can also be used by QErrorMessage, which now matches behavior between native and non-native dialogs in terms of the label of the checkbox and its initial state. We might want to tweak this in the future, since user's might expect the suppression label and state to match the system default, but that's something we can expose from the platform theme if so, and should apply equally to the non-native dialog. Fixes: QTBUG-111803 Pick-to: 6.5.0 6.5 Change-Id: Ied9fc34383fe79fbd8437592ad1c1993b9396178 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: fix jni function name from standardIcon to setStandardIconAssam Boudjelthia2022-12-211-1/+1
| | | | | | | | The issue came from 53b413f1c589d976bbc1eb0ad2cc526633e247db. Change-Id: Idb77a66dbd8649bdece213298b1e1676b22cc8ba Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rename QMessageDialogOptions::Icon to StandardIconTor Arne Vestbø2022-12-131-1/+1
| | | | | | | | To clarify its use as a pre-defined standard icon, which is a separate use-case from providing a user-defined QIcon. Change-Id: I187ce2e5f125a7392b1279c9bd1e871790c8065f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Teach QErrorMessage to use native dialog helper if availableTor Arne Vestbø2022-12-041-0/+3
| | | | | | | | | | | And implement for macOS. The default modality of the QErrorMessage on macOS now depends on whether the dialog has a parent or not. The QErrorMessage must be hidden and re-shown again after each message, so that the native dialog has a chance to recreate itself. Change-Id: I474ed35d6271118834fac8e97f6f540a6fb89b8c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | 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>
* Android: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-141-1/+3
| | | | | | Task-number: QTBUG-98434 Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-141-2/+2
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Iebcbdbd7cecac09d0a7039e3ef6a4509d33039ba Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: minor code refactorings for QAndroidPlatformMessageDialogHelperAssam Boudjelthia2022-04-011-26/+34
| | | | | Change-Id: Ia42450a5c3ebc2f608bae599f03246464136ca06 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Android: hide() in the QAndroidPlatformMessageDialogHelper destructorAssam Boudjelthia2022-04-011-0/+5
| | | | | | | | | | | | The native dialog window is not being hidden or destroyed when the QAndroidPlatformMessageDialogHelper object is destroyed. This makes sure to not leave any native dialogs open. Pick-to: 6.2 6.3 6.3.0 Task-number: QTBUG-97482 Fixes: QTBUG-101758 Change-Id: I2e50caebd286ea6abd3e948a4873dc3c971626a4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-7/+8
| | | | | | | | | | | | | | | | | | | | As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: rename Android's package name for Qt 6Assam Boudjelthia2020-10-031-2/+2
| | | | | | | | | | Rename Android package name org.qtproject.qt5.android to org.qtproject.qt.android to avoid inconsistency with Qt 6 name. Also, we include the major version number in the jar target. Task-number: QTBUG-86969 Change-Id: Ibb68947289be1079911b34ea157bf089cc52c47f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-3/+3
| | | | | | | | 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>
* Android: add support for custom buttons in native MessageDialog helperShawn Rutledge2018-09-251-0/+16
| | | | | | | | | New API in QMessageDialogOptions and implementation on Android. Task-number: QTBUG-35545 Change-Id: I59567251199f220862d01ba76979266379eecd86 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add button layout for dialogs on AndroidNikita Krupenko2017-04-111-5/+1
| | | | | | | | | | | | | | | It used macOS layout before, but it differs from the actual layout in Android/Material Design: affirmative actions are on the right side, dismissive actions are directly to the left of the affirmative actions and neutral actions are on the left side. [ChangeLog][Platform-specific Changes][Android] Android dialogs now have more appropriate button layout, with affirmative actions on the right. Task-number: QTBUG-58060 Change-Id: I0755f80261410c64cf4f854b7f2a72e2d959db28 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | 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.4' into 5.5Liang Qi2015-03-311-5/+20
|\ | | | | | | | | | | | | | | | | Conflicts: mkspecs/android-g++/qmake.conf qmake/generators/unix/unixmake2.cpp src/gui/image/qimage_conversions.cpp Change-Id: Ib76264b8c2d29a0228438ec02bd97d4b97545be0
| * Android MessageDialog: order buttons according to OS X button layoutShawn Rutledge2015-03-261-5/+20
| | | | | | | | | | | | | | | | | | At least the dismissive action should be on the left, but we can take the OS X rules as reasonable in cases where a lot of buttons are in use. Task-number: QTBUG-42808 Change-Id: If45f991a068d47009e02d39fbb3886ff4b31c8e1 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* | Update copyright headersJani Heikkinen2015-02-111-6/+6
|/ | | | | | | | | | | | | | | | | | 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>
* Android: Add findClass() function to the QJNIEnvironmentPrivate class.Christian Strømme2014-09-261-2/+4
| | | | | | | | | The static QJNIEnvironmentPrivate::findClass() function exposes the cache and the class finding code in qjni. Change-Id: I42043dc993cf9cace042faf763f2a647ba79d97f Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Android: Fix namespace usageChristian Strømme2014-06-301-0/+4
| | | | | | | This change makes it possible to set a Qt namespace for Android builds. Change-Id: I79f4ae8200223f36f97e2849aae49e45b8850d23 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Convert plain text to html text for native dialogs.BogDan Vatra2014-03-281-4/+15
| | | | | | | Task-number: QTBUG-37824 Change-Id: I380b41d300b198b6cf3060bbecb5b98e0190b69a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-181-2/+0
| | | | | | | Conflicts: src/plugins/platforms/android/qandroidplatformtheme.h Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
* Consolidate StandardButton, ButtonRole and related static functionsShawn Rutledge2014-02-151-3/+3
| | | | | | | | | | Moving them into QPlatformDialogHelper for the convenience of both widgets and QtQuick.Dialogs. The main reason is to ensure that QtQuick.Dialogs does not need to depend on the widgets module, in order to re-implement the button box concept in a generic dialog. Change-Id: If400d215338d7cb6dade39d9de60e50b5e7515ef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Introduce function for standard button texts to QPlatformTheme.Friedemann Kleint2014-01-181-45/+6
| | | | | Change-Id: I91eec04a95b5047d893490a70152237b2991f662 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Support multiple native surfaces on Android.BogDan Vatra2014-01-171-0/+204
Support for multiple native surfaces is needed by applications that need to mix raster windows with GL windows. Rework the raster and opengl implementation, get rid of eglfs and fbconvenience dependencies. Create a single android platform plugin. [ChangeLog][Android] Rework the raster and opengl implementation. [ChangeLog][Android] Create a single android platform plugin. Task-number: QTBUG-34650 Change-Id: I9b1ab51554823329dda8cfbf8fef27c38f917c7b Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>