1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Carsten Pfeiffer <pfeiffer@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef KFILE_H |
9 | #define KFILE_H |
10 | |
11 | #include <QDir> |
12 | |
13 | #include "kiowidgets_export.h" |
14 | |
15 | /** |
16 | * @class KFile kfile.h <KFile> |
17 | * |
18 | * KFile is a class which provides a namespace for some enumerated |
19 | * values associated with the kfile library. You will never need to |
20 | * construct a KFile object itself. |
21 | */ |
22 | |
23 | class KIOWIDGETS_EXPORT KFile |
24 | { |
25 | Q_GADGET |
26 | public: |
27 | /** |
28 | * Modes of operation for the dialog. |
29 | * @li @p File - Get a single file name from the user. |
30 | * @li @p Directory - Get a directory name from the user. |
31 | * @li @p Files - Get multiple file names from the user. |
32 | * @li @p ExistingOnly - Never return a filename which does not exist yet |
33 | * @li @p LocalOnly - Don't return remote filenames |
34 | * @see Modes |
35 | */ |
36 | enum Mode { |
37 | File = 1, |
38 | Directory = 2, |
39 | Files = 4, |
40 | ExistingOnly = 8, |
41 | LocalOnly = 16, |
42 | ModeMax = 65536, |
43 | }; |
44 | /** |
45 | * Stores a combination of #Mode values. |
46 | */ |
47 | Q_DECLARE_FLAGS(Modes, Mode) |
48 | Q_FLAG(Modes) |
49 | |
50 | enum FileView { |
51 | Default = 0, |
52 | Simple = 1, |
53 | Detail = 2, |
54 | SeparateDirs = 4, |
55 | PreviewContents = 8, |
56 | PreviewInfo = 16, |
57 | Tree = 32, |
58 | DetailTree = 64, |
59 | FileViewMax = 65536, |
60 | }; |
61 | |
62 | enum SelectionMode { |
63 | Single = 1, |
64 | Multi = 2, |
65 | Extended = 4, |
66 | NoSelection = 8, |
67 | }; |
68 | |
69 | // |
70 | // some bittests |
71 | // |
72 | |
73 | // sorting specific |
74 | |
75 | static bool isSortByName(const QDir::SortFlags &sort); |
76 | |
77 | static bool isSortBySize(const QDir::SortFlags &sort); |
78 | |
79 | static bool isSortByDate(const QDir::SortFlags &sort); |
80 | |
81 | static bool isSortByType(const QDir::SortFlags &sort); |
82 | |
83 | static bool isSortDirsFirst(const QDir::SortFlags &sort); |
84 | |
85 | static bool isSortCaseInsensitive(const QDir::SortFlags &sort); |
86 | |
87 | // view specific |
88 | static bool isDefaultView(const FileView &view); |
89 | |
90 | static bool isSimpleView(const FileView &view); |
91 | |
92 | static bool isDetailView(const FileView &view); |
93 | |
94 | static bool isSeparateDirs(const FileView &view); |
95 | |
96 | static bool isPreviewContents(const FileView &view); |
97 | |
98 | static bool isPreviewInfo(const FileView &view); |
99 | |
100 | static bool isTreeView(const FileView &view); |
101 | |
102 | static bool isDetailTreeView(const FileView &view); |
103 | |
104 | private: |
105 | KFile() = delete; |
106 | }; |
107 | |
108 | Q_DECLARE_OPERATORS_FOR_FLAGS(KFile::Modes) |
109 | |
110 | #endif // KFILE_H |
111 | |