diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-01-25 13:26:31 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-01-26 13:28:35 +0100 |
commit | d7c07578bc02be1f0c3c3c3c3d64b020f2ec50ac (patch) | |
tree | 37b8a5ff20591e7a1dd02336399e83ccfcf31698 /src/plugins/platforms | |
parent | fce391fefb0bbdea220aa2c935ca6f154f6121cf (diff) |
macOS: Don't restrict non-modal file dialogs to open-dialogs only
None of the APIs used for non-modal operation require NSOpenPanel.
Pick-to: 6.0 5.15
Change-Id: I7ea49a8dad6e724a8a0d4321ea443d4cdcc5a6b1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 541eabd3ed..e0fc7dd9ce 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -191,22 +191,20 @@ static QString strippedText(QString s) - (void)showModelessPanel { - if (mOpenPanel){ - QFileInfo info(*mCurrentSelection); - NSString *filepath = info.filePath().toNSString(); - NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()]; - bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) - || [self panel:mOpenPanel shouldEnableURL:url]; - - [self updateProperties]; - [mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""]; - - [mOpenPanel beginWithCompletionHandler:^(NSInteger result){ - mReturnCode = result; - if (mHelper) - mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSModalResponseOK); - }]; - } + QFileInfo info(*mCurrentSelection); + NSString *filepath = info.filePath().toNSString(); + NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()]; + bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) + || [self panel:mSavePanel shouldEnableURL:url]; + + [self updateProperties]; + [mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""]; + + [mSavePanel beginWithCompletionHandler:^(NSInteger result){ + mReturnCode = result; + if (mHelper) + mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSModalResponseOK); + }]; } - (BOOL)runApplicationModalPanel |