2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2016 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.
23 * Kern Sibbald, February MMVII
32 * Setup all the combo boxes and display the dialog
34 estimatePage::estimatePage() : Pages()
38 m_name = tr("Estimate");
41 m_conn = m_console->notifyOff();
43 m_console->beginNewCommand(m_conn);
44 jobCombo->addItems(m_console->job_list);
45 filesetCombo->addItems(m_console->fileset_list);
46 levelCombo->addItems(m_console->level_list);
47 clientCombo->addItems(m_console->client_list);
49 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
50 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
51 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
52 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
53 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/estimate-job.png")));
58 m_aButtonPushed = false;
61 void estimatePage::okButtonPushed()
63 if (m_aButtonPushed) return;
64 m_aButtonPushed = true;
67 QTextStream(&cmd) << "estimate" <<
68 " job=\"" << jobCombo->currentText() << "\"" <<
69 " fileset=\"" << filesetCombo->currentText() << "\"" <<
70 " level=\"" << levelCombo->currentText() << "\"" <<
71 " client=\"" << clientCombo->currentText() << "\"";
72 if (listingCheckBox->checkState() == Qt::Checked) {
76 if (mainWin->m_commandDebug) {
77 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
80 consoleCommand(cmd, m_conn, true, true);
81 m_console->notify(m_conn, true);
83 mainWin->resetFocus();
87 void estimatePage::cancelButtonPushed()
89 if (m_aButtonPushed) return;
90 m_aButtonPushed = true;
91 mainWin->set_status(" Canceled");
93 m_console->notify(m_conn, true);
95 mainWin->resetFocus();
99 * Called here when the jobname combo box is changed.
100 * We load the default values for the new job in the
103 void estimatePage::job_name_change(int index)
105 job_defaults job_defs;
108 job_defs.job_name = jobCombo->currentText();
109 if (m_console->get_job_defaults(m_conn, job_defs)) {
110 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
111 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly));
112 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));