1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.widgets.dirmodel;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.abstractitemmodel;
19 import qt.core.dir;
20 import qt.core.fileinfo;
21 import qt.core.mimedata;
22 import qt.core.namespace;
23 import qt.core.object;
24 import qt.core.string;
25 import qt.core.stringlist;
26 import qt.core.variant;
27 import qt.gui.icon;
28 import qt.helpers;
29 import qt.widgets.fileiconprovider;
30 
31 /+ #if QT_DEPRECATED_SINCE(5, 15) +/
32 
33 /+ QT_REQUIRE_CONFIG(dirmodel); +/
34 
35 
36 extern(C++, class) struct QDirModelPrivate;
37 
38 class /+ Q_WIDGETS_EXPORT +/ QDirModel : QAbstractItemModel
39 {
40     mixin(Q_OBJECT);
41     /+ Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks)
42     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
43     Q_PROPERTY(bool lazyChildCount READ lazyChildCount WRITE setLazyChildCount) +/
44 
45 public:
46 /*    enum Roles {
47         FileIconRole = /+ Qt:: +/qt.core.namespace.ItemDataRole.DecorationRole,
48         FilePathRole = /+ Qt:: +/qt.core.namespace.ItemDataRole.UserRole + 1,
49         FileNameRole
50     }*/
51 
52     /+ QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") +/this(ref const(QStringList) nameFilters,
53                   QDir.Filters filters, QDir.SortFlags sort,
54                   QObject parent = null);
55     /+ QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") +/ /+ explicit +/this(QObject parent = null);
56     ~this();
57 
58     override QModelIndex index(int row, int column, ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
59     override QModelIndex parent(ref const(QModelIndex) child) const;
60 
61     override int rowCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
62     override int columnCount(ref const(QModelIndex) parent = globalInitVar!QModelIndex) const;
63 
64     override QVariant data(ref const(QModelIndex) index, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const;
65     override bool setData(ref const(QModelIndex) index, ref const(QVariant) value, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.EditRole);
66 
67     override QVariant headerData(int section, /+ Qt:: +/qt.core.namespace.Orientation orientation, int role = /+ Qt:: +/qt.core.namespace.ItemDataRole.DisplayRole) const;
68 
69     override bool hasChildren(ref const(QModelIndex) index = globalInitVar!QModelIndex) const;
70     override /+ Qt:: +/qt.core.namespace.ItemFlags flags(ref const(QModelIndex) index) const;
71 
72     override void sort(int column, /+ Qt:: +/qt.core.namespace.SortOrder order = /+ Qt:: +/qt.core.namespace.SortOrder.AscendingOrder);
73 
74     override QStringList mimeTypes() const;
75     override QMimeData mimeData(ref const(QModelIndexList) indexes) const;
76     override bool dropMimeData(const(QMimeData) data, /+ Qt:: +/qt.core.namespace.DropAction action,
77                           int row, int column, ref const(QModelIndex) parent);
78     override /+ Qt:: +/qt.core.namespace.DropActions supportedDropActions() const;
79 
80     // QDirModel specific API
81 
82     final void setIconProvider(QFileIconProvider provider);
83     final QFileIconProvider iconProvider() const;
84 
85     final void setNameFilters(ref const(QStringList) filters);
86     final QStringList nameFilters() const;
87 
88     final void setFilter(QDir.Filters filters);
89     final QDir.Filters filter() const;
90 
91     final void setSorting(QDir.SortFlags sort);
92     final QDir.SortFlags sorting() const;
93 
94     final void setResolveSymlinks(bool enable);
95     final bool resolveSymlinks() const;
96 
97     final void setReadOnly(bool enable);
98     final bool isReadOnly() const;
99 
100     final void setLazyChildCount(bool enable);
101     final bool lazyChildCount() const;
102 
103     final QModelIndex index(ref const(QString) path, int column = 0) const;
104 
105     final bool isDir(ref const(QModelIndex) index) const;
106     final QModelIndex mkdir(ref const(QModelIndex) parent, ref const(QString) name);
107     final bool rmdir(ref const(QModelIndex) index);
108     final bool remove(ref const(QModelIndex) index);
109 
110     final QString filePath(ref const(QModelIndex) index) const;
111     final QString fileName(ref const(QModelIndex) index) const;
112     final QIcon fileIcon(ref const(QModelIndex) index) const;
113     final QFileInfo fileInfo(ref const(QModelIndex) index) const;
114 
115     /+ using QObject::parent; +/
116 
117 public /+ Q_SLOTS +/:
118     @QSlot final void refresh(ref const(QModelIndex) parent = globalInitVar!QModelIndex);
119 
120 protected:
121     this(ref QDirModelPrivate , QObject parent = null);
122     /+ friend class QFileDialogPrivate; +/
123 
124 private:
125     /+ Q_DECLARE_PRIVATE(QDirModel) +/
126     /+ Q_DISABLE_COPY(QDirModel) +/
127     /+ Q_PRIVATE_SLOT(d_func(), void _q_refresh()) +/
128 }
129 
130 
131 /+ #endif +/ // QT_DEPRECATED_SINCE(5, 15)
132