]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
The check whether there is a cut-selection when receiving a preview consumes 12 ...
[dolphin.git] / src / dolphinmainwindow.cpp
index 81d1e2670cbf4b7928425e00afebcd09f1eca423..6822250e1706b4becaff9795694b26821e50c04f 100644 (file)
@@ -209,8 +209,7 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
 
     QAction* compareFilesAction = actionCollection()->action("compare_files");
     if (selectedUrlsCount == 2) {
-        const bool kompareInstalled = !KGlobal::dirs()->findExe("kompare").isEmpty();
-        compareFilesAction->setEnabled(selectedUrlsCount == 2 && kompareInstalled);
+        compareFilesAction->setEnabled(isKompareInstalled());
     } else {
         compareFilesAction->setEnabled(false);
     }
@@ -356,9 +355,15 @@ void DolphinMainWindow::updateNewMenu()
 
 void DolphinMainWindow::properties()
 {
+    KPropertiesDialog* dialog = 0;
     const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+    if (list.isEmpty()) {
+        const KUrl url = activeViewContainer()->url();
+        dialog = new KPropertiesDialog(url, this);
+    } else {
+        dialog = new KPropertiesDialog(list, this);
+    }
 
-    KPropertiesDialog *dialog = new KPropertiesDialog(list, this);
     dialog->setAttribute(Qt::WA_DeleteOnClose);
     dialog->show();
     dialog->raise();
@@ -909,7 +914,7 @@ void DolphinMainWindow::setupActions()
     KAction* newTab = actionCollection()->addAction("new_tab");
     newTab->setIcon(KIcon("tab-new"));
     newTab->setText(i18nc("@action:inmenu File", "New Tab"));
-    newTab->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_N);
+    newTab->setShortcut(KShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_N, Qt::CTRL | Qt::Key_T));
     connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
 
     QAction* closeTab = new QAction(KIcon("tab-close"), i18nc("@action:inmenu File", "Close Tab"), this);
@@ -1113,6 +1118,7 @@ void DolphinMainWindow::updateEditActions()
         QAction* moveToTrashAction = col->action("move_to_trash");
         QAction* deleteAction      = col->action("delete");
         QAction* cutAction         = col->action(KStandardAction::name(KStandardAction::Cut));
+        QAction* deleteWithTrashShortcut = col->action("delete_shortcut"); // see DolphinViewActionHandler
 
         KonqFileItemCapabilities capabilities(list);
         const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
@@ -1120,6 +1126,7 @@ void DolphinMainWindow::updateEditActions()
         renameAction->setEnabled(capabilities.supportsMoving());
         moveToTrashAction->setEnabled(enableMoveToTrash);
         deleteAction->setEnabled(capabilities.supportsDeleting());
+        deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
         cutAction->setEnabled(capabilities.supportsMoving());
     }
     updatePasteAction();
@@ -1208,6 +1215,19 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
     return name;
 }
 
+bool DolphinMainWindow::isKompareInstalled() const
+{
+    static bool initialized = false;
+    static bool installed = false;
+    if (!initialized) {
+        // TODO: maybe replace this approach later by using a menu
+        // plugin like kdiff3plugin.cpp
+        installed = !KGlobal::dirs()->findExe("kompare").isEmpty();
+        initialized = true;
+    }
+    return installed;
+}
+
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
     KIO::FileUndoManager::UiInterface()
 {