From 867e3c50d7a04a8bb656287d07709b23c5e57eb1 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 20 May 2007 01:57:51 +0000 Subject: [PATCH] Default to never in overwrite in replace of runcmd. Fix of when and bootstrap entry boxes. Still an issue with messages. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4844 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/mainwin.cpp | 2 +- bacula/src/qt-console/mainwin.h | 1 + bacula/src/qt-console/run/run.cpp | 46 ++- bacula/src/qt-console/run/run.ui | 524 +++++++++++++-------------- bacula/src/qt-console/run/runcmd.cpp | 5 +- bacula/src/qt-console/run/runcmd.ui | 2 +- 6 files changed, 290 insertions(+), 290 deletions(-) diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 0e23313aa4..e6e33be146 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -49,7 +49,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { - + m_dtformat = "yyyy-MM-dd HH:mm:ss"; mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ readPreferences(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 0e965c6b8c..b14ae65386 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -78,6 +78,7 @@ public: int m_recordLimitVal; bool m_daysLimitCheck; int m_daysLimitVal; + QString m_dtformat; public slots: diff --git a/bacula/src/qt-console/run/run.cpp b/bacula/src/qt-console/run/run.cpp index a0fa20e091..41c5e1673c 100644 --- a/bacula/src/qt-console/run/run.cpp +++ b/bacula/src/qt-console/run/run.cpp @@ -56,7 +56,13 @@ runPage::runPage() clientCombo->addItems(m_console->client_list); poolCombo->addItems(m_console->pool_list); storageCombo->addItems(m_console->storage_list); + dateTimeEdit->setDisplayFormat(mainWin->m_dtformat); dateTimeEdit->setDateTime(dt.currentDateTime()); + /*printf("listing messages resources"); ***FIME *** + foreach(QString mes, m_console->messages_list) { + printf("%s\n", mes.toUtf8().data()); + }*/ + messagesCombo->addItems(m_console->messages_list); job_name_change(0); connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int))); connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); @@ -69,23 +75,28 @@ runPage::runPage() void runPage::okButtonPushed() { - char cmd[1000]; - this->hide(); - - // ***FIXME** add date/time from dateTimeEdit. - bsnprintf(cmd, sizeof(cmd), - "run job=\"%s\" fileset=\"%s\" level=%s client=\"%s\" pool=\"%s\" " - "storage=\"%s\" priority=\"%d\" yes\n", - jobCombo->currentText().toUtf8().data(), - filesetCombo->currentText().toUtf8().data(), - levelCombo->currentText().toUtf8().data(), - clientCombo->currentText().toUtf8().data(), - poolCombo->currentText().toUtf8().data(), - storageCombo->currentText().toUtf8().data(), - prioritySpin->value()); - - m_console->write_dir(cmd); + QString cmd; + QTextStream(&cmd) << "run" << + " job=\"" << jobCombo->currentText() << "\"" << + " fileset=\"" << filesetCombo->currentText() << "\"" << + " level=\"" << levelCombo->currentText() << "\"" << + " client=\"" << clientCombo->currentText() << "\"" << + " pool=\"" << poolCombo->currentText() << "\"" << + " storage=\"" << storageCombo->currentText() << "\"" << + " priority=\"" << prioritySpin->value() << "\"" + " when=\"" << dateTimeEdit->dateTime().toString(mainWin->m_dtformat) << "\""; + if (bootstrap->text() != "") { + cmd += " bootstrap=\"" + bootstrap->text() + "\""; + } + cmd += " yes"; +// messagesCombo->currentText().toUtf8().data(); FIXME messages not working + + if (mainWin->m_commandDebug) { + Pmsg1(000, "command : %s\n", cmd.toUtf8().data()); + } + + m_console->write_dir(cmd.toUtf8().data()); m_console->display_text(cmd); m_console->displayToPrompt(); m_console->notify(true); @@ -120,7 +131,6 @@ void runPage::job_name_change(int index) clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly)); storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly)); - typeCombo->clear(); - typeCombo->addItem(job_defs.type); + messagesCombo->setCurrentIndex(messagesCombo->findText(job_defs.messages_name, Qt::MatchExactly)); } } diff --git a/bacula/src/qt-console/run/run.ui b/bacula/src/qt-console/run/run.ui index 02679a1deb..4bd95aecf9 100644 --- a/bacula/src/qt-console/run/run.ui +++ b/bacula/src/qt-console/run/run.ui @@ -5,8 +5,8 @@ 0 0 - 777 - 429 + 734 + 483 @@ -19,51 +19,6 @@ 6 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 351 - 16 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 351 - 16 - - - - @@ -72,7 +27,152 @@ 6 - + + + + Level: + + + levelCombo + + + + + + + + + + Bootstrap: + + + true + + + bootstrap + + + + + + + + + + true + + + + 200 + 0 + + + + false + + + + + + + + + + + 0 + 2 + 0 + 2000 + 1 + 1 + + + + yyyy-mm-dd hh:mm:ss + + + true + + + + + + + Job: + + + jobCombo + + + + + + + Qt::Vertical + + + + 56 + 151 + + + + + + + + Pool: + + + poolCombo + + + + + + + 0 + + + 6 + + + + + Type: + + + + + + + <h3>Backup<h3/> + + + + + + + + + FileSet: + + + filesetCombo + + + + + + + Messages: + + + messagesCombo + + + + 0 @@ -121,231 +221,33 @@ - - - - 0 + + + + + + + Priority: - - 6 + + prioritySpin - - - - Type: - - - typeCombo - - - - - - - Messages: - - - messagesCombo - - - - - - - Qt::Vertical - - - - 20 - 171 - - - - - - - - - - - - - - When: - - - dateTimeEdit - - - - - - - FileSet: - - - filesetCombo - - - - - - - false - - - - 200 - 0 - - - - false - - - - - - - - 0 - 2 - 0 - 2000 - 1 - 1 - - - - yyyy-mm-dd hh:mm:ss - - - true - - - - - - - 10000 - - - 1 - - - 10 - - - - - - - - - - - - - - - - Pool: - - - poolCombo - - - - - - - Bootstrap: - - - true - - - bootstrap - - - - - - - - 5 - 0 - 0 - 0 - - - - - 150 - 0 - - - - - - - - Client: - - - clientCombo - - - - - - - Job: - - - jobCombo - - - - - - - Storage: - - - storageCombo - - - - - - - Level: - - - levelCombo - - - - - - - Priority: - - - prioritySpin - - - - - - - - - - + + + + + + + Client: + + + clientCombo + + + + 0 @@ -382,8 +284,60 @@ + + + + 10000 + + + 1 + + + 10 + + + + + + + + + + Storage: + + + storageCombo + + + + + + + + + + When: + + + dateTimeEdit + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -397,6 +351,38 @@ + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 351 + 16 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 351 + 16 + + + + diff --git a/bacula/src/qt-console/run/runcmd.cpp b/bacula/src/qt-console/run/runcmd.cpp index f83de90820..a96692e4da 100644 --- a/bacula/src/qt-console/run/runcmd.cpp +++ b/bacula/src/qt-console/run/runcmd.cpp @@ -74,6 +74,7 @@ void runCmdPage::fill() clientCombo->addItems(m_console->client_list); filesetCombo->addItems(m_console->fileset_list); replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder"); + replaceCombo->setCurrentIndex(replaceCombo->findText("never", Qt::MatchExactly)); storageCombo->addItems(m_console->storage_list); dateTimeEdit->setDisplayFormat(m_dtformat); @@ -129,7 +130,9 @@ void runCmdPage::fill() continue; } if (item.startsWith("Replace:")) { - replaceCombo->setCurrentIndex(replaceCombo->findText(val, Qt::MatchExactly)); + int replaceIndex = replaceCombo->findText(val, Qt::MatchExactly); + if (replaceIndex >= 0) + replaceCombo->setCurrentIndex(replaceIndex); continue; } } diff --git a/bacula/src/qt-console/run/runcmd.ui b/bacula/src/qt-console/run/runcmd.ui index 9778231eb0..2f32c5cfe1 100644 --- a/bacula/src/qt-console/run/runcmd.ui +++ b/bacula/src/qt-console/run/runcmd.ui @@ -284,7 +284,7 @@ - Client: + To client: clientCombo -- 2.39.5