]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinviewactionhandler.cpp
Allow folder creation on desktop via F10 shortcut
[dolphin.git] / src / views / dolphinviewactionhandler.cpp
index 5975146ff8606e6a221e26813cf28a66602fdefa..af105512976b98b5c37bbb3a2f2c21a27588e592 100644 (file)
@@ -78,8 +78,12 @@ void DolphinViewActionHandler::createActions()
     // 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);
-    newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
+       #if KCONFIG_VERSION >= QT_VERSION_CHECK(5, 74, 0)
+               m_actionCollection->setDefaultShortcuts(newDirAction, KStandardShortcut::createFolder());
+       #else
+           m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10);
+       #endif
+       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);
 
@@ -381,25 +385,25 @@ void DolphinViewActionHandler::slotViewModeActionTriggered(QAction* action)
 
 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);
 }
 
@@ -498,7 +502,7 @@ void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst)
 
 void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
 {
-    emit actionBeingHandled();
+    Q_EMIT actionBeingHandled();
 
     const QByteArray toggledRole = action->data().toByteArray();
 
@@ -546,7 +550,7 @@ void DolphinViewActionHandler::slotGroupedSortingChanged(bool groupedSorting)
 
 void DolphinViewActionHandler::toggleShowHiddenFiles(bool show)
 {
-    emit actionBeingHandled();
+    Q_EMIT actionBeingHandled();
     m_currentView->setHiddenFilesShown(show);
 }
 
@@ -673,7 +677,7 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action)
 
 void DolphinViewActionHandler::slotAdjustViewProperties()
 {
-    emit actionBeingHandled();
+    Q_EMIT actionBeingHandled();
     QPointer<ViewPropertiesDialog> dialog = new ViewPropertiesDialog(m_currentView);
     dialog->exec();
     delete dialog;
@@ -681,7 +685,7 @@ void DolphinViewActionHandler::slotAdjustViewProperties()
 
 void DolphinViewActionHandler::slotDuplicate()
 {
-    emit actionBeingHandled();
+    Q_EMIT actionBeingHandled();
     m_currentView->duplicateSelectedItems();
 }