1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/*
* SPDX-FileCopyrightText: 2017 - 2023 UnionTech Software Technology Co., Ltd.
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#ifndef QDEEPINFILEDIALOGHELPER_H
#define QDEEPINFILEDIALOGHELPER_H
#include <qpa/qplatformdialoghelper.h>
#include <QPointer>
#include <QEventLoop>
QT_BEGIN_NAMESPACE
class ComDeepinFilemanagerFiledialogInterface;
typedef ComDeepinFilemanagerFiledialogInterface DFileDialogHandle;
class ComDeepinFilemanagerFiledialogmanagerInterface;
typedef ComDeepinFilemanagerFiledialogmanagerInterface DFileDialogManager;
class QDeepinFileDialogHelper : public QPlatformFileDialogHelper
{
public:
enum CustomWidgetType {
LineEditType = 0,
ComboBoxType = 1
};
QDeepinFileDialogHelper();
~QDeepinFileDialogHelper();
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) Q_DECL_OVERRIDE;
void exec() Q_DECL_OVERRIDE;
void hide() Q_DECL_OVERRIDE;
bool defaultNameFilterDisables() const Q_DECL_OVERRIDE;
void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE;
QUrl directory() const Q_DECL_OVERRIDE;
void selectFile(const QUrl &filename) Q_DECL_OVERRIDE;
QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
void setFilter() Q_DECL_OVERRIDE;
void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE;
QString selectedNameFilter() const Q_DECL_OVERRIDE;
static void initDBusFileDialogManager();
static bool iAmFileDialogDBusServer();
protected:
void onApplicationStateChanged(Qt::ApplicationState state);
void onWindowActiveChanged();
private:
mutable QPointer<DFileDialogHandle> filedlgInterface;
mutable QPointer<QWindow> auxiliaryWindow;
QPointer<QWindow> activeWindow;
QPointer<QObject> sourceDialog;
QPointer<QEventLoop> execLoop;
static DFileDialogManager *manager;
static QString dialogService;
void ensureDialog() const;
void applyOptions();
void hideAuxiliaryWindow() const;
friend class QDeepinTheme;
};
QT_END_NAMESPACE
#endif // QDEEPINFILEDIALOGHELPER_H
|