]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/restore/restore.h
bat: more work on brestore panel
[bacula/bacula] / bacula / src / qt-console / restore / restore.h
1 #ifndef _RESTORE_H_
2 #define _RESTORE_H_
3
4 /*
5    Bacula® - The Network Backup Solution
6
7    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
8
9    The main author of Bacula is Kern Sibbald, with contributions from
10    many others, a complete list can be found in the file AUTHORS.
11    This program is Free Software; you can redistribute it and/or
12    modify it under the terms of version three of the GNU Affero General Public
13    License as published by the Free Software Foundation and included
14    in the file LICENSE.
15
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU Affero General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24    02110-1301, USA.
25
26    Bacula® is a registered trademark of Kern Sibbald.
27    The licensor of Bacula is the Free Software Foundation Europe
28    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
29    Switzerland, email:ftf@fsfeurope.org.
30 */
31 /*
32  *   Version $Id$
33  *
34  *  Kern Sibbald, February 2007
35  */
36
37 #include <QtGui>
38 #include "pages.h"
39 #include "ui_runrestore.h"
40
41 class bRestoreTable : public QTableWidget
42 {
43    Q_OBJECT 
44 private:
45    QPoint dragStartPosition;
46 public:
47    bRestoreTable(QWidget *parent)
48       : QTableWidget(parent)
49    {
50    }
51    void mousePressEvent(QMouseEvent *event);
52    void mouseMoveEvent(QMouseEvent *event);
53
54    void dragEnterEvent(QDragEnterEvent *event);
55    void dragMoveEvent(QDragMoveEvent *event);
56    void dropEvent(QDropEvent *event);
57 };
58
59 #include "ui_brestore.h"
60 #include "ui_restore.h"
61 #include "ui_prerestore.h"
62
63 enum {
64    R_NONE,
65    R_JOBIDLIST,
66    R_JOBDATETIME
67 };
68
69 /*
70  * The pre-restore dialog selects the Job/Client to be restored
71  * It really could use considerable enhancement.
72  */
73 class prerestorePage : public Pages, public Ui::prerestoreForm
74 {
75    Q_OBJECT 
76
77 public:
78    prerestorePage();
79    prerestorePage(QString &data, unsigned int);
80
81 private slots:
82    void okButtonPushed();
83    void cancelButtonPushed();
84    void job_name_change(int index);
85    void recentChanged(int);
86    void jobRadioClicked(bool);
87    void jobidsRadioClicked(bool);
88    void jobIdEditFinished();
89
90 private:
91    int m_conn;
92    int jobdefsFromJob(QStringList &, QString &);
93    void buildPage();
94    bool checkJobIdList();
95    QString m_dataIn;
96    unsigned int m_dataInType;
97 };
98
99 /*  
100  * The restore dialog is brought up once we are in the Bacula
101  * restore tree routines.  It handles putting up a GUI tree
102  * representation of the files to be restored.
103  */
104 class restorePage : public Pages, public Ui::restoreForm
105 {
106    Q_OBJECT 
107
108 public:
109    restorePage(int conn);
110    ~restorePage();
111    void fillDirectory();
112    char *get_cwd();
113    bool cwd(const char *);
114
115 private slots:
116    void okButtonPushed();
117    void cancelButtonPushed();
118    void fileDoubleClicked(QTreeWidgetItem *item, int column);
119    void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
120    void upButtonPushed();
121    void unmarkButtonPushed();
122    void markButtonPushed();
123    void addDirectory(QString &);
124
125 private:
126    int m_conn;
127    void writeSettings();
128    void readSettings();
129    QString m_cwd;
130    QHash<QString, QTreeWidgetItem *> m_dirPaths;
131    QHash<QTreeWidgetItem *,QString> m_dirTreeItems;
132    QRegExp m_rx;
133    QString m_splitText;
134 };
135
136 class bRestore : public Pages, public Ui::bRestoreForm
137 {
138    Q_OBJECT 
139
140 public:
141    bRestore();
142    ~bRestore();
143    void PgSeltreeWidgetClicked();
144    QString m_client;
145    QString m_jobids;
146    void get_info_from_selection(QStringList &fileids, QStringList &jobids,
147                                 QStringList &dirids, QStringList &fileindexes);
148
149 public slots:
150    void setClient();
151    void setJob();
152    void showInfoForFile(QTableWidgetItem *);
153    void applyLocation();
154    void clearVersions(QTableWidgetItem *);
155    void clearRestoreList();
156    void runRestore();
157 private:
158    QString m_path;
159    int64_t m_pathid;
160    QTableWidgetItem *m_current;
161    void setupPage();
162    bool m_populated;
163    void displayFiles(int64_t pathid, QString path);
164    void displayFileVersion(QString pathid, QString fnid, 
165                            QString client, QString filename);
166 };
167
168 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
169 {
170    Q_OBJECT 
171 private:
172    bRestore *brestore;
173    QStringList m_fileids, m_jobids, m_dirids, m_findexes;
174
175 public:
176    bRunRestore(bRestore *parent);
177    ~bRunRestore() {}
178    void computeVolumeList();
179
180 public slots:
181    void useRegexp();
182    void UFRcb();
183    void computeRestore();
184 };
185
186 #endif /* _RESTORE_H_ */