Mercurial > minori
comparison src/sys/osx/permissions.cc @ 237:a7d0d543b334
*: make OS X builds succeed
new script: deploy_build.sh, creates the app bundle
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Fri, 19 Jan 2024 11:14:44 -0500 |
parents | |
children | 862d0d8619f6 |
comparison
equal
deleted
inserted
replaced
236:4d461ef7d424 | 237:a7d0d543b334 |
---|---|
1 #include "sys/osx/permissions.h" | |
2 | |
3 #include <ApplicationServices/ApplicationServices.h> | |
4 | |
5 #include <QCoreApplication> | |
6 #include <QMessageBox> | |
7 #include <QDesktopServices> | |
8 #include <QUrl> | |
9 | |
10 namespace osx { | |
11 | |
12 bool AskForPermissions() { | |
13 if (::AXIsProcessTrusted()) | |
14 return true; | |
15 | |
16 QMessageBox msg; | |
17 msg.setIcon(QMessageBox::Information); | |
18 msg.setText(QCoreApplication::tr("Permissions needed!")); | |
19 msg.setInformativeText(QCoreApplication::tr("Minori needs access to accessibility features for certain features to work. Open System Preferences?")); | |
20 msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); | |
21 msg.setDefaultButton(QMessageBox::Yes); | |
22 int ret = msg.exec(); | |
23 if (ret != QMessageBox::Yes) | |
24 return false; | |
25 | |
26 QDesktopServices::openUrl(QUrl("x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility")); | |
27 return true; | |
28 } | |
29 | |
30 } |