#include "kitemviews/kfileitemmodel.h"
#include "settings/viewpropertiesdialog.h"
#include "views/zoomlevelinfo.h"
+#include "kconfig_version.h"
#ifdef HAVE_BALOO
#include <Baloo/IndexerConfig>
// KNewFileMenu takes care of the GUI stuff.
QAction* newDirAction = m_actionCollection->addAction(QStringLiteral("create_dir"));
newDirAction->setText(i18nc("@action", "Create Folder..."));
- m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10);
+ m_actionCollection->setDefaultShortcuts(newDirAction, KStandardShortcut::createFolder());
newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectoryTriggered);
sortByActionMenu->setText(i18nc("@action:inmenu View", "Sort By"));
sortByActionMenu->setDelayed(false);
- foreach (QAction* action, sortByActionGroup->actions()) {
+ const auto sortByActionGroupActions = sortByActionGroup->actions();
+ for (QAction* action : sortByActionGroupActions) {
sortByActionMenu->addAction(action);
}
visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
visibleRolesMenu->setDelayed(false);
- foreach (QAction* action, visibleRolesGroup->actions()) {
+ const auto visibleRolesGroupActions = visibleRolesGroup->actions();
+ for (QAction* action : visibleRolesGroupActions) {
visibleRolesMenu->addAction(action);
}
connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
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->setToolTip(i18nc("@info", "Visibility of hidden files and folders"));
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>"
#endif
const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
- foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
+ for (const KFileItemModel::RoleInfo& info : rolesInfo) {
if (!isSortGroup && info.role == "text") {
// It should not be possible to hide the "text" role
continue;
void DolphinViewActionHandler::slotRename()
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->renameSelectedItems();
}
void DolphinViewActionHandler::slotTrashActivated()
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->trashSelectedItems();
}
void DolphinViewActionHandler::slotDeleteItems()
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->deleteSelectedItems();
}
void DolphinViewActionHandler::togglePreview(bool show)
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->setPreviewsShown(show);
}
void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
const QByteArray toggledRole = action->data().toByteArray();
{
Q_UNUSED(previous)
- const QSet<QByteArray> checkedRoles = current.toSet();
+ const auto checkedRoles = QSet<QByteArray>(current.constBegin(), current.constEnd());
QHashIterator<QByteArray, KToggleAction*> it(m_visibleRoles);
while (it.hasNext()) {
it.next();
void DolphinViewActionHandler::toggleShowHiddenFiles(bool show)
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->setHiddenFilesShown(show);
}
{
QAction* showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
showHiddenFilesAction->setChecked(shown);
-
- // #374508: don't overwrite custom icons.
- const QString iconName = showHiddenFilesAction->icon().name();
- if (!iconName.isEmpty() && iconName != QLatin1String("view-visible") && iconName != QLatin1String("view-hidden")) {
- return;
- }
-
- showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
for (QAction *groupAction : qAsConst(m_sortByActions)) {
KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction);
if (actionMenu) {
- foreach (QAction* subAction, actionMenu->menu()->actions()) {
+ const auto actions = actionMenu->menu()->actions();
+ for (QAction* subAction : actions) {
subAction->setChecked(false);
}
} else if (groupAction->actionGroup()) {
void DolphinViewActionHandler::slotAdjustViewProperties()
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
QPointer<ViewPropertiesDialog> dialog = new ViewPropertiesDialog(m_currentView);
dialog->exec();
delete dialog;
void DolphinViewActionHandler::slotDuplicate()
{
- emit actionBeingHandled();
+ Q_EMIT actionBeingHandled();
m_currentView->duplicateSelectedItems();
}