2 Copyright (C) 2004 Kern Sibbald and John Walker
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #include "wxbrestorepanel.h"
21 #include "wxbmainframe.h"
25 #include <wx/choice.h>
26 #include <wx/datetime.h>
28 #include "unmarked.xpm"
30 #include "partmarked.xpm"
33 * Class which is stored in the tree and in the list to keep informations
36 class wxbTreeItemData : public wxTreeItemData {
38 wxbTreeItemData(wxString path, wxString name, int marked);
39 wxbTreeItemData(wxString path, wxString name, wxString marked);
43 //wxbTreeItemData* GetChild(wxString dirname);
45 void SetMarked(int marked);
46 void SetMarked(wxString marked);
48 static int GetMarkedStatus(wxString file);
50 wxString* path; /* Full path */
51 wxString* name; /* File name */
52 int marked; /* 0 - Not Marked, 1 - Marked, 2 - Some file under is marked */
55 wxbTreeItemData::wxbTreeItemData(wxString path, wxString name, int marked): wxTreeItemData() {
56 this->path = new wxString(path);
57 this->name = new wxString(name);
58 this->marked = marked;
61 wxbTreeItemData::wxbTreeItemData(wxString path, wxString name, wxString marked): wxTreeItemData() {
62 this->path = new wxString(path);
63 this->name = new wxString(name);
67 wxbTreeItemData::~wxbTreeItemData() {
72 int wxbTreeItemData::GetMarked() {
76 void wxbTreeItemData::SetMarked(wxString marked) {
80 else if (marked == "+") {
88 void wxbTreeItemData::SetMarked(int marked) {
89 this->marked = marked;
92 wxString wxbTreeItemData::GetPath() {
96 wxString wxbTreeItemData::GetName() {
100 /*wxbTreeItemData* wxbTreeItemData::GetChild(wxString dirname) {
101 int marked = GetMarkedStatus(dirname);
102 return new wxbTreeItemData(path + (marked ? dirname.Mid(1) : dirname), marked);
105 int wxbTreeItemData::GetMarkedStatus(wxString file) {
106 if (file.Length() == 0)
109 switch (file.GetChar(0)) {
119 // ----------------------------------------------------------------------------
120 // event tables and other macros for wxWindows
121 // ----------------------------------------------------------------------------
131 BEGIN_EVENT_TABLE(wxbRestorePanel, wxPanel)
132 EVT_BUTTON(RestoreStart, wxbRestorePanel::OnStart)
133 EVT_TREE_SEL_CHANGING(TreeCtrl, wxbRestorePanel::OnTreeChanging)
134 EVT_TREE_SEL_CHANGED(TreeCtrl, wxbRestorePanel::OnTreeChanged)
135 EVT_TREE_ITEM_EXPANDING(TreeCtrl, wxbRestorePanel::OnTreeExpanding)
136 EVT_TREE_ITEM_RIGHT_CLICK(TreeCtrl, wxbRestorePanel::OnTreeRightClicked)
137 EVT_LIST_ITEM_RIGHT_CLICK(ListCtrl, wxbRestorePanel::OnListRightClicked)
138 EVT_LIST_ITEM_ACTIVATED(ListCtrl, wxbRestorePanel::OnListActivated)
139 EVT_CHOICE(ClientChoice, wxbRestorePanel::OnClientChoiceChanged)
143 * wxbRestorePanel constructor
145 wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) {
146 imagelist = new wxImageList(16, 16, TRUE, 3);
147 imagelist->Add(wxIcon(unmarked_xpm));
148 imagelist->Add(wxIcon(marked_xpm));
149 imagelist->Add(wxIcon(partmarked_xpm));
151 wxFlexGridSizer *sizer = new wxFlexGridSizer(3, 1, 10, 10);
152 sizer->AddGrowableCol(0);
153 sizer->AddGrowableRow(1);
155 wxBoxSizer *firstSizer = new wxBoxSizer(wxHORIZONTAL);
157 start = new wxButton(this, RestoreStart, "Enter restore mode", wxDefaultPosition, wxSize(150, 30));
158 firstSizer->Add(start, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 10);
160 wxString* elist = new wxString[1];
162 clientChoice = new wxChoice(this, ClientChoice, wxDefaultPosition, wxSize(150, 30), 0, elist);
163 firstSizer->Add(clientChoice, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 10);
165 jobChoice = new wxChoice(this, -1, wxDefaultPosition, wxSize(150, 30), 0, elist);
166 firstSizer->Add(jobChoice, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 10);
168 sizer->Add(firstSizer, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 10);
170 wxFlexGridSizer *secondSizer = new wxFlexGridSizer(1, 2, 10, 10);
172 tree = new wxTreeCtrl(this, TreeCtrl, wxDefaultPosition, wxSize(250, 10));
173 secondSizer->Add(tree, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 10);
175 tree->SetImageList(imagelist);
177 list = new wxListCtrl(this, ListCtrl, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
178 secondSizer->Add(list, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 10);
180 list->SetImageList(imagelist, wxIMAGE_LIST_SMALL);
183 info.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT);
185 info.SetAlign(wxLIST_FORMAT_CENTER);
186 list->InsertColumn(0, info);
188 info.SetText("Filename");
189 info.SetAlign(wxLIST_FORMAT_LEFT);
190 list->InsertColumn(1, info);
192 info.SetText("Size");
193 info.SetAlign(wxLIST_FORMAT_RIGHT);
194 list->InsertColumn(2, info);
196 info.SetText("Date");
197 info.SetAlign(wxLIST_FORMAT_LEFT);
198 list->InsertColumn(3, info);
200 info.SetText("Perm.");
201 info.SetAlign(wxLIST_FORMAT_LEFT);
202 list->InsertColumn(4, info);
204 info.SetText("User");
205 info.SetAlign(wxLIST_FORMAT_RIGHT);
206 list->InsertColumn(5, info);
208 info.SetText("Group");
209 info.SetAlign(wxLIST_FORMAT_RIGHT);
210 list->InsertColumn(6, info);
212 secondSizer->AddGrowableCol(1);
213 secondSizer->AddGrowableRow(0);
215 sizer->Add(secondSizer, 1, wxEXPAND, 10);
217 gauge = new wxGauge(this, -1, 1, wxDefaultPosition, wxSize(200,20));
219 sizer->Add(gauge, 1, wxEXPAND, 5);
221 gauge->Enable(false);
224 sizer->SetSizeHints(this);
230 jobChoice->Enable(false);
236 * wxbRestorePanel destructor
238 wxbRestorePanel::~wxbRestorePanel() {
242 /*----------------------------------------------------------------------------
243 wxbPanel overloadings
244 ----------------------------------------------------------------------------*/
246 wxString wxbRestorePanel::GetTitle() {
250 void wxbRestorePanel::Print(wxString str, int stat) {
254 else if (status == listing) {
255 if (str.Find("cwd is:") == 0) { // Sometimes cd command result "infiltrate" into listings.
261 wxString* file = ParseList(str);
266 if (file[8].GetChar(file[8].Length()-1) == '/') {
270 wxTreeItemId currentChild = tree->GetFirstChild(currentTreeItem, cookie);
272 bool updated = false;
274 while (currentChild.IsOk()) {
275 itemStr = tree->GetItemText(currentChild);
276 if (file[8] == itemStr) {
277 int stat = wxbTreeItemData::GetMarkedStatus(file[6]);
278 if (static_cast<wxbTreeItemData*>(tree->GetItemData(currentChild))->GetMarked() != stat) {
279 tree->SetItemImage(currentChild, stat, wxTreeItemIcon_Normal);
280 tree->SetItemImage(currentChild, stat, wxTreeItemIcon_Selected);
281 static_cast<wxbTreeItemData*>(tree->GetItemData(currentChild))->SetMarked(file[6]);
286 currentChild = tree->GetNextChild(currentTreeItem, cookie);
290 int img = wxbTreeItemData::GetMarkedStatus(file[6]);
291 tree->AppendItem(currentTreeItem, file[8], img, img, new wxbTreeItemData(file[7], file[8], file[6]));
296 long ind = list->InsertItem(list->GetItemCount(), wxbTreeItemData::GetMarkedStatus(file[6]));
297 long data = (long)(new wxbTreeItemData(file[7], file[8], file[6]));
298 list->SetItemData(ind, data);
299 list->SetItem(ind, 1, file[8]); // filename
300 list->SetItem(ind, 2, file[4]); //Size
301 list->SetItem(ind, 3, file[5]); //date
302 list->SetItem(ind, 4, file[0]); //perm
303 list->SetItem(ind, 5, file[2]); //user
304 list->SetItem(ind, 6, file[3]); //grp
310 if (status == restoring) {
312 //15847 total files; 1 marked to be restored; 1,034 bytes.
313 if ((i = str.Find(" marked to be restored;")) > -1) {
314 int j = str.Find("; ");
315 str.Mid(j+2, i).ToLong(&totfilemessages);
316 //wxbMainFrame::GetInstance()->Print(wxString("TOT(") << totfilemessages << ")\n", CS_DEBUG);
320 if ((i = str.Find(" files selected to be restored.")) > -1) {
321 str.Mid(0, i).ToLong(&totfilemessages);
322 //wxbMainFrame::GetInstance()->Print(wxString("TOT(") << totfilemessages << ")\n", CS_DEBUG);
326 if ((i = str.Find(" file selected to be restored.")) > -1) {
327 str.Mid(0, i).ToLong(&totfilemessages);
328 //wxbMainFrame::GetInstance()->Print(wxString("TOT(") << totfilemessages << ")\n", CS_DEBUG);
332 wxStringTokenizer tkz(str, " ", wxTOKEN_STRTOK);
336 // Date Time name: perm ? user grp size date time
337 //04-Apr-2004 17:19 Tom-fd: -rwx------ 1 nicolas None 514967 2004-03-20 20:03:42 filename
339 if (datetime.ParseDate(tkz.GetNextToken()) != NULL) { // Date
340 if (datetime.ParseTime(tkz.GetNextToken()) != NULL) { // Time
341 if (tkz.GetNextToken().Last() == ':') { // name:
342 tkz.GetNextToken(); // perm
343 tkz.GetNextToken(); // ?
344 tkz.GetNextToken(); // user
345 tkz.GetNextToken(); // grp
346 tkz.GetNextToken(); // size
347 if (datetime.ParseDate(tkz.GetNextToken()) != NULL) { //date
348 if (datetime.ParseTime(tkz.GetNextToken()) != NULL) { //time
350 //wxbMainFrame::GetInstance()->Print(wxString("(") << filemessages << ")", CS_DEBUG);
351 gauge->SetValue(filemessages);
359 if (tableParser != NULL) {
360 tableParser->Print(str, stat);
362 if (stat == CS_END) {
368 /*----------------------------------------------------------------------------
369 Commands called by events handler
370 ----------------------------------------------------------------------------*/
372 /* The main button has been clicked */
373 void wxbRestorePanel::CmdStart() {
374 if (status == disabled) {
375 CreateAndWaitForParser("list clients\n");
377 clientChoice->Clear();
378 for (unsigned int i = 0; i < tableParser->size(); i++) {
379 /*for (unsigned int k = 0; k < (*tableParser)[i].size(); k++) {
380 wxbMainFrame::GetInstance()->Print(wxString() << (*tableParser)[i][k] << ":", CS_DEBUG);
382 wxbMainFrame::GetInstance()->Print(wxString(";\n"), CS_DEBUG);*/
384 (*tableParser)[i][0].ToLong(j);
385 clientChoice->Append((*tableParser)[i][1], (void*)j);
390 else if (status == entered) {
391 if (jobChoice->GetStringSelection().Length() < 1) {
392 wxbMainFrame::GetInstance()->SetStatusText("Please select a client.\n");
395 WaitForEnd("restore\n");
397 WaitForEnd(wxString() << jobChoice->GetStringSelection() << "\n");
398 WaitForEnd(wxString() << *((long*)clientChoice->GetClientData(clientChoice->GetSelection())) << "\n");
399 WaitForEnd("unmark *\n");
401 wxTreeItemId root = tree->AddRoot(clientChoice->GetStringSelection(), -1, -1, new wxbTreeItemData("/", clientChoice->GetStringSelection(), 0));
403 WaitForList(root, true);
404 wxbMainFrame::GetInstance()->SetStatusText("Right click on a file or on a directory to add it to the restore list.\n");
407 else if (status == choosing) {
408 setStatus(restoring);
410 wxbMainFrame::GetInstance()->SetStatusText("Restoring, please wait...\n");
413 WaitForEnd("estimate\n");
414 WaitForEnd("done\n");
416 if (totfilemessages == 0) {
417 wxbMainFrame::GetInstance()->Print("Restore failed : no file selected.\n", CS_DEBUG);
418 wxbMainFrame::GetInstance()->SetStatusText("Restore failed : no file selected.\n");
426 gauge->SetRange(totfilemessages);
428 wxString cmd = "list jobid=";
430 CreateAndWaitForParser("list jobs\n");
431 /* TODO (#1#): Check more carefully which job we just have run. */
432 cmd << (*tableParser)[tableParser->size()-1][0] << "\n";
437 CreateAndWaitForParser(cmd);
438 if ((*tableParser)[0][7] != "C") {
442 WaitForEnd("messages\n");
444 wxbMainFrame::GetInstance()->SetStatusText(wxString("Restoring, please wait (") << filemessages << " of " << totfilemessages << " files done)...\n");
446 time_t start = wxDateTime::Now().GetTicks();
447 while (((wxDateTime::Now().GetTicks())-start) < 3) {
452 WaitForEnd("messages\n");
454 gauge->SetValue(totfilemessages);
456 if ((*tableParser)[0][7] == "T") {
457 wxbMainFrame::GetInstance()->Print("Restore done successfully.\n", CS_DEBUG);
458 wxbMainFrame::GetInstance()->SetStatusText("Restore done successfully.\n");
461 wxbMainFrame::GetInstance()->Print("Restore failed, please look at messages.\n", CS_DEBUG);
462 wxbMainFrame::GetInstance()->SetStatusText("Restore failed, please look at messages in console.\n");
468 /* List jobs for a specified client */
469 void wxbRestorePanel::CmdListJobs() {
470 if (status == entered) {
472 WaitForEnd("query\n");
474 CreateAndWaitForParser(clientChoice->GetString(clientChoice->GetSelection()) + "\n");
476 for (int i = tableParser->size()-1; i > -1; i--) {
477 wxString str = (*tableParser)[i][3];
480 if ( ( (chr = datetime.ParseDate(str.GetData()) ) != NULL ) && ( datetime.ParseTime(++chr) != NULL ) ) {
481 datetime = datetime.GetTicks() + 1;
482 //wxbMainFrame::GetInstance()->Print(wxString("-") << datetime.Format("%Y-%m-%d %H:%M:%S"), CS_DEBUG);
483 jobChoice->Append(datetime.Format("%Y-%m-%d %H:%M:%S"));
486 jobChoice->Append("Invalid");
490 jobChoice->SetSelection(0);
494 /* List files and directories for a specified tree item */
495 void wxbRestorePanel::CmdList(wxTreeItemId item) {
496 if (status == choosing) {
497 list->DeleteAllItems();
502 WaitForList(item, (tree->GetSelection() == item));
504 if (list->GetItemCount() > 1) {
505 int firstwidth = list->GetSize().GetWidth();
506 for (int i = 2; i < 7; i++) {
507 list->SetColumnWidth(i, wxLIST_AUTOSIZE);
508 firstwidth -= list->GetColumnWidth(i);
511 list->SetColumnWidth(0, 18);
513 list->SetColumnWidth(1, wxLIST_AUTOSIZE);
514 if (list->GetColumnWidth(1) < firstwidth) {
515 list->SetColumnWidth(1, firstwidth-20);
521 /* Mark a treeitem (directory) or a listitem (file or directory) */
522 void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long listitem) {
523 if (status == choosing) {
524 wxbTreeItemData* itemdata = NULL;
525 if (listitem != -1) {
526 itemdata = (wxbTreeItemData*)list->GetItemData(listitem);
528 else if (treeitem.IsOk()) {
529 itemdata = (wxbTreeItemData*)tree->GetItemData(treeitem);
535 if (itemdata == NULL) //Should never happen
538 wxString dir = itemdata->GetPath();
542 if (dir.GetChar(dir.Length()-1) == '/') {
546 int i = dir.Find('/', TRUE);
551 else { /* first dir below root */
553 dir = dir.Mid(0, i+1);
561 WaitForEnd(wxString("cd ") << dir << "\n");
562 WaitForEnd(wxString((itemdata->GetMarked() == 1) ? "unmark " : "mark ") << file << "\n");
564 if ((dir == "/") && (file == "*")) {
565 itemdata->SetMarked((itemdata->GetMarked() == 1) ? 0 : 1);
568 if (listitem != -1) {
569 treeitem = tree->GetSelection();
570 UpdateTree(treeitem, true);
571 treeitem = tree->GetItemParent(treeitem);
574 UpdateTree(treeitem, (tree->GetSelection() == treeitem));
575 treeitem = tree->GetItemParent(treeitem);
578 while (treeitem.IsOk()) {
579 WaitForList(treeitem, false);
580 treeitem = tree->GetItemParent(treeitem);
583 /* Update root marked status */
584 treeitem = tree->GetRootItem();
586 wxTreeItemId currentChild = tree->GetFirstChild(treeitem, cookie);
588 bool onechildmarked = false;
589 bool onechildunmarked = false;
591 while (currentChild.IsOk()) {
592 itemdata = (wxbTreeItemData*)tree->GetItemData(currentChild);
593 switch (itemdata->GetMarked()) {
595 onechildunmarked = true;
598 onechildmarked = true;
601 onechildmarked = true;
602 onechildunmarked = true;
606 if (onechildmarked && onechildunmarked) {
610 currentChild = tree->GetNextChild(treeitem, cookie);
613 itemdata = (wxbTreeItemData*)tree->GetItemData(treeitem);
614 if (onechildmarked && onechildunmarked) {
615 itemdata->SetMarked(2);
616 tree->SetItemImage(treeitem, 2, wxTreeItemIcon_Normal);
617 tree->SetItemImage(treeitem, 2, wxTreeItemIcon_Selected);
619 else if (onechildmarked) {
620 itemdata->SetMarked(1);
621 tree->SetItemImage(treeitem, 1, wxTreeItemIcon_Normal);
622 tree->SetItemImage(treeitem, 1, wxTreeItemIcon_Selected);
625 itemdata->SetMarked(0);
626 tree->SetItemImage(treeitem, 0, wxTreeItemIcon_Normal);
627 tree->SetItemImage(treeitem, 0, wxTreeItemIcon_Selected);
632 /*----------------------------------------------------------------------------
634 ----------------------------------------------------------------------------*/
636 /* Parse a table in tableParser */
637 void wxbRestorePanel::CreateAndWaitForParser(wxString cmd) {
638 if (tableParser != NULL) {
641 tableParser = new wxbTableParser();
643 wxbMainFrame::GetInstance()->Send(cmd);
645 //time_t base = wxDateTime::Now().GetTicks();
646 while (!tableParser->hasFinished()) {
647 //innerThread->Yield();
649 //if (base+15 < wxDateTime::Now().GetTicks()) break;
653 /* Run a command, and waits until result is fully received. */
654 void wxbRestorePanel::WaitForEnd(wxString cmd) {
655 wxbMainFrame::GetInstance()->Send(cmd);
659 //time_t base = wxDateTime::Now().GetTicks();
661 //innerThread->Yield();
663 //if (base+15 < wxDateTime::Now().GetTicks()) break;
667 /* Run a dir command, and waits until result is fully received. */
668 void wxbRestorePanel::WaitForList(wxTreeItemId item, bool updatelist) {
669 this->updatelist = updatelist;
670 currentTreeItem = item;
672 WaitForEnd(wxString("cd \"") << static_cast<wxbTreeItemData*>(tree->GetItemData(currentTreeItem))->GetPath() << "\"\n");
677 list->DeleteAllItems();
684 /* Parse dir command results. */
685 wxString* wxbRestorePanel::ParseList(wxString line) {
686 //drwx------ 11 1003 42949672 0 2001-07-30 16:45:14 *filename
687 //+ 10 ++ 4++ 10 ++ 8 ++ 8 + + 19 + *+ ->
688 //0 10 14 24 32 42 62
690 if (line.Length() < 63)
693 wxString* ret = new wxString[9];
695 ret[0] = line.Mid(0, 10).Trim();
696 ret[1] = line.Mid(10, 4).Trim();
697 ret[2] = line.Mid(14, 10).Trim();
698 ret[3] = line.Mid(24, 8).Trim();
699 ret[4] = line.Mid(32, 8).Trim();
700 ret[5] = line.Mid(42, 19).Trim();
701 ret[6] = line.Mid(62, 1);
702 ret[7] = line.Mid(63).Trim();
704 if (ret[6] == " ") ret[6] = "";
706 if (ret[7].GetChar(ret[7].Length()-1) == '/') {
709 ret[8] = ret[7].Mid(ret[8].Find('/', true)+1);
712 ret[8] = ret[7].Mid(ret[7].Find('/', true)+1);
718 /* Update a tree item, and all its childs. */
719 void wxbRestorePanel::UpdateTree(wxTreeItemId item, bool updatelist) {
720 WaitForList(item, updatelist);
722 /* Updated all child which are not collapsed */
724 wxTreeItemId currentChild = tree->GetFirstChild(item, cookie);
726 while (currentChild.IsOk()) {
727 if (tree->IsExpanded(currentChild))
728 UpdateTree(currentChild, false);
730 currentChild = tree->GetNextChild(item, cookie);
734 /*----------------------------------------------------------------------------
736 ----------------------------------------------------------------------------*/
738 /* Set current status by enabling/disabling components */
739 void wxbRestorePanel::setStatus(status_enum newstatus) {
742 tree->DeleteAllItems();
743 list->DeleteAllItems();
744 clientChoice->Clear();
746 newstatus = disabled;
748 start->SetLabel("Enter restore mode");
750 clientChoice->Enable(false);
751 jobChoice->Enable(false);
754 gauge->Enable(false);
758 start->SetLabel("Choose files to restore");
759 clientChoice->Enable(true);
760 jobChoice->Enable(true);
768 start->SetLabel("Restore");
769 clientChoice->Enable(false);
770 jobChoice->Enable(false);
776 start->SetLabel("Restoring...");
779 start->Enable(false);
780 clientChoice->Enable(false);
781 jobChoice->Enable(false);
790 /*----------------------------------------------------------------------------
792 ----------------------------------------------------------------------------*/
794 void wxbRestorePanel::OnClientChoiceChanged(wxCommandEvent& event) {
799 clientChoice->Enable(false);
801 clientChoice->Enable(true);
802 jobChoice->Refresh();
806 void wxbRestorePanel::OnStart(wxEvent& WXUNUSED(event)) {
815 void wxbRestorePanel::OnTreeChanging(wxTreeEvent& event) {
821 void wxbRestorePanel::OnTreeExpanding(wxTreeEvent& event) {
827 //CmdList(event.GetItem());
828 tree->SelectItem(event.GetItem());
832 void wxbRestorePanel::OnTreeChanged(wxTreeEvent& event) {
837 CmdList(event.GetItem());
841 void wxbRestorePanel::OnTreeRightClicked(wxTreeEvent& event) {
847 CmdMark(event.GetItem(), -1);
853 void wxbRestorePanel::OnListRightClicked(wxListEvent& event) {
859 long item = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
860 CmdMark(wxTreeItemId(), item);
866 void wxbRestorePanel::OnListActivated(wxListEvent& event) {
872 long item = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
874 wxbTreeItemData* itemdata = (wxbTreeItemData*)list->GetItemData(item);
875 wxString name = itemdata->GetName();
882 if (name.GetChar(name.Length()-1) == '/') {
883 wxTreeItemId currentChild = tree->GetFirstChild(currentTreeItem, cookie);
885 while (currentChild.IsOk()) {
886 wxString name2 = tree->GetItemText(currentChild);
890 tree->Expand(currentTreeItem);
891 tree->SelectItem(currentChild);
895 currentChild = tree->GetNextChild(currentTreeItem, cookie);