/usr/include/kparts/listingextension.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /* This file is part of the KDE project
Copyright (C) 2012 Dawit Alemayehu <adawit@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPARTS_LISTINGEXTENSION_H
#define KPARTS_LISTINGEXTENSION_H
#include <QtCore/QObject>
#include <kparts/kparts_export.h>
class KFileItemList;
namespace KParts
{
class ReadOnlyPart;
/**
* @short an extension for filtering listings.
*
* This extension is intended to be implemented by parts that provide listing
* services, e.g. file management parts and is intended to provide a generic
* API for filtering any listing through keywords, wildcard characters and/or
* content-type.
*
* Examples:
*
* To show items that only match the term "kde"
* \code
* KParts::ListingFilterExtension* ext = KParts::ListingFilterExtension::childObject(part);
* if (ext && (ext->supportedFilterModes() & KParts::ListingFilterExtension::SubString)) {
* ext->setFilter(KParts::ListingFilterExtension::SubString, QLatin1String("kde"));
* }
* \endcode
*
* To show items that only match "text/html"
* \code
* KParts::ListingFilterExtension* ext = KParts::ListingFilterExtension::childObject(part);
* if (ext && (ext->supportedFilterModes() & KParts::ListingFilterExtension::MimeType)) {
* ext->setFilter(KParts::ListingFilterExtension::MimeType, QLatin1String("text/html"));
* }
* \endcode
*
* To show items that only match the wildcard string "*.txt"
* \code
* KParts::ListingFilterExtension* ext = KParts::ListingFilterExtension::childObject(part);
* if (ext && (ext->supportedFilterModes() & KParts::ListingFilterExtension::WildCard)) {
* ext->setFilter(KParts::ListingFilterExtension::WildCard, QLatin1String("*.txt"));
* }
* \endcode
*
* To show items that match multiple mime types, e.g. text/html & application/xml:
*
* \code
* KParts::ListingFilterExtension* ext = KParts::ListingFilterExtension::childObject(part);
* if (ext &&
* (ext->supportedFilterModes() & KParts::ListingFilterExtension::MimeType) &&
* ext->supportsMultipleFilters(KParts::ListingFilterExtension::MimeType)) {
* QStringList mimeTypes = ext->filter(KParts::ListingFilterExtension::MimeType).toStringList();
* mimeTypes << QLatin1String("text/html") << QLatin1String("application/xml");
* ext->setFilter(KParts::ListingFilterExtension::MimeType, mimeTypes);
* }
* \endcode
*
* @since 4.9.2
*/
class KPARTS_EXPORT ListingFilterExtension : public QObject
{
Q_OBJECT
public:
/**
* Supported file filtering modes modes.
*/
enum FilterMode {
None = 0x00,
MimeType = 0x01, /*!< Filter by mime type, e.g. "text/plain". */
SubString = 0x02, /*!< Filter by matching any part of a file or directory name, e.g. "Documents" */
WildCard = 0x04 /*!< Filter by using wildcard matches, e.g. "*.txt" */
};
Q_DECLARE_FLAGS(FilterModes, FilterMode)
/*! Constructor */
ListingFilterExtension(KParts::ReadOnlyPart* parent);
/*! Destructor */
virtual ~ListingFilterExtension();
/**
* Queries @p obj for a child object which inherits from this class.
*/
static ListingFilterExtension *childObject(QObject* obj);
/**
* Returns the OR'ed value of the file filter modes supported by the part
* that implements this extension.
*
* By default this function returns None.
*/
virtual FilterModes supportedFilterModes() const;
/**
* Returns true if the part that implements this extension allows
* the use of multiple filters for the given filtering @p mode.
*
* By default this function returns false.
*/
virtual bool supportsMultipleFilters(FilterMode mode) const;
/**
* Returns the currently set filters for the given @p mode.
*
* @param mode the desired filter mode as specified in @ref FilterMode.
*/
virtual QVariant filter(FilterMode mode) const = 0;
/**
* Sets the file @p filter that should be applied by the part that
* implements this extension for the given filtering @p mode.
*
* To remove a filter for a given filter mode, simply call this function with
* the desired mode and the @p filter parameter set to a NULL variant.
*
* The second parameter can be
*
* @param mode the desired filter mode as specified in @ref FilterMode.
* @param filters a list of filter texts based on the selected mode.
*/
virtual void setFilter(FilterMode mode, const QVariant& filter) = 0;
private:
class ListingFilterExtensionPrivate;
ListingFilterExtension* const d;
};
/**
* @short an extension for receiving listing change notification.
*
* This extension is intended for implementation by parts that provide listing
* services, e.g. file management and is intended to notify about changes to
* a given listing. For example, if file management part implemented this extension
* it would emit @ref itemsDeleted and @ref itemsAdded signal whenever new files
* or folders are deleted and added to a directory respectively.
*
* @since 4.9.2
*/
class KPARTS_EXPORT ListingNotificationExtension : public QObject
{
Q_OBJECT
public:
/**
* Supported notification event types.
*/
enum NotificationEventType {
None = 0x00,
ItemsAdded = 0x01, /*!< New items added to the listing. */
ItemsDeleted = 0x02 /*!< Items deleted from the listing. */
};
Q_DECLARE_FLAGS(NotificationEventTypes, NotificationEventType)
/*! Constructor */
ListingNotificationExtension(KParts::ReadOnlyPart* parent);
/*! Destructor */
virtual ~ListingNotificationExtension();
/**
* Returns the OR'ed value of the notification types supported by the part
* that implements this extension.
*
* By default this function returns None.
*/
virtual NotificationEventTypes supportedNotificationEventTypes() const;
/**
* Queries @p obj for a child object which inherits from this class.
*/
static ListingNotificationExtension *childObject(QObject* obj);
Q_SIGNALS:
/**
* This signal is emitted when one of the notification events listed
* in @ref NotificationEventType occur.
*/
void listingEvent(KParts::ListingNotificationExtension::NotificationEventType, const KFileItemList&);
private:
class ListingNotificationExtensionPrivate;
ListingNotificationExtension* const d;
};
}
Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::ListingFilterExtension::FilterModes)
Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::ListingNotificationExtension::NotificationEventTypes)
#endif /* KPARTS_LISTINGEXTENSION_H */
|