Krita Source Code Documentation
Loading...
Searching...
No Matches
KoFileDialog.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2013-2014 Yue Liu <yue.liu@mail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KOFILEDIALOG_H
8#define KOFILEDIALOG_H
9
10#include "kritawidgetutils_export.h"
11
12#include <QFileDialog>
13#include <QString>
14#include <QStringList>
15
16
21class KRITAWIDGETUTILS_EXPORT KoFileDialog : public QObject
22{
23 Q_OBJECT
24
25public:
35
46 KoFileDialog(QWidget *parent,
48 const QString &dialogName);
49
50 ~KoFileDialog() override;
51
52 void setCaption(const QString &caption);
53
59 void setDefaultDir(const QString &defaultDir, bool force = false);
60
67 void setDirectoryUrl(const QUrl &defaultUri);
68
73 void setImageFilters();
74
80 void setMimeTypeFilters(const QStringList &mimeTypeList,
81 QString defaultMimeType = QString());
82
83 // Set the file type filter
84 void setNameFilter(const QString &filter);
85
86 //Set the selected file type filter
87 void selectNameFilter(const QString &filter);
88
90 QStringList filenames();
91
93 QString filename();
94
100 QString selectedNameFilter() const;
101
102 QString selectedMimeType() const;
103
104public Q_SLOTS:
105 // Set default file extension matching the filter.
106 void onFilterSelected(const QString &filter);
107
108private:
119 static QStringList splitNameFilter(const QString &nameFilter, QStringList *mimeList);
120
121 void createFileDialog();
122
123 QString getUsedDir(const QString &dialogName);
124 void saveUsedDir(const QString &fileName, const QString &dialogName);
125
126 // Get list of user friendly descriptions and map of these descriptions to the proposed file extension.
127 const QPair<QStringList, QMap<QString, QString>> getFilterStringListFromMime(const QStringList &mimeList,
128 bool withAllSupportedEntry = false);
129
130 class Private;
131 Private * const d;
132};
133
134#endif /* KOFILEDIALOG_H */
Private *const d
const QPair< QStringList, QMap< QString, QString > > getFilterStringListFromMime(const QStringList &mimeList, bool withAllSupportedEntry=false)