kio: remove unused KDirModel and KFileItemDelegate feature

other than starting kuiserver it does nothing, the kuiserver program is
already started by other classes (such as job tracker classes) on demand

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-02 07:34:47 +03:00
parent 9aa8b4fd14
commit 12745a92d7
6 changed files with 3 additions and 148 deletions

View file

@ -83,11 +83,6 @@ qt4_add_dbus_adaptor(kiocore_STAT_SRCS
KIOFileUndoManagerAdaptor
)
qt4_add_dbus_interface(kiocore_STAT_SRCS
kio/org.kde.kuiserver.xml
kuiserver_interface
)
set(kbookmarks_STAT_SRCS
bookmarks/kbookmark.cc
bookmarks/kbookmarkmanager.cc

View file

@ -20,7 +20,6 @@
#include "kdirmodel.h"
#include "kdirlister.h"
#include "kfileitem.h"
#include "kuiserver_interface.h"
#include <kdatetime.h>
#include <kicon.h>
#include <klocale.h>
@ -35,7 +34,6 @@
#include <QFileInfo>
#include <QBitArray>
#include <QDir>
#include <QApplication>
#include <sys/types.h>
#include <dirent.h>
@ -43,11 +41,6 @@
class KDirModelNode;
class KDirModelDirNode;
K_GLOBAL_STATIC_WITH_ARGS(
org::kde::kuiserver, globalJobViewServer,
("org.kde.kuiserver", "/JobViewServer", QDBusConnection::sessionBus(), qApp)
);
static KUrl cleanupUrl(const KUrl& url)
{
KUrl u = url;
@ -136,7 +129,7 @@ public:
KDirModelPrivate( KDirModel* model )
: q(model), m_dirLister(0),
m_rootNode(new KDirModelDirNode(0, KFileItem())),
m_dropsAllowed(KDirModel::NoDrops), m_jobTransfersVisible(false)
m_dropsAllowed(KDirModel::NoDrops)
{
}
~KDirModelPrivate() {
@ -148,7 +141,6 @@ public:
void _k_slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&);
void _k_slotClear();
void _k_slotRedirection(const KUrl& newUrl);
void _k_slotJobUrlsChanged(const QStringList& urlList);
void clear() {
delete m_rootNode;
@ -189,12 +181,10 @@ public:
KDirLister* m_dirLister;
KDirModelDirNode* m_rootNode;
KDirModel::DropsAllowed m_dropsAllowed;
bool m_jobTransfersVisible;
// key = current known parent node (always a KDirModelDirNode but KDirModelNode is more convenient),
// value = final url[s] being fetched
QMap<KDirModelNode*, KUrl::List> m_urlsBeingFetched;
QHash<KUrl, KDirModelNode *> m_nodeHash; // global node hash: url -> node
QStringList m_allCurrentDestUrls; //list of all dest urls that have jobs on them (e.g. copy, download)
};
KDirModelNode* KDirModelPrivate::nodeForUrl(const KUrl& _url) const // O(1), well, O(length of url as a string)
@ -626,11 +616,6 @@ void KDirModelPrivate::_k_slotClear()
//emit layoutChanged();
}
void KDirModelPrivate::_k_slotJobUrlsChanged(const QStringList& urlList)
{
m_allCurrentDestUrls = urlList;
}
void KDirModel::itemChanged( const QModelIndex& index )
{
// This method is really a itemMimeTypeChanged(), it's mostly called by KMimeTypeResolver.
@ -741,13 +726,6 @@ QVariant KDirModel::data( const QModelIndex & index, int role ) const
}
return count;
}
case HasJobRole:
if (d->m_jobTransfersVisible && d->m_allCurrentDestUrls.isEmpty() == false) {
KDirModelNode* node = d->nodeForIndex(index);
const QString url = node->item().url().url();
//return whether or not there are job dest urls visible in the view, so the delegate knows which ones to paint.
return QVariant(d->m_allCurrentDestUrls.contains(url));
}
}
}
return QVariant();
@ -837,27 +815,6 @@ void KDirModel::requestSequenceIcon(const QModelIndex& index, int sequenceIndex)
emit needSequenceIcon(index, sequenceIndex);
}
void KDirModel::setJobTransfersVisible(bool value)
{
if (value) {
d->m_jobTransfersVisible = true;
connect(
globalJobViewServer, SIGNAL(jobUrlsChanged(QStringList)),
this, SLOT(_k_slotJobUrlsChanged(QStringList)),
Qt::UniqueConnection
);
globalJobViewServer->emitJobUrlsChanged();
} else {
disconnect(this, SLOT(_k_slotJobUrlsChanged(QStringList)));
}
}
bool KDirModel::jobTransfersVisible() const
{
return d->m_jobTransfersVisible;
}
KUrl::List KDirModel::simplifiedUrlList(const KUrl::List &urls)
{
if (!urls.count()) {

View file

@ -126,8 +126,7 @@ public:
// Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM))
// to define additional roles.
FileItemRole = 0x07A263FF, ///< returns the KFileItem for a given index
ChildCountRole = 0x2C4D0A40, ///< returns the number of items in a directory, or ChildCountUnknown
HasJobRole = 0x01E555A5 ///< returns whether or not there is a job on an item (file/directory)
ChildCountRole = 0x2C4D0A40 ///< returns the number of items in a directory, or ChildCountUnknown
};
enum DropsAllowedFlag {
@ -198,30 +197,6 @@ public:
*/
void requestSequenceIcon(const QModelIndex &index, int sequenceIndex);
/**
* Enable/Disable the displaying of an animated overlay that is shown for any destination
* urls (in the view). When enabled, the animations (if any) will be drawn automatically.
*
* Only the files/folders that are visible and have jobs associated with them
* will display the animation.
* You would likely not want this enabled if you perform some kind of custom painting
* that takes up a whole item, and will just make this(and what you paint) look funky.
*
* Default is disabled.
*
* Note: KFileItemDelegate needs to have it's method called with the same
* value, when you make the call to this method.
*
* @since 4.5
*/
void setJobTransfersVisible(bool value);
/**
* Returns whether or not displaying job transfers has been enabled.
* @since 4.5
*/
bool jobTransfersVisible() const;
Q_SIGNALS:
/**
* Emitted for each subdirectory that is a parent of a url passed to expandToUrl
@ -250,7 +225,6 @@ private:
Q_PRIVATE_SLOT(d, void _k_slotRefreshItems(const QList<QPair<KFileItem, KFileItem> > &))
Q_PRIVATE_SLOT(d, void _k_slotClear())
Q_PRIVATE_SLOT(d, void _k_slotRedirection(const KUrl &))
Q_PRIVATE_SLOT(d, void _k_slotJobUrlsChanged(const QStringList &))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KDirModel::DropsAllowed)

View file

@ -105,8 +105,6 @@ class KFileItemDelegate::Private
QSize maximumSize;
bool showToolTipWhenElided;
QTextOption::WrapMode wrapMode;
bool jobTransfersVisible;
KIcon downArrowIcon;
private:
Margin verticalMargin[NMargins];
@ -117,7 +115,7 @@ class KFileItemDelegate::Private
KFileItemDelegate::Private::Private()
: shadowColor(Qt::transparent), shadowOffset(1, 1), shadowBlur(2), maximumSize(0, 0),
showToolTipWhenElided(true), wrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere ), jobTransfersVisible(false),
showToolTipWhenElided(true), wrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere ),
activeMargins(0)
{
}
@ -961,19 +959,6 @@ QRect KFileItemDelegate::iconRect(const QStyleOptionViewItem &option, const QMod
}
void KFileItemDelegate::setJobTransfersVisible(bool jobTransfersVisible)
{
d->downArrowIcon = KIcon("go-down");
d->jobTransfersVisible = jobTransfersVisible;
}
bool KFileItemDelegate::jobTransfersVisible() const
{
return d->jobTransfersVisible;
}
QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItemV4 &option, const QModelIndex &index) const
{
const QVariant value = index.data(Qt::DecorationRole);

View file

@ -126,13 +126,6 @@ class KIO_EXPORT KFileItemDelegate : public QAbstractItemDelegate
*/
Q_PROPERTY(bool showToolTipWhenElided READ showToolTipWhenElided WRITE setShowToolTipWhenElided)
/**
* This property determines if there are KIO jobs on a destination URL visible, then
* they will have a small animation overlay displayed on them.
* @since 4.5
*/
Q_PROPERTY(bool jobTransfersVisible READ jobTransfersVisible WRITE setJobTransfersVisible)
Q_ENUMS(Information)
@ -410,31 +403,6 @@ class KIO_EXPORT KFileItemDelegate : public QAbstractItemDelegate
*/
QTextOption::WrapMode wrapMode() const;
/**
* Enable/Disable the displaying of an animated overlay that is shown for any destination
* urls (in the view). When enabled, the animations (if any) will be drawn automatically.
*
* Only the files/folders that are visible and have jobs associated with them
* will display the animation.
* You would likely not want this enabled if you perform some kind of custom painting
* that takes up a whole item, and will just make this(and what you paint) look funky.
*
* Default is disabled.
*
* Note: The model (KDirModel) needs to have it's method called with the same
* value, when you make the call to this method.
*
* @since 4.5
*/
void setJobTransfersVisible(bool jobTransfersVisible);
/**
* Returns whether or not the displaying of job transfers is enabled.
* @see setJobTransfersVisible()
* @since 4.5
*/
bool jobTransfersVisible() const;
/**
* Reimplemented from @ref QAbstractItemDelegate.
*/

View file

@ -1,24 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kuiserver">
<method name="registerService">
<arg name="service" type="s" direction="in"/>
<arg name="objectPath" type="s" direction="in"/>
</method>
<method name="emitJobUrlsChanged">
</method>
<method name="requiresJobTracker">
<arg type="b" direction="out"/>
</method>
<signal name="jobUrlsChanged">
<arg type="as" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QList&lt;QString&gt;"/>
</signal>
</interface>
</node>