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
31 runPage::runPage() : Pages()
37 runPage::runPage(const QString &defJob) : Pages()
39 m_dockOnFirstUse = false;
42 jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
47 runPage::runPage(const QString &defJob, const QString &level,
48 const QString &pool, const QString &storage,
49 const QString &client, const QString &fileset)
52 m_dockOnFirstUse = false;
54 jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
56 filesetCombo->setCurrentIndex(filesetCombo->findText(fileset,
58 levelCombo->setCurrentIndex(levelCombo->findText(level, Qt::MatchExactly));
59 clientCombo->setCurrentIndex(clientCombo->findText(client,Qt::MatchExactly));
60 poolCombo->setCurrentIndex(poolCombo->findText(pool, Qt::MatchExactly));
62 if (storage != "") { // TODO: enable storage
63 storageCombo->setCurrentIndex(storageCombo->findText(storage,
71 * Setup all the combo boxes and display the dialog
76 QDesktopWidget *desk = QApplication::desktop();
82 /* Get screen rectangle */
83 scrn = desk->screenGeometry(desk->primaryScreen());
84 /* Position this window in the middle of the screen */
85 this->move((scrn.width()-this->width())/2, (scrn.height()-this->height())/2);
86 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
87 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/run.png")));
88 m_conn = m_console->notifyOff();
90 m_console->beginNewCommand(m_conn);
91 jobCombo->addItems(m_console->job_list);
92 filesetCombo->addItems(m_console->fileset_list);
93 levelCombo->addItems(m_console->level_list);
94 clientCombo->addItems(m_console->client_list);
95 poolCombo->addItems(m_console->pool_list);
96 storageCombo->addItems(m_console->storage_list);
97 dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
98 dateTimeEdit->setDateTime(dt.currentDateTime());
99 /*printf("listing messages resources"); ***FIME ***
100 foreach(QString mes, m_console->messages_list) {
101 printf("%s\n", mes.toUtf8().data());
103 messagesCombo->addItems(m_console->messages_list);
104 messagesCombo->setEnabled(false);
106 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
107 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
108 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
110 // find a way to place the new window at the cursor position
111 // or in the middle of the page
116 void runPage::okButtonPushed()
120 QTextStream(&cmd) << "run" <<
121 " job=\"" << jobCombo->currentText() << "\"" <<
122 " fileset=\"" << filesetCombo->currentText() << "\"" <<
123 " level=\"" << levelCombo->currentText() << "\"" <<
124 " client=\"" << clientCombo->currentText() << "\"" <<
125 " pool=\"" << poolCombo->currentText() << "\"" <<
126 " storage=\"" << storageCombo->currentText() << "\"" <<
127 " priority=\"" << prioritySpin->value() << "\""
128 " when=\"" << dateTimeEdit->dateTime().toString(mainWin->m_dtformat) << "\"";
130 " messages=\"" << messagesCombo->currentText() << "\"";
131 /* FIXME when there is an option to modify the messages resoruce associated
134 if (bootstrap->text() != "") {
135 cmd += " bootstrap=\"" + bootstrap->text() + "\"";
139 if (mainWin->m_commandDebug) {
140 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
144 m_console->notify(m_conn, true);
146 mainWin->resetFocus();
150 void runPage::cancelButtonPushed()
152 mainWin->set_status(tr(" Canceled"));
154 m_console->notify(m_conn, true);
156 mainWin->resetFocus();
160 * Called here when the jobname combo box is changed.
161 * We load the default values for the new job in the
164 void runPage::job_name_change(int index)
166 job_defaults job_defs;
169 job_defs.job_name = jobCombo->currentText();
170 if (m_console->get_job_defaults(job_defs)) {
172 typeLabel->setText("<H3>"+job_defs.type+"</H3>");
173 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
174 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly));
175 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
176 poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
177 storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
178 messagesCombo->setCurrentIndex(messagesCombo->findText(job_defs.messages_name, Qt::MatchExactly));
179 m_console->level_list.clear();
180 cmd = ".levels " + job_defs.type;
181 m_console->dir_cmd(cmd, m_console->level_list);
183 levelCombo->addItems(m_console->level_list);
184 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, 0 /*Qt::MatchExactly*/));