1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2014 Arjun A.K. <arjunak234@gmail.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef EXECUTABLEFILEOPENDIALOG_H |
9 | #define EXECUTABLEFILEOPENDIALOG_H |
10 | |
11 | #include <QDialog> |
12 | |
13 | class QCheckBox; |
14 | |
15 | /** |
16 | * @brief Dialog shown when opening an executable file |
17 | */ |
18 | class ExecutableFileOpenDialog : public QDialog |
19 | { |
20 | Q_OBJECT |
21 | |
22 | public: |
23 | enum ReturnCode { |
24 | OpenFile = 42, |
25 | ExecuteFile, |
26 | }; |
27 | |
28 | enum Mode { |
29 | // For executable scripts |
30 | OpenOrExecute, |
31 | // For native binary executables |
32 | OnlyExecute, |
33 | // For *.exe files, open with WINE is like execute the file |
34 | // In this case, openAsExecute is true, we hide "Open" button and connect |
35 | // "Execute" button to OpenFile action. |
36 | OpenAsExecute, |
37 | }; |
38 | |
39 | explicit ExecutableFileOpenDialog(Mode mode, QWidget *parent = nullptr); |
40 | explicit ExecutableFileOpenDialog(QWidget *parent = nullptr); |
41 | |
42 | bool isDontAskAgainChecked() const; |
43 | |
44 | private: |
45 | void executeFile(); |
46 | void openFile(); |
47 | |
48 | QCheckBox *m_dontAskAgain; |
49 | }; |
50 | |
51 | #endif // EXECUTABLEFILEOPENDIALOG_H |
52 | |