KParts

fileinfoextension.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2010 Dawit Alemayehu <adawit@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KPARTS_FILEINFOEXTENSION_H
9#define KPARTS_FILEINFOEXTENSION_H
10
11#include <kparts/kparts_export.h>
12
13#include <KFileItem>
14#include <QObject>
15#include <memory>
16
17class KFileItemList;
18
19namespace KParts
20{
21class ReadOnlyPart;
22class FileInfoExtensionPrivate;
23
24/**
25 * @class FileInfoExtension fileinfoextension.h <KParts/FileInfoExtension>
26 *
27 * @short An extension for obtaining file information from the part.
28 *
29 * This extension provides information about file and directory resources
30 * that are present in the part the implements it.
31 *
32 * The main purpose of for this extension is to provide information about
33 * files and directories located on remote servers so that download managers
34 * such as kget can easily retrieve these resources.
35 *
36 * @since 4.6
37 */
38class KPARTS_EXPORT FileInfoExtension : public QObject
39{
40 Q_OBJECT
41
42public:
43 /**
44 * Supported file information retrieval modes.
45 * @see QueryModes
46 */
47 enum QueryMode {
48 None = 0x00, /*!< Querying for file information is NOT possible */
49 AllItems = 0x01, /*!< Retrieve or can retrieve file information for all items.*/
50 SelectedItems = 0x02, /*!< Retrieve or can retrieve file information for selected items.*/
51 };
52
53 /**
54 * Stores a combination of #QueryMode values.
55 */
56 Q_DECLARE_FLAGS(QueryModes, QueryMode)
57
58 /*! Constructor */
60
61 /*! Destructor */
62 ~FileInfoExtension() override;
63
64 /**
65 * Queries @p obj for a child object which inherits from this class.
66 */
67 static FileInfoExtension *childObject(QObject *obj);
68
69 /**
70 * Returns true if any of the items in the current view of the part that
71 * implements this extension are selected.
72 *
73 * By default this function returns false.
74 */
75 virtual bool hasSelection() const;
76
77 /**
78 * Returns the file information retrieve modes supported by the part
79 * that implements this extension.
80 *
81 * By default this function returns None.
82 */
83 virtual QueryModes supportedQueryModes() const;
84
85 /**
86 * Returns a information for files that match the specified query @p mode.
87 *
88 * If the mode specified by @p mode is not supported or cannot be
89 * handled, then an empty list is returned.
90 */
91 virtual KFileItemList queryFor(QueryMode mode) const = 0;
92
93private:
94 std::unique_ptr<FileInfoExtensionPrivate> const d;
95};
96
97Q_DECLARE_OPERATORS_FOR_FLAGS(FileInfoExtension::QueryModes)
98
99}
100
101#endif /* KPARTS_FILEINFOEXTENSION_H */
An extension for obtaining file information from the part.
QueryMode
Supported file information retrieval modes.
virtual KFileItemList queryFor(QueryMode mode) const =0
Returns a information for files that match the specified query mode.
Base class for any "viewer" part.
The KParts namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:48:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.