+void DolphinViewContainer::slotErrorMessageFromView(const QString &message, const int kioErrorCode)
+{
+ if (kioErrorCode == KIO::ERR_CANNOT_ENTER_DIRECTORY && m_view->url().scheme() == QStringLiteral("file")
+ && KProtocolInfo::isKnownProtocol(QStringLiteral("admin")) && !rootItem().isReadable()) {
+ // Explain to users that they need authentication to see the folder contents.
+ if (!m_authorizeToEnterFolderAction) { // This code is similar to parts of Admin::Bar::hideTheNextTimeAuthorizationExpires().
+ // We should not simply use the actAsAdminAction() itself here because that one always refers to the active view instead of this->m_view.
+ auto actAsAdminAction = Admin::WorkerIntegration::FriendAccess::actAsAdminAction();
+ m_authorizeToEnterFolderAction = new QAction{actAsAdminAction->icon(), actAsAdminAction->text(), this};
+ m_authorizeToEnterFolderAction->setToolTip(actAsAdminAction->toolTip());
+ m_authorizeToEnterFolderAction->setWhatsThis(actAsAdminAction->whatsThis());
+ connect(m_authorizeToEnterFolderAction, &QAction::triggered, this, [this, actAsAdminAction]() {
+ setActive(true);
+ actAsAdminAction->trigger();
+ });
+ }
+ showMessage(i18nc("@info", "Authorization required to enter this folder."), KMessageWidget::Error, {m_authorizeToEnterFolderAction});
+ return;
+ }
+ Q_EMIT showErrorMessage(message);
+}
+
+void DolphinViewContainer::showErrorMessage(const QString &message)