mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
FileChooser: In Linux FileChoosers, prefer to open files rather than directories if both are requested
Zenity and Kdialog only support opening either files or directories during a single invocation.
This commit is contained in:
parent
0feda541e7
commit
7504fa065b
2 changed files with 11 additions and 5 deletions
|
|
@ -183,7 +183,6 @@ void FileChooser::launchAsync (int flags, std::function<void (const FileChooser&
|
||||||
pimpl->launch();
|
pimpl->launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<FileChooser::Pimpl> FileChooser::createPimpl (int flags, FilePreviewComponent* previewComp)
|
std::shared_ptr<FileChooser::Pimpl> FileChooser::createPimpl (int flags, FilePreviewComponent* previewComp)
|
||||||
{
|
{
|
||||||
results.clear();
|
results.clear();
|
||||||
|
|
|
||||||
|
|
@ -39,16 +39,23 @@ static bool exeIsAvailable (String executable)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isSet (int flags, int toCheck)
|
||||||
|
{
|
||||||
|
return (flags & toCheck) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
class FileChooser::Native : public FileChooser::Pimpl,
|
class FileChooser::Native : public FileChooser::Pimpl,
|
||||||
private Timer
|
private Timer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Native (FileChooser& fileChooser, int flags)
|
Native (FileChooser& fileChooser, int flags)
|
||||||
: owner (fileChooser),
|
: owner (fileChooser),
|
||||||
isDirectory ((flags & FileBrowserComponent::canSelectDirectories) != 0),
|
// kdialog/zenity only support opening either files or directories.
|
||||||
isSave ((flags & FileBrowserComponent::saveMode) != 0),
|
// Files should take precedence, if requested.
|
||||||
selectMultipleFiles ((flags & FileBrowserComponent::canSelectMultipleItems) != 0),
|
isDirectory (isSet (flags, FileBrowserComponent::canSelectDirectories) && ! isSet (flags, FileBrowserComponent::canSelectFiles)),
|
||||||
warnAboutOverwrite ((flags & FileBrowserComponent::warnAboutOverwriting) != 0)
|
isSave (isSet (flags, FileBrowserComponent::saveMode)),
|
||||||
|
selectMultipleFiles (isSet (flags, FileBrowserComponent::canSelectMultipleItems)),
|
||||||
|
warnAboutOverwrite (isSet (flags, FileBrowserComponent::warnAboutOverwriting))
|
||||||
{
|
{
|
||||||
const File previousWorkingDirectory (File::getCurrentWorkingDirectory());
|
const File previousWorkingDirectory (File::getCurrentWorkingDirectory());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue