1 /*
2    Bacula(R) - The Network Backup Solution
3 
4    Copyright (C) 2000-2020 Kern Sibbald
5 
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8 
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13 
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16 
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  * Restore Wizard: File selection page
21  *
22  * Written by Norbert Bizet, May MMXVII
23  *
24  */
25 #ifndef FILESELECTWIZARDPAGE_H
26 #define FILESELECTWIZARDPAGE_H
27 
28 #include <QWizardPage>
29 
30 class QStandardItemModel;
31 class QModelIndex;
32 class RESMON;
33 class task;
34 
35 namespace Ui {
36 class FileSelectWizardPage;
37 }
38 
39 class FileSelectWizardPage : public QWizardPage
40 {
41     Q_OBJECT
42 
43     Q_PROPERTY(qulonglong currentSourceId READ currentSourceId NOTIFY currentSourceIdChanged)
44     Q_PROPERTY(QString currentPathStr READ currentPathStr NOTIFY currentPathStrChanged)
45     Q_PROPERTY(QString jobIds READ jobIds NOTIFY jobIdsChanged)
46     Q_PROPERTY(QString fileIds READ fileIds NOTIFY fileIdsChanged)
47     Q_PROPERTY(QString dirIds READ dirIds NOTIFY dirIdsChanged)
48     Q_PROPERTY(QString hardlinks READ hardlinks NOTIFY hardlinksChanged)
49     Q_PROPERTY(QString pluginIds READ pluginIds NOTIFY pluginIdsChanged)
50     Q_PROPERTY(QString pluginNames READ pluginNames NOTIFY pluginNamesChanged)
51 
52 private:    qulonglong          m_currentSourceId;
currentSourceId()53 public:     qulonglong          currentSourceId() const { return m_currentSourceId; }
54 signals:    void                currentSourceIdChanged();
55 private:    QString             m_currentPathStr;
currentPathStr()56 public:     QString             currentPathStr() const { return m_currentPathStr; }
57 signals:    void                currentPathStrChanged();
58 private:    QString             m_jobIds;
jobIds()59 public:     QString             jobIds() const { return m_jobIds; }
60 signals:    void                jobIdsChanged();
61 private:    QString             m_fileIds;
fileIds()62 public:     QString             fileIds() const { return m_fileIds; }
63 signals:    void                fileIdsChanged();
64 private:    QString             m_dirIds;
dirIds()65 public:     QString             dirIds() const { return m_dirIds; }
66 signals:    void                dirIdsChanged();
67 private:    QString             m_hardlinks;
hardlinks()68 public:     QString             hardlinks() const { return m_hardlinks; }
69 signals:    void                hardlinksChanged();
70 private:    QString             m_pluginIds;
pluginIds()71 public:     QString             pluginIds() const { return m_pluginIds; }
72 signals:    void                pluginIdsChanged();
73 private:    QString             m_pluginNames;
pluginNames()74 public:     QString             pluginNames() const { return m_pluginNames; }
75 signals:    void                pluginNamesChanged();
76 
77 public:
78     explicit FileSelectWizardPage(QWidget *parent = 0);
79     ~FileSelectWizardPage();
80     /* QWizardPage interface */
81     void initializePage();
82     bool isComplete() const;
83     int nextId() const;
84     bool validatePage();
85     /* local interface */
setRes(RESMON * r)86     void setRes(RESMON *r) {res=r;}
87 
88 protected slots:
89     void updateSourceModel();
90 
91     void optimizeSize();
92 
93     void changeCurrentFolder(const QModelIndex& current);
94     void changeCurrentText(const QString &current);
95 
96     void deleteDestSelection();
97 
98     void delayedFilter();
99 
100     void freezeSrcView();
101     void unFreezeSrcView();
102 
103 private:
104     Ui::FileSelectWizardPage    *ui;
105     QStandardItemModel          *src_files_model;
106     QStandardItemModel          *dest_files_model;
107     QTimer                      *m_filterTimer;
108     RESMON                      *res;
109     bool                        need_optimize;
110 };
111 
112 #endif // FILESELECTWIZARDPAGE_H
113