Mercurial > minori
comparison src/sys/osx/permissions.cc @ 249:6b2441c776dd
*: merge
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Wed, 24 Jan 2024 20:18:59 -0500 |
| parents | a7d0d543b334 |
| children | 862d0d8619f6 |
comparison
equal
deleted
inserted
replaced
| 248:cf47a8f687c0 | 249:6b2441c776dd |
|---|---|
| 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 } |
