]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Properly disable create_dir action in Trash
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Mon, 2 Jan 2017 13:52:37 +0000 (14:52 +0100)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Mon, 2 Jan 2017 13:54:38 +0000 (14:54 +0100)
`isFolderWritable` is set in DolphinView::updateWritableState() according to
KFileItemListProperties::supportsWriting().
However, `writing=true` does not imply `makedir=true`,
in an ioslave's .protocol file. An example is the trash protocol.

So we need to enable the `create_dir` action only if the protocol is
actually able to create folders.

CCBUG: 332463
REVIEW: 129712

src/views/dolphinviewactionhandler.cpp

index 858f9299b96d22ebbd81f324661cec3f3ff895e0..5c0b49cd206c371fd5dda83895dd93f9e1f37be2 100644 (file)
@@ -37,6 +37,7 @@
 #include <KSelectAction>
 #include <KToggleAction>
 #include <KPropertiesDialog>
 #include <KSelectAction>
 #include <KToggleAction>
 #include <KPropertiesDialog>
+#include <KProtocolManager>
 #include <QIcon>
 
 #include "dolphindebug.h"
 #include <QIcon>
 
 #include "dolphindebug.h"
@@ -486,7 +487,8 @@ void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
 
 void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
 {
 
 void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
 {
-    m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable);
+    m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable &&
+                                                                         KProtocolManager::supportsMakeDir(currentView()->url()));
 }
 
 KToggleAction* DolphinViewActionHandler::iconsModeAction()
 }
 
 KToggleAction* DolphinViewActionHandler::iconsModeAction()