]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/restore/restore.h
8280a5d6c6027ca73475cd20239baa6763fed4d3
[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
147 public slots:
148    void setClient();
149    void setJob();
150    void showInfoForFile(QTableWidgetItem *);
151    void applyLocation();
152    void clearVersions(QTableWidgetItem *);
153    void clearRestoreList();
154    void runRestore();
155 private:
156    QString m_path;
157    int64_t m_pathid;
158    QTableWidgetItem *m_current;
159    void setupPage();
160    bool m_populated;
161    void displayFiles(int64_t pathid, QString path);
162    void displayFileVersion(QString pathid, QString fnid, 
163                            QString client, QString filename);
164 };
165
166 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
167 {
168    Q_OBJECT 
169
170 public:
171    bRunRestore(bRestore *parent);
172    ~bRunRestore() {}
173 public slots:
174    void useRegexp();
175    void UFRcb();
176 };
177
178 #endif /* _RESTORE_H_ */