File indexing completed on 2024-05-05 04:38:47

0001 /*
0002     SPDX-FileCopyrightText: 2012 Ivan Shapovalov <intelfx100@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef SHELLUTILS_H
0008 #define SHELLUTILS_H
0009 
0010 #include "utilexport.h"
0011 #include <QList>
0012 
0013 class QString;
0014 class QUrl;
0015 
0016 namespace KDevelop {
0017 
0018 /**
0019 * Asks user of an arbitrary question by using either a \ref KMessageBox or stdin/stderr.
0020 *
0021 * @return @c true if user chose "Yes" and @c false otherwise.
0022 */
0023 bool KDEVPLATFORMUTIL_EXPORT askUser(const QString& mainText,
0024                                      const QString& ttyPrompt,
0025                                      const QString& mboxTitle,
0026                                      const QString& mboxAdditionalText,
0027                                      const QString& confirmText,
0028                                      const QString& rejectText,
0029                                      bool ttyDefaultToYes = true);
0030 
0031 /**
0032  * Ensures that the given list of files is writable. If some files are not writable,
0033  * asks the user whether they should be made writable. If the user disagrees,
0034  * or if the operation failed, returns false.
0035  * */
0036 bool KDEVPLATFORMUTIL_EXPORT ensureWritable(const QList<QUrl>& urls);
0037 
0038 }
0039 
0040 #endif // SHELLUTILS_H