Serenity Operating System
at master 40 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * Copyright (c) 2022, the SerenityOS developers. 4 * 5 * SPDX-License-Identifier: BSD-2-Clause 6 */ 7 8#include "ProcessUnveiledPathsWidget.h" 9#include <LibGUI/BoxLayout.h> 10#include <LibGUI/JsonArrayModel.h> 11#include <LibGUI/SortingProxyModel.h> 12#include <LibGUI/TableView.h> 13#include <LibGUI/Widget.h> 14 15REGISTER_WIDGET(SystemMonitor, ProcessUnveiledPathsWidget) 16 17namespace SystemMonitor { 18 19ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() 20{ 21 set_layout<GUI::VerticalBoxLayout>(4); 22 m_table_view = add<GUI::TableView>(); 23 24 Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; 25 pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft); 26 pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft); 27 28 m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields)); 29 m_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_model))); 30} 31 32void ProcessUnveiledPathsWidget::set_pid(pid_t pid) 33{ 34 if (m_pid == pid) 35 return; 36 m_pid = pid; 37 m_model->set_json_path(DeprecatedString::formatted("/proc/{}/unveil", m_pid)); 38} 39 40}