SystemMonitor: Disable menu items for inaccessible process
Disable the context menu items if user cannot access the process. Fixes #7486
This commit is contained in:
parent
c94e1206bd
commit
b06d01f040
Notes:
sideshowbarker
2024-07-18 17:15:58 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/b06d01f0405 Pull-request: https://github.com/SerenityOS/serenity/pull/7526 Issue: https://github.com/SerenityOS/serenity/issues/7486
1 changed files with 12 additions and 1 deletions
|
@ -352,7 +352,18 @@ int main(int argc, char** argv)
|
|||
window->set_menubar(move(menubar));
|
||||
|
||||
process_table_view.on_activation = [&](auto&) {
|
||||
process_properties_action->activate();
|
||||
if (process_properties_action->is_enabled())
|
||||
process_properties_action->activate();
|
||||
};
|
||||
|
||||
process_table_view.on_selection_change = [&] {
|
||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||
bool has_access = can_access_pid(pid);
|
||||
kill_action->set_enabled(has_access);
|
||||
stop_action->set_enabled(has_access);
|
||||
continue_action->set_enabled(has_access);
|
||||
profile_action->set_enabled(has_access);
|
||||
process_properties_action->set_enabled(has_access);
|
||||
};
|
||||
|
||||
app->on_action_enter = [](GUI::Action const& action) {
|
||||
|
|
Loading…
Add table
Reference in a new issue