+ KActionMenu *visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
+ visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information"));
+ visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
+ visibleRolesMenu->setPopupMode(QToolButton::InstantPopup);
+
+ const auto visibleRolesGroupActions = visibleRolesGroup->actions();
+ for (QAction *action : visibleRolesGroupActions) {
+ visibleRolesMenu->addAction(action);
+ }
+
+ KToggleAction *showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
+ showHiddenFiles->setIcon(QIcon::fromTheme(QStringLiteral("view-visible")));
+ showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
+ showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis",
+ "<para>When "
+ "this is enabled, <emphasis>hidden</emphasis> files and folders "
+ "are visible. They will be displayed semi-transparent.</para>"
+ "<para>Hidden items only differ from normal ones in that their "
+ "name starts with a dot (\".\"). Typically, there is no need for "
+ "users to access them, which is why they are hidden.</para>"
+ "<para>Items can also be hidden if their names are listed in a text file "
+ "named \".hidden\". Files with the \"application/x-trash\" MIME type, "
+ "such as backup files, can also be hidden by enabling that setting in "
+ "Configure Dolphin > View > General.</para>"));
+ m_actionCollection->setDefaultShortcuts(showHiddenFiles, KStandardShortcut::showHideHiddenFiles());
+ connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
+
+ QAction *adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
+ adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Display Style…"));
+ adjustViewProps->setIcon(QIcon::fromTheme(QStringLiteral("view-choose")));
+ adjustViewProps->setWhatsThis(i18nc("@info:whatsthis",
+ "This opens a window "
+ "in which all folder view properties can be adjusted."));
+ connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
+}
+
+QActionGroup *DolphinViewActionHandler::createFileItemRolesActionGroup(const QString &groupPrefix)
+{
+ const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_"));
+ Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_"));
+
+ QActionGroup *rolesActionGroup = new QActionGroup(m_actionCollection);
+ rolesActionGroup->setExclusive(isSortGroup);
+ if (isSortGroup) {
+ connect(rolesActionGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::slotSortTriggered);
+ } else {
+ connect(rolesActionGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::toggleVisibleRole);
+ }