Skip to content

Commit

Permalink
fix: [menu] show ext scenes menu in filedialog
Browse files Browse the repository at this point in the history
show ext scenes menu in filedialog

Log: show ext scenes menu in filedialog

Bug: https://pms.uniontech.com/bug-view-232227.html
  • Loading branch information
Johnson-zs committed Dec 5, 2023
1 parent 990017b commit 6f05831
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void FileDialogMenuScene::filterAction(QMenu *parent, bool isSubMenu)
"open", "rename", "delete", "copy", "cut", "paste" };
static const QStringList whiteSceneList { "NewCreateMenu", "ClipBoardMenu", "OpenDirMenu", "FileOperatorMenu",
"OpenWithMenu", "ShareMenu", "SortAndDisplayMenu" };
static const QStringList extSceneList { "ExtendMenu", "OemMenu", "ExtensionLibMenu" };

auto actions = parent->actions();
for (auto act : actions) {
Expand All @@ -70,17 +71,24 @@ void FileDialogMenuScene::filterAction(QMenu *parent, bool isSubMenu)

QString id { act->property(ActionPropertyKey::kActionID).toString() };
QString sceneName { findSceneName(act) };
if (!isSubMenu) {
if (!whiteActIdList.contains(id) || !whiteSceneList.contains(sceneName)) {
act->setVisible(false);
} else {
auto subMenu = act->menu();
if (subMenu)
filterAction(subMenu, true);
}
} else {

if (extSceneList.contains(sceneName)) {
act->setVisible(true);
continue;
}

if (isSubMenu) {
if (!whiteSceneList.contains(sceneName))
act->setVisible(false);
continue;
}

if (!whiteActIdList.contains(id) || !whiteSceneList.contains(sceneName)) {
act->setVisible(false);
} else {
auto subMenu = act->menu();
if (subMenu)
filterAction(subMenu, true);
}
}
}

0 comments on commit 6f05831

Please sign in to comment.