+ connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage, this, &DolphinPart::slotErrorMessage);
+
+ connect(m_view, &DolphinView::directoryLoadingCompleted, this, &KParts::ReadOnlyPart::completed);
+ connect(m_view, &DolphinView::directoryLoadingCompleted, this, &DolphinPart::updatePasteAction);
+ connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress);
+ connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
+
+ setXMLFile(QStringLiteral("dolphinpart.rc"));
+
+ connect(m_view, &DolphinView::infoMessage, this, &DolphinPart::slotMessage);
+ connect(m_view, &DolphinView::operationCompletedMessage, this, &DolphinPart::slotMessage);
+ connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
+ connect(m_view, &DolphinView::itemActivated, this, &DolphinPart::slotItemActivated);
+ connect(m_view, &DolphinView::itemsActivated, this, &DolphinPart::slotItemsActivated);
+ connect(m_view, &DolphinView::statusBarTextChanged, this, [this](const QString &text) {
+ const QString escapedText = Qt::convertFromPlainText(text);
+ Q_EMIT ReadOnlyPart::setStatusBarText(QStringLiteral("<qt>%1</qt>").arg(escapedText));
+ });
+ connect(m_view, &DolphinView::tabRequested, this, &DolphinPart::createNewWindow);
+ connect(m_view, &DolphinView::requestContextMenu, this, &DolphinPart::slotOpenContextMenu);
+ connect(m_view, &DolphinView::selectionChanged, m_extension, &KParts::NavigationExtension::selectionInfo);
+ connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::slotSelectionChanged);
+ connect(m_view, &DolphinView::requestItemInfo, this, &DolphinPart::slotRequestItemInfo);
+ connect(m_view, &DolphinView::modeChanged, this, &DolphinPart::viewModeChanged); // relay signal
+ connect(m_view, &DolphinView::redirection, this, &DolphinPart::slotDirectoryRedirection);
+
+ // Watch for changes that should result in updates to the
+ // status bar text.
+ connect(m_view, &DolphinView::itemCountChanged, this, &DolphinPart::updateStatusBar);
+ connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::updateStatusBar);
+
+ m_actionHandler = new DolphinViewActionHandler(actionCollection(), nullptr, this);
+ m_actionHandler->setCurrentView(m_view);
+ connect(m_actionHandler, &DolphinViewActionHandler::createDirectoryTriggered, this, &DolphinPart::createDirectory);
+
+ m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
+ connect(this, &DolphinPart::aboutToOpenURL, m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
+
+ QClipboard *clipboard = QApplication::clipboard();
+ connect(clipboard, &QClipboard::dataChanged, this, &DolphinPart::updatePasteAction);
+
+ // Create file info and listing filter extensions.
+ // NOTE: Listing filter needs to be instantiated after the creation of the view.
+ new DolphinPartFileInfoExtension(this);
+
+ new DolphinPartListingFilterExtension(this);
+
+ KDirLister *lister = m_view->m_model->m_dirLister;
+ if (lister) {
+ DolphinPartListingNotificationExtension *notifyExt = new DolphinPartListingNotificationExtension(this);
+ connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems);
+ connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted);
+ } else {
+ qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
+ }
+
+ createActions();
+ m_actionHandler->updateViewActions();
+ slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions
+
+ // Listen to events from the app so we can update the remove key by
+ // checking for a Shift key press.
+ qApp->installEventFilter(this);