diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-01-05 14:14:41 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-01-24 19:40:40 +0000 |
commit | c1cece8e546a138609c974be94588ba4e72c6fb1 (patch) | |
tree | a355ec5cc99bd1b8ab48ff490afb66fc63d27d7b /src/plugins/platforms/cocoa | |
parent | ffc9d27d7eb5c6779c6bf3963bac2dafb2a828cf (diff) |
Fix deprecated API usage
Change-Id: I62448507f80daf6be72994ee99f0fb1aa107eb78
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
4 files changed, 20 insertions, 19 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index e53c085e41..a8974c4de5 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -80,7 +80,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mHelper = 0; mStolenContentView = 0; mPanelButtons = nil; - mResultCode = NSCancelButton; + mResultCode = NSModalResponseCancel; mDialogIsExecuting = false; mResultSet = false; mClosingDueToKnownButton = false; @@ -168,7 +168,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mClosingDueToKnownButton = true; [mColorPanel close]; [self updateQtColor]; - [self finishOffWithCode:NSOKButton]; + [self finishOffWithCode:NSModalResponseOK]; } - (void)onCancelClicked @@ -177,7 +177,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mClosingDueToKnownButton = true; [mColorPanel close]; mQtColor = QColor(); - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } } @@ -238,12 +238,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); [NSApp runModalForWindow:mColorPanel]; mDialogIsExecuting = false; - return (mResultCode == NSOKButton); + return (mResultCode == NSModalResponseOK); } - (QPlatformDialogHelper::DialogCode)dialogResultCode { - return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; + return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; } - (BOOL)windowShouldClose:(id)window @@ -252,7 +252,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); if (!mPanelButtons) [self updateQtColor]; if (mDialogIsExecuting) { - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } else { mResultSet = true; if (mHelper) @@ -278,7 +278,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); // This check will prevent any such recursion. if (!mResultSet) { mResultSet = true; - if (mResultCode == NSCancelButton) { + if (mResultCode == NSModalResponseCancel) { emit mHelper->reject(); } else { emit mHelper->accept(); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 72c7856c2d..d2f985ec87 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -401,7 +401,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) // [NSApp run], which is the normal code path for cocoa applications. if (NSModalSession session = d->currentModalSession()) { QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); - while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) + while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); if (!d->interrupt && session == d->currentModalSessionCached) { @@ -435,7 +435,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) if (flags & QEventLoop::WaitForMoreEvents) qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); NSInteger status = [NSApp runModalSession:session]; - if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + if (status != NSModalResponseContinue && session == d->currentModalSessionCached) { // INVARIANT: Someone called [NSApp stopModal:] from outside the event // dispatcher (e.g to stop a native dialog). But that call wrongly stopped // 'session' as well. As a result, we need to restart all internal sessions: diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 33dd4260a5..e4b796dcde 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -106,7 +106,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); mHelper = 0; mStolenContentView = 0; mPanelButtons = 0; - mResultCode = NSCancelButton; + mResultCode = NSModalResponseCancel; mDialogIsExecuting = false; mResultSet = false; @@ -171,7 +171,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); - (void)onOkClicked { [mFontPanel close]; - [self finishOffWithCode:NSOKButton]; + [self finishOffWithCode:NSModalResponseOK]; } - (void)onCancelClicked @@ -179,7 +179,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); if (mPanelButtons) { [mFontPanel close]; mQtFont = QFont(); - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } } @@ -224,12 +224,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); [NSApp runModalForWindow:mFontPanel]; mDialogIsExecuting = false; - return (mResultCode == NSOKButton); + return (mResultCode == NSModalResponseOK); } - (QPlatformDialogHelper::DialogCode)dialogResultCode { - return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; + return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; } - (BOOL)windowShouldClose:(id)window @@ -238,7 +238,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); if (!mPanelButtons) [self updateQtFont]; if (mDialogIsExecuting) { - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } else { mResultSet = true; if (mHelper) @@ -264,7 +264,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); // This check will prevent any such recursion. if (!mResultSet) { mResultSet = true; - if (mResultCode == NSCancelButton) { + if (mResultCode == NSModalResponseCancel) { emit mHelper->reject(); } else { emit mHelper->accept(); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 972230349b..26ab07ffaf 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -172,11 +172,12 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() { - QCFType<CFURLRef> url; const int ExpectedImageWidth = 242; const int ExpectedImageHeight = 414; - if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"), - 0, 0, &url) == noErr) { + QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier( + CFSTR("com.apple.KeyboardSetupAssistant"), nullptr); + if (urls && CFArrayGetCount(urls) > 0) { + CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0); QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url); if (bundle) { url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0); |