From ccf58c433cfaee0ab871933e454e44073b97dc1d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 18 Jul 2009 21:03:34 +0000 Subject: [PATCH] Fix bat command line input bug git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9054 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/console/console.cpp | 18 ++++++++++++++++++ bacula/src/qt-console/console/console.h | 1 + bacula/src/qt-console/mainwin.cpp | 12 ++++++++---- bacula/technotes | 2 ++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 8b2bf80b5e..dacbd97e45 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -811,6 +811,24 @@ bool Console::availableDirComm(int &conn) return false; } + +/* + * Need current connection. + */ +bool Console::currentDirComm(int &conn) +{ + QHash::const_iterator iter = m_dircommHash.constBegin(); + while (iter != m_dircommHash.constEnd()) { + DirComm *dircomm = iter.value(); + if (dircomm->m_at_prompt && !dircomm->m_at_main_prompt && dircomm->is_notify_enabled()) { + conn = dircomm->m_conn; + return true; + } + ++iter; + } + return false; +} + /* * Create a new connection */ diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index f798748f9a..3b2896eff7 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -81,6 +81,7 @@ public: bool notify(int conn, bool enable); // enables/disables socket notification - returns the previous state bool is_notify_enabled(int conn) const; bool availableDirComm(int &conn); + bool currentDirComm(int &conn); void displayToPrompt(int conn); bool dir_cmd(int conn, const char *cmd, QStringList &results); diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index ababdd3454..cddfb23001 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -321,8 +321,7 @@ void MainWin::waitEnter() void MainWin::waitExit() { m_waitState = false; - if (mainWin->m_connDebug) - Pmsg0(000, "Exiting Wait State\n"); + if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n"); app->restoreOverrideCursor(); if (m_waitTreeItem != treeWidget->currentItem()) treeWidget->setCurrentItem(m_waitTreeItem); @@ -591,11 +590,16 @@ void MainWin::jobPlotButtonClicked() */ void MainWin::input_line() { + int conn; QString cmdStr = lineEdit->text(); /* Get the text */ lineEdit->clear(); /* clear the lineEdit box */ if (m_currentConsole->is_connected()) { - /* Use consoleCommand to allow typing anything */ - m_currentConsole->consoleCommand(cmdStr); + if (m_currentConsole->currentDirComm(conn)) { + m_currentConsole->consoleCommand(cmdStr, conn); + } else { + /* Use consoleCommand to allow typing anything */ + m_currentConsole->consoleCommand(cmdStr); + } } else { set_status(tr("Director not connected. Click on connect button.")); } diff --git a/bacula/technotes b/bacula/technotes index fbb0cf57c5..968b93efb6 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,8 @@ General: +18Jul09 +kes Fix bat command line input bug 17Jul09 ebl Fix sql query for sqlite on suse10 on copy job 16Jul09 -- 2.39.5