2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
7 The original author of Bacula is Kern Sibbald, with contributions
8 from many others, a complete list can be found in the file AUTHORS.
10 You may use this file and others of this release according to the
11 license defined in the LICENSE file, which includes the Affero General
12 Public License, v3.0 ("AGPLv3") and some additional permissions and
13 terms pursuant to its AGPLv3 Section 7.
15 This notice must be preserved when any source code is
16 conveyed and/or propagated.
18 Bacula(R) is a registered trademark of Kern Sibbald.
24 * Kern Sibbald, February MMVII
33 * Setup all the combo boxes and display the dialog
35 estimatePage::estimatePage() : Pages()
39 m_name = tr("Estimate");
42 m_conn = m_console->notifyOff();
44 m_console->beginNewCommand(m_conn);
45 jobCombo->addItems(m_console->job_list);
46 filesetCombo->addItems(m_console->fileset_list);
47 levelCombo->addItems(m_console->level_list);
48 clientCombo->addItems(m_console->client_list);
50 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
51 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
52 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
53 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
54 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/estimate-job.png")));
59 m_aButtonPushed = false;
62 void estimatePage::okButtonPushed()
64 if (m_aButtonPushed) return;
65 m_aButtonPushed = true;
68 QTextStream(&cmd) << "estimate" <<
69 " job=\"" << jobCombo->currentText() << "\"" <<
70 " fileset=\"" << filesetCombo->currentText() << "\"" <<
71 " level=\"" << levelCombo->currentText() << "\"" <<
72 " client=\"" << clientCombo->currentText() << "\"";
73 if (listingCheckBox->checkState() == Qt::Checked) {
77 if (mainWin->m_commandDebug) {
78 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
81 consoleCommand(cmd, m_conn, true, true);
82 m_console->notify(m_conn, true);
84 mainWin->resetFocus();
88 void estimatePage::cancelButtonPushed()
90 if (m_aButtonPushed) return;
91 m_aButtonPushed = true;
92 mainWin->set_status(" Canceled");
94 m_console->notify(m_conn, true);
96 mainWin->resetFocus();
100 * Called here when the jobname combo box is changed.
101 * We load the default values for the new job in the
104 void estimatePage::job_name_change(int index)
106 job_defaults job_defs;
109 job_defs.job_name = jobCombo->currentText();
110 if (m_console->get_job_defaults(m_conn, job_defs)) {
111 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
112 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly));
113 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));