]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'Applications/17.08'
authorFabian Vogt <fabian@ritter-vogt.de>
Sat, 30 Sep 2017 14:30:14 +0000 (16:30 +0200)
committerFabian Vogt <fabian@ritter-vogt.de>
Sat, 30 Sep 2017 14:30:14 +0000 (16:30 +0200)
31 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/dolphincontextmenu.cpp
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinpart.cpp
src/dolphinpart.rc
src/dolphinremoveaction.cpp
src/dolphinremoveaction.h
src/dolphinui.rc
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/kitemviews/private/kbaloorolesprovider.cpp
src/kitemviews/private/kbaloorolesprovider.h
src/middleclickactioneventfilter.cpp [new file with mode: 0644]
src/middleclickactioneventfilter.h [new file with mode: 0644]
src/org.kde.dolphin.appdata.xml
src/panels/folders/dolphin_folderspanelsettings.kcfg
src/panels/folders/folderspanel.cpp
src/panels/folders/folderspanel.h
src/panels/folders/treeviewcontextmenu.cpp
src/panels/folders/treeviewcontextmenu.h
src/panels/places/placesitem.cpp
src/panels/places/placespanel.cpp
src/settings/additionalinfodialog.cpp
src/settings/general/previewssettingspage.cpp
src/settings/viewmodes/viewsettingstab.cpp
src/views/dolphinviewactionhandler.cpp
src/views/tooltips/tooltipmanager.cpp

index 20ba68100a8359be5ccb81d1660afb7a94c5a2e2..bd0b17586acfe70c616e292512894f624f116dbe 100644 (file)
@@ -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
index 13b94f73b4131000e29f2718af217acbf72a6dea..e1b63358dcf024d08150a2a617514c65aaa984eb 100644 (file)
@@ -110,6 +110,7 @@ set(dolphinprivate_LIB_SRCS
     views/viewproperties.cpp
     views/zoomlevelinfo.cpp
     dolphinremoveaction.cpp
+    middleclickactioneventfilter.cpp
     dolphinnewfilemenu.cpp
     dolphindebug.cpp
 )
index 05082df86207a1d9b313ba1f0084071275d88656..b4d249d761420d468248f6f9ec0b16d5bf13c8ff 100644 (file)
@@ -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)));
index 658b89006fef721e7533f92f845bc667c609884b..3df25001c986407440743d7d694b6cdc319db878 100644 (file)
@@ -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
index d741eb21ed455aa84e1f85c05e3347c4fdc5b355..06eb5a7a50ab3de51aca6b02cc38cd0478f0ab45 100644 (file)
@@ -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();
index ef9b300ca7d910637039cfb56229974a11ad5419..b3b47304e1b211e32bca7424331e27575870f63b 100644 (file)
@@ -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);
             }
         }
     }
index 01bd60009f1a5945c766ae73a435bbfe248385f1..149fa198a4acfd785a56c9391a91df4b86349d6d 100644 (file)
@@ -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"/>
 </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>
index 79d6bed6021bee4dec7ba231cdcea1438de93073..ab1117770f2b76537d675b325cb3bcc60ad4dcfd 100644 (file)
@@ -1,5 +1,6 @@
 /***************************************************************************
- *   Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org                 *
+ *   Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org>                *
+ *   Copyright (C) 2017 by Elvis Angelaccio <elvis.angelaccio@kde.org>     *
  *                                                                         *
  *   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());
     }
index fd8fc35d664a8369419c5c5394de29930d150a4d..6ba25923af3f6c1019fa681a28c97db9e8c83768 100644 (file)
@@ -1,5 +1,6 @@
 /***************************************************************************
- *   Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org                 *
+ *   Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org>                *
+ *   Copyright (C) 2017 by Elvis Angelaccio <elvis.angelaccio@kde.org>     *
  *                                                                         *
  *   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  *
  * 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();
index 9354882468bc1507e4b2f1b362ed31b060777bbb..f2ef106597c8f83682f7a3eb21931563e689eb3a 100644 (file)
@@ -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" />
index 198879f377b52ec9571acc0e5a42847ad2fb834c..d830166109fb8617dc33257cebbaa83d36ccc3bc 100644 (file)
@@ -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);
index e50386ab6388174b31ded5d662ab25fbeff5a990..41c8f0b04b400353e4533f47aaf94a530e3428a7 100644 (file)
@@ -256,6 +256,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
index b725d950797b4620f61955b373f0b8e2399e6360..8f89b89df620fa7cff8d3f36a85f525cbdc21418 100644 (file)
@@ -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 },
index ef902775fcf1abbf340ef382d3e76e6d8ab4f3f6..5dbeb32b2e2a7e416f8f143d595fe2264081a3b1 100644 (file)
@@ -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:
index d6c15afcdbb42ac5ba0d563d00e5d36cf92cc58b..314c2f06bcd23c48a050466063fb7d812073aefc 100644 (file)
@@ -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;
+}
+
index 65b59793cdca051c8acb45fd36a1c37fb4157f90..6fef98edee635884619d16df8008aacf3f1f20c4 100644 (file)
@@ -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 (file)
index 0000000..e091785
--- /dev/null
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *   Copyright (C) 2017 Kai Uwe Broulik <kde@privat.broulik.de>            *
+ *                                                                         *
+ *   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 (file)
index 0000000..6974f46
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *   Copyright (C) 2017 Kai Uwe Broulik <kde@privat.broulik.de>            *
+ *                                                                         *
+ *   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;
+
+};
index 40ff6e8636a367d8db325fd6013a431c16eff374..566529d29a658ec0f97516618c6822c725081f65 100644 (file)
       <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>
index 8b8ca66f82c26cb1d7372a9b13580a302cd73cf7..d7d479fa16478179e8f4bcd9e6e8ce607d340612 100644 (file)
             <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>
index 8b759d813dac6b4fae4d5b2b27cda5a7ff09a2bb..cb35fd2185aae555cfd77d11fa23c5a3bac6bfdb 100644 (file)
@@ -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
     }
index 7c591cc20c78aac23e6aff971d2754aab408f5a6..5f0b9a37881a8abd56cc7bb14cb5e437cb9a3c92 100644 (file)
@@ -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.
index 51fc229c1906f7c5a7f64ee599c2047a75a0425f..6381a88ff13993cfc8e254a00f55e24b15c32405 100644 (file)
@@ -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);
index 598ffaed6a5b537f593f1302bc5f9ec2133ef438..93ddd7aef9cfd95379d174576c9b0c717aa9040f 100644 (file)
@@ -78,6 +78,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.
index b32f8204d76efcdc2474544f52e6d4046ba23240..4ba1217f01bebeb1a360ae1073ab38649264ba26 100644 (file)
@@ -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"));
index 3c9309435be601e5fda724ea1709b6a50aee5ff7..19a17be08e6d456a128efd253bb7fec99fa44903 100644 (file)
@@ -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.
index 23a65b5ac0a96e7f5a1d6812848ef898aa5650a1..4589b5d4477a947622236fa10316a97bd39002ed 100644 (file)
@@ -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);
index f01d220dda50d9d0519eb6cdec312e87d31e639c..1a92cd16c30380a5da9fe112b5e258f6b9c0a955 100644 (file)
@@ -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);
 
index 632ae99da7eac3ff08933a35e70f008611eb3a02..a673769ade679fce5c42debee6848729399995ae 100644 (file)
@@ -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();
index f4104d9cfeef21e166f989cc7d67457c67e00bae..d0b9e7dc1ea6eb0e3505f87d1c5b87ee9195d7c1 100644 (file)
@@ -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"));
index 4c5825635504577bb44c63ffb0b57a29a2f066bb..9375172eb4feefb70a3c8ca07d9debe0145ddc84 100644 (file)
@@ -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;
 }