mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Implemented the new KParts extension, KParts::ListingiNotificationExtension.
REVIEW: 106333
(cherry picked from commit acef4b1c28
)
This commit is contained in:
parent
7b64f58a6c
commit
2da3823b74
4 changed files with 49 additions and 1 deletions
|
@ -45,6 +45,8 @@
|
||||||
#include "views/dolphinviewactionhandler.h"
|
#include "views/dolphinviewactionhandler.h"
|
||||||
#include "views/dolphinnewfilemenuobserver.h"
|
#include "views/dolphinnewfilemenuobserver.h"
|
||||||
#include "views/dolphinremoteencoding.h"
|
#include "views/dolphinremoteencoding.h"
|
||||||
|
#include "kitemviews/kfileitemmodel.h"
|
||||||
|
#include "kitemviews/private/kfileitemmodeldirlister.h"
|
||||||
|
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -120,6 +122,15 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
||||||
new DolphinPartFileInfoExtension(this);
|
new DolphinPartFileInfoExtension(this);
|
||||||
new DolphinPartListingFilterExtension(this);
|
new DolphinPartListingFilterExtension(this);
|
||||||
|
|
||||||
|
KDirLister* lister = m_view->m_model->m_dirLister;
|
||||||
|
if (lister) {
|
||||||
|
DolphinPartListingNotificationExtension* notifyExt = new DolphinPartListingNotificationExtension(this);
|
||||||
|
connect(lister, SIGNAL(newItems(KFileItemList)), notifyExt, SLOT(slotNewItems(KFileItemList)));
|
||||||
|
connect(lister, SIGNAL(itemsDeleted(KFileItemList)), notifyExt, SLOT(slotItemsDeleted(KFileItemList)));
|
||||||
|
} else {
|
||||||
|
kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
|
||||||
|
}
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
m_actionHandler->updateViewActions();
|
m_actionHandler->updateViewActions();
|
||||||
slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
|
slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
|
||||||
|
@ -128,7 +139,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
||||||
// (sort of spacial navigation)
|
// (sort of spacial navigation)
|
||||||
|
|
||||||
loadPlugins(this, this, componentData());
|
loadPlugins(this, this, componentData());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DolphinPart::~DolphinPart()
|
DolphinPart::~DolphinPart()
|
||||||
|
@ -706,4 +716,27 @@ void DolphinPartListingFilterExtension::setFilter (KParts::ListingFilterExtensio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////
|
||||||
|
|
||||||
|
DolphinPartListingNotificationExtension::DolphinPartListingNotificationExtension(DolphinPart* part)
|
||||||
|
:KParts::ListingNotificationExtension(part)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
KParts::ListingNotificationExtension::NotificationEventTypes DolphinPartListingNotificationExtension::supportedNotificationEventTypes() const
|
||||||
|
{
|
||||||
|
return (KParts::ListingNotificationExtension::ItemsAdded |
|
||||||
|
KParts::ListingNotificationExtension::ItemsDeleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DolphinPartListingNotificationExtension::slotNewItems(const KFileItemList& items)
|
||||||
|
{
|
||||||
|
emit listingEvent(KParts::ListingNotificationExtension::ItemsAdded, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DolphinPartListingNotificationExtension::slotItemsDeleted(const KFileItemList& items)
|
||||||
|
{
|
||||||
|
emit listingEvent(KParts::ListingNotificationExtension::ItemsDeleted, items);
|
||||||
|
}
|
||||||
|
|
||||||
#include "dolphinpart.moc"
|
#include "dolphinpart.moc"
|
||||||
|
|
|
@ -297,4 +297,17 @@ private:
|
||||||
DolphinPart* m_part;
|
DolphinPart* m_part;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DolphinPartListingNotificationExtension : public KParts::ListingNotificationExtension
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DolphinPartListingNotificationExtension(DolphinPart* part);
|
||||||
|
virtual NotificationEventTypes supportedNotificationEventTypes() const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void slotNewItems(const KFileItemList&);
|
||||||
|
void slotItemsDeleted(const KFileItemList&);
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* DOLPHINPART_H */
|
#endif /* DOLPHINPART_H */
|
||||||
|
|
|
@ -475,6 +475,7 @@ private:
|
||||||
friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method
|
friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method
|
||||||
friend class KFileItemModelTest; // For unit testing
|
friend class KFileItemModelTest; // For unit testing
|
||||||
friend class KFileItemListViewTest; // For unit testing
|
friend class KFileItemListViewTest; // For unit testing
|
||||||
|
friend class DolphinPart; // Accesses m_dirLister
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool KFileItemModel::isChildItem(int index) const
|
inline bool KFileItemModel::isChildItem(int index) const
|
||||||
|
|
|
@ -764,6 +764,7 @@ private:
|
||||||
// For unit tests
|
// For unit tests
|
||||||
friend class TestBase;
|
friend class TestBase;
|
||||||
friend class DolphinDetailsViewTest;
|
friend class DolphinDetailsViewTest;
|
||||||
|
friend class DolphinPart; // Accesses m_model
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Allow using DolphinView::Mode in QVariant
|
/// Allow using DolphinView::Mode in QVariant
|
||||||
|
|
Loading…
Reference in a new issue