File indexing completed on 2024-04-21 03:55:45

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 Carsten Pfeiffer <pfeiffer@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KFILE_H
0009 #define KFILE_H
0010 
0011 #include <QDir>
0012 
0013 #include "kiowidgets_export.h"
0014 
0015 /**
0016  * @class KFile kfile.h <KFile>
0017  *
0018  * KFile is a class which provides a namespace for some enumerated
0019  * values associated with the kfile library.  You will never need to
0020  * construct a KFile object itself.
0021  */
0022 
0023 class KIOWIDGETS_EXPORT KFile
0024 {
0025     Q_GADGET
0026 public:
0027     /**
0028      * Modes of operation for the dialog.
0029      * @li @p File - Get a single file name from the user.
0030      * @li @p Directory - Get a directory name from the user.
0031      * @li @p Files - Get multiple file names from the user.
0032      * @li @p ExistingOnly - Never return a filename which does not exist yet
0033      * @li @p LocalOnly - Don't return remote filenames
0034      * @see Modes
0035      */
0036     enum Mode {
0037         File = 1,
0038         Directory = 2,
0039         Files = 4,
0040         ExistingOnly = 8,
0041         LocalOnly = 16,
0042         ModeMax = 65536,
0043     };
0044     /**
0045      * Stores a combination of #Mode values.
0046      */
0047     Q_DECLARE_FLAGS(Modes, Mode)
0048     Q_FLAG(Modes)
0049 
0050     enum FileView {
0051         Default = 0,
0052         Simple = 1,
0053         Detail = 2,
0054         SeparateDirs = 4,
0055         PreviewContents = 8,
0056         PreviewInfo = 16,
0057         Tree = 32,
0058         DetailTree = 64,
0059         FileViewMax = 65536,
0060     };
0061 
0062     enum SelectionMode {
0063         Single = 1,
0064         Multi = 2,
0065         Extended = 4,
0066         NoSelection = 8,
0067     };
0068 
0069     //
0070     // some bittests
0071     //
0072 
0073     // sorting specific
0074 
0075     static bool isSortByName(const QDir::SortFlags &sort);
0076 
0077     static bool isSortBySize(const QDir::SortFlags &sort);
0078 
0079     static bool isSortByDate(const QDir::SortFlags &sort);
0080 
0081     static bool isSortByType(const QDir::SortFlags &sort);
0082 
0083     static bool isSortDirsFirst(const QDir::SortFlags &sort);
0084 
0085     static bool isSortCaseInsensitive(const QDir::SortFlags &sort);
0086 
0087     // view specific
0088     static bool isDefaultView(const FileView &view);
0089 
0090     static bool isSimpleView(const FileView &view);
0091 
0092     static bool isDetailView(const FileView &view);
0093 
0094     static bool isSeparateDirs(const FileView &view);
0095 
0096     static bool isPreviewContents(const FileView &view);
0097 
0098     static bool isPreviewInfo(const FileView &view);
0099 
0100     static bool isTreeView(const FileView &view);
0101 
0102     static bool isDetailTreeView(const FileView &view);
0103 
0104 private:
0105     KFile() = delete;
0106 };
0107 
0108 Q_DECLARE_OPERATORS_FOR_FLAGS(KFile::Modes)
0109 
0110 #endif // KFILE_H