X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3186f0428888447a783d014afaaa0b44b68ebaba..98c5db504685f125ef5140331c36fafc91bf2945:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 49615d185..726e0d129 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -957,6 +957,22 @@ void DolphinViewContainer::slotStatusBarZoomLevelChanged(int zoomLevel) m_view->setZoomLevel(zoomLevel); } +bool DolphinViewContainer::isTopMostParentFolderWritable(QUrl url) +{ + Q_ASSERT(url.isLocalFile()); + while (url.isValid()) { + url = url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); + QFileInfo info(url.toLocalFile()); + if (info.exists()) { + return info.isWritable(); + } + if (info.isSymLink()) { + return false; + } + } + return false; +} + void DolphinViewContainer::slotErrorMessageFromView(const QString &message, const int kioErrorCode) { if (kioErrorCode == KIO::ERR_CANNOT_ENTER_DIRECTORY && m_view->url().scheme() == QStringLiteral("file") @@ -975,7 +991,7 @@ void DolphinViewContainer::slotErrorMessageFromView(const QString &message, cons } showMessage(i18nc("@info", "Authorization required to enter this folder."), KMessageWidget::Error, {m_authorizeToEnterFolderAction}); return; - } else if (kioErrorCode == KIO::ERR_DOES_NOT_EXIST && m_view->url().isLocalFile()) { + } else if (kioErrorCode == KIO::ERR_DOES_NOT_EXIST && m_view->url().isLocalFile() && isFolderCreatable(m_view->url())) { if (!m_createFolderAction) { m_createFolderAction = new QAction(this); m_createFolderAction->setText(i18nc("@action", "Create missing folder"));