1 | // Copyright (C) 2017 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICKLABSPLATFORMFOLDERDIALOG_P_H |
5 | #define QQUICKLABSPLATFORMFOLDERDIALOG_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This folder is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header folder may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qquicklabsplatformdialog_p.h" |
19 | #include <QtCore/qurl.h> |
20 | #include <QtQml/qqml.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQuickLabsPlatformFolderDialog : public QQuickLabsPlatformDialog |
25 | { |
26 | Q_OBJECT |
27 | QML_NAMED_ELEMENT(FolderDialog) |
28 | QML_EXTENDED_NAMESPACE(QFileDialogOptions) |
29 | Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL) |
30 | Q_PROPERTY(QUrl currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged FINAL) |
31 | Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL) |
32 | Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL) |
33 | Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL) |
34 | |
35 | public: |
36 | explicit QQuickLabsPlatformFolderDialog(QObject *parent = nullptr); |
37 | |
38 | QUrl folder() const; |
39 | void setFolder(const QUrl &folder); |
40 | |
41 | QUrl currentFolder() const; |
42 | void setCurrentFolder(const QUrl &folder); |
43 | |
44 | QFileDialogOptions::FileDialogOptions options() const; |
45 | void setOptions(QFileDialogOptions::FileDialogOptions options); |
46 | void resetOptions(); |
47 | |
48 | QString acceptLabel() const; |
49 | void setAcceptLabel(const QString &label); |
50 | void resetAcceptLabel(); |
51 | |
52 | QString rejectLabel() const; |
53 | void setRejectLabel(const QString &label); |
54 | void resetRejectLabel(); |
55 | |
56 | Q_SIGNALS: |
57 | void folderChanged(); |
58 | void currentFolderChanged(); |
59 | void optionsChanged(); |
60 | void acceptLabelChanged(); |
61 | void rejectLabelChanged(); |
62 | |
63 | protected: |
64 | bool useNativeDialog() const override; |
65 | void onCreate(QPlatformDialogHelper *dialog) override; |
66 | void onShow(QPlatformDialogHelper *dialog) override; |
67 | void accept() override; |
68 | |
69 | private: |
70 | QUrl m_folder; |
71 | QSharedPointer<QFileDialogOptions> m_options; |
72 | }; |
73 | |
74 | QT_END_NAMESPACE |
75 | |
76 | QML_DECLARE_TYPE(QQuickLabsPlatformFolderDialog) |
77 | |
78 | #endif // QQUICKLABSPLATFORMFOLDERDIALOG_P_H |
79 |