| 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 | #if QT_DEPRECATED_SINCE(6, 9) |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QQuickLabsPlatformFolderDialog : public QQuickLabsPlatformDialog |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | QML_NAMED_ELEMENT(FolderDialog) |
| 30 | QML_EXTENDED_NAMESPACE(QFileDialogOptions) |
| 31 | Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL) |
| 32 | Q_PROPERTY(QUrl currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged FINAL) |
| 33 | Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL) |
| 34 | Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL) |
| 35 | Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL) |
| 36 | |
| 37 | public: |
| 38 | explicit QQuickLabsPlatformFolderDialog(QObject *parent = nullptr); |
| 39 | |
| 40 | QUrl folder() const; |
| 41 | void setFolder(const QUrl &folder); |
| 42 | |
| 43 | QUrl currentFolder() const; |
| 44 | void setCurrentFolder(const QUrl &folder); |
| 45 | |
| 46 | QFileDialogOptions::FileDialogOptions options() const; |
| 47 | void setOptions(QFileDialogOptions::FileDialogOptions options); |
| 48 | void resetOptions(); |
| 49 | |
| 50 | QString acceptLabel() const; |
| 51 | void setAcceptLabel(const QString &label); |
| 52 | void resetAcceptLabel(); |
| 53 | |
| 54 | QString rejectLabel() const; |
| 55 | void setRejectLabel(const QString &label); |
| 56 | void resetRejectLabel(); |
| 57 | |
| 58 | Q_SIGNALS: |
| 59 | void folderChanged(); |
| 60 | void currentFolderChanged(); |
| 61 | void optionsChanged(); |
| 62 | void acceptLabelChanged(); |
| 63 | void rejectLabelChanged(); |
| 64 | |
| 65 | protected: |
| 66 | bool useNativeDialog() const override; |
| 67 | void onCreate(QPlatformDialogHelper *dialog) override; |
| 68 | void onShow(QPlatformDialogHelper *dialog) override; |
| 69 | void accept() override; |
| 70 | |
| 71 | private: |
| 72 | QUrl m_folder; |
| 73 | QSharedPointer<QFileDialogOptions> m_options; |
| 74 | }; |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QT_DEPRECATED_SINCE(6, 9) |
| 79 | |
| 80 | #endif // QQUICKLABSPLATFORMFOLDERDIALOG_P_H |
| 81 |
