]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/restore/restore.h
Change copyright as per agreement with FSFE
[bacula/bacula] / bacula / src / qt-console / restore / restore.h
1 #ifndef _RESTORE_H_
2 #define _RESTORE_H_
3
4 /*
5    Bacula(R) - The Network Backup Solution
6
7    Copyright (C) 2000-2016 Kern Sibbald
8
9    The original author of Bacula is Kern Sibbald, with contributions
10    from many others, a complete list can be found in the file AUTHORS.
11
12    You may use this file and others of this release according to the
13    license defined in the LICENSE file, which includes the Affero General
14    Public License, v3.0 ("AGPLv3") and some additional permissions and
15    terms pursuant to its AGPLv3 Section 7.
16
17    This notice must be preserved when any source code is 
18    conveyed and/or propagated.
19
20    Bacula(R) is a registered trademark of Kern Sibbald.
21 */
22 /*
23  *
24  *  Kern Sibbald, February 2007
25  */
26
27 #include <stdint.h>
28 #include <sys/types.h>     /* Needed for some systems */
29 #include <QtGui>
30 #include "pages.h"
31 #include "ui_runrestore.h"
32
33 class bRestoreTable : public QTableWidget
34 {
35    Q_OBJECT 
36 private:
37    QPoint dragStartPosition;
38 public:
39    bRestoreTable(QWidget *parent)
40       : QTableWidget(parent)
41    {
42    }
43    void mousePressEvent(QMouseEvent *event);
44    void mouseMoveEvent(QMouseEvent *event);
45
46    void dragEnterEvent(QDragEnterEvent *event);
47    void dragMoveEvent(QDragMoveEvent *event);
48    void dropEvent(QDropEvent *event);
49 };
50
51 #include "ui_brestore.h"
52 #include "ui_restore.h"
53 #include "ui_prerestore.h"
54
55 enum {
56    R_NONE,
57    R_JOBIDLIST,
58    R_JOBDATETIME
59 };
60
61 /*
62  * The pre-restore dialog selects the Job/Client to be restored
63  * It really could use considerable enhancement.
64  */
65 class prerestorePage : public Pages, public Ui::prerestoreForm
66 {
67    Q_OBJECT 
68
69 public:
70    prerestorePage();
71    prerestorePage(QString &data, unsigned int);
72
73 private slots:
74    void okButtonPushed();
75    void cancelButtonPushed();
76    void job_name_change(int index);
77    void recentChanged(int);
78    void jobRadioClicked(bool);
79    void jobidsRadioClicked(bool);
80    void jobIdEditFinished();
81
82 private:
83    int m_conn;
84    int jobdefsFromJob(QStringList &, QString &);
85    void buildPage();
86    bool checkJobIdList();
87    QString m_dataIn;
88    unsigned int m_dataInType;
89 };
90
91 /*  
92  * The restore dialog is brought up once we are in the Bacula
93  * restore tree routines.  It handles putting up a GUI tree
94  * representation of the files to be restored.
95  */
96 class restorePage : public Pages, public Ui::restoreForm
97 {
98    Q_OBJECT 
99
100 public:
101    restorePage(int conn);
102    ~restorePage();
103    void fillDirectory();
104    char *get_cwd();
105    bool cwd(const char *);
106
107 private slots:
108    void okButtonPushed();
109    void cancelButtonPushed();
110    void fileDoubleClicked(QTreeWidgetItem *item, int column);
111    void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
112    void upButtonPushed();
113    void unmarkButtonPushed();
114    void markButtonPushed();
115    void addDirectory(QString &);
116
117 private:
118    int m_conn;
119    void writeSettings();
120    void readSettings();
121    QString m_cwd;
122    QHash<QString, QTreeWidgetItem *> m_dirPaths;
123    QHash<QTreeWidgetItem *,QString> m_dirTreeItems;
124    QRegExp m_rx;
125    QString m_splitText;
126 };
127
128 class bRestore : public Pages, public Ui::bRestoreForm
129 {
130    Q_OBJECT 
131
132 public:
133    bRestore();
134    ~bRestore();
135    void PgSeltreeWidgetClicked();
136    QString m_client;
137    QString m_jobids;
138    void get_info_from_selection(QStringList &fileids, QStringList &jobids,
139                                 QStringList &dirids, QStringList &fileindexes);
140
141 public slots:
142    void setClient();
143    void setJob();
144    void showInfoForFile(QTableWidgetItem *);
145    void applyLocation();
146    void clearVersions(QTableWidgetItem *);
147    void clearRestoreList();
148    void runRestore();
149    void refreshView();
150 private:
151    QString m_path;
152    int64_t m_pathid;
153    QTableWidgetItem *m_current;
154    void setupPage();
155    bool m_populated;
156    void displayFiles(int64_t pathid, QString path);
157    void displayFileVersion(QString pathid, QString fnid, 
158                            QString client, QString filename);
159 };
160
161 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
162 {
163    Q_OBJECT 
164 private:
165    bRestore *brestore;
166    QStringList m_fileids, m_jobids, m_dirids, m_findexes;
167
168 public:
169    bRunRestore(bRestore *parent);
170    ~bRunRestore() {}
171    void computeVolumeList();
172    int64_t runRestore(QString tablename);
173
174 public slots:
175    void useRegexp();
176    void UFRcb();
177    void computeRestore();
178 };
179
180 #endif /* _RESTORE_H_ */