┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-01-30 22:10:08 +0100
committerFrank Reininghaus <[email protected]>2014-01-30 22:10:31 +0100
commit900a4ba3b9213802c2c7a5329f88704f9f664c70 (patch)
treebd327dfc67f9912be6ffbc4c5a68b21fbed29ddb /src
parentdf2179ec6bd81a0d80dd4e660d4c4c386287817e (diff)
Always enable the "Create New..." menu if the URL is writable
This commit works around the problem that KDirLister may not provide a "rootItem" for some kioslaves by setting up a KFileItem with the view URL and using this to find out if the URL is writable. BUG: 330001 CCBUG: 330015 REVIEW: 115405 FIXED-IN: 4.12.2
Diffstat (limited to 'src')
-rw-r--r--src/views/dolphinview.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 303731c6d..71364e045 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1666,11 +1666,16 @@ void DolphinView::updateWritableState()
const bool wasFolderWritable = m_isFolderWritable;
m_isFolderWritable = false;
- const KFileItem item = m_model->rootItem();
- if (!item.isNull()) {
- KFileItemListProperties capabilities(KFileItemList() << item);
- m_isFolderWritable = capabilities.supportsWriting();
+ KFileItem item = m_model->rootItem();
+ if (item.isNull()) {
+ // Try to find out if the URL is writable even if the "root item" is
+ // null, see https://bugs.kde.org/show_bug.cgi?id=330001
+ item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url(), true);
}
+
+ KFileItemListProperties capabilities(KFileItemList() << item);
+ m_isFolderWritable = capabilities.supportsWriting();
+
if (m_isFolderWritable != wasFolderWritable) {
emit writeStateChanged(m_isFolderWritable);
}