1 /*
2    Bacula(R) - The Network Backup Solution
3 
4    Copyright (C) 2000-2020 Kern Sibbald
5 
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8 
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13 
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16 
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 
20 /*
21  *  Select dialog class
22  *
23  *   Kern Sibbald, March MMVII
24  *
25  */
26 
27 #include "bat.h"
28 #include "textinput.h"
29 
30 /*
31  * Read input text box
32  */
textInputDialog(Console * console,int conn)33 textInputDialog::textInputDialog(Console *console, int conn)
34 {
35    m_conn = conn;
36    QDateTime dt;
37 
38    m_console = console;
39    m_console->notify(m_conn, false);
40    setupUi(this);
41    setAttribute(Qt::WA_DeleteOnClose);
42    m_console->read(m_conn);                 /* get title */
43    labelWidget->setText(m_console->msg(m_conn));
44    this->show();
45 }
46 
accept()47 void textInputDialog::accept()
48 {
49    this->hide();
50    m_console->write_dir(m_conn, lineEdit->text().toUtf8().data());
51    /* Do not displayToPrompt because there may be another Text Input required */
52    this->close();
53    mainWin->resetFocus();
54    m_console->notify(m_conn, true);
55 }
56 
57 
reject()58 void textInputDialog::reject()
59 {
60    this->hide();
61    mainWin->set_status(tr(" Canceled"));
62    m_console->write_dir(m_conn, ".");
63    this->close();
64    mainWin->resetFocus();
65    m_console->beginNewCommand(m_conn);
66    m_console->notify(m_conn, true);
67 }
68