From 727071fe368ab673fbe10e7b70349c76c7f96296 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 23 Jun 2007 14:56:32 +0000 Subject: [PATCH] Always allow keyboard input git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5073 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/mainwin.cpp | 3 ++- bacula/src/qt-console/pages.cpp | 15 +++++++++++++-- bacula/src/qt-console/pages.h | 1 + bacula/src/qt-console/restore/restoretree.cpp | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 277ded583b..0dcf4f6015 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -422,7 +422,8 @@ void MainWin::input_line() QString cmdStr = lineEdit->text(); /* Get the text */ lineEdit->clear(); /* clear the lineEdit box */ if (m_currentConsole->is_connected()) { - m_currentConsole->consoleCommand(cmdStr); + /* Use consoleInput to allow typing anything */ + m_currentConsole->consoleInput(cmdStr); } else { set_status("Director not connected. Click on connect button."); } diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index f5de282384..1e37bd8d67 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -207,9 +207,20 @@ void Pages::consoleCommand(QString &command) { /*if (!m_console->is_connectedGui()) return;*/ - if (!m_console->preventInUseConnect()) + if (!m_console->preventInUseConnect()) { return; - /* Bring this directors console to the front of the stack */ + } + consoleInput(command); +} + +/* + * Function to simplify executing a console command, but does not + * check for the connection in use. We need this so that we can + * *always* enter command from the command line. + */ +void Pages::consoleInput(QString &command) +{ + /* Bring this director's console to the front of the stack */ setConsoleCurrent(); QString displayhtml(""); displayhtml += command + "\n"; diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 6f9fb4716a..483911f469 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -70,6 +70,7 @@ public: void setContextMenuDockText(); void setTreeWidgetItemDockColor(); void consoleCommand(QString &); + void consoleInput(QString &); public slots: /* closeEvent is a virtual function inherited from QWidget */ diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index 0b8573960f..a987ac7923 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -237,7 +237,7 @@ bool restoreTree::addDirectory(QString &m_cwd, QString &newdirr) /* no need to check for windows drive if unix */ if (m_winRegExpDrive.indexIn(m_cwd, 0) == 0) { /* this is a windows drive add the base widget */ - QTreeWidgetItem *item = item = new QTreeWidgetItem(directoryTree); + QTreeWidgetItem *item = new QTreeWidgetItem(directoryTree); item->setIcon(0, QIcon(QString::fromUtf8(":images/folder.png"))); item->setText(0, m_cwd); item->setData(0, Qt::UserRole, QVariant(fullpath)); -- 2.39.5