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 #ifndef WXBRESTOREPANEL_H
20 #define WXBRESTOREPANEL_H
22 #include "wx/wxprec.h"
28 #include "wxbtableparser.h"
30 #include <wx/thread.h>
31 #include <wx/listctrl.h>
32 #include <wx/treectrl.h>
38 * wxbPanel for restoring files
40 class wxbRestorePanel : public wxbPanel
43 wxbRestorePanel(wxWindow* parent);
46 /* wxbPanel overloadings */
47 virtual wxString GetTitle();
48 virtual void Print(wxString str, int status);
51 /* Commands called by events handler */
53 /* The main button has been clicked */
56 /* List jobs for a specified client */
59 /* List files and directories for a specified tree item */
60 void CmdList(wxTreeItemId item);
62 /* Mark a treeitem (directory) or a listitem (file or directory) */
63 void CmdMark(wxTreeItemId treeitem, long listitem);
65 /* General functions and variables */
66 bool ended; /* The last command send has finished */
68 long filemessages; /* When restoring, number of files restored */
69 long totfilemessages; /* When restoring, number of files to be restored */
71 /* When listing a directory, sets if file list must be updated
72 * (otherwise only the tree structure is updated)
76 wxbTableParser* tableParser; /* Used to parse tables */
78 /* Parse a table in tableParser */
79 void CreateAndWaitForParser(wxString cmd);
81 /* Run a command, and waits until result is fully received. */
82 void WaitForEnd(wxString cmd);
84 /* Run a dir command, and waits until result is fully received. */
85 void WaitForList(wxTreeItemId item, bool updatelist);
87 /* Parse dir command results. */
88 wxString* ParseList(wxString line);
90 /* Update a tree item, and all its childs. */
91 void UpdateTree(wxTreeItemId item, bool updatelist);
96 disabled, // The panel is not activated
97 entered, // The panel is activated
98 choosing, // The user is choosing files to restore
99 listing, // Dir listing is in progress
100 restoring, // Bacula is restoring files
101 finished // Retore done
106 /* Set current status by enabling/disabling components */
107 void setStatus(status_enum newstatus);
110 bool working; // A command is running, discard GUI events
111 wxTreeItemId currentTreeItem; // Currently selected tree item
114 void OnStart(wxEvent& WXUNUSED(event));
115 void OnTreeChanging(wxTreeEvent& event);
116 void OnTreeExpanding(wxTreeEvent& event);
117 void OnTreeChanged(wxTreeEvent& event);
118 void OnTreeRightClicked(wxTreeEvent& event);
119 void OnListRightClicked(wxListEvent& event);
120 void OnListActivated(wxListEvent& event);
121 void OnClientChoiceChanged(wxCommandEvent& event);
124 wxImageList* imagelist; //image list for tree and list
127 wxChoice* clientChoice;
133 DECLARE_EVENT_TABLE();
136 #endif // WXBRESTOREPANEL_H