2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2017 Kern Sibbald
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.
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.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
19 #include "restorewizard.h"
20 #include "ui_restorewizard.h"
21 #include "filesmodel.h"
23 #include <QStandardItemModel>
25 RestoreWizard::RestoreWizard(RESMON *r, QWidget *parent) :
28 ui(new Ui::RestoreWizard),
29 jobs_model(new QStandardItemModel),
30 src_files_model(new FileSourceModel),
31 dest_files_model(new FileDestModel)
35 connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)));
37 ui->RestWizBackupSelectPage->setModel(jobs_model);
38 ui->RestWiFileSelectionPage->setModels(src_files_model, dest_files_model);
39 connect(ui->RestWiFileSelectionPage, SIGNAL(currentFileChanged()), this, SLOT(fillFilePage()));
40 ui->RestWizAdvancedOptionsPage->setModel(dest_files_model);
41 ui->RestWizAdvancedOptionsPage->setResmon(res);
45 void RestoreWizard::pageChanged(int index)
49 ui->RestWizClientPage->setClients(res->clients);
57 case RW_ADVANCEDOPTIONS_PAGE:
61 qDebug( "pageChanged default: %d", index );
65 RestoreWizard::~RestoreWizard()
70 void RestoreWizard::fillJobPage()
73 connect(t, SIGNAL(done(task*)), ui->RestWizBackupSelectPage, SLOT(optimizeSize()), Qt::QueuedConnection);
74 connect(t, SIGNAL(done(task*)), t, SLOT(deleteLater()));
76 t->init(res, TASK_LIST_CLIENT_JOBS);
78 int idx = field("currentClient").toInt();
79 char *p = (char*) res->clients->get(idx);
82 t->arg = info.c_str();
83 t->model = jobs_model;
87 void RestoreWizard::fillFilePage()
90 connect(t, SIGNAL(done(task*)), t, SLOT(deleteLater()));
92 t->init(res, TASK_LIST_JOB_FILES);
94 const char *p = field("currentJob").toString().toUtf8();
97 t->arg = info.c_str();
99 t->pathId = field("currentFile").toULongLong();
100 t->model = src_files_model;
105 void RestoreWizard::fillOptionsPage()
107 ui->RestWizAdvancedOptionsPage->setClients(res->clients);
109 task *t = new task();
110 connect(t, SIGNAL(done(task *)), ui->RestWizAdvancedOptionsPage, SLOT(fill_defaults(task *)), Qt::QueuedConnection);
111 connect(t, SIGNAL(done(task*)), t, SLOT(deleteLater()));
113 const char *p = "RestoreFile";/*field("currentJob").toString().toStdString().c_str();*/
117 bfree_and_null(res->defaults.job);
118 res->defaults.job = bstrdup(info.c_str());
119 res->mutex->unlock();
121 t->init(res, TASK_DEFAULTS);