| 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 |
| 17 | * \inmodule KIOWidgets |
| 18 | * |
| 19 | * \brief KFile is a class which provides a namespace for some enumerated |
| 20 | * values associated with the kfile library. You will never need to |
| 21 | * construct a KFile object itself. |
| 22 | */ |
| 23 | |
| 24 | class KIOWIDGETS_EXPORT KFile |
| 25 | { |
| 26 | Q_GADGET |
| 27 | public: |
| 28 | /*! |
| 29 | * Modes of operation for the dialog. |
| 30 | * \value File Get a single file name from the user. |
| 31 | * \value Directory Get a directory name from the user. |
| 32 | * \value Files Get multiple file names from the user. |
| 33 | * \value ExistingOnly Never return a filename which does not exist yet |
| 34 | * \value LocalOnly Don't return remote filenames |
| 35 | * \omitvalue ModeMax |
| 36 | */ |
| 37 | enum Mode { |
| 38 | File = 1, |
| 39 | Directory = 2, |
| 40 | Files = 4, |
| 41 | ExistingOnly = 8, |
| 42 | LocalOnly = 16, |
| 43 | ModeMax = 65536, |
| 44 | }; |
| 45 | Q_DECLARE_FLAGS(Modes, Mode) |
| 46 | Q_FLAG(Modes) |
| 47 | |
| 48 | /*! |
| 49 | * \value Default |
| 50 | * \value Simple |
| 51 | * \value Detail |
| 52 | * \value SeparateDirs |
| 53 | * \value PreviewContents |
| 54 | * \value PreviewInfo |
| 55 | * \value Tree |
| 56 | * \value DetailTree |
| 57 | * \omitvalue FileViewMax |
| 58 | */ |
| 59 | enum FileView { |
| 60 | Default = 0, |
| 61 | Simple = 1, |
| 62 | Detail = 2, |
| 63 | SeparateDirs = 4, |
| 64 | PreviewContents = 8, |
| 65 | PreviewInfo = 16, |
| 66 | Tree = 32, |
| 67 | DetailTree = 64, |
| 68 | FileViewMax = 65536, |
| 69 | }; |
| 70 | |
| 71 | /*! |
| 72 | * \value Single |
| 73 | * \value Multi |
| 74 | * \value Extended |
| 75 | * \value NoSelection |
| 76 | */ |
| 77 | enum SelectionMode { |
| 78 | Single = 1, |
| 79 | Multi = 2, |
| 80 | Extended = 4, |
| 81 | NoSelection = 8, |
| 82 | }; |
| 83 | |
| 84 | // |
| 85 | // some bittests |
| 86 | // |
| 87 | |
| 88 | // sorting specific |
| 89 | |
| 90 | /*! |
| 91 | * |
| 92 | */ |
| 93 | static bool isSortByName(const QDir::SortFlags &sort); |
| 94 | |
| 95 | /*! |
| 96 | * |
| 97 | */ |
| 98 | static bool isSortBySize(const QDir::SortFlags &sort); |
| 99 | |
| 100 | /*! |
| 101 | * |
| 102 | */ |
| 103 | static bool isSortByDate(const QDir::SortFlags &sort); |
| 104 | |
| 105 | /*! |
| 106 | * |
| 107 | */ |
| 108 | static bool isSortByType(const QDir::SortFlags &sort); |
| 109 | |
| 110 | /*! |
| 111 | * |
| 112 | */ |
| 113 | static bool isSortDirsFirst(const QDir::SortFlags &sort); |
| 114 | |
| 115 | /*! |
| 116 | * |
| 117 | */ |
| 118 | static bool isSortCaseInsensitive(const QDir::SortFlags &sort); |
| 119 | |
| 120 | // view specific |
| 121 | /*! |
| 122 | * |
| 123 | */ |
| 124 | static bool isDefaultView(const FileView &view); |
| 125 | |
| 126 | /*! |
| 127 | * |
| 128 | */ |
| 129 | static bool isSimpleView(const FileView &view); |
| 130 | |
| 131 | /*! |
| 132 | * |
| 133 | */ |
| 134 | static bool isDetailView(const FileView &view); |
| 135 | |
| 136 | /*! |
| 137 | * |
| 138 | */ |
| 139 | static bool isSeparateDirs(const FileView &view); |
| 140 | |
| 141 | /*! |
| 142 | * |
| 143 | */ |
| 144 | static bool isPreviewContents(const FileView &view); |
| 145 | |
| 146 | /*! |
| 147 | * |
| 148 | */ |
| 149 | static bool isPreviewInfo(const FileView &view); |
| 150 | |
| 151 | /*! |
| 152 | * |
| 153 | */ |
| 154 | static bool isTreeView(const FileView &view); |
| 155 | |
| 156 | /*! |
| 157 | * |
| 158 | */ |
| 159 | static bool isDetailTreeView(const FileView &view); |
| 160 | |
| 161 | private: |
| 162 | KFile() = delete; |
| 163 | }; |
| 164 | |
| 165 | Q_DECLARE_OPERATORS_FOR_FLAGS(KFile::Modes) |
| 166 | |
| 167 | #endif // KFILE_H |
| 168 | |