FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
FORMS += restore/restoretree.ui
FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui
-FORMS += select/select.ui
+FORMS += select/select.ui select/textinput.ui
FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui
FORMS += joblog/joblog.ui jobs/jobs.ui
SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp run/prune.cpp
# Select dialog
-HEADERS += select/select.h
-SOURCES += select/select.cpp
+HEADERS += select/select.h select/textinput.h
+SOURCES += select/select.cpp select/textinput.cpp
## MediaList
HEADERS += medialist/medialist.h
#include "console.h"
#include "restore.h"
#include "select.h"
+#include "textinput.h"
#include "run/run.h"
static int tls_pem_callback(char *buf, int size, const void *userdata);
m_at_main_prompt = false;
m_conn = conn;
m_in_command = 0;
+ m_in_select = false;
}
DirComm::~DirComm()
mainWin->set_status(_("At main prompt waiting for input ..."));
break;
case BNET_PROMPT:
- if (mainWin->m_commDebug) Pmsg1(000, "conn %i PROMPT\n", m_conn);
+ if (mainWin->m_commDebug) Pmsg2(000, "conn %i PROMPT m_in_select %i\n", m_conn, m_in_select);
m_at_prompt = true;
m_at_main_prompt = false;
mainWin->set_status(_("At prompt waiting for input ..."));
+ /* commented out until the prompt communication issue with the director is resolved
+ This is where I call a new text input dialog class to prevent the connection issues
+ when a text input is requited.
+ if (! m_in_select) {
+ new textInputDialog(m_console, m_conn);
+ } */
break;
case BNET_CMD_FAILED:
if (mainWin->m_commDebug) Pmsg1(000, "CMD FAILED\n", m_conn);
case BNET_START_SELECT:
notify(false);
if (mainWin->m_commDebug) Pmsg1(000, "conn %i START SELECT\n", m_conn);
+ m_in_select = true;
new selectDialog(m_console, m_conn);
+ m_in_select = false;
break;
case BNET_YESNO:
if (mainWin->m_commDebug) Pmsg1(000, "conn %i YESNO\n", m_conn);
QSocketNotifier *m_notifier;
bool m_api_set;
int m_conn;
+ bool m_in_select;
};
#endif /* _DIRCOMM_H_ */
if (mainWin->m_commDebug) Pmsg2(000, "endDiscardToPrompt=%d %s\n", stat, m_dir->name());
}
+QString Console::returnFromPrompt(int conn)
+{
+ DirComm *dircomm = m_dircommHash.value(conn);
+ QString text("");
+
+ int stat = 0;
+ text = "";
+ if (mainWin->m_commDebug) Pmsg1(000, "returnFromPrompt %s\n", m_dir->name());
+ while (!dircomm->m_at_prompt) {
+ if ((stat=dircomm->read()) > 0) {
+ text += dircomm->msg();
+ }
+ }
+ if (mainWin->m_commDebug) Pmsg2(000, "endreturnFromPrompt=%d %s\n", stat, m_dir->name());
+ return text;
+}
+
/*
* When the notifier is enabled, read_dir() will automatically be
* called by the Qt event loop when ever there is any output
bool availableDirComm(int &conn);
bool currentDirComm(int &conn);
void displayToPrompt(int conn);
+ QString returnFromPrompt(int conn);
bool dir_cmd(int conn, const char *cmd, QStringList &results);
bool dir_cmd(const char *cmd, QStringList &results);
--- /dev/null
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+
+/*
+ * Select dialog class
+ *
+ * Kern Sibbald, March MMVII
+ *
+ * $Id: select.cpp 8775 2009-04-30 16:57:18Z bartleyd2 $
+ */
+
+#include "bat.h"
+#include "textinput.h"
+
+/*
+ * Read input text box
+ */
+textInputDialog::textInputDialog(Console *console, int conn)
+{
+ m_conn = conn;
+ QDateTime dt;
+
+ m_console = console;
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ labelWidget->setText(m_console->returnFromPrompt(m_conn));
+ this->show();
+}
+
+void textInputDialog::accept()
+{
+ this->hide();
+ m_console->write_dir(m_conn, lineEdit->text().toUtf8().data());
+ m_console->displayToPrompt(m_conn);
+ mainWin->resetFocus();
+ m_console->displayToPrompt(m_conn);
+ m_console->notify(m_conn, true);
+ this->close();
+}
+
+
+void textInputDialog::reject()
+{
+ this->hide();
+ mainWin->set_status(tr(" Canceled"));
+ mainWin->resetFocus();
+ m_console->beginNewCommand(m_conn);
+ m_console->notify(m_conn, true);
+ this->close();
+}
+
--- /dev/null
+
+#ifndef _TEXTENTRY_H_
+#define _TEXTENTRY_H_
+
+#include <QtGui>
+#include "ui_textinput.h"
+#include "console.h"
+
+class textInputDialog : public QDialog, public Ui::textInputForm
+{
+ Q_OBJECT
+
+public:
+ textInputDialog(Console *console, int conn);
+
+public slots:
+ void accept();
+ void reject();
+
+private:
+ Console *m_console;
+ int m_conn;
+};
+
+#endif /* _TEXTENTRY_H_ */
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>textInputForm</class>
+ <widget class="QDialog" name="textInputForm">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>430</width>
+ <height>132</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Selection dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelWidget">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="lineEdit"/>
+ </item>
+ <item row="3" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>textInputForm</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>textInputForm</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>