Commit 3119dac1 authored by Jan Paul Batrina's avatar Jan Paul Batrina Committed by Elvis Angelaccio

Enable "Extract archive to..." file menu action on read only folders

The whole extract archive menu is disabled when an archive is in a read-only directory.
This patch makes it so that the whole menu is replaced by the "Extract archive to..." action on such folders.
parent bd38caa7
......@@ -68,36 +68,40 @@ QList<QAction*> ExtractFileItemAction::actions(const KFileItemListProperties& fi
return {};
}
QMenu *extractMenu = new QMenu(parentWidget);
extractMenu->addAction(createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here"),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination %F")));
extractMenu->addAction(createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive to..."),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination --dialog %F")));
extractMenu->addAction(createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here, autodetect subfolder"),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination --autosubfolder %F")));
QAction *extractMenuAction = new QAction(i18nc("@action:inmenu Extract submenu in Dolphin context menu", "Extract"), parentWidget);
extractMenuAction->setMenu(extractMenu);
extractMenuAction->setIcon(icon);
// #189177: disable extract menu in read-only folders.
QAction *extractToAction = createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive to..."),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination --dialog %F"));
// #189177: disable "extract here" actions in read-only folders.
if (readOnlyParentDir) {
extractMenuAction->setEnabled(false);
actions << extractToAction;
} else {
QMenu *extractMenu = new QMenu(parentWidget);
extractMenu->addAction(createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here"),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination %F")));
extractMenu->addAction(extractToAction);
extractMenu->addAction(createAction(icon,
i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here, autodetect subfolder"),
parentWidget,
supportedUrls,
QStringLiteral("ark --batch --autodestination --autosubfolder %F")));
QAction *extractMenuAction = new QAction(i18nc("@action:inmenu Extract submenu in Dolphin context menu", "Extract"), parentWidget);
extractMenuAction->setMenu(extractMenu);
extractMenuAction->setIcon(icon);
actions << extractMenuAction;
}
actions << extractMenuAction;
return actions;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment