]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
stay consistent with Konqueror: F10 creates a new directory
[dolphin.git] / src / dolphinmainwindow.cpp
index 2048de1a5618aee14bf80411ae4ad917624ca6d4..1157124f927e90f04d4c885379547ca2bd1dea50 100644 (file)
@@ -59,6 +59,7 @@
 #include <kmenu.h>
 #include <kmenubar.h>
 #include <kmessagebox.h>
+#include <konq_operations.h>
 #include <konqmimedata.h>
 #include <kpropertiesdialog.h>
 #include <kprotocolinfo.h>
@@ -422,6 +423,12 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
     }
 }
 
+void DolphinMainWindow::createDir()
+{
+    const KUrl& url = m_activeViewContainer->view()->url();
+    KonqOperations::newDir(this, url);
+}
+
 void DolphinMainWindow::updateNewMenu()
 {
     m_newMenu->slotCheckUpToDate();
@@ -985,6 +992,13 @@ void DolphinMainWindow::setupActions()
     connect(menu, SIGNAL(aboutToShow()),
             this, SLOT(updateNewMenu()));
 
+    // This action doesn't appear in the GUI, it's for the shortcut only.
+    // KNewMenu takes care of the GUI stuff.
+    KAction* newDirAction = actionCollection()->addAction("create_dir");
+    newDirAction->setText(i18n("Create Folder..."));
+    connect(newDirAction, SIGNAL(triggered()), SLOT(createDir()));
+    newDirAction->setShortcut(Qt::Key_F10);
+
     KAction* newWindow = actionCollection()->addAction("new_window");
     newWindow->setIcon(KIcon("window-new"));
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
@@ -1012,8 +1026,8 @@ void DolphinMainWindow::setupActions()
                           SLOT(undo()),
                           actionCollection());
 
-    //Need to remove shift+del from cut action, else the shortcut for deletejob
-    //doesn't work
+    // need to remove shift+del from cut action, else the shortcut for deletejob
+    // doesn't work
     KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
     KShortcut cutShortcut = cut->shortcut();
     cutShortcut.remove(Qt::SHIFT + Qt::Key_Delete, KShortcut::KeepEmpty);
@@ -1040,7 +1054,6 @@ void DolphinMainWindow::setupActions()
                              SLOT(zoomOut()),
                              actionCollection());
 
-
     KToggleAction* iconsView = DolphinView::iconsModeAction(actionCollection());
     KToggleAction* detailsView = DolphinView::detailsModeAction(actionCollection());
     KToggleAction* columnView = DolphinView::columnsModeAction(actionCollection());