2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 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 Bacula® is a registered trademark of Kern Sibbald.
20 * Kern Sibbald, February MMVII
29 * Setup all the combo boxes and display the dialog
31 estimatePage::estimatePage() : Pages()
35 m_name = tr("Estimate");
38 m_conn = m_console->notifyOff();
40 m_console->beginNewCommand(m_conn);
41 jobCombo->addItems(m_console->job_list);
42 filesetCombo->addItems(m_console->fileset_list);
43 levelCombo->addItems(m_console->level_list);
44 clientCombo->addItems(m_console->client_list);
46 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
47 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
48 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
49 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
50 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/estimate-job.png")));
55 m_aButtonPushed = false;
58 void estimatePage::okButtonPushed()
60 if (m_aButtonPushed) return;
61 m_aButtonPushed = true;
64 QTextStream(&cmd) << "estimate" <<
65 " job=\"" << jobCombo->currentText() << "\"" <<
66 " fileset=\"" << filesetCombo->currentText() << "\"" <<
67 " level=\"" << levelCombo->currentText() << "\"" <<
68 " client=\"" << clientCombo->currentText() << "\"";
69 if (listingCheckBox->checkState() == Qt::Checked) {
73 if (mainWin->m_commandDebug) {
74 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
77 consoleCommand(cmd, m_conn, true, true);
78 m_console->notify(m_conn, true);
80 mainWin->resetFocus();
84 void estimatePage::cancelButtonPushed()
86 if (m_aButtonPushed) return;
87 m_aButtonPushed = true;
88 mainWin->set_status(" Canceled");
90 m_console->notify(m_conn, true);
92 mainWin->resetFocus();
96 * Called here when the jobname combo box is changed.
97 * We load the default values for the new job in the
100 void estimatePage::job_name_change(int index)
102 job_defaults job_defs;
105 job_defs.job_name = jobCombo->currentText();
106 if (m_console->get_job_defaults(m_conn, job_defs)) {
107 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
108 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly));
109 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));