macOS: Don't restrict non-modal file dialogs to open-dialogs only
None of the APIs used for non-modal operation require NSOpenPanel. Change-Id: I7ea49a8dad6e724a8a0d4321ea443d4cdcc5a6b1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit d7c07578bc02be1f0c3c3c3c3d64b020f2ec50ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a6a8a4e06e
commit
257caeec0a
@ -191,22 +191,20 @@ static QString strippedText(QString s)
|
|||||||
|
|
||||||
- (void)showModelessPanel
|
- (void)showModelessPanel
|
||||||
{
|
{
|
||||||
if (mOpenPanel){
|
QFileInfo info(*mCurrentSelection);
|
||||||
QFileInfo info(*mCurrentSelection);
|
NSString *filepath = info.filePath().toNSString();
|
||||||
NSString *filepath = info.filePath().toNSString();
|
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||||
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
|| [self panel:mSavePanel shouldEnableURL:url];
|
||||||
|| [self panel:mOpenPanel shouldEnableURL:url];
|
|
||||||
|
|
||||||
[self updateProperties];
|
[self updateProperties];
|
||||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||||
|
|
||||||
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
|
[mSavePanel beginWithCompletionHandler:^(NSInteger result){
|
||||||
mReturnCode = result;
|
mReturnCode = result;
|
||||||
if (mHelper)
|
if (mHelper)
|
||||||
mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSModalResponseOK);
|
mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSModalResponseOK);
|
||||||
}];
|
}];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)runApplicationModalPanel
|
- (BOOL)runApplicationModalPanel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user