4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "bcsignals.h"
24 #include "filesystem.h"
31 BC_DeleteFile::BC_DeleteFile(BC_FileBox *filebox, int x, int y)
32 : BC_Window(filebox->get_delete_title(),
43 this->filebox = filebox;
47 BC_DeleteFile::~BC_DeleteFile()
52 void BC_DeleteFile::create_objects()
55 data = new ArrayList<BC_ListBoxItem*>;
61 lock_window("BC_DeleteFile::create_objects");
62 while((path = filebox->get_path(i)))
64 data->append(new BC_ListBoxItem(path));
69 add_subwindow(title = new BC_Title(x, y, _("Really delete the following files?")));
70 y += title->get_h() + 5;
72 add_subwindow(list = new BC_DeleteList(filebox,
76 get_h() - y - BC_OKButton::calculate_h() - 20,
78 y += list->get_h() + 5;
79 add_subwindow(new BC_OKButton(this));
80 add_subwindow(new BC_CancelButton(this));
89 BC_DeleteList::BC_DeleteList(BC_FileBox *filebox,
94 ArrayList<BC_ListBoxItem*> *data)
102 this->filebox = filebox;
114 BC_DeleteThread::BC_DeleteThread(BC_FileBox *filebox)
117 this->filebox = filebox;
120 void BC_DeleteThread::handle_done_event(int result)
124 filebox->lock_window("BC_DeleteThread::handle_done_event");
125 filebox->delete_files();
126 filebox->unlock_window();
130 BC_Window* BC_DeleteThread::new_gui()
132 int x = filebox->get_abs_cursor_x(1);
133 int y = filebox->get_abs_cursor_y(1);
134 BC_DeleteFile *result = new BC_DeleteFile(filebox, x, y);
135 result->create_objects();