From 07eea5cf0d8392da96df5ff1a762b16b8f129544 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Wed, 15 Apr 2015 10:51:10 +0200 Subject: [PATCH] Fix invalid .mod command in BAT during restore --- bacula/src/qt-console/bcomm/dircomm.cpp | 5 +---- bacula/src/qt-console/pages.cpp | 26 ++++++++++++------------- bacula/src/qt-console/pages.h | 3 +-- bacula/src/qt-console/run/estimate.cpp | 2 +- bacula/src/qt-console/run/runcmd.cpp | 8 +++----- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/bacula/src/qt-console/bcomm/dircomm.cpp b/bacula/src/qt-console/bcomm/dircomm.cpp index 4b81699d4c..33500b00c8 100644 --- a/bacula/src/qt-console/bcomm/dircomm.cpp +++ b/bacula/src/qt-console/bcomm/dircomm.cpp @@ -396,11 +396,8 @@ int DirComm::read() case BNET_TEXT_INPUT: if (mainWin->m_commDebug) Pmsg4(000, "conn %i TEXT_INPUT at_prompt=%d m_in_select=%d notify=%d\n", m_conn, m_at_prompt, m_in_select, is_notify_enabled()); - //if (!m_in_select && is_notify_enabled()) { - if (!m_in_select) { - mainWin->waitExit(); + if (!m_in_select && is_notify_enabled()) { new textInputDialog(m_console, m_conn); - } else { if (mainWin->m_commDebug) Pmsg0(000, "!m_in_select && is_notify_enabled\n"); m_at_prompt = true; m_at_main_prompt = false; diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 0a7c70c903..fc1494e1c4 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -293,24 +293,22 @@ void Pages::consoleCommand(QString &command) void Pages::consoleCommand(QString &command, bool setCurrent) { int conn; - bool donotify = false; - if (m_console->getDirComm(conn)) { - if (m_console->is_notify_enabled(conn)) { - donotify = true; - m_console->notify(conn, false); - } - consoleCommand(command, conn, setCurrent); - if (donotify) { m_console->notify(conn, true); } + if (m_console->getDirComm(conn)) { + consoleCommand(command, conn, setCurrent, true); } } -void Pages::consoleCommand(QString &command, int conn) -{ - consoleCommand(command, conn, true); -} - -void Pages::consoleCommand(QString &command, int conn, bool setCurrent) +/* + * Lowest level of console command method. + * "notify" parameter default is set to true by higher level console command call. + * In most cases "notify" parameter should be set to true value because after console + * command sent, notifier should be always enabled for catch all Director responses. + */ +void Pages::consoleCommand(QString &command, int conn, bool setCurrent, bool notify) { + if (notify) { + m_console->notify(conn, true); + } /* Bring this director's console to the front of the stack */ if (setCurrent) { setConsoleCurrent(); } QString displayhtml(""); diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index bc460ca740..c3e3280f8b 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -58,9 +58,8 @@ public: void setContextMenuDockText(); void setTreeWidgetItemDockColor(); void consoleCommand(QString &); - void consoleCommand(QString &, int conn); void consoleCommand(QString &, bool setCurrent); - void consoleCommand(QString &, int conn, bool setCurrent); + void consoleCommand(QString &, int conn, bool setCurrent=true, bool notify=true); QString &name() { return m_name; }; void getVolumeList(QStringList &); void getStatusList(QStringList &); diff --git a/bacula/src/qt-console/run/estimate.cpp b/bacula/src/qt-console/run/estimate.cpp index 28399da919..7154d526ba 100644 --- a/bacula/src/qt-console/run/estimate.cpp +++ b/bacula/src/qt-console/run/estimate.cpp @@ -74,7 +74,7 @@ void estimatePage::okButtonPushed() Pmsg1(000, "command : %s\n", cmd.toUtf8().data()); } - consoleCommand(cmd, m_conn); + consoleCommand(cmd, m_conn, true, true); m_console->notify(m_conn, true); closeStackPage(); mainWin->resetFocus(); diff --git a/bacula/src/qt-console/run/runcmd.cpp b/bacula/src/qt-console/run/runcmd.cpp index e9369ca7fe..66573985b8 100644 --- a/bacula/src/qt-console/run/runcmd.cpp +++ b/bacula/src/qt-console/run/runcmd.cpp @@ -44,7 +44,6 @@ runCmdPage::runCmdPage(int conn) : Pages() m_console->notify(conn, false); fill(); - m_console->discardToPrompt(m_conn); connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed())); @@ -159,12 +158,11 @@ void runCmdPage::okButtonPushed() void runCmdPage::cancelButtonPushed() { - m_console->displayToPrompt(m_conn); - m_console->write_dir("."); - m_console->displayToPrompt(m_conn); - mainWin->set_status(tr(" Canceled")); this->hide(); + m_console->write_dir(m_conn, "no"); + m_console->displayToPrompt(m_conn); m_console->notify(m_conn, true); + mainWin->set_status(tr(" Canceled")); closeStackPage(); mainWin->resetFocus(); } -- 2.39.2