┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index d1626e55d..ccc91fd7d 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -40,11 +40,18 @@
#include <KMenu>
#include <KInputDialog>
#include <KProtocolInfo>
+#include <kdeversion.h>
+
+#if KDE_IS_VERSION(4, 9, 2)
+#include "dolphinpart_ext.h"
+#endif
#include "views/dolphinview.h"
#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>
@@ -61,7 +68,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
Q_UNUSED(args)
setComponentData(DolphinPartFactory::componentData(), false);
m_extension = new DolphinPartBrowserExtension(this);
- new DolphinPartFileInfoExtension(this);
// make sure that other apps using this part find Dolphin's view-file-columns icons
KIconLoader::global()->addAppDir("dolphin");
@@ -116,6 +122,23 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
connect(clipboard, SIGNAL(dataChanged()),
this, SLOT(updatePasteAction()));
+ // Create file info and listing filter extensions.
+ // NOTE: Listing filter needs to be instantiated after the creation of the view.
+ new DolphinPartFileInfoExtension(this);
+
+#if KDE_IS_VERSION(4, 9, 2)
+ 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";
+ }
+#endif
+
createActions();
m_actionHandler->updateViewActions();
slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
@@ -124,7 +147,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
// (sort of spacial navigation)
loadPlugins(this, this, componentData());
-
}
DolphinPart::~DolphinPart()
@@ -554,7 +576,12 @@ void DolphinPart::createDirectory()
void DolphinPart::setFilesToSelect(const KUrl::List& files)
{
+ if (files.isEmpty()) {
+ return;
+ }
+
m_view->markUrlsAsSelected(files);
+ m_view->markUrlAsCurrent(files.at(0));
}
////