]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Always enable the "Create New..." menu if the URL is writable
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 30 Jan 2014 21:10:08 +0000 (22:10 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 30 Jan 2014 21:10:31 +0000 (22:10 +0100)
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

src/views/dolphinview.cpp

index 303731c6d435229b20f502e246720b0d5fa66335..71364e0451c148ca17b182a05369a08d87e7db71 100644 (file)
@@ -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);
     }