2020-01-20 18:32:44 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-20 18:32:44 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ProcessUnveiledPathsWidget.h"
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/BoxLayout.h>
|
|
|
|
|
#include <LibGUI/JsonArrayModel.h>
|
2020-09-21 19:40:57 -03:00
|
|
|
#include <LibGUI/SortingProxyModel.h>
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/TableView.h>
|
2020-01-20 18:32:44 -03:00
|
|
|
|
2020-02-23 08:07:13 -03:00
|
|
|
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
|
2020-01-20 18:32:44 -03:00
|
|
|
{
|
2020-03-04 05:43:54 -03:00
|
|
|
set_layout<GUI::VerticalBoxLayout>();
|
2020-01-20 18:32:44 -03:00
|
|
|
layout()->set_margins({ 4, 4, 4, 4 });
|
2020-02-23 08:07:13 -03:00
|
|
|
m_table_view = add<GUI::TableView>();
|
2020-01-20 18:32:44 -03:00
|
|
|
|
2020-02-02 11:07:41 -03:00
|
|
|
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;
|
2020-02-06 07:56:38 -03:00
|
|
|
pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft);
|
|
|
|
|
pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft);
|
2020-09-21 19:40:57 -03:00
|
|
|
|
|
|
|
|
m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields));
|
|
|
|
|
m_table_view->set_model(GUI::SortingProxyModel::create(*m_model));
|
2020-01-20 18:32:44 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessUnveiledPathsWidget::~ProcessUnveiledPathsWidget()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProcessUnveiledPathsWidget::set_pid(pid_t pid)
|
|
|
|
|
{
|
|
|
|
|
if (m_pid == pid)
|
|
|
|
|
return;
|
|
|
|
|
m_pid = pid;
|
2020-10-06 13:04:36 -03:00
|
|
|
m_model->set_json_path(String::formatted("/proc/{}/unveil", m_pid));
|
2020-01-20 18:32:44 -03:00
|
|
|
}
|