]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewactionhandler.cpp
* use existing KFileItem also for the selection instead of creating a new KFileItem...
[dolphin.git] / src / dolphinviewactionhandler.cpp
index f382a10c1a6c872634a1335469723a5665dc9484..3c42ff1aecfc98e7c23ec59ea78462fd05b24d40 100644 (file)
@@ -18,8 +18,8 @@
  ***************************************************************************/
 
 #include "dolphinviewactionhandler.h"
-#include <kdebug.h>
 
+#include "viewpropertiesdialog.h"
 #include "dolphinview.h"
 
 #include <konq_operations.h>
@@ -28,6 +28,7 @@
 #include <kactioncollection.h>
 #include <klocale.h>
 #include <ktoggleaction.h>
+#include <krun.h>
 
 DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent)
     : QObject(parent),
@@ -92,6 +93,17 @@ void DolphinViewActionHandler::createActions()
     deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);
     connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
 
+    // This action is useful for being enabled when "move_to_trash" should be
+    // disabled and "delete" is enabled (e.g. non-local files), so that Key_Del
+    // can be used for deleting the file (#76016). It needs to be a separate action
+    // so that the Edit menu isn't affected.
+    KAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut");
+    // TODO after message freeze, a more descriptive text, for the shortcuts editor.
+    deleteWithTrashShortcut->setText(i18nc("@action:inmenu File", "Delete"));
+    deleteWithTrashShortcut->setShortcut(QKeySequence::Delete);
+    deleteWithTrashShortcut->setEnabled(false);
+    connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+
     // View menu
 
     QActionGroup* viewModeActions = new QActionGroup(this);
@@ -132,6 +144,17 @@ void DolphinViewActionHandler::createActions()
     showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_Period);
     connect(showHiddenFiles, SIGNAL(triggered(bool)), this, SLOT(toggleShowHiddenFiles(bool)));
 
+    KAction* adjustViewProps = m_actionCollection->addAction("view_properties");
+    adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
+    connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(slotAdjustViewProperties()));
+
+    // Tools menu
+
+    QAction* findFile = m_actionCollection->addAction("find_file");
+    findFile->setText(i18nc("@action:inmenu Tools", "Find File..."));
+    findFile->setShortcut(Qt::CTRL | Qt::Key_F);
+    findFile->setIcon(KIcon("edit-find"));
+    connect(findFile, SIGNAL(triggered()), this, SLOT(slotFindFile()));
 }
 
 QActionGroup* DolphinViewActionHandler::createAdditionalInformationActionGroup()
@@ -471,3 +494,15 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action)
     const DolphinView::Sorting sorting = action->data().value<DolphinView::Sorting>();
     m_currentView->setSorting(sorting);
 }
+
+void DolphinViewActionHandler::slotAdjustViewProperties()
+{
+    emit actionBeingHandled();
+    ViewPropertiesDialog dlg(m_currentView);
+    dlg.exec();
+}
+
+void DolphinViewActionHandler::slotFindFile()
+{
+    KRun::run("kfind", m_currentView->url(), m_currentView->window());
+}