From 12745a92d78da0d6dc71d5c8b4c704a8aa26653c Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 2 Jul 2023 07:34:47 +0300 Subject: [PATCH] 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 --- kio/CMakeLists.txt | 5 ---- kio/kio/kdirmodel.cpp | 45 +---------------------------------- kio/kio/kdirmodel.h | 28 +--------------------- kio/kio/kfileitemdelegate.cpp | 17 +------------ kio/kio/kfileitemdelegate.h | 32 ------------------------- kio/kio/org.kde.kuiserver.xml | 24 ------------------- 6 files changed, 3 insertions(+), 148 deletions(-) delete mode 100644 kio/kio/org.kde.kuiserver.xml diff --git a/kio/CMakeLists.txt b/kio/CMakeLists.txt index db87ab4f..332c2741 100644 --- a/kio/CMakeLists.txt +++ b/kio/CMakeLists.txt @@ -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 diff --git a/kio/kio/kdirmodel.cpp b/kio/kio/kdirmodel.cpp index dac6e8d2..8757629c 100644 --- a/kio/kio/kdirmodel.cpp +++ b/kio/kio/kdirmodel.cpp @@ -20,7 +20,6 @@ #include "kdirmodel.h" #include "kdirlister.h" #include "kfileitem.h" -#include "kuiserver_interface.h" #include #include #include @@ -35,7 +34,6 @@ #include #include #include -#include #include #include @@ -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 >&); 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 m_urlsBeingFetched; QHash 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()) { diff --git a/kio/kio/kdirmodel.h b/kio/kio/kdirmodel.h index 5e111bd6..674fda8e 100644 --- a/kio/kio/kdirmodel.h +++ b/kio/kio/kdirmodel.h @@ -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 > &)) 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) diff --git a/kio/kio/kfileitemdelegate.cpp b/kio/kio/kfileitemdelegate.cpp index 1857020a..1ab21010 100644 --- a/kio/kio/kfileitemdelegate.cpp +++ b/kio/kio/kfileitemdelegate.cpp @@ -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); diff --git a/kio/kio/kfileitemdelegate.h b/kio/kio/kfileitemdelegate.h index 9006a688..4917e1af 100644 --- a/kio/kio/kfileitemdelegate.h +++ b/kio/kio/kfileitemdelegate.h @@ -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. */ diff --git a/kio/kio/org.kde.kuiserver.xml b/kio/kio/org.kde.kuiserver.xml deleted file mode 100644 index a4996cbf..00000000 --- a/kio/kio/org.kde.kuiserver.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -