From: Kern Sibbald Date: Sat, 18 Jul 2009 21:03:34 +0000 (+0000) Subject: Fix bat command line input bug X-Git-Tag: Release-3.0.2~12 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0ffb03fbbdebf816c13172462cf7af2093fee6e9;p=bacula%2Fbacula Fix bat command line input bug git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9054 91ce42f0-d328-0410-95d8-f526ca767f89 --- 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