#include "dolphinsettingsdialog.h"
#include "dolphinstatusbar.h"
#include "dolphinviewcontainer.h"
-#include "fileitemcapabilities.h"
#include "infosidebarpage.h"
#include "metadatawidget.h"
#include "mainwindowadaptor.h"
#include <kmenubar.h>
#include <kmessagebox.h>
#include <kurlnavigator.h>
+#include <konq_fileitemcapabilities.h>
#include <konqmimedata.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
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());
}
}
+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();
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)),
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)));
}
} 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();
}
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() :