]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbrestorepanel.h
kes Simplify locking in the reservations system.
[bacula/bacula] / bacula / src / wx-console / wxbrestorepanel.h
index bf991cd36d3e4e1ec8003b2772322759a020b085..4f6bae9d83763798f1771297c6ce7c5f24f84d72 100644 (file)
@@ -4,24 +4,35 @@
  *
  *    Nicolas Boichat, April-May 2004
  *
+ *    Version $Id$
  */
 /*
-   Copyright (C) 2004 Kern Sibbald and John Walker
+   Bacula® - The Network Backup Solution
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
+   Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 
 #ifndef WXBRESTOREPANEL_H
 #define WXBRESTOREPANEL_H
 #include "wxbtreectrl.h"
 #include "wxblistctrl.h"
 
+WX_DECLARE_LIST(wxEvent, wxbEventList);
+
+/* Class for storing directory entries (results from dir commands). */
+class wxbDirEntry {
+public:
+   wxString perm;
+   wxString nlink;
+   wxString user;
+   wxString group;
+   wxString size;
+   wxString date;
+   int marked; /* 0 - Not Marked, 1 - Marked, 2 - Some file under is marked */
+   wxString fullname; /* full name with path */
+   wxString filename; /* only filename, no path */
+};
+
 /*
  * wxbPanel for restoring files
  */
@@ -92,47 +119,34 @@ class wxbRestorePanel : public wxbPanel
       long totfilemessages; /* When restoring, number of files to be restored */
       wxString jobid;
 
-      /* Parse a table in tableParser */
-      wxbTableParser* CreateAndWaitForParser(wxString cmd);
-
-      /* Run a command, and waits until result is fully received,
-       * if keepresults is true, returns a valid pointer to a wxbDataTokenizer
-       * containing the data. */
-      wxbDataTokenizer* WaitForEnd(wxString cmd, bool keepresults = false, bool linebyline = true);
-
-      /* Run a command, and waits until prompt result is fully received,
-       * if keepresults is true, returns a valid pointer to a wxbPromptParser
-       * containing the data. */
-      wxbPromptParser* WaitForPrompt(wxString cmd, bool keepresults = false);
-
       /* Run a dir command, and waits until result is fully received.
        * If recurse is true, update the children too. */
       void UpdateTreeItem(wxTreeItemId item, bool updatelist, bool recurse);
 
       /* Parse dir command results. */
-      wxString* ParseList(wxString line);
+      int ParseList(wxString line, wxbDirEntry* entry);
 
       /* Sets a list item state, and update its parents and children if it is a directory */
       void SetListItemState(long listitem, int newstate);
 
       /* Sets a tree item state, and update its children, parents and list (if necessary) */
       void SetTreeItemState(wxTreeItemId item, int newstate);
-      
+
       /* Update a tree item parents' state */
       void UpdateTreeItemState(wxTreeItemId item);
 
       /* Refresh the whole tree. */
       void RefreshTree();
-      
+
       /* Refresh file list */
       void RefreshList();
-      
+
       /* Update first config, adapting settings to the job name selected */
       void UpdateFirstConfig();
-      
+
       /* Update second config */
       bool UpdateSecondConfig(wxbDataTokenizer* dt);
-      
+
 /* Status related */
       enum status_enum
       {
@@ -159,31 +173,39 @@ class wxbRestorePanel : public wxbPanel
 
 /* UI related */
       bool working; // A command is running, discard GUI events
-      bool markWhenListingDone;
+      void SetWorking(bool working);
+      bool IsWorking();
+      bool markWhenCommandDone; //If an item should be (un)marked after the current listing/marking is done
       wxTreeItemId currentTreeItem; // Currently selected tree item
 
       /* Enable or disable config controls status */
       void EnableConfig(bool enable);
 
 /* Event handling */
-      void OnStart(wxCommandEvent& WXUNUSED(event));
-      void OnCancel(wxCommandEvent& WXUNUSED(event));
-      
+//      wxbEventList* pendingEvents; /* Stores event sent while working */ //EVTQUEUE
+//      bool processing; /* True if pendingEvents is being processed */ //EVTQUEUE
+
+//      virtual void AddPendingEvent(wxEvent& event);
+//      virtual bool ProcessEvent(wxEvent& event); //EVTQUEUE
+
+      void OnStart(wxCommandEvent& event);
+      void OnCancel(wxCommandEvent& event);
+
       void OnTreeChanging(wxTreeEvent& event);
       void OnTreeExpanding(wxTreeEvent& event);
       void OnTreeChanged(wxTreeEvent& event);
       void OnTreeMarked(wxbTreeMarkedEvent& event);
-      void OnTreeAdd(wxCommandEvent& WXUNUSED(event));
-      void OnTreeRemove(wxCommandEvent& WXUNUSED(event));
-      void OnTreeRefresh(wxCommandEvent& WXUNUSED(event));
-      
+      void OnTreeAdd(wxCommandEvent& event);
+      void OnTreeRemove(wxCommandEvent& event);
+      void OnTreeRefresh(wxCommandEvent& event);
+
       void OnListMarked(wxbListMarkedEvent& event);
       void OnListActivated(wxListEvent& event);
       void OnListChanged(wxListEvent& event);
-      void OnListAdd(wxCommandEvent& WXUNUSED(event));
-      void OnListRemove(wxCommandEvent& WXUNUSED(event));
-      void OnListRefresh(wxCommandEvent& WXUNUSED(event));
-      
+      void OnListAdd(wxCommandEvent& event);
+      void OnListRemove(wxCommandEvent& event);
+      void OnListRefresh(wxCommandEvent& event);
+
       void OnConfigUpdated(wxCommandEvent& event);
       void OnConfigOk(wxCommandEvent& WXUNUSED(event));
       void OnConfigApply(wxCommandEvent& WXUNUSED(event));
@@ -199,25 +221,24 @@ class wxbRestorePanel : public wxbPanel
 
       wxButton* start;
       wxButton* cancel;
-      
+
       wxbTreeCtrl* tree;
       wxButton* treeadd;
       wxButton* treeremove;
       wxButton* treerefresh;
-      
+
       wxbListCtrl* list;
       wxButton* listadd;
       wxButton* listremove;
       wxButton* listrefresh;
-      
+
       wxGauge* gauge;
-     
+
       long cfgUpdated; //keeps which config fields have been updated
 
       friend class wxbSplitterWindow;
 
-      DECLARE_EVENT_TABLE();    
+      DECLARE_EVENT_TABLE();
 };
 
 #endif // WXBRESTOREPANEL_H
-