/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #include "ProcessUnveiledPathsWidget.h" #include #include #include #include #include REGISTER_WIDGET(SystemMonitor, ProcessUnveiledPathsWidget) namespace SystemMonitor { ErrorOr> ProcessUnveiledPathsWidget::try_create() { auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcessUnveiledPathsWidget())); TRY(widget->try_set_layout(4)); widget->m_table_view = TRY(widget->try_add()); Vector pid_unveil_fields; TRY(pid_unveil_fields.try_empend("path", "Path"_short_string, Gfx::TextAlignment::CenterLeft)); TRY(pid_unveil_fields.try_empend("permissions", TRY("Permissions"_string), Gfx::TextAlignment::CenterLeft)); widget->m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields)); widget->m_table_view->set_model(TRY(GUI::SortingProxyModel::create(*widget->m_model))); return widget; } void ProcessUnveiledPathsWidget::set_pid(pid_t pid) { if (m_pid == pid) return; m_pid = pid; m_model->set_json_path(DeprecatedString::formatted("/proc/{}/unveil", m_pid)); } }