┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/dolphincontextmenu.cpp9
-rw-r--r--src/dolphinmainwindow.cpp128
-rw-r--r--src/dolphinmainwindow.h35
-rw-r--r--src/dolphinpart.cpp11
-rw-r--r--src/dolphinpart.rc12
-rw-r--r--src/dolphinremoveaction.cpp36
-rw-r--r--src/dolphinremoveaction.h18
-rw-r--r--src/dolphinui.rc18
-rw-r--r--src/dolphinviewcontainer.cpp11
-rw-r--r--src/dolphinviewcontainer.h5
-rw-r--r--src/kitemviews/kfileitemmodel.cpp9
-rw-r--r--src/kitemviews/kfileitemmodel.h4
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.cpp15
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.h6
-rw-r--r--src/middleclickactioneventfilter.cpp58
-rw-r--r--src/middleclickactioneventfilter.h50
-rw-r--r--src/org.kde.dolphin.appdata.xml2
-rw-r--r--src/panels/folders/dolphin_folderspanelsettings.kcfg4
-rw-r--r--src/panels/folders/folderspanel.cpp33
-rw-r--r--src/panels/folders/folderspanel.h5
-rw-r--r--src/panels/folders/treeviewcontextmenu.cpp17
-rw-r--r--src/panels/folders/treeviewcontextmenu.h6
-rw-r--r--src/panels/places/placesitem.cpp2
-rw-r--r--src/panels/places/placespanel.cpp4
-rw-r--r--src/settings/additionalinfodialog.cpp4
-rw-r--r--src/settings/general/previewssettingspage.cpp2
-rw-r--r--src/settings/viewmodes/viewsettingstab.cpp4
-rw-r--r--src/views/dolphinviewactionhandler.cpp20
-rw-r--r--src/views/tooltips/tooltipmanager.cpp8
31 files changed, 394 insertions, 154 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20ba68100..bd0b17586 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,14 @@
-cmake_minimum_required(VERSION 2.8.12)
-
-project(Dolphin)
+cmake_minimum_required(VERSION 3.0)
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "17")
-set (KDE_APPLICATIONS_VERSION_MINOR "08")
-set (KDE_APPLICATIONS_VERSION_MICRO "1")
+set (KDE_APPLICATIONS_VERSION_MINOR "11")
+set (KDE_APPLICATIONS_VERSION_MICRO "70")
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
+project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION})
set(QT_MIN_VERSION "5.5.0")
-set(KF5_MIN_VERSION "5.30.0")
+set(KF5_MIN_VERSION "5.37.0")
set(ECM_MIN_VERSION "1.6.0")
# ECM setup
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 13b94f73b..e1b63358d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -110,6 +110,7 @@ set(dolphinprivate_LIB_SRCS
views/viewproperties.cpp
views/zoomlevelinfo.cpp
dolphinremoveaction.cpp
+ middleclickactioneventfilter.cpp
dolphinnewfilemenu.cpp
dolphindebug.cpp
)
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 05082df86..b4d249d76 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -124,7 +124,7 @@ DolphinContextMenu::Command DolphinContextMenu::open()
void DolphinContextMenu::keyPressEvent(QKeyEvent *ev)
{
if (m_removeAction && ev->key() == Qt::Key_Shift) {
- m_removeAction->update();
+ m_removeAction->update(DolphinRemoveAction::ShiftState::Pressed);
}
QMenu::keyPressEvent(ev);
}
@@ -132,7 +132,7 @@ void DolphinContextMenu::keyPressEvent(QKeyEvent *ev)
void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev)
{
if (m_removeAction && ev->key() == Qt::Key_Shift) {
- m_removeAction->update();
+ m_removeAction->update(DolphinRemoveAction::ShiftState::Released);
}
QMenu::keyReleaseEvent(ev);
}
@@ -392,8 +392,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
addSeparator();
// Insert 'Rename'
- QAction* renameAction = collection->action(QStringLiteral("rename"));
- addAction(renameAction);
+ addAction(collection->action(KStandardAction::name(KStandardAction::RenameFile)));
// Insert 'Move to Trash' and/or 'Delete'
if (properties.supportsDeleting()) {
@@ -405,7 +404,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
if (showDeleteAction && showMoveToTrashAction) {
delete m_removeAction;
m_removeAction = 0;
- addAction(m_mainWindow->actionCollection()->action(QStringLiteral("move_to_trash")));
+ addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)));
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
} else if (showDeleteAction && !showMoveToTrashAction) {
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 658b89006..3df25001c 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -29,6 +29,7 @@
#include "dolphintabwidget.h"
#include "dolphinviewcontainer.h"
#include "dolphintabpage.h"
+#include "middleclickactioneventfilter.h"
#include "panels/folders/folderspanel.h"
#include "panels/places/placespanel.h"
#include "panels/information/informationpanel.h"
@@ -51,6 +52,7 @@
#include <KAuthorized>
#include <KConfig>
#include <kdualaction.h>
+#include <KHelpMenu>
#include <KJobWidgets>
#include <QLineEdit>
#include <KToolBar>
@@ -60,6 +62,7 @@
#include <KProtocolInfo>
#include <QMenu>
#include <KMessageBox>
+#include <KFilePlacesModel>
#include <KFileItemListProperties>
#include <KRun>
#include <KShell>
@@ -169,6 +172,11 @@ DolphinMainWindow::DolphinMainWindow() :
if (!showMenu) {
createControlButton();
}
+
+ // enable middle-click on back/forward/up to open in a new tab
+ auto *middleClickEventFilter = new MiddleClickActionEventFilter(this);
+ connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked);
+ toolBar()->installEventFilter(middleClickEventFilter);
}
DolphinMainWindow::~DolphinMainWindow()
@@ -500,6 +508,19 @@ void DolphinMainWindow::slotDirectoryLoadingCompleted()
updatePasteAction();
}
+void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction *action)
+{
+ if (action == actionCollection()->action(QStringLiteral("go_back"))) {
+ goBackInNewTab();
+ } else if (action == actionCollection()->action(QStringLiteral("go_forward"))) {
+ goForwardInNewTab();
+ } else if (action == actionCollection()->action(QStringLiteral("go_up"))) {
+ goUpInNewTab();
+ } else if (action == actionCollection()->action(QStringLiteral("go_home"))) {
+ goHomeInNewTab();
+ }
+}
+
void DolphinMainWindow::selectAll()
{
clearStatusBar();
@@ -625,40 +646,29 @@ void DolphinMainWindow::goHome()
m_activeViewContainer->urlNavigator()->goHome();
}
-void DolphinMainWindow::goBack(Qt::MouseButtons buttons)
+void DolphinMainWindow::goBackInNewTab()
{
- // The default case (left button pressed) is handled in goBack().
- if (buttons == Qt::MiddleButton) {
- KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
- const int index = urlNavigator->historyIndex() + 1;
- openNewTab(urlNavigator->locationUrl(index));
- }
+ KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+ const int index = urlNavigator->historyIndex() + 1;
+ openNewTab(urlNavigator->locationUrl(index));
}
-void DolphinMainWindow::goForward(Qt::MouseButtons buttons)
+void DolphinMainWindow::goForwardInNewTab()
{
- // The default case (left button pressed) is handled in goForward().
- if (buttons == Qt::MiddleButton) {
- KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
- const int index = urlNavigator->historyIndex() - 1;
- openNewTab(urlNavigator->locationUrl(index));
- }
+ KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+ const int index = urlNavigator->historyIndex() - 1;
+ openNewTab(urlNavigator->locationUrl(index));
}
-void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
+void DolphinMainWindow::goUpInNewTab()
{
- // The default case (left button pressed) is handled in goUp().
- if (buttons == Qt::MiddleButton) {
- openNewTab(KIO::upUrl(activeViewContainer()->url()));
- }
+ const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
+ openNewTab(KIO::upUrl(currentUrl));
}
-void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
+void DolphinMainWindow::goHomeInNewTab()
{
- // The default case (left button pressed) is handled in goHome().
- if (buttons == Qt::MiddleButton) {
- openNewTab(Dolphin::homeUrl());
- }
+ openNewTab(Dolphin::homeUrl());
}
void DolphinMainWindow::compareFiles()
@@ -876,19 +886,8 @@ void DolphinMainWindow::updateControlMenu()
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Preferences)), menu);
// Add "Help" menu
- QMenu* helpMenu = new QMenu(i18nc("@action:inmenu", "Help"), menu);
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
- helpMenu->addSeparator();
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::ReportBug)));
- helpMenu->addSeparator();
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Donate)));
- helpMenu->addSeparator();
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage)));
- helpMenu->addSeparator();
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutApp)));
- helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutKDE)));
- menu->addMenu(helpMenu);
+ auto helpMenu = new KHelpMenu(menu);
+ menu->addMenu(helpMenu->menu());
menu->addSeparator();
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ShowMenubar)), menu);
@@ -964,26 +963,35 @@ void DolphinMainWindow::tabCountChanged(int count)
void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
{
- QString caption;
+ static KFilePlacesModel s_placesModel;
+
+ QString schemePrefix;
if (!url.isLocalFile()) {
- caption.append(url.scheme() + " - ");
+ schemePrefix.append(url.scheme() + " - ");
if (!url.host().isEmpty()) {
- caption.append(url.host() + " - ");
+ schemePrefix.append(url.host() + " - ");
}
}
if (GeneralSettings::showFullPathInTitlebar()) {
const QString path = url.adjusted(QUrl::StripTrailingSlash).path();
- caption.append(path);
- } else {
- QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
- if (fileName.isEmpty()) {
- fileName = '/';
- }
- caption.append(fileName);
+ setWindowTitle(schemePrefix + path);
+ return;
+ }
+
+ const auto& matchedPlaces = s_placesModel.match(s_placesModel.index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
+
+ if (!matchedPlaces.isEmpty()) {
+ setWindowTitle(s_placesModel.text(matchedPlaces.first()));
+ return;
+ }
+
+ QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
+ if (fileName.isEmpty()) {
+ fileName = '/';
}
- setWindowTitle(caption);
+ setWindowTitle(schemePrefix + fileName);
}
void DolphinMainWindow::setupActions()
@@ -1016,23 +1024,23 @@ void DolphinMainWindow::setupActions()
closeTab->setEnabled(false);
connect(closeTab, &QAction::triggered, m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab));
- KStandardAction::quit(this, SLOT(quit()), actionCollection());
+ KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection());
// setup 'Edit' menu
KStandardAction::undo(this,
- SLOT(undo()),
+ &DolphinMainWindow::undo,
actionCollection());
- KStandardAction::cut(this, SLOT(cut()), actionCollection());
- KStandardAction::copy(this, SLOT(copy()), actionCollection());
- QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
+ KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection());
+ KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection());
+ QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::paste, actionCollection());
// The text of the paste-action is modified dynamically by Dolphin
// (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
// due to the long text, the text "Paste" is used:
paste->setIconText(i18nc("@action:inmenu Edit", "Paste"));
- KStandardAction::find(this, SLOT(find()), actionCollection());
+ KStandardAction::find(this, &DolphinMainWindow::find, actionCollection());
QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
@@ -1083,7 +1091,7 @@ void DolphinMainWindow::setupActions()
connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
// setup 'Go' menu
- QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+ QAction* backAction = KStandardAction::back(this, &DolphinMainWindow::goBack, actionCollection());
auto backShortcuts = backAction->shortcuts();
backShortcuts.append(QKeySequence(Qt::Key_Backspace));
actionCollection()->setDefaultShortcuts(backAction, backShortcuts);
@@ -1107,9 +1115,9 @@ void DolphinMainWindow::setupActions()
auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
undoAction->setEnabled(false); // undo should be disabled by default
- KStandardAction::forward(this, SLOT(goForward()), actionCollection());
- KStandardAction::up(this, SLOT(goUp()), actionCollection());
- KStandardAction::home(this, SLOT(goHome()), actionCollection());
+ KStandardAction::forward(this, &DolphinMainWindow::goForward, actionCollection());
+ KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection());
+ KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection());
// setup 'Tools' menu
QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
@@ -1318,8 +1326,8 @@ void DolphinMainWindow::updateEditActions()
stateChanged(QStringLiteral("has_selection"));
KActionCollection* col = actionCollection();
- QAction* renameAction = col->action(QStringLiteral("rename"));
- QAction* moveToTrashAction = col->action(QStringLiteral("move_to_trash"));
+ QAction* renameAction = col->action(KStandardAction::name(KStandardAction::RenameFile));
+ QAction* moveToTrashAction = col->action(KStandardAction::name(KStandardAction::MoveToTrash));
QAction* deleteAction = col->action(KStandardAction::name(KStandardAction::DeleteFile));
QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut));
QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index d741eb21e..06eb5a7a5 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -267,28 +267,17 @@ private slots:
/** Changes the location to the home URL. */
void goHome();
- /**
- * Open the previous URL in the URL history in a new tab
- * if the middle mouse button is clicked.
- */
- void goBack(Qt::MouseButtons buttons);
+ /** Open the previous URL in the URL history in a new tab. */
+ void goBackInNewTab();
- /**
- * Open the next URL in the URL history in a new tab
- * if the middle mouse button is clicked.
- */
- void goForward(Qt::MouseButtons buttons);
+ /** Open the next URL in the URL history in a new tab. */
+ void goForwardInNewTab();
- /**
- * Open the URL one hierarchy above the current URL in a new tab
- * if the middle mouse button is clicked.
- */
- void goUp(Qt::MouseButtons buttons);
+ /** Open the URL one hierarchy above the current URL in a new tab. */
+ void goUpInNewTab();
- /**
- * Open the home URL in a new tab
- */
- void goHome(Qt::MouseButtons buttons);
+ /** * Open the home URL in a new tab. */
+ void goHomeInNewTab();
/** Opens Kompare for 2 selected files. */
void compareFiles();
@@ -425,6 +414,14 @@ private slots:
*/
void slotDirectoryLoadingCompleted();
+ /**
+ * Is called when the user middle clicks a toolbar button.
+ *
+ * Here middle clicking Back/Forward/Up/Home will open the resulting
+ * folder in a new tab.
+ */
+ void slotToolBarActionMiddleClicked(QAction *action);
+
private:
void setupActions();
void setupDockWidgets();
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index ef9b300ca..b3b47304e 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -253,8 +253,8 @@ void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
{
const bool hasSelection = !selection.isEmpty();
- QAction* renameAction = actionCollection()->action(QStringLiteral("rename"));
- QAction* moveToTrashAction = actionCollection()->action(QStringLiteral("move_to_trash"));
+ QAction* renameAction = actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile));
+ QAction* moveToTrashAction = actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash));
QAction* deleteAction = actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile));
QAction* editMimeTypeAction = actionCollection()->action(QStringLiteral("editMimeType"));
QAction* propertiesAction = actionCollection()->action(QStringLiteral("properties"));
@@ -432,7 +432,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
if (showDeleteAction && showMoveToTrashAction) {
delete m_removeAction;
m_removeAction = 0;
- editActions.append(actionCollection()->action(QStringLiteral("move_to_trash")));
+ editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)));
editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
} else if (showDeleteAction && !showMoveToTrashAction) {
editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
@@ -447,7 +447,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
}
if (supportsMoving) {
- editActions.append(actionCollection()->action(QStringLiteral("rename")));
+ editActions.append(actionCollection()->action(KStandardAction::name(KStandardAction::RenameFile)));
}
// Normally KonqPopupMenu only shows the "Create new" submenu in the current view
@@ -597,6 +597,7 @@ void DolphinPart::setFilesToSelect(const QList<QUrl>& files)
bool DolphinPart::eventFilter(QObject* obj, QEvent* event)
{
+ using ShiftState = DolphinRemoveAction::ShiftState;
const int type = event->type();
if ((type == QEvent::KeyPress || type == QEvent::KeyRelease) && m_removeAction) {
@@ -604,7 +605,7 @@ bool DolphinPart::eventFilter(QObject* obj, QEvent* event)
if (menu && menu->parent() == m_view) {
QKeyEvent* ev = static_cast<QKeyEvent*>(event);
if (ev->key() == Qt::Key_Shift) {
- m_removeAction->update();
+ m_removeAction->update(type == QEvent::KeyPress ? ShiftState::Pressed : ShiftState::Released);
}
}
}
diff --git a/src/dolphinpart.rc b/src/dolphinpart.rc
index 01bd60009..149fa198a 100644
--- a/src/dolphinpart.rc
+++ b/src/dolphinpart.rc
@@ -1,11 +1,11 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="dolphinpart" version="12" translationDomain="dolphin">
+<kpartgui name="dolphinpart" version="14" translationDomain="dolphin">
<MenuBar>
<Menu name="edit"><text>&amp;Edit</text>
<Action name="new_menu"/>
<Separator/>
- <Action name="rename"/>
- <Action name="move_to_trash" />
+ <Action name="renamefile"/>
+ <Action name="movetotrash" />
<Action name="deletefile"/>
<Action name="editMimeType"/>
<Action name="properties"/>
@@ -52,14 +52,14 @@
</ToolBar>
<State name="has_selection" >
<enable>
- <Action name="move_to_trash" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
</enable>
</State>
<State name="has_no_selection" >
<disable>
- <Action name="rename" />
- <Action name="move_to_trash" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
</disable>
</State>
diff --git a/src/dolphinremoveaction.cpp b/src/dolphinremoveaction.cpp
index 79d6bed60..ab1117770 100644
--- a/src/dolphinremoveaction.cpp
+++ b/src/dolphinremoveaction.cpp
@@ -1,5 +1,6 @@
/***************************************************************************
- * Copyright (C) 2013 by Dawit Alemayehu <[email protected] *
+ * Copyright (C) 2013 by Dawit Alemayehu <[email protected]> *
+ * Copyright (C) 2017 by Elvis Angelaccio <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -39,27 +40,38 @@ void DolphinRemoveAction::slotRemoveActionTriggered()
}
}
-void DolphinRemoveAction::update()
+void DolphinRemoveAction::update(ShiftState shiftState)
{
- Q_ASSERT(m_collection);
- // Using setText(action->text()) does not apply the &-shortcut.
- // This is only done until the original action has been shown at least once. To
- // bypass this issue, the text and &-shortcut is applied manually.
- if (qApp->queryKeyboardModifiers() & Qt::ShiftModifier) {
- m_action = m_collection ? m_collection->action(KStandardAction::name(KStandardAction::DeleteFile)) : 0;
- setText(i18nc("@action:inmenu", "&Delete"));
+ if (!m_collection) {
+ m_action = nullptr;
+ return;
+ }
+
+ if (shiftState == ShiftState::Unknown) {
+ shiftState = QGuiApplication::keyboardModifiers() & Qt::ShiftModifier ? ShiftState::Pressed : ShiftState::Released;
+ }
+
+ switch (shiftState) {
+ case ShiftState::Pressed: {
+ m_action = m_collection->action(KStandardAction::name(KStandardAction::DeleteFile));
// Make sure we show Shift+Del in the context menu.
auto deleteShortcuts = m_action->shortcuts();
deleteShortcuts.removeAll(Qt::SHIFT | Qt::Key_Delete);
deleteShortcuts.prepend(Qt::SHIFT | Qt::Key_Delete);
m_collection->setDefaultShortcuts(this, deleteShortcuts);
- } else {
- m_action = m_collection ? m_collection->action(QStringLiteral("move_to_trash")) : 0;
- setText(i18nc("@action:inmenu", "&Move to Trash"));
+ break;
+ }
+ case ShiftState::Released:
+ m_action = m_collection->action(KStandardAction::name(KStandardAction::MoveToTrash));
m_collection->setDefaultShortcuts(this, m_action->shortcuts());
+ break;
+ case ShiftState::Unknown:
+ Q_UNREACHABLE();
+ break;
}
if (m_action) {
+ setText(m_action->text());
setIcon(m_action->icon());
setEnabled(m_action->isEnabled());
}
diff --git a/src/dolphinremoveaction.h b/src/dolphinremoveaction.h
index fd8fc35d6..6ba25923a 100644
--- a/src/dolphinremoveaction.h
+++ b/src/dolphinremoveaction.h
@@ -1,5 +1,6 @@
/***************************************************************************
- * Copyright (C) 2013 by Dawit Alemayehu <[email protected] *
+ * Copyright (C) 2013 by Dawit Alemayehu <[email protected]> *
+ * Copyright (C) 2017 by Elvis Angelaccio <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -31,18 +32,27 @@
* A QAction that manages the delete based on the current state of
* the Shift key or the parameter passed to update.
*
- * This class expects the presence of both the "move_to_trash" and
+ * This class expects the presence of both the KStandardAction::MoveToTrash and
* KStandardAction::DeleteFile actions in @ref collection.
*/
class DOLPHIN_EXPORT DolphinRemoveAction : public QAction
{
Q_OBJECT
public:
+
+ enum class ShiftState {
+ Unknown,
+ Pressed,
+ Released
+ };
+
DolphinRemoveAction(QObject* parent, KActionCollection* collection);
+
/**
- * Updates this action key based on the state of the Shift key.
+ * Updates this action key based on @p shiftState.
+ * Default value is QueryShiftState, meaning it will query QGuiApplication::modifiers().
*/
- void update();
+ void update(ShiftState shiftState = ShiftState::Unknown);
private Q_SLOTS:
void slotRemoveActionTriggered();
diff --git a/src/dolphinui.rc b/src/dolphinui.rc
index 935488246..f2ef10659 100644
--- a/src/dolphinui.rc
+++ b/src/dolphinui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="dolphin" version="15">
+<kpartgui name="dolphin" version="17">
<MenuBar>
<Menu name="file">
<Action name="new_menu" />
@@ -8,8 +8,8 @@
<Action name="close_tab" />
<Action name="undo_close_tab" />
<Separator/>
- <Action name="rename" />
- <Action name="move_to_trash" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
<Separator/>
<Action name="properties" />
@@ -56,8 +56,8 @@
<Action name="edit_redo" />
<Action name="edit_cut" />
<Action name="edit_copy" />
- <Action name="rename" />
- <Action name="move_to_trash" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
<Action name="invert_selection" />
<Separator/>
@@ -69,8 +69,8 @@
<enable>
<Action name="edit_cut" />
<Action name="edit_copy" />
- <Action name="rename" />
- <Action name="move_to_trash" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
<Action name="invert_selection" />
</enable>
@@ -79,8 +79,8 @@
<disable>
<Action name="edit_cut" />
<Action name="edit_copy" />
- <Action name="rename" />
- <Action name="move_to_trash" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
<Action name="deletefile" />
<Action name="delete_shortcut" />
<Action name="invert_selection" />
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 198879f37..d83016610 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -24,6 +24,7 @@
#include <QTimer>
#include <QMimeData>
#include <QVBoxLayout>
+#include <QLoggingCategory>
#include <KFileItemActions>
#include <KFilePlacesModel>
@@ -41,6 +42,7 @@
#endif
#include "global.h"
+#include "dolphindebug.h"
#include "dolphin_generalsettings.h"
#include "filterbar/filterbar.h"
#include "search/dolphinsearchbox.h"
@@ -134,6 +136,8 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged);
connect(m_urlNavigator, &KUrlNavigator::urlChanged,
this, &DolphinViewContainer::slotUrlNavigatorLocationChanged);
+ connect(m_urlNavigator, &KUrlNavigator::urlSelectionRequested,
+ this, &DolphinViewContainer::slotUrlSelectionRequested);
connect(m_urlNavigator, &KUrlNavigator::returnPressed,
this, &DolphinViewContainer::slotReturnPressed);
connect(m_urlNavigator, &KUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) {
@@ -600,6 +604,13 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
}
}
+void DolphinViewContainer::slotUrlSelectionRequested(const QUrl& url)
+{
+ qCDebug(DolphinDebug) << "slotUrlSelectionRequested: " << url;
+ m_view->markUrlsAsSelected({url});
+ m_view->markUrlAsCurrent(url); // makes the item scroll into view
+}
+
void DolphinViewContainer::redirect(const QUrl& oldUrl, const QUrl& newUrl)
{
Q_UNUSED(oldUrl);
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index e50386ab6..41c8f0b04 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -257,6 +257,11 @@ private slots:
void slotUrlNavigatorLocationChanged(const QUrl& url);
/**
+ * @see KUrlNavigator::urlSelectionRequested
+ */
+ void slotUrlSelectionRequested(const QUrl& url);
+
+ /**
* Is invoked when a redirection is done and changes the
* URL of the URL navigator to \a newUrl without triggering
* a reloading of the directory.
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index b725d9507..8f89b89df 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -636,7 +636,11 @@ void KFileItemModel::expandParentDirectories(const QUrl &url)
// does not care whether the parent-URL has already been
// expanded.
QUrl urlToExpand = m_dirLister->url();
- const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
+
+ // first subdir can be empty, if m_dirLister->url().path() does not end with '/'
+ // this happens if baseUrl is not root but a home directory, see FoldersPanel,
+ // so using QString::SkipEmptyParts
+ const QStringList subDirs = url.path().mid(pos).split(QDir::separator(), QString::SkipEmptyParts);
for (int i = 0; i < subDirs.count() - 1; ++i) {
urlToExpand.setPath(urlToExpand.path() + '/' + subDirs.at(i));
m_urlsToExpand.insert(urlToExpand);
@@ -2307,9 +2311,12 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count)
{ "imageSize", ImageSizeRole, I18N_NOOP2_NOSTRIP("@label", "Image Size"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true },
{ "orientation", OrientationRole, I18N_NOOP2_NOSTRIP("@label", "Orientation"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true },
{ "artist", ArtistRole, I18N_NOOP2_NOSTRIP("@label", "Artist"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
+ { "genre", GenreRole, I18N_NOOP2_NOSTRIP("@label", "Genre"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
{ "album", AlbumRole, I18N_NOOP2_NOSTRIP("@label", "Album"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
{ "duration", DurationRole, I18N_NOOP2_NOSTRIP("@label", "Duration"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
+ { "bitrate", BitrateRole, I18N_NOOP2_NOSTRIP("@label", "Bitrate"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
{ "track", TrackRole, I18N_NOOP2_NOSTRIP("@label", "Track"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
+ { "releaseYear", ReleaseYearRole, I18N_NOOP2_NOSTRIP("@label", "Release Year"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
{ "path", PathRole, I18N_NOOP2_NOSTRIP("@label", "Path"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
{ "deletiontime",DeletionTimeRole,I18N_NOOP2_NOSTRIP("@label", "Deletion Time"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
{ "destination", DestinationRole, I18N_NOOP2_NOSTRIP("@label", "Link Destination"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index ef902775f..5dbeb32b2 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -286,8 +286,8 @@ private:
GroupRole, TypeRole, DestinationRole, PathRole, DeletionTimeRole,
// User visible roles available with Baloo:
CommentRole, TagsRole, RatingRole, ImageSizeRole, OrientationRole,
- WordCountRole, TitleRole, LineCountRole, ArtistRole, AlbumRole, DurationRole, TrackRole,
- OriginUrlRole,
+ WordCountRole, TitleRole, LineCountRole, ArtistRole, GenreRole, AlbumRole, DurationRole, TrackRole, ReleaseYearRole,
+ BitrateRole, OriginUrlRole,
// Non-visible roles:
IsDirRole, IsLinkRole, IsHiddenRole, IsExpandedRole, IsExpandableRole, ExpandedParentsCountRole,
// Mandatory last entry:
diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp
index d6c15afcd..314c2f06b 100644
--- a/src/kitemviews/private/kbaloorolesprovider.cpp
+++ b/src/kitemviews/private/kbaloorolesprovider.cpp
@@ -26,6 +26,7 @@
#include <Baloo/File>
#include <KFileMetaData/PropertyInfo>
#include <KFileMetaData/UserMetaData>
+#include <KFormat>
#include <QTime>
#include <QMap>
@@ -95,6 +96,9 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f
} else if (role == "duration") {
const QString duration = durationFromValue(value.toInt());
values.insert(role, duration);
+ } else if (role == "bitrate") {
+ const QString bitrate = bitrateFromValue(value.toInt());
+ values.insert(role, bitrate);
} else {
values.insert(role, value.toString());
}
@@ -146,8 +150,11 @@ KBalooRolesProvider::KBalooRolesProvider() :
{ "height", "imageSize" },
{ "nexif.orientation", "orientation", },
{ "artist", "artist" },
+ { "genre", "genre" },
{ "album", "album" },
{ "duration", "duration" },
+ { "bitRate", "bitrate" },
+ { "releaseYear", "releaseYear" },
{ "trackNumber", "track" },
{ "originUrl", "originUrl" }
};
@@ -192,3 +199,11 @@ QString KBalooRolesProvider::durationFromValue(int value) const
return duration.toString(QStringLiteral("hh:mm:ss"));
}
+
+QString KBalooRolesProvider::bitrateFromValue(int value) const
+{
+ KFormat form;
+ QString bitrate = i18nc("@label bitrate (per second)", "%1/s", form.formatByteSize(value, 1, KFormat::MetricBinaryDialect));
+ return bitrate;
+}
+
diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h
index 65b59793c..6fef98ede 100644
--- a/src/kitemviews/private/kbaloorolesprovider.h
+++ b/src/kitemviews/private/kbaloorolesprovider.h
@@ -79,6 +79,12 @@ private:
*/
QString durationFromValue(int value) const;
+ /**
+ * @return Bitrate in the format N kB/s for the value given
+ * in b/s.
+ */
+ QString bitrateFromValue(int value) const;
+
private:
QSet<QByteArray> m_roles;
QHash<QString, QByteArray> m_roleForProperty;
diff --git a/src/middleclickactioneventfilter.cpp b/src/middleclickactioneventfilter.cpp
new file mode 100644
index 000000000..e0917850a
--- /dev/null
+++ b/src/middleclickactioneventfilter.cpp
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * Copyright (C) 2017 Kai Uwe Broulik <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "middleclickactioneventfilter.h"
+
+#include <QAction>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QToolBar>
+
+MiddleClickActionEventFilter::MiddleClickActionEventFilter(QObject *parent) : QObject(parent)
+{
+
+}
+
+MiddleClickActionEventFilter::~MiddleClickActionEventFilter() = default;
+
+bool MiddleClickActionEventFilter::eventFilter(QObject *watched, QEvent *event)
+{
+ if (event->type() == QEvent::MouseButtonPress
+ || event->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent *me = static_cast<QMouseEvent *>(event);
+
+ if (me->button() == Qt::MiddleButton) {
+ QToolBar *toolBar = qobject_cast<QToolBar *>(watched);
+
+ QAction *action = toolBar->actionAt(me->pos());
+ if (action) {
+ if (event->type() == QEvent::MouseButtonPress) {
+ m_lastMiddlePressedAction = action;
+ } else if (event->type() == QEvent::MouseButtonRelease) {
+ if (m_lastMiddlePressedAction == action) {
+ emit actionMiddleClicked(action);
+ }
+ m_lastMiddlePressedAction = nullptr;
+ }
+ }
+ }
+ }
+
+ return QObject::eventFilter(watched, event);
+}
diff --git a/src/middleclickactioneventfilter.h b/src/middleclickactioneventfilter.h
new file mode 100644
index 000000000..6974f469e
--- /dev/null
+++ b/src/middleclickactioneventfilter.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2017 Kai Uwe Broulik <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#pragma once
+
+#include "dolphin_export.h"
+
+#include <QObject>
+#include <QPointer>
+
+class QAction;
+
+/**
+ * An event filter that allows to detect a middle click
+ * to trigger e.g. opening something in a new tab.
+ */
+class DOLPHIN_EXPORT MiddleClickActionEventFilter : public QObject
+{
+ Q_OBJECT
+
+public:
+ MiddleClickActionEventFilter(QObject *parent);
+ ~MiddleClickActionEventFilter() override;
+
+signals:
+ void actionMiddleClicked(QAction *action);
+
+protected:
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
+private:
+ QPointer<QAction> m_lastMiddlePressedAction;
+
+};
diff --git a/src/org.kde.dolphin.appdata.xml b/src/org.kde.dolphin.appdata.xml
index 40ff6e863..566529d29 100644
--- a/src/org.kde.dolphin.appdata.xml
+++ b/src/org.kde.dolphin.appdata.xml
@@ -225,7 +225,7 @@
<li xml:lang="et">Võimalus kasutada mitut laadi vaatestiile ja -omadusi ning neid igati enda käe järgi seadistada.</li>
<li xml:lang="fi">Tukee useita erilaisia näkymätyylejä ja -ominaisuuksia, ja mahdollistaa näkymän muokkaamisen mieleisekseen.</li>
<li xml:lang="fr">Prend en charge plusieurs types de styles d'affichage et de propriété et vous permet de configurer l'affichage de la manière exacte que vous voulez.</li>
- <li xml:lang="gl">É compatíbel con varios estilos e propiedades de vista diferentes, e permítelle configurar a vista como mellor lle pareza.</li>
+ <li xml:lang="gl">É compatíbel con varios estilos e propiedades de vista distintos, e permítelle configurar a vista como mellor lle pareza.</li>
<li xml:lang="hu">Számos különféle nézetstílus fajtát és tulajdonságot támogat, valamint lehetővé teszi a nézet beállítását pontosan olyanra, ahogy azt látni szeretné.</li>
<li xml:lang="ia">Il supporta multe differente typos de stilos de vista e proprietates e il permitte te configurar le vista exactemente como tu vole.</li>
<li xml:lang="it">Supporta diversi stili di visualizzazione e proprietà e ti consente di configurare la vista come desideri.</li>
diff --git a/src/panels/folders/dolphin_folderspanelsettings.kcfg b/src/panels/folders/dolphin_folderspanelsettings.kcfg
index 8b8ca66f8..d7d479fa1 100644
--- a/src/panels/folders/dolphin_folderspanelsettings.kcfg
+++ b/src/panels/folders/dolphin_folderspanelsettings.kcfg
@@ -10,6 +10,10 @@
<label>Hidden files shown</label>
<default>false</default>
</entry>
+ <entry name="LimitFoldersPanelToHome" type="Bool">
+ <label>Limit folders panel to home directory if inside home</label>
+ <default>true</default>
+ </entry>
<entry name="AutoScrolling" type="Bool">
<label>Automatic scrolling</label>
<default>true</default>
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp
index 8b759d813..cb35fd218 100644
--- a/src/panels/folders/folderspanel.cpp
+++ b/src/panels/folders/folderspanel.cpp
@@ -50,6 +50,7 @@
#include <views/draganddrophelper.h>
#include "dolphindebug.h"
+#include "global.h"
FoldersPanel::FoldersPanel(QWidget* parent) :
Panel(parent),
@@ -82,6 +83,17 @@ bool FoldersPanel::showHiddenFiles() const
return FoldersPanelSettings::hiddenFilesShown();
}
+void FoldersPanel::setLimitFoldersPanelToHome(bool enable)
+{
+ FoldersPanelSettings::setLimitFoldersPanelToHome(enable);
+ reloadTree();
+}
+
+bool FoldersPanel::limitFoldersPanelToHome() const
+{
+ return FoldersPanelSettings::limitFoldersPanelToHome();
+}
+
void FoldersPanel::setAutoScrolling(bool enable)
{
// TODO: Not supported yet in Dolphin 2.0
@@ -122,6 +134,14 @@ bool FoldersPanel::urlChanged()
return true;
}
+void FoldersPanel::reloadTree()
+{
+ if (m_controller) {
+ loadTree(url());
+ }
+}
+
+
void FoldersPanel::showEvent(QShowEvent* event)
{
if (event->spontaneous()) {
@@ -304,8 +324,13 @@ void FoldersPanel::loadTree(const QUrl& url)
QUrl baseUrl;
if (url.isLocalFile()) {
- // Use the root directory as base for local URLs (#150941)
- baseUrl = QUrl::fromLocalFile(QDir::rootPath());
+ const bool isInHomeFolder = Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url);
+ if (FoldersPanelSettings::limitFoldersPanelToHome() && isInHomeFolder) {
+ baseUrl = Dolphin::homeUrl();
+ } else {
+ // Use the root directory as base for local URLs (#150941)
+ baseUrl = QUrl::fromLocalFile(QDir::rootPath());
+ }
} else {
// Clear the path for non-local URLs and use it as base
baseUrl = url;
@@ -320,9 +345,13 @@ void FoldersPanel::loadTree(const QUrl& url)
const int index = m_model->index(url);
if (index >= 0) {
updateCurrentItem(index);
+ } else if (url == baseUrl) {
+ // clear the selection when visiting the base url
+ updateCurrentItem(-1);
} else {
m_updateCurrentItem = true;
m_model->expandParentDirectories(url);
+
// slotLoadingCompleted() will be invoked after the model has
// expanded the url
}
diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h
index 7c591cc20..5f0b9a378 100644
--- a/src/panels/folders/folderspanel.h
+++ b/src/panels/folders/folderspanel.h
@@ -43,7 +43,9 @@ public:
virtual ~FoldersPanel();
void setShowHiddenFiles(bool show);
+ void setLimitFoldersPanelToHome(bool enable);
bool showHiddenFiles() const;
+ bool limitFoldersPanelToHome() const;
void setAutoScrolling(bool enable);
bool autoScrolling() const;
@@ -81,6 +83,7 @@ private slots:
*/
void startFadeInAnimation();
+
private:
/**
* Initializes the base URL of the tree and expands all
@@ -89,6 +92,8 @@ private:
*/
void loadTree(const QUrl& url);
+ void reloadTree();
+
/**
* Sets the item with the index \a index as current item, selects
* the item and assures that the item will be visible.
diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp
index 51fc229c1..6381a88ff 100644
--- a/src/panels/folders/treeviewcontextmenu.cpp
+++ b/src/panels/folders/treeviewcontextmenu.cpp
@@ -43,6 +43,7 @@
#include <QClipboard>
#include <QMimeData>
#include <QPointer>
+#include "global.h"
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
@@ -124,6 +125,17 @@ void TreeViewContextMenu::open()
popup->addAction(showHiddenFilesAction);
connect(showHiddenFilesAction, &QAction::toggled, this, &TreeViewContextMenu::setShowHiddenFiles);
+ // insert 'Limit to Home Directory'
+ const QUrl url = m_fileItem.url();
+ const bool showLimitToHomeDirectory = url.isLocalFile() && (Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url));
+ if (showLimitToHomeDirectory) {
+ QAction* limitFoldersPanelToHomeAction = new QAction(i18nc("@action:inmenu", "Limit to Home Directory"), this);
+ limitFoldersPanelToHomeAction->setCheckable(true);
+ limitFoldersPanelToHomeAction->setChecked(m_parent->limitFoldersPanelToHome());
+ popup->addAction(limitFoldersPanelToHomeAction);
+ connect(limitFoldersPanelToHomeAction, &QAction::toggled, this, &TreeViewContextMenu::setLimitFoldersPanelToHome);
+ }
+
// insert 'Automatic Scrolling'
QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
autoScrollingAction->setCheckable(true);
@@ -229,6 +241,11 @@ void TreeViewContextMenu::setShowHiddenFiles(bool show)
m_parent->setShowHiddenFiles(show);
}
+void TreeViewContextMenu::setLimitFoldersPanelToHome(bool enable)
+{
+ m_parent->setLimitFoldersPanelToHome(enable);
+}
+
void TreeViewContextMenu::setAutoScrolling(bool enable)
{
m_parent->setAutoScrolling(enable);
diff --git a/src/panels/folders/treeviewcontextmenu.h b/src/panels/folders/treeviewcontextmenu.h
index 598ffaed6..93ddd7aef 100644
--- a/src/panels/folders/treeviewcontextmenu.h
+++ b/src/panels/folders/treeviewcontextmenu.h
@@ -79,6 +79,12 @@ private slots:
void setShowHiddenFiles(bool show);
/**
+ * Sets the 'Limit folders panel to home' setting for the
+ * folders panel to \a enable.
+ */
+ void setLimitFoldersPanelToHome(bool enable);
+
+ /**
* Sets the 'Automatic Scrolling' setting for the
* folders panel to \a enable.
*/
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index b32f8204d..4ba1217f0 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -316,7 +316,7 @@ void PlacesItem::updateBookmarkForRole(const QByteArray& role)
}
} else if (role == "url") {
m_bookmark.setUrl(url());
- } else if (role == "udi)") {
+ } else if (role == "udi") {
m_bookmark.setMetaDataItem(QStringLiteral("UDI"), udi());
} else if (role == "isSystemItem") {
m_bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), isSystemItem() ? QStringLiteral("true") : QStringLiteral("false"));
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 3c9309435..19a17be08 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -25,6 +25,7 @@
#include "dolphin_generalsettings.h"
+#include "global.h"
#include <KFileItem>
#include "dolphindebug.h"
#include <KDirNotify>
@@ -192,6 +193,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
}
}
+ QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme("window-new"), i18nc("@item:inmenu", "Open in New Window"));
QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@item:inmenu", "Open in New Tab"));
if (!isDevice && !isTrash) {
menu.addSeparator();
@@ -232,6 +234,8 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
} else if (action == hideAction) {
item->setHidden(hideAction->isChecked());
m_model->saveBookmarks();
+ } else if (action == openInNewWindowAction) {
+ Dolphin::openNewWindow({PlacesItemModel::convertedUrl(m_model->data(index).value("url").toUrl())}, this);
} else if (action == openInNewTabAction) {
// TriggerItem does set up the storage first and then it will
// emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
diff --git a/src/settings/additionalinfodialog.cpp b/src/settings/additionalinfodialog.cpp
index 23a65b5ac..4589b5d44 100644
--- a/src/settings/additionalinfodialog.cpp
+++ b/src/settings/additionalinfodialog.cpp
@@ -69,9 +69,9 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
QListWidgetItem* item = new QListWidgetItem(info.translation, m_listWidget);
item->setCheckState(visibleRoles.contains(info.role) ? Qt::Checked : Qt::Unchecked);
- const bool enable = (!info.requiresBaloo && !info.requiresIndexer) ||
+ const bool enable = ((!info.requiresBaloo && !info.requiresIndexer) ||
(info.requiresBaloo) ||
- (info.requiresIndexer && indexingEnabled);
+ (info.requiresIndexer && indexingEnabled)) && info.role != "text";
if (!enable) {
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp
index f01d220dd..1a92cd16c 100644
--- a/src/settings/general/previewssettingspage.cpp
+++ b/src/settings/general/previewssettingspage.cpp
@@ -81,7 +81,7 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
m_remoteFileSizeBox->setSuffix(QStringLiteral(" MB"));
m_remoteFileSizeBox->setRange(0, 9999999); /* MB */
- QHBoxLayout* fileSizeBoxLayout = new QHBoxLayout(this);
+ QHBoxLayout* fileSizeBoxLayout = new QHBoxLayout();
fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight);
fileSizeBoxLayout->addWidget(m_remoteFileSizeBox);
diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp
index 632ae99da..a673769ad 100644
--- a/src/settings/viewmodes/viewsettingstab.cpp
+++ b/src/settings/viewmodes/viewsettingstab.cpp
@@ -133,7 +133,9 @@ ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) :
topLayout->addWidget(iconSizeGroup);
topLayout->addWidget(textGroup);
- topLayout->addWidget(m_expandableFolders);
+ if (m_expandableFolders) {
+ topLayout->addWidget(m_expandableFolders);
+ }
topLayout->addStretch(1);
loadSettings();
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index f4104d9cf..d0b9e7dc1 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -107,19 +107,9 @@ void DolphinViewActionHandler::createActions()
// File menu
- QAction* rename = m_actionCollection->addAction(QStringLiteral("rename"));
- rename->setText(i18nc("@action:inmenu File", "Rename..."));
- m_actionCollection->setDefaultShortcut(rename, Qt::Key_F2);
- rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
- connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename);
-
- QAction* moveToTrash = m_actionCollection->addAction(QStringLiteral("move_to_trash"));
- moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
- moveToTrash->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
- m_actionCollection->setDefaultShortcut(moveToTrash, QKeySequence::Delete);
- connect(moveToTrash, &QAction::triggered,
- this, &DolphinViewActionHandler::slotTrashActivated);
+ KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection);
+ KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
auto deleteShortcuts = deleteAction->shortcuts();
if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) {
@@ -127,7 +117,7 @@ void DolphinViewActionHandler::createActions()
m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts);
}
- // This action is useful for being enabled when "move_to_trash" should be
+ // This action is useful for being enabled when KStandardAction::MoveToTrash should be
// disabled and KStandardAction::DeleteFile 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.
@@ -159,11 +149,11 @@ void DolphinViewActionHandler::createActions()
connect(viewModeActions, static_cast<void(KSelectAction::*)(QAction*)>(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered);
KStandardAction::zoomIn(this,
- SLOT(zoomIn()),
+ &DolphinViewActionHandler::zoomIn,
m_actionCollection);
KStandardAction::zoomOut(this,
- SLOT(zoomOut()),
+ &DolphinViewActionHandler::zoomOut,
m_actionCollection);
KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview"));
diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp
index 4c5825635..9375172eb 100644
--- a/src/views/tooltips/tooltipmanager.cpp
+++ b/src/views/tooltips/tooltipmanager.cpp
@@ -39,7 +39,6 @@ ToolTipManager::ToolTipManager(QWidget* parent) :
m_contentRetrievalTimer(0),
m_transientParent(0),
m_fileMetaDataWidget(0),
- m_tooltipWidget(new KToolTipWidget()),
m_toolTipRequested(false),
m_metaDataRequested(false),
m_appliedWaitCursor(false),
@@ -106,7 +105,9 @@ void ToolTipManager::hideToolTip()
m_metaDataRequested = false;
m_showToolTipTimer->stop();
m_contentRetrievalTimer->stop();
- m_tooltipWidget->hideLater();
+ if (m_tooltipWidget) {
+ m_tooltipWidget->hideLater();
+ }
}
void ToolTipManager::startContentRetrieval()
@@ -201,6 +202,9 @@ void ToolTipManager::showToolTip()
// Adjust the size to get a proper sizeHint()
m_fileMetaDataWidget->adjustSize();
+ if (!m_tooltipWidget) {
+ m_tooltipWidget.reset(new KToolTipWidget());
+ }
m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataWidget, m_transientParent);
m_toolTipRequested = false;
}