1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18#ifndef KFILE_H
19#define KFILE_H
20
21#include <QtCore/QDir>
22
23#include <kio/kio_export.h>
24
25/**
26 * KFile is a class which provides a namespace for some enumerated
27 * values associated with the kfile library. You will never need to
28 * construct a KFile object itself.
29 */
30
31class KIO_EXPORT KFile
32{
33 Q_GADGET
34 Q_FLAGS(Modes)
35public:
36 /**
37 * Modes of operation for the dialog.
38 * @li @p File - Get a single file name from the user.
39 * @li @p Directory - Get a directory name from the user.
40 * @li @p Files - Get multiple file names from the user.
41 * @li @p ExistingOnly - Never return a filename which does not exist yet
42 * @li @p LocalOnly - Don't return remote filenames
43 */
44 enum Mode {
45 File = 1,
46 Directory = 2,
47 Files = 4,
48 ExistingOnly = 8,
49 LocalOnly = 16,
50 ModeMax = 65536
51 };
52 Q_DECLARE_FLAGS(Modes, Mode)
53
54 enum FileView {
55 Default = 0,
56 Simple = 1,
57 Detail = 2,
58 SeparateDirs = 4,
59 PreviewContents = 8,
60 PreviewInfo = 16,
61 Tree = 32,
62 DetailTree = 64,
63 FileViewMax = 65536
64 };
65
66 enum SelectionMode {
67 Single = 1,
68 Multi = 2,
69 Extended = 4,
70 NoSelection = 8
71 };
72
73
74 //
75 // some bittests
76 //
77
78 // sorting specific
79
80 static bool isSortByName( const QDir::SortFlags& sort );
81
82 static bool isSortBySize( const QDir::SortFlags& sort );
83
84 static bool isSortByDate( const QDir::SortFlags& sort );
85
86 static bool isSortByType( const QDir::SortFlags& sort );
87
88 static bool isSortDirsFirst( const QDir::SortFlags& sort );
89
90 static bool isSortCaseInsensitive( const QDir::SortFlags& sort );
91
92
93 // view specific
94 static bool isDefaultView( const FileView& view );
95
96 static bool isSimpleView( const FileView& view );
97
98 static bool isDetailView( const FileView& view );
99
100 static bool isSeparateDirs( const FileView& view );
101
102 static bool isPreviewContents( const FileView& view );
103
104 static bool isPreviewInfo( const FileView& view );
105
106 static bool isTreeView( const FileView& view );
107
108 static bool isDetailTreeView( const FileView& view );
109
110private:
111 KFile(); // forbidden
112};
113
114Q_DECLARE_OPERATORS_FOR_FLAGS(KFile::Modes)
115
116#endif // KFILE_H
117