┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorDawit Alemayehu <[email protected]>2012-09-04 22:26:28 -0400
committerDawit Alemayehu <[email protected]>2012-09-07 08:54:14 -0400
commit2da3823b747d0eda7ddb28e2c1c7a492e26d5743 (patch)
treee7ac2bfdfe89b1e7d3900c004570be31379c90f0 /src/dolphinpart.cpp
parent7b64f58a6ccd20c743452bbc706fab15462bd43b (diff)
Implemented the new KParts extension, KParts::ListingiNotificationExtension.
REVIEW: 106333 (cherry picked from commit acef4b1c287a315b42550c27fc18ac4b9f49746c)
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index bf3d2a54f..a957fa665 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -45,6 +45,8 @@
#include "views/dolphinviewactionhandler.h"
#include "views/dolphinnewfilemenuobserver.h"
#include "views/dolphinremoteencoding.h"
+#include "kitemviews/kfileitemmodel.h"
+#include "kitemviews/private/kfileitemmodeldirlister.h"
#include <QActionGroup>
#include <QApplication>
@@ -120,6 +122,15 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
new DolphinPartFileInfoExtension(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();
m_actionHandler->updateViewActions();
slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
@@ -128,7 +139,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
// (sort of spacial navigation)
loadPlugins(this, this, componentData());
-
}
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"