2022-10-01 04:40:28 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Ashley N. <dev-serenity@ne0ndrag0n.com>
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2023-05-07 18:47:40 +00:00
|
|
|
* Copyright (c) 2023, Fabian Dellwing <fabian@dellwing.net>
|
2022-10-01 04:40:28 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/StringView.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
#include <LibCore/Account.h>
|
2023-08-06 16:09:39 +00:00
|
|
|
#include <LibCore/EventReceiver.h>
|
2022-10-01 04:40:28 +00:00
|
|
|
#include <LibGUI/Button.h>
|
|
|
|
#include <LibGUI/ImageWidget.h>
|
|
|
|
#include <LibGUI/TextBox.h>
|
|
|
|
#include <LibGUI/Window.h>
|
|
|
|
|
2024-01-09 22:07:42 +00:00
|
|
|
namespace Escalator {
|
2022-10-01 04:40:28 +00:00
|
|
|
class EscalatorWindow final : public GUI::Window {
|
|
|
|
C_OBJECT(EscalatorWindow)
|
|
|
|
public:
|
|
|
|
struct Options {
|
|
|
|
StringView description;
|
|
|
|
Core::Account current_user;
|
|
|
|
bool preserve_env { false };
|
2023-05-07 18:47:40 +00:00
|
|
|
bool forward_stdin { false };
|
|
|
|
bool forward_stdout { false };
|
2022-10-01 04:40:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~EscalatorWindow() override = default;
|
|
|
|
|
|
|
|
ErrorOr<void> execute_command();
|
|
|
|
|
|
|
|
private:
|
|
|
|
EscalatorWindow(StringView executable, Vector<StringView> arguments, Options const& options);
|
|
|
|
|
2024-03-02 19:01:58 +00:00
|
|
|
bool check_password();
|
2022-10-01 04:40:28 +00:00
|
|
|
|
|
|
|
Vector<StringView> m_arguments;
|
|
|
|
StringView m_executable;
|
|
|
|
Core::Account m_current_user;
|
|
|
|
bool m_preserve_env { false };
|
2023-05-07 18:47:40 +00:00
|
|
|
bool m_forward_stdin { false };
|
|
|
|
bool m_forward_stdout { false };
|
2022-10-01 04:40:28 +00:00
|
|
|
|
|
|
|
RefPtr<GUI::ImageWidget> m_icon_image_widget;
|
|
|
|
RefPtr<GUI::Button> m_ok_button;
|
|
|
|
RefPtr<GUI::Button> m_cancel_button;
|
|
|
|
RefPtr<GUI::PasswordBox> m_password_input;
|
|
|
|
};
|
2024-01-09 22:07:42 +00:00
|
|
|
}
|