1/* This file is part of the KDE project
2 Copyright (C) 2008 by Peter Penz <peter.penz19@gmail.com>
3 Copyright (C) 2008 by George Goldberg <grundleborg@googlemail.com>
4 Copyright 2009 David Faure <faure@kde.org>
5
6 This library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Library General Public License as published
8 by the Free Software Foundation; either version 2 of the License or
9 ( at your option ) version 3 or, at the discretion of KDE e.V.
10 ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#ifndef KONQ_FILEITEMCAPABILITIES_H
24#define KONQ_FILEITEMCAPABILITIES_H
25
26#include <libkonq_export.h>
27
28#include <QtCore/QSharedDataPointer>
29
30class KonqFileItemCapabilitiesPrivate;
31class KFileItemList;
32
33/**
34 * @brief Provides information about the access capabilities of a group of
35 * KFileItem objects.
36 *
37 * As soon as one file item does not support a specific capability, it is
38 * marked as unsupported for all items.
39 *
40 * This class is implicitly shared, which means it can be used as a value and
41 * copied around at almost no cost.
42 *
43 * @since 4.1
44 */
45class LIBKONQ_EXPORT KonqFileItemCapabilities
46{
47public:
48 /**
49 * @brief Default constructor. Use setItems to specify the items.
50 */
51 KonqFileItemCapabilities();
52 /**
53 * @brief Constructor that takes a KFileItemList and sets the capabilities
54 * supported by all the FileItems as true.
55 * @param items The list of items that are to have their supported
56 * capabilities checked.
57 */
58 KonqFileItemCapabilities(const KFileItemList& items);
59 /**
60 * @brief Copy constructor
61 */
62 KonqFileItemCapabilities(const KonqFileItemCapabilities&);
63 /**
64 * @brief Destructor
65 */
66 virtual ~KonqFileItemCapabilities();
67 /**
68 * @brief Assignment operator
69 */
70 KonqFileItemCapabilities& operator=(const KonqFileItemCapabilities& other);
71 /**
72 * Sets the items that are to have their supported capabilities checked.
73 */
74 void setItems(const KFileItemList& items);
75
76 /**
77 * @brief Check if reading capability is supported
78 * @return true if all the FileItems support reading, otherwise false.
79 */
80 bool supportsReading() const;
81 /**
82 * @brief Check if deleting capability is supported
83 * @return true if all the FileItems support deleting, otherwise false.
84 */
85 bool supportsDeleting() const;
86 /**
87 * @brief Check if writing capability is supported
88 * @return true if all the FileItems support writing, otherwise false.
89 */
90 bool supportsWriting() const;
91 /**
92 * @brief Check if moving capability is supported
93 * @return true if all the FileItems support moving, otherwise false.
94 */
95 bool supportsMoving() const;
96 /**
97 * @brief Check if files are local
98 * @return true if all the FileItems are local, otherwise there is one or more
99 * remote file, so false.
100 */
101 bool isLocal() const;
102
103private:
104 /** @brief d-pointer */
105 QSharedDataPointer<KonqFileItemCapabilitiesPrivate> d;
106};
107
108#endif
109