mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kparts: drop FileInfoExtension, ListingFilterExtension and ListingNotificationExtension classes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1b5c5fe630
commit
2f7a4473be
8 changed files with 0 additions and 452 deletions
|
@ -447,9 +447,7 @@ install(
|
|||
KParts/BrowserExtension
|
||||
KParts/Event
|
||||
KParts/Factory
|
||||
KParts/FileInfoExtension
|
||||
KParts/GUIActivateEvent
|
||||
KParts/ListingExtension
|
||||
KParts/MainWindow
|
||||
KParts/OpenUrlEvent
|
||||
KParts/Part
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "../../kparts/fileinfoextension.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../../kparts/listingextension.h"
|
|
@ -17,8 +17,6 @@ set(kparts_LIB_SRCS
|
|||
browserextension.cpp
|
||||
factory.cpp
|
||||
statusbarextension.cpp
|
||||
fileinfoextension.cpp
|
||||
listingextension.cpp
|
||||
)
|
||||
|
||||
add_library(kparts ${LIBRARY_TYPE} ${kparts_LIB_SRCS})
|
||||
|
@ -63,8 +61,6 @@ install(
|
|||
browserextension.h
|
||||
factory.h
|
||||
statusbarextension.h
|
||||
fileinfoextension.h
|
||||
listingextension.h
|
||||
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}/kparts
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2010 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.
|
||||
*/
|
||||
|
||||
#include "fileinfoextension.h"
|
||||
|
||||
#include "part.h"
|
||||
#include "kglobal.h"
|
||||
|
||||
KParts::FileInfoExtension::FileInfoExtension(KParts::ReadOnlyPart* parent)
|
||||
: QObject(parent),
|
||||
d(0)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
KParts::FileInfoExtension::~FileInfoExtension()
|
||||
{
|
||||
}
|
||||
|
||||
KParts::FileInfoExtension* KParts::FileInfoExtension::childObject(QObject* obj)
|
||||
{
|
||||
return KGlobal::findDirectChild<KParts::FileInfoExtension*>(obj);
|
||||
}
|
||||
|
||||
KParts::FileInfoExtension::QueryModes KParts::FileInfoExtension::supportedQueryModes() const
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
bool KParts::FileInfoExtension::hasSelection() const
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2010 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_FILEINFOEXTENSION_H
|
||||
#define KPARTS_FILEINFOEXTENSION_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <kfileitem.h>
|
||||
#include <kparts/kparts_export.h>
|
||||
|
||||
class KFileItemList;
|
||||
class FileInfoExtensionPrivate;
|
||||
|
||||
namespace KParts
|
||||
{
|
||||
|
||||
class ReadOnlyPart;
|
||||
|
||||
/**
|
||||
* @short an extension for obtaining file information from the part.
|
||||
*
|
||||
* This extension provides information about file and directory resources
|
||||
* that are present in the part the implements it.
|
||||
*
|
||||
* The main purpose of for this extension is to provide information about
|
||||
* files and directories located on remote servers so that download managers
|
||||
* such as kget can easily retrieve these resources.
|
||||
*
|
||||
* @since 4.6
|
||||
*/
|
||||
class KPARTS_EXPORT FileInfoExtension : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Supported file information retrieval modes.
|
||||
*/
|
||||
enum QueryMode {
|
||||
None = 0x00, /*!< Querying for file information is NOT possible */
|
||||
AllItems = 0x01, /*!< Retrieve or can retrieve file information for all items.*/
|
||||
SelectedItems = 0x02 /*!< Retrieve or can retrieve file information for selected items.*/
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(QueryModes, QueryMode)
|
||||
|
||||
/*! Constructor */
|
||||
FileInfoExtension(KParts::ReadOnlyPart* parent);
|
||||
|
||||
/*! Destructor */
|
||||
virtual ~FileInfoExtension();
|
||||
|
||||
/**
|
||||
* Queries @p obj for a child object which inherits from this class.
|
||||
*/
|
||||
static FileInfoExtension *childObject( QObject *obj );
|
||||
|
||||
/**
|
||||
* Returns true if any of the items in the current view of the part that
|
||||
* implements this extension are selected.
|
||||
*
|
||||
* By default this function returns false.
|
||||
*/
|
||||
virtual bool hasSelection() const;
|
||||
|
||||
/**
|
||||
* Returns the file information retrieve modes supported by the part
|
||||
* that implements this extension.
|
||||
*
|
||||
* By default this function returns None.
|
||||
*/
|
||||
virtual QueryModes supportedQueryModes() const;
|
||||
|
||||
/**
|
||||
* Returns a information for files that match the specified query @p mode.
|
||||
*
|
||||
* If the mode specified by @p mode is not supported or cannot be
|
||||
* handled, then an empty list is returned.
|
||||
*/
|
||||
virtual KFileItemList queryFor(QueryMode mode) const = 0;
|
||||
|
||||
private:
|
||||
FileInfoExtensionPrivate* const d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::FileInfoExtension::QueryModes)
|
||||
|
||||
#endif /* KPARTS_FILEINFOEXTENSION_H */
|
|
@ -1,70 +0,0 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#include "listingextension.h"
|
||||
|
||||
#include "part.h"
|
||||
#include "kglobal.h"
|
||||
|
||||
|
||||
KParts::ListingFilterExtension::ListingFilterExtension (KParts::ReadOnlyPart* parent)
|
||||
: QObject(parent),
|
||||
d(0)
|
||||
{
|
||||
}
|
||||
|
||||
KParts::ListingFilterExtension::~ListingFilterExtension()
|
||||
{
|
||||
}
|
||||
|
||||
KParts::ListingFilterExtension* KParts::ListingFilterExtension::childObject (QObject* obj)
|
||||
{
|
||||
return KGlobal::findDirectChild<KParts::ListingFilterExtension*>(obj);
|
||||
}
|
||||
|
||||
KParts::ListingFilterExtension::FilterModes KParts::ListingFilterExtension::supportedFilterModes() const
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
bool KParts::ListingFilterExtension::supportsMultipleFilters (KParts::ListingFilterExtension::FilterMode) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
KParts::ListingNotificationExtension::ListingNotificationExtension(KParts::ReadOnlyPart* parent)
|
||||
:QObject(parent),
|
||||
d(0)
|
||||
{
|
||||
}
|
||||
|
||||
KParts::ListingNotificationExtension::~ListingNotificationExtension()
|
||||
{
|
||||
}
|
||||
|
||||
KParts::ListingNotificationExtension* KParts::ListingNotificationExtension::childObject(QObject* obj)
|
||||
{
|
||||
return KGlobal::findDirectChild<KParts::ListingNotificationExtension*>(obj);
|
||||
}
|
||||
|
||||
KParts::ListingNotificationExtension::NotificationEventTypes KParts::ListingNotificationExtension::supportedNotificationEventTypes() const
|
||||
{
|
||||
return None;
|
||||
}
|
|
@ -1,217 +0,0 @@
|
|||
/* 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 */
|
Loading…
Add table
Reference in a new issue