35 child.waitForProcessToFinish (60 * 1000);
36 return (child.getExitCode() == 0);
42static bool isSet (
int flags,
int toCheck)
63 if (exeIsAvailable (
"kdialog") && (isKdeFullSession() || ! exeIsAvailable (
"zenity")))
74 void runModally()
override
76 #if JUCE_MODAL_LOOPS_PERMITTED
77 child.start (args, ChildProcess::wantStdOut);
79 while (child.isRunning())
89 void launch()
override
91 child.start (args, ChildProcess::wantStdOut);
97 bool isDirectory, isSave, selectMultipleFiles, warnAboutOverwrite;
103 void timerCallback()
override
126 if (selectMultipleFiles)
127 tokens.
addTokens (result, separator,
"\"");
131 for (
auto&
token : tokens)
138 owner.finished (selection);
142 static uint64 getTopWindowID()
noexcept
150 static bool isKdeFullSession()
156 void addKDialogArgs()
158 args.
add (
"kdialog");
161 args.
add (
"--title=" + owner.title);
165 args.
add (
"--attach");
169 if (selectMultipleFiles)
172 args.
add (
"--multiple");
173 args.
add (
"--separate-output");
174 args.
add (
"--getopenfilename");
178 if (isSave) args.
add (
"--getsavefilename");
179 else if (isDirectory) args.
add (
"--getexistingdirectory");
180 else args.
add (
"--getopenfilename");
185 if (owner.startingFile.
exists())
208 args.
add (
"--file-selection");
214 process.
start (
"zenity --version");
218 return version.size() >= 2
219 && (version[0].getIntValue() < 3
220 || (version[0].getIntValue() == 3 && version[1].getIntValue() < 91));
224 args.
add (
"--confirm-overwrite");
227 args.
add (
"--title=" + owner.title);
229 if (selectMultipleFiles)
232 args.
add (
"--multiple");
233 args.
add (
"--separator=" + separator);
242 args.
add (
"--directory");
244 if (owner.filters.
isNotEmpty() && owner.filters !=
"*" && owner.filters !=
"*.*")
247 tokens.
addTokens (owner.filters,
";,|",
"\"");
261 if (! filename.isEmpty())
262 args.
add (
"--filename=" + filename);
274 #if JUCE_DISABLE_NATIVE_FILECHOOSERS
277 static bool canUseNativeBox = exeIsAvailable (
"zenity") || exeIsAvailable (
"kdialog");
284 return std::make_shared<Native> (owner, flags);
Holds a resizable array of primitive or copy-by-value objects.
void add(const ElementType &newElement)
Appends a new element at the end of the array.
Launches and monitors a child process.
String readAllProcessOutput()
Blocks until the process has finished, and then returns its complete output as a string.
bool isRunning() const
Returns true if the child process is alive.
bool waitForProcessToFinish(int timeoutMs) const
Blocks until the process is no longer running.
bool kill()
Attempts to kill the child process.
bool start(const String &command, int streamFlags=wantStdOut|wantStdErr)
Attempts to launch a child process command.
@ saveMode
specifies that the component should allow the user to specify the name of a file that will be used to...
@ canSelectMultipleItems
specifies that the user can select multiple items.
@ warnAboutOverwriting
specifies that the dialog should warn about overwriting existing files (if possible).
@ canSelectFiles
specifies that the user can select files (can be used in conjunction with canSelectDirectories).
@ canSelectDirectories
specifies that the user can select directories (can be used in conjunction with canSelectFiles).
Creates a dialog box to choose a file or directory to load or save.
static bool isPlatformDialogAvailable()
Returns if a native filechooser is currently available on this platform.
Base class for components that live inside a file chooser dialog box and show previews of the files t...
Represents a local file or directory.
bool isDirectory() const
Checks whether the file is a directory that exists.
bool setAsCurrentWorkingDirectory() const
Sets the current working directory to be this file.
String getFileName() const
Returns the last section of the pathname.
static File getCurrentWorkingDirectory()
Returns the current working directory.
@ userHomeDirectory
The user's home folder.
static File JUCE_CALLTYPE getSpecialLocation(const SpecialLocationType type)
Finds the location of a special type of file or directory, such as a home folder or documents folder.
File getParentDirectory() const
Returns the directory that contains this file or directory.
bool exists() const
Checks whether the file actually exists.
static MessageManager * getInstance()
Returns the global instance of the MessageManager.
A special array for holding a list of strings.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
static StringArray fromTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Returns an array containing the tokens in a given string.
void add(String stringToAdd)
Appends a string at the end of the array.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
bool equalsIgnoreCase(const String &other) const noexcept
Case-insensitive comparison with another string.
String trim() const
Returns a copy of this string with any whitespace characters removed from the start and end.
String replaceCharacter(juce_wchar characterToReplace, juce_wchar characterToInsertInstead) const
Returns a string with all occurrences of a character replaced with a different one.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
static String getEnvironmentVariable(const String &name, const String &defaultValue)
Returns an environment variable.
Makes repeated callbacks to a virtual method at a specified time interval.
void stopTimer() noexcept
Stops the timer.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
A base class for top-level windows.
static TopLevelWindow * getActiveTopLevelWindow() noexcept
Returns the currently-active top level window.
Represents a URL and has a bunch of useful functions to manipulate it.
unsigned int pointer_sized_uint
An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it...
unsigned long long uint64
A platform-independent 64-bit unsigned integer type.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...