[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [osx-integration/qt590] src/qcocoa-qpa: Fall back to using LSFindApplicationForInfo() on 10.9
From:       R.J.V. Bertin <null () kde ! org>
Date:       2017-04-30 17:21:43
Message-ID: E1d4sXX-0003us-B1 () code ! kde ! org
[Download RAW message or body]

Git commit 4c7da1fb50e05685a8698cbbb92a5e84e79defdb by R.J.V. Bertin.
Committed on 30/04/2017 at 17:21.
Pushed by rjvbb into branch 'qt590'.

Fall back to using LSFindApplicationForInfo() on 10.9

Committed from host : Portia.local

M  +35   -0    src/qcocoa-qpa/patches/14-patch-build-against-580-and-on-OSX109.diff
M  +18   -4    src/qcocoa-qpa/qcocoanativeinterface.mm

https://commits.kde.org/osx-integration/4c7da1fb50e05685a8698cbbb92a5e84e79defdb

diff --git a/src/qcocoa-qpa/patches/14-patch-build-against-580-and-on-OSX109.diff \
b/src/qcocoa-qpa/patches/14-patch-build-against-580-and-on-OSX109.diff index \
                9a4998a..2295119 100644
--- a/src/qcocoa-qpa/patches/14-patch-build-against-580-and-on-OSX109.diff
+++ b/src/qcocoa-qpa/patches/14-patch-build-against-580-and-on-OSX109.diff
@@ -169,6 +169,41 @@ index \
ecdd20c4dc06e97e4ea8a201adc63d51b4de1935..f41f023198148cf2081a32d9aad0a4a1  #ifndef \
                QT_NO_OPENGL
      QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) \
const Q_DECL_OVERRIDE;  #endif
+diff --git a/cocoa/qcocoanativeinterface.mm b/cocoa/qcocoanativeinterface.mm
+index ee762f68788a4ffaa140a56a57fdafd37b73945d..77065a555768c959b576bfcb5756d4b3cdde42ba \
100644 +--- a/cocoa/qcocoanativeinterface.mm
++++ b/cocoa/qcocoanativeinterface.mm
+@@ -172,12 +172,26 @@ void \
*QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine + 
+ QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
+ {
++    QCFType<CFURLRef> url109;
++    CFURLRef url = nullptr;
+     const int ExpectedImageWidth = 242;
+     const int ExpectedImageHeight = 414;
+-    QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
+-        CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
+-    if (urls && CFArrayGetCount(urls) > 0) {
+-        CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
++    bool ok = false;
++    if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) {
++        if (LSFindApplicationForInfo(kLSUnknownCreator, \
CFSTR("com.apple.KeyboardSetupAssistant"), ++                                     0, \
0, &url109) == noErr) { ++            url = url109;
++            ok = true;
++        }
++    } else {
++        QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
++            CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
++        if (urls && CFArrayGetCount(urls) > 0) {
++            url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
++            ok = true;
++        }
++    }
++    if (ok) {
+         QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
+         if (bundle) {
+             url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), \
CFSTR("png"), 0);  diff --git a/cocoa/qcocoatheme.h b/cocoa/qcocoatheme.h
 index 27c071a8cd2f82b8f880e3336ea684dd840eb830..f5e065047889aeccf0af0708468531e87ef75391 \
                100644
 --- a/cocoa/qcocoatheme.h
diff --git a/src/qcocoa-qpa/qcocoanativeinterface.mm \
b/src/qcocoa-qpa/qcocoanativeinterface.mm index ee762f6..77065a5 100644
--- a/src/qcocoa-qpa/qcocoanativeinterface.mm
+++ b/src/qcocoa-qpa/qcocoanativeinterface.mm
@@ -172,12 +172,26 @@ void \
*QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine  
 QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
 {
+    QCFType<CFURLRef> url109;
+    CFURLRef url = nullptr;
     const int ExpectedImageWidth = 242;
     const int ExpectedImageHeight = 414;
-    QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
-        CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
-    if (urls && CFArrayGetCount(urls) > 0) {
-        CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
+    bool ok = false;
+    if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) {
+        if (LSFindApplicationForInfo(kLSUnknownCreator, \
CFSTR("com.apple.KeyboardSetupAssistant"), +                                     0, \
0, &url109) == noErr) { +            url = url109;
+            ok = true;
+        }
+    } else {
+        QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
+            CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
+        if (urls && CFArrayGetCount(urls) > 0) {
+            url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
+            ok = true;
+        }
+    }
+    if (ok) {
         QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
         if (bundle) {
             url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), \
0);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic