2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2007-2011 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
32 runPage::runPage() : Pages()
38 runPage::runPage(const QString &defJob) : Pages()
40 m_dockOnFirstUse = false;
43 jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
48 runPage::runPage(const QString &defJob, const QString &level,
49 const QString &pool, const QString &storage,
50 const QString &client, const QString &fileset)
53 m_dockOnFirstUse = false;
55 jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
57 filesetCombo->setCurrentIndex(filesetCombo->findText(fileset,
59 levelCombo->setCurrentIndex(levelCombo->findText(level, Qt::MatchExactly));
60 clientCombo->setCurrentIndex(clientCombo->findText(client,Qt::MatchExactly));
61 poolCombo->setCurrentIndex(poolCombo->findText(pool, Qt::MatchExactly));
63 if (storage != "") { // TODO: enable storage
64 storageCombo->setCurrentIndex(storageCombo->findText(storage,
72 * Setup all the combo boxes and display the dialog
77 QDesktopWidget *desk = QApplication::desktop();
83 /* Get screen rectangle */
84 scrn = desk->screenGeometry(desk->primaryScreen());
85 /* Position this window in the middle of the screen */
86 this->move((scrn.width()-this->width())/2, (scrn.height()-this->height())/2);
87 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
88 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/run.png")));
89 m_conn = m_console->notifyOff();
91 m_console->beginNewCommand(m_conn);
92 jobCombo->addItems(m_console->job_list);
93 filesetCombo->addItems(m_console->fileset_list);
94 levelCombo->addItems(m_console->level_list);
95 clientCombo->addItems(m_console->client_list);
96 poolCombo->addItems(m_console->pool_list);
97 storageCombo->addItems(m_console->storage_list);
98 dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
99 dateTimeEdit->setDateTime(dt.currentDateTime());
100 /*printf("listing messages resources"); ***FIME ***
101 foreach(QString mes, m_console->messages_list) {
102 printf("%s\n", mes.toUtf8().data());
104 messagesCombo->addItems(m_console->messages_list);
105 messagesCombo->setEnabled(false);
107 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
108 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
109 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
111 // find a way to place the new window at the cursor position
112 // or in the middle of the page
117 void runPage::okButtonPushed()
121 QTextStream(&cmd) << "run" <<
122 " job=\"" << jobCombo->currentText() << "\"" <<
123 " fileset=\"" << filesetCombo->currentText() << "\"" <<
124 " level=\"" << levelCombo->currentText() << "\"" <<
125 " client=\"" << clientCombo->currentText() << "\"" <<
126 " pool=\"" << poolCombo->currentText() << "\"" <<
127 " storage=\"" << storageCombo->currentText() << "\"" <<
128 " priority=\"" << prioritySpin->value() << "\""
129 " when=\"" << dateTimeEdit->dateTime().toString(mainWin->m_dtformat) << "\"";
131 " messages=\"" << messagesCombo->currentText() << "\"";
132 /* FIXME when there is an option to modify the messages resoruce associated
135 if (bootstrap->text() != "") {
136 cmd += " bootstrap=\"" + bootstrap->text() + "\"";
140 if (mainWin->m_commandDebug) {
141 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
145 m_console->notify(m_conn, true);
147 mainWin->resetFocus();
151 void runPage::cancelButtonPushed()
153 mainWin->set_status(tr(" Canceled"));
155 m_console->notify(m_conn, true);
157 mainWin->resetFocus();
161 * Called here when the jobname combo box is changed.
162 * We load the default values for the new job in the
165 void runPage::job_name_change(int index)
167 job_defaults job_defs;
170 job_defs.job_name = jobCombo->currentText();
171 if (m_console->get_job_defaults(job_defs)) {
173 typeLabel->setText("<H3>"+job_defs.type+"</H3>");
174 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
175 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly));
176 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
177 poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
178 storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
179 messagesCombo->setCurrentIndex(messagesCombo->findText(job_defs.messages_name, Qt::MatchExactly));
180 m_console->level_list.clear();
181 cmd = ".levels " + job_defs.type;
182 m_console->dir_cmd(cmd, m_console->level_list);
184 levelCombo->addItems(m_console->level_list);
185 levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, 0 /*Qt::MatchExactly*/));