mirror of
https://github.com/RGBCube/serenity
synced 2025-07-01 07:42:06 +00:00
LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that will no longer work in the ref-counting world.
This commit is contained in:
parent
defafd72bc
commit
31b38ed88f
7 changed files with 30 additions and 33 deletions
|
@ -102,11 +102,11 @@ GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringVie
|
|||
toolbar->add_separator();
|
||||
|
||||
auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [this](const GAction&) {
|
||||
GInputBox input_box("Enter name:", "New directory", this);
|
||||
if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) {
|
||||
auto input_box = GInputBox::construct("Enter name:", "New directory", this);
|
||||
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto new_dir_path = FileSystemPath(String::format("%s/%s",
|
||||
m_model->path().characters(),
|
||||
input_box.text_value().characters()))
|
||||
input_box->text_value().characters()))
|
||||
.string();
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
|
@ -248,8 +248,8 @@ void GFilePicker::on_file_return()
|
|||
FileSystemPath path(String::format("%s/%s", m_model->path().characters(), m_filename_textbox->text().characters()));
|
||||
|
||||
if (GFilePicker::file_exists(path.string()) && m_mode == Mode::Save) {
|
||||
GMessageBox box("File already exists, overwrite?", "Existing File", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel);
|
||||
if (box.exec() == GMessageBox::ExecCancel)
|
||||
auto result = GMessageBox::show("File already exists, overwrite?", "Existing File", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel);
|
||||
if (result == GMessageBox::ExecCancel)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue