]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Compile without foreach
[dolphin.git] / src / views / dolphinview.cpp
index 48f41bb0e85f1de848f18a1803d6ce4905a6d2bf..e69f18d7eb652951da3b180bef843aad4f4405e3 100644 (file)
@@ -1,22 +1,9 @@
-/***************************************************************************
- *   Copyright (C) 2006-2009 by Peter Penz <peter.penz19@gmail.com>        *
- *   Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net>          *
- *                                                                         *
- *   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            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2006-2009 Peter Penz <peter.penz19@gmail.com>
+ * SPDX-FileCopyrightText: 2006 Gregor Kališnik <gregor@podnapisi.net>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "dolphinview.h"
 
@@ -31,7 +18,6 @@
 #include "kitemviews/kitemlistcontroller.h"
 #include "kitemviews/kitemlistheader.h"
 #include "kitemviews/kitemlistselectionmanager.h"
-#include "renamedialog.h"
 #include "versioncontrol/versioncontrolobserver.h"
 #include "viewproperties.h"
 #include "views/tooltips/tooltipmanager.h"
@@ -52,6 +38,7 @@
 #include <KIO/Paste>
 #include <KIO/PasteJob>
 #include <KIO/PreviewJob>
+#include <KIO/RenameFileDialog>
 #include <KJobWidgets>
 #include <KLocalizedString>
 #include <KMessageBox>
 #include <QDropEvent>
 #include <QGraphicsSceneDragDropEvent>
 #include <QMenu>
+#include <QMimeDatabase>
 #include <QPixmapCache>
 #include <QPointer>
 #include <QScrollBar>
+#include <QSize>
 #include <QTimer>
 #include <QVBoxLayout>
 
@@ -97,7 +86,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
 {
     m_topLayout = new QVBoxLayout(this);
     m_topLayout->setSpacing(0);
-    m_topLayout->setMargin(0);
+    m_topLayout->setContentsMargins(0, 0, 0, 0);
 
     // When a new item has been created by the "Create New..." menu, the item should
     // get selected and it must be assured that the item will get visible. As the
@@ -128,8 +117,8 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     m_container = new KItemListContainer(controller, this);
     m_container->installEventFilter(this);
     setFocusProxy(m_container);
-    connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
-    connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
+    connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
+    connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
 
     controller->setSelectionBehavior(KItemListController::MultiSelection);
     connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
@@ -145,6 +134,9 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading);
     connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged);
     connect(controller, &KItemListController::selectedItemTextPressed, this, &DolphinView::slotSelectedItemTextPressed);
+    connect(controller, &KItemListController::increaseZoom, this, &DolphinView::slotIncreaseZoom);
+    connect(controller, &KItemListController::decreaseZoom, this, &DolphinView::slotDecreaseZoom);
+    connect(controller, &KItemListController::swipeUp, this, &DolphinView::slotSwipeUp);
 
     connect(m_model, &KFileItemModel::directoryLoadingStarted,       this, &DolphinView::slotDirectoryLoadingStarted);
     connect(m_model, &KFileItemModel::directoryLoadingCompleted,     this, &DolphinView::slotDirectoryLoadingCompleted);
@@ -182,6 +174,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
 #endif
 
     m_versionControlObserver = new VersionControlObserver(this);
+    m_versionControlObserver->setView(this);
     m_versionControlObserver->setModel(m_model);
     connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
     connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
@@ -361,7 +354,7 @@ void DolphinView::markUrlAsCurrent(const QUrl &url)
     m_scrollToCurrentItem = true;
 }
 
-void DolphinView::selectItems(const QRegExp& pattern, bool enabled)
+void DolphinView::selectItems(const QRegularExpression &regexp, bool enabled)
 {
     const KItemListSelectionManager::SelectionMode mode = enabled
                                                         ? KItemListSelectionManager::Select
@@ -370,7 +363,7 @@ void DolphinView::selectItems(const QRegExp& pattern, bool enabled)
 
     for (int index = 0; index < m_model->count(); index++) {
         const KFileItem item = m_model->fileItem(index);
-        if (pattern.exactMatch(item.text())) {
+        if (regexp.match(item.text()).hasMatch()) {
             // An alternative approach would be to store the matching items in a KItemSet and
             // select them in one go after the loop, but we'd need a new function
             // KItemListSelectionManager::setSelected(KItemSet, SelectionMode mode)
@@ -519,7 +512,7 @@ QString DolphinView::statusBarText() const
     if (m_container->controller()->selectionManager()->hasSelection()) {
         // Give a summary of the status of the selected files
         const KFileItemList list = selectedItems();
-        foreach (const KFileItem& item, list) {
+        for (const KFileItem& item : list) {
             if (item.isDir()) {
                 ++folderCount;
             } else {
@@ -635,12 +628,11 @@ void DolphinView::renameSelectedItems()
         connect(m_view, &DolphinItemListView::roleEditingFinished,
                 this, &DolphinView::slotRoleEditingFinished);
     } else {
-        RenameDialog* dialog = new RenameDialog(this, items);
-        connect(dialog, &RenameDialog::renamingFinished, this, &DolphinView::slotRenameDialogRenamingFinished);
+        KIO::RenameFileDialog* dialog = new KIO::RenameFileDialog(items, this);
+        connect(dialog, &KIO::RenameFileDialog::renamingFinished,
+                this, &DolphinView::slotRenameDialogRenamingFinished);
 
-        dialog->show();
-        dialog->raise();
-        dialog->activateWindow();
+        dialog->open();
     }
 
     // Assure that the current index remains visible when KFileItemModel
@@ -677,19 +669,40 @@ void DolphinView::deleteSelectedItems()
     }
 }
 
-void DolphinView::cutSelectedItems()
+void DolphinView::cutSelectedItemsToClipboard()
 {
     QMimeData* mimeData = selectionMimeData();
     KIO::setClipboardDataCut(mimeData, true);
     QApplication::clipboard()->setMimeData(mimeData);
 }
 
-void DolphinView::copySelectedItems()
+void DolphinView::copySelectedItemsToClipboard()
 {
     QMimeData* mimeData = selectionMimeData();
     QApplication::clipboard()->setMimeData(mimeData);
 }
 
+void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
+{
+    KIO::CopyJob* job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags);
+    KJobWidgets::setWindow(job, this);
+
+    connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
+    connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotCopyingDone);
+    KIO::FileUndoManager::self()->recordCopyJob(job);
+}
+
+void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
+{
+    KIO::CopyJob* job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags);
+    KJobWidgets::setWindow(job, this);
+
+    connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
+    connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotCopyingDone);
+    KIO::FileUndoManager::self()->recordCopyJob(job);
+
+}
+
 void DolphinView::paste()
 {
     pasteToUrl(url());
@@ -703,6 +716,53 @@ void DolphinView::pasteIntoFolder()
     }
 }
 
+void DolphinView::duplicateSelectedItems()
+{
+    const KFileItemList itemList = selectedItems();
+    if (itemList.isEmpty()) {
+        return;
+    }
+
+    const QMimeDatabase db;
+
+    // Duplicate all selected items and append "copy" to the end of the file name
+    // but before the filename extension, if present
+    QList<QUrl> newSelection;
+    for (const auto &item : itemList) {
+        const QUrl originalURL  = item.url();
+        const QString originalDirectoryPath = originalURL.adjusted(QUrl::RemoveFilename).path();
+        const QString originalFileName = item.name();
+
+        QString extension = db.suffixForFileName(originalFileName);
+
+        QUrl duplicateURL = originalURL;
+
+        // No extension; new filename is "<oldfilename> copy"
+        if (extension.isEmpty()) {
+            duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFileName));
+        // There's an extension; new filename is "<oldfilename> copy.<extension>"
+        } else {
+            // Need to add a dot since QMimeDatabase::suffixForFileName() doesn't include it
+            extension = QLatin1String(".") + extension;
+            const QString originalFilenameWithoutExtension = originalFileName.chopped(extension.size());
+            // Preserve file's original filename extension in case the casing differs
+            // from what QMimeDatabase::suffixForFileName() returned
+            const QString originalExtension = originalFileName.right(extension.size());
+            duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFilenameWithoutExtension) + originalExtension);
+        }
+
+        KIO::CopyJob* job = KIO::copyAs(originalURL, duplicateURL);
+        KJobWidgets::setWindow(job, this);
+
+        if (job) {
+            newSelection << duplicateURL;
+            KIO::FileUndoManager::self()->recordCopyJob(job);
+        }
+    }
+
+    forceUrlsSelection(newSelection.first(), newSelection);
+}
+
 void DolphinView::stopLoading()
 {
     m_model->cancelDirectoryLoading();
@@ -710,7 +770,7 @@ void DolphinView::stopLoading()
 
 void DolphinView::updatePalette()
 {
-    QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
+    QColor color = KColorScheme(isActiveWindow() ? QPalette::Active : QPalette::Inactive, KColorScheme::View).background().color();
     if (!m_active) {
         color.setAlpha(150);
     }
@@ -739,7 +799,13 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
         QPixmapCache::clear();
         break;
 
+    case QEvent::WindowActivate:
+    case QEvent::WindowDeactivate:
+        updatePalette();
+        break;
+
     case QEvent::KeyPress:
+        hideToolTip(ToolTipManager::HideBehavior::Instantly);
         if (GeneralSettings::useTabForSwitchingSplitView()) {
             QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
             if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) {
@@ -849,7 +915,7 @@ void DolphinView::slotItemsActivated(const KItemSet& indexes)
         const QUrl& url = openItemAsFolderUrl(item);
 
         if (!url.isEmpty()) { // Open folders in new tabs
-            emit tabRequested(url);
+            emit tabRequested(url, DolphinTabWidget::AfterLastTab);
         } else {
             items.append(item);
         }
@@ -867,9 +933,9 @@ void DolphinView::slotItemMiddleClicked(int index)
     const KFileItem& item = m_model->fileItem(index);
     const QUrl& url = openItemAsFolderUrl(item);
     if (!url.isEmpty()) {
-        emit tabRequested(url);
+        emit tabRequested(url, DolphinTabWidget::AfterCurrentTab);
     } else if (isTabsForFilesEnabled()) {
-        emit tabRequested(item.url());
+        emit tabRequested(item.url(), DolphinTabWidget::AfterCurrentTab);
     }
 }
 
@@ -897,7 +963,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
     QPointer<QMenu> menu = new QMenu(QApplication::activeWindow());
 
     KItemListView* view = m_container->controller()->view();
-    const QSet<QByteArray> visibleRolesSet = view->visibleRoles().toSet();
+    const QList<QByteArray> visibleRolesSet = view->visibleRoles();
 
     bool indexingEnabled = false;
 #ifdef HAVE_BALOO
@@ -910,7 +976,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
 
     // Add all roles to the menu that can be shown or hidden by the user
     const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
-    foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
+    for (const KFileItemModel::RoleInfo& info : rolesInfo) {
         if (info.role == "text") {
             // It should not be possible to hide the "text" role
             continue;
@@ -967,8 +1033,9 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
             // Apply the current column-widths as custom column-widths and turn
             // off the automatic resizing of the columns
             QList<int> columnWidths;
-            columnWidths.reserve(view->visibleRoles().count());
-            foreach (const QByteArray& role, view->visibleRoles()) {
+            const auto visibleRoles = view->visibleRoles();
+            columnWidths.reserve(visibleRoles.count());
+            for (const QByteArray& role : visibleRoles) {
                 columnWidths.append(header->columnWidth(role));
             }
             props.setHeaderColumnWidths(columnWidths);
@@ -989,8 +1056,9 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
 
             QList<int> columnWidths;
             if (!header->automaticColumnResizing()) {
-                columnWidths.reserve(view->visibleRoles().count());
-                foreach (const QByteArray& role, view->visibleRoles()) {
+                const auto visibleRoles = view->visibleRoles();
+                columnWidths.reserve(visibleRoles.count());
+                for (const QByteArray& role : visibleRoles) {
                     columnWidths.append(header->columnWidth(role));
                 }
             }
@@ -1011,7 +1079,7 @@ void DolphinView::slotHeaderColumnWidthChangeFinished(const QByteArray& role, qr
         columnWidths.clear();
         columnWidths.reserve(visibleRoles.count());
         const KItemListHeader* header = m_view->header();
-        foreach (const QByteArray& role, visibleRoles) {
+        for (const QByteArray& role : visibleRoles) {
             const int width = header->columnWidth(role);
             columnWidths.append(width);
         }
@@ -1043,7 +1111,7 @@ void DolphinView::slotItemHovered(int index)
 
 void DolphinView::slotItemUnhovered(int index)
 {
-    Q_UNUSED(index);
+    Q_UNUSED(index)
     hideToolTip();
     emit requestItemInfo(KFileItem());
 }
@@ -1077,7 +1145,7 @@ void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *
     KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget);
 
     if (job) {
-        connect(job, &KIO::DropJob::result, this, &DolphinView::slotPasteJobResult);
+        connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
 
         if (destUrl == url()) {
             // Mark the dropped urls as selected.
@@ -1107,7 +1175,7 @@ void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* prev
 
 void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons)
 {
-    Q_UNUSED(itemIndex);
+    Q_UNUSED(itemIndex)
 
     hideToolTip();
 
@@ -1120,7 +1188,7 @@ void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons
 
 void DolphinView::slotSelectedItemTextPressed(int index)
 {
-    if (GeneralSettings::renameInline()) {
+    if (GeneralSettings::renameInline() && !m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
         const KFileItem item = m_model->fileItem(index);
         const KFileItemListProperties capabilities(KFileItemList() << item);
         if (capabilities.supportsMoving()) {
@@ -1130,6 +1198,11 @@ void DolphinView::slotSelectedItemTextPressed(int index)
     }
 }
 
+void DolphinView::slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to)
+{
+    slotItemCreated(to);
+}
+
 void DolphinView::slotItemCreated(const QUrl& url)
 {
     if (m_markFirstNewlySelectedItemAsCurrent) {
@@ -1139,13 +1212,13 @@ void DolphinView::slotItemCreated(const QUrl& url)
     m_selectedUrls << url;
 }
 
-void DolphinView::slotPasteJobResult(KJob *job)
+void DolphinView::slotJobResult(KJob *job)
 {
     if (job->error()) {
         emit errorMessage(job->errorString());
     }
     if (!m_selectedUrls.isEmpty()) {
-        m_selectedUrls << KDirModel::simplifiedUrlList(m_selectedUrls);
+        m_selectedUrls = KDirModel::simplifiedUrlList(m_selectedUrls);
     }
 }
 
@@ -1333,6 +1406,20 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
     return QUrl();
 }
 
+void DolphinView::resetZoomLevel()
+{
+    ViewModeSettings::ViewMode mode;
+
+    switch (m_mode) {
+    case IconsView:     mode = ViewModeSettings::IconsMode;   break;
+    case CompactView:   mode = ViewModeSettings::CompactMode; break;
+    case DetailsView:   mode = ViewModeSettings::DetailsMode; break;
+    }
+    const ViewModeSettings settings(mode);
+    const QSize iconSize = QSize(settings.iconSize(), settings.iconSize());
+    setZoomLevel(ZoomLevelInfo::zoomLevelForIconSize(iconSize));
+}
+
 void DolphinView::observeCreatedItem(const QUrl& url)
 {
     if (m_active) {
@@ -1410,12 +1497,14 @@ void DolphinView::updateViewState()
     }
 }
 
-void DolphinView::hideToolTip()
+void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
 {
 #ifdef HAVE_BALOO
     if (GeneralSettings::showToolTips()) {
-        m_toolTipManager->hideToolTip();
+        m_toolTipManager->hideToolTip(behavior);
     }
+#else
+        Q_UNUSED(behavior)
 #endif
 }
 
@@ -1424,13 +1513,31 @@ void DolphinView::calculateItemCount(int& fileCount,
                                      KIO::filesize_t& totalFileSize) const
 {
     const int itemCount = m_model->count();
+
+    bool countFileSize = true;
+
+    if (!m_model->rootItem().url().isValid()) {
+        return;
+    }
+
+    // In case we have a precomputed value
+    const auto job = KIO::statDetails(m_model->rootItem().url(), KIO::StatJob::SourceSide, KIO::StatRecursiveSize, KIO::HideProgressInfo);
+    job->exec();
+    const auto entry =  job->statResult();
+    if (entry.contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) {
+        totalFileSize = static_cast<KIO::filesize_t>(entry.numberValue(KIO::UDSEntry::UDS_RECURSIVE_SIZE));
+        countFileSize = false;
+    }
+
     for (int i = 0; i < itemCount; ++i) {
         const KFileItem item = m_model->fileItem(i);
         if (item.isDir()) {
             ++folderCount;
         } else {
             ++fileCount;
-            totalFileSize += item.size();
+            if (countFileSize) {
+                totalFileSize += item.size();
+            }
         }
     }
 }
@@ -1488,7 +1595,7 @@ void DolphinView::slotRenamingResult(KJob* job)
 void DolphinView::slotDirectoryLoadingStarted()
 {
     // Disable the writestate temporary until it can be determined in a fast way
-    // in DolphinView::slotLoadingCompleted()
+    // in DolphinView::slotDirectoryLoadingCompleted()
     if (m_isFolderWritable) {
         m_isFolderWritable = false;
         emit writeStateChanged(m_isFolderWritable);
@@ -1515,7 +1622,7 @@ void DolphinView::slotItemsChanged()
 
 void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
 {
-    Q_UNUSED(previous);
+    Q_UNUSED(previous)
     Q_ASSERT(m_model->sortOrder() == current);
 
     ViewProperties props(viewPropertiesUrl());
@@ -1526,7 +1633,7 @@ void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOr
 
 void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous)
 {
-    Q_UNUSED(previous);
+    Q_UNUSED(previous)
     Q_ASSERT(m_model->sortRole() == current);
 
     ViewProperties props(viewPropertiesUrl());
@@ -1538,7 +1645,7 @@ void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const Q
 void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& current,
                                                   const QList<QByteArray>& previous)
 {
-    Q_UNUSED(previous);
+    Q_UNUSED(previous)
     Q_ASSERT(m_container->controller()->view()->visibleRoles() == current);
 
     const QList<QByteArray> previousVisibleRoles = m_visibleRoles;
@@ -1569,12 +1676,35 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
     if (role == "text") {
         const KFileItem oldItem = m_model->fileItem(index);
         const QString newName = value.toString();
-        if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
+        if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) {
             const QUrl oldUrl = oldItem.url();
 
             QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
             newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));
 
+#ifndef Q_OS_WIN
+            //Confirm hiding file/directory by renaming inline
+            if (!hiddenFilesShown() && newName.startsWith(QLatin1Char('.')) && !oldItem.name().startsWith(QLatin1Char('.'))) {
+                KGuiItem yesGuiItem(KStandardGuiItem::yes());
+                yesGuiItem.setText(i18nc("@action:button", "Rename and Hide"));
+
+                const auto code = KMessageBox::questionYesNo(this,
+                                                             oldItem.isFile() ? i18n("Adding a dot to the beginning of this file's name will hide it from view.\n"
+                                                                                     "Do you still want to rename it?")
+                                                                              : i18n("Adding a dot to the beginning of this folder's name will hide it from view.\n"
+                                                                                     "Do you still want to rename it?"),
+                                                             oldItem.isFile() ? i18n("Hide this File?") : i18n("Hide this Folder?"),
+                                                             yesGuiItem,
+                                                             KStandardGuiItem::cancel(),
+                                                             QStringLiteral("ConfirmHide")
+                                                            );
+
+                if (code == KMessageBox::No) {
+                   return;
+                }
+            }
+#endif
+
             const bool newNameExistsAlready = (m_model->index(newUrl) >= 0);
             if (!newNameExistsAlready) {
                 // Only change the data in the model if no item with the new name
@@ -1739,7 +1869,7 @@ void DolphinView::pasteToUrl(const QUrl& url)
     m_clearSelectionBeforeSelectingNewItems = true;
     m_markFirstNewlySelectedItemAsCurrent = true;
     connect(job, &KIO::PasteJob::itemCreated, this, &DolphinView::slotItemCreated);
-    connect(job, &KIO::PasteJob::result, this, &DolphinView::slotPasteJobResult);
+    connect(job, &KIO::PasteJob::result, this, &DolphinView::slotJobResult);
 }
 
 QList<QUrl> DolphinView::simplifiedSelectedUrls() const
@@ -1748,7 +1878,7 @@ QList<QUrl> DolphinView::simplifiedSelectedUrls() const
 
     const KFileItemList items = selectedItems();
     urls.reserve(items.count());
-    foreach (const KFileItem& item, items) {
+    for (const KFileItem& item : items) {
         urls.append(item.url());
     }
 
@@ -1813,3 +1943,36 @@ void DolphinView::forceUrlsSelection(const QUrl& current, const QList<QUrl>& sel
     markUrlAsCurrent(current);
     markUrlsAsSelected(selected);
 }
+
+void DolphinView::copyPathToClipboard()
+{
+    const KFileItemList list = selectedItems();
+    if (list.isEmpty()) {
+        return;
+    }
+    const KFileItem& item = list.at(0);
+    QString path = item.localPath();
+    if (path.isEmpty()) {
+        path = item.url().toDisplayString();
+    }
+    QClipboard* clipboard = QApplication::clipboard();
+    if (clipboard == nullptr) {
+        return;
+    }
+    clipboard->setText(path);
+}
+
+void DolphinView::slotIncreaseZoom()
+{
+    setZoomLevel(zoomLevel() + 1);
+}
+
+void DolphinView::slotDecreaseZoom()
+{
+    setZoomLevel(zoomLevel() - 1);
+}
+
+void DolphinView::slotSwipeUp()
+{
+    emit goUpRequested();
+}