From: Frank Reininghaus Date: Thu, 30 Jan 2014 21:10:08 +0000 (+0100) Subject: Always enable the "Create New..." menu if the URL is writable X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/900a4ba3b9213802c2c7a5329f88704f9f664c70 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 --- 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); }