]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/restore/restore.h
Fix brestore that should have miscDebug enabled to start a restore job
[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-2010 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  *
33  *  Kern Sibbald, February 2007
34  */
35
36 #include <QtGui>
37 #include "pages.h"
38 #include "ui_runrestore.h"
39
40 class bRestoreTable : public QTableWidget
41 {
42    Q_OBJECT 
43 private:
44    QPoint dragStartPosition;
45 public:
46    bRestoreTable(QWidget *parent)
47       : QTableWidget(parent)
48    {
49    }
50    void mousePressEvent(QMouseEvent *event);
51    void mouseMoveEvent(QMouseEvent *event);
52
53    void dragEnterEvent(QDragEnterEvent *event);
54    void dragMoveEvent(QDragMoveEvent *event);
55    void dropEvent(QDropEvent *event);
56 };
57
58 #include "ui_brestore.h"
59 #include "ui_restore.h"
60 #include "ui_prerestore.h"
61
62 enum {
63    R_NONE,
64    R_JOBIDLIST,
65    R_JOBDATETIME
66 };
67
68 /*
69  * The pre-restore dialog selects the Job/Client to be restored
70  * It really could use considerable enhancement.
71  */
72 class prerestorePage : public Pages, public Ui::prerestoreForm
73 {
74    Q_OBJECT 
75
76 public:
77    prerestorePage();
78    prerestorePage(QString &data, unsigned int);
79
80 private slots:
81    void okButtonPushed();
82    void cancelButtonPushed();
83    void job_name_change(int index);
84    void recentChanged(int);
85    void jobRadioClicked(bool);
86    void jobidsRadioClicked(bool);
87    void jobIdEditFinished();
88
89 private:
90    int m_conn;
91    int jobdefsFromJob(QStringList &, QString &);
92    void buildPage();
93    bool checkJobIdList();
94    QString m_dataIn;
95    unsigned int m_dataInType;
96 };
97
98 /*  
99  * The restore dialog is brought up once we are in the Bacula
100  * restore tree routines.  It handles putting up a GUI tree
101  * representation of the files to be restored.
102  */
103 class restorePage : public Pages, public Ui::restoreForm
104 {
105    Q_OBJECT 
106
107 public:
108    restorePage(int conn);
109    ~restorePage();
110    void fillDirectory();
111    char *get_cwd();
112    bool cwd(const char *);
113
114 private slots:
115    void okButtonPushed();
116    void cancelButtonPushed();
117    void fileDoubleClicked(QTreeWidgetItem *item, int column);
118    void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
119    void upButtonPushed();
120    void unmarkButtonPushed();
121    void markButtonPushed();
122    void addDirectory(QString &);
123
124 private:
125    int m_conn;
126    void writeSettings();
127    void readSettings();
128    QString m_cwd;
129    QHash<QString, QTreeWidgetItem *> m_dirPaths;
130    QHash<QTreeWidgetItem *,QString> m_dirTreeItems;
131    QRegExp m_rx;
132    QString m_splitText;
133 };
134
135 class bRestore : public Pages, public Ui::bRestoreForm
136 {
137    Q_OBJECT 
138
139 public:
140    bRestore();
141    ~bRestore();
142    void PgSeltreeWidgetClicked();
143    QString m_client;
144    QString m_jobids;
145    void get_info_from_selection(QStringList &fileids, QStringList &jobids,
146                                 QStringList &dirids, QStringList &fileindexes);
147
148 public slots:
149    void setClient();
150    void setJob();
151    void showInfoForFile(QTableWidgetItem *);
152    void applyLocation();
153    void clearVersions(QTableWidgetItem *);
154    void clearRestoreList();
155    void runRestore();
156    void refreshView();
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    int64_t runRestore(QString tablename);
180
181 public slots:
182    void useRegexp();
183    void UFRcb();
184    void computeRestore();
185 };
186
187 #endif /* _RESTORE_H_ */