X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fd98230020bdbdd051bbb11193a61097f169479b..13b2fc55704fbc734cd4f9cbae56cfc2ef3ec0ce:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index afa6ea43f..57926d33e 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -32,7 +32,6 @@ #include "dolphinsettingsdialog.h" #include "dolphinstatusbar.h" #include "dolphinviewcontainer.h" -#include "fileitemcapabilities.h" #include "infosidebarpage.h" #include "metadatawidget.h" #include "mainwindowadaptor.h" @@ -63,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -737,7 +737,7 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos) QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab")); newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut()); - QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Other Tabs")); + QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs")); QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab")); closeTabAction->setShortcut(actionCollection()->action("close_tab")->shortcut()); @@ -763,6 +763,16 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos) } } +void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons) +{ + if (buttons & Qt::MidButton) { + openNewTab(url); + m_tabBar->setCurrentIndex(m_viewTab.count() - 1); + } else { + changeUrl(url); + } +} + void DolphinMainWindow::init() { DolphinSettings& settings = DolphinSettings::instance(); @@ -1036,8 +1046,8 @@ void DolphinMainWindow::setupDockWidgets() addDockWidget(Qt::LeftDockWidgetArea, treeViewDock); connect(this, SIGNAL(urlChanged(KUrl)), treeWidget, SLOT(setUrl(KUrl))); - connect(treeWidget, SIGNAL(changeUrl(KUrl)), - this, SLOT(changeUrl(KUrl))); + connect(treeWidget, SIGNAL(changeUrl(KUrl, Qt::MouseButtons)), + this, SLOT(handlePlacesClick(KUrl, Qt::MouseButtons))); connect(treeWidget, SIGNAL(changeSelection(KFileItemList)), this, SLOT(changeSelection(KFileItemList))); connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)), @@ -1084,8 +1094,8 @@ void DolphinMainWindow::setupDockWidgets() actionCollection()->addAction("show_places_panel", placesDock->toggleViewAction()); addDockWidget(Qt::LeftDockWidgetArea, placesDock); - connect(placesView, SIGNAL(urlChanged(KUrl)), - this, SLOT(changeUrl(KUrl))); + connect(placesView, SIGNAL(urlChanged(KUrl, Qt::MouseButtons)), + this, SLOT(handlePlacesClick(KUrl, Qt::MouseButtons))); connect(this, SIGNAL(urlChanged(KUrl)), placesView, SLOT(setUrl(KUrl))); } @@ -1098,11 +1108,21 @@ void DolphinMainWindow::updateEditActions() } else { stateChanged("has_selection"); - FileItemCapabilities capabilities(list); - actionCollection()->action("rename")->setEnabled(capabilities.supportsMoving()); + KActionCollection* col = actionCollection(); + QAction* renameAction = col->action("rename"); + 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(); - actionCollection()->action("move_to_trash")->setEnabled(enableMoveToTrash); - actionCollection()->action("delete")->setEnabled(capabilities.supportsDeleting()); + + renameAction->setEnabled(capabilities.supportsMoving()); + moveToTrashAction->setEnabled(enableMoveToTrash); + deleteAction->setEnabled(capabilities.supportsDeleting()); + deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash); + cutAction->setEnabled(capabilities.supportsMoving()); } updatePasteAction(); } @@ -1178,7 +1198,16 @@ void DolphinMainWindow::updateSplitAction() QString DolphinMainWindow::tabName(const KUrl& url) const { - return url.equals(KUrl("file:///")) ? "/" : url.fileName(); + QString name; + if (url.equals(KUrl("file:///"))) { + name = "/"; + } else { + name = url.fileName(); + if (name.isEmpty()) { + name = url.protocol(); + } + } + return name; } DolphinMainWindow::UndoUiInterface::UndoUiInterface() :