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