]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Prevent "Two clicks renaming" if the selected file/folder is not movable
authorAndreas Krutzler <andi.krutzler@gmail.com>
Sat, 11 Nov 2017 02:32:53 +0000 (19:32 -0700)
committerNathaniel Graham <pointedstick@zoho.com>
Sat, 11 Nov 2017 02:33:27 +0000 (19:33 -0700)
Summary:
Two clicks renaming doesn't check if the user is actually allowed to rename a file/folder. With this patch, this get fixed.
Depends on D7647

Reviewers: rkflx, #dolphin, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: elvisangelaccio, ngraham, #dolphin

Differential Revision: https://phabricator.kde.org/D8740

src/views/dolphinview.cpp

index 4485c1707909aa5beb665fc22d470db907a43ecd..cd802eec1c1612016b493d0e6d5daa50793454be 100644 (file)
@@ -1125,8 +1125,12 @@ void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons
 void DolphinView::slotSelectedItemTextPressed(int index)
 {
     if (GeneralSettings::renameInline()) {
-        m_twoClicksRenamingItemUrl = m_model->fileItem(index).url();
-        m_twoClicksRenamingTimer->start(QApplication::doubleClickInterval());
+        const KFileItem item = m_model->fileItem(index);
+        const KFileItemListProperties capabilities(KFileItemList() << item);
+        if (capabilities.supportsMoving()) {
+            m_twoClicksRenamingItemUrl = item.url();
+            m_twoClicksRenamingTimer->start(QApplication::doubleClickInterval());
+        }
     }
 }