From aeec6595302aded5bdf9b00448859b68e375cdcb Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 19 Jan 2008 16:59:10 +0000 Subject: [PATCH] stay consistent with Konqueror: F10 creates a new directory svn path=/trunk/KDE/kdebase/apps/; revision=763500 --- src/dolphinmainwindow.cpp | 19 ++++++++++++++++--- src/dolphinmainwindow.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 2048de1a5..1157124f9 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -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()); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index f757520c3..43dc2248a 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -163,6 +163,9 @@ protected: virtual void readProperties(const KConfigGroup& group); private slots: + /** Opens the dialog for creating a directory. */ + void createDir(); + /** Updates the 'Create New...' sub menu. */ void updateNewMenu(); -- 2.47.3