fix: cut option enabled

This commit is contained in:
kate 2022-01-01 13:04:49 +08:00
parent 6f7c03b9f5
commit 9c5b3bc3cd

View file

@ -1011,6 +1011,9 @@ void FolderModel::openSelected()
if (!m_selectionModel->hasSelection()) if (!m_selectionModel->hasSelection())
return; return;
if (resolvedUrl().scheme() == QLatin1String("trash"))
return;
const QList<QUrl> urls = selectedUrls(); const QList<QUrl> urls = selectedUrls();
if (!m_isDesktop) { if (!m_isDesktop) {
if (urls.size() == 1 && KFileItem(urls.first()).isDir()) { if (urls.size() == 1 && KFileItem(urls.first()).isDir()) {
@ -1875,6 +1878,7 @@ void FolderModel::updateActions()
if (QAction *cutAction = m_actionCollection.action(QStringLiteral("cut"))) { if (QAction *cutAction = m_actionCollection.action(QStringLiteral("cut"))) {
cutAction->setVisible(!isTrash); cutAction->setVisible(!isTrash);
cutAction->setEnabled(rootItem().isWritable());
} }
if (QAction *restoreAction = m_actionCollection.action(QStringLiteral("restore"))) { if (QAction *restoreAction = m_actionCollection.action(QStringLiteral("restore"))) {