]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/select/textinput.cpp
Backport from BEE
[bacula/bacula] / bacula / src / qt-console / select / textinput.cpp
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from many
7    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    Bacula® is a registered trademark of Kern Sibbald.
15 */
16
17 /*
18  *  Select dialog class
19  *
20  *   Kern Sibbald, March MMVII
21  *
22  */
23
24 #include "bat.h"
25 #include "textinput.h"
26
27 /*
28  * Read input text box
29  */
30 textInputDialog::textInputDialog(Console *console, int conn)
31 {
32    m_conn = conn;
33    QDateTime dt;
34
35    m_console = console;
36    m_console->notify(m_conn, false);
37    setupUi(this);
38    setAttribute(Qt::WA_DeleteOnClose);
39    m_console->read(m_conn);                 /* get title */
40    labelWidget->setText(m_console->msg(m_conn));
41    this->show();
42 }
43
44 void textInputDialog::accept()
45 {
46    this->hide();
47    m_console->write_dir(m_conn, lineEdit->text().toUtf8().data());
48    /* Do not displayToPrompt because there may be another Text Input required */
49    this->close();
50    mainWin->resetFocus();
51    m_console->notify(m_conn, true);
52 }
53
54
55 void textInputDialog::reject()
56 {
57    this->hide();
58    mainWin->set_status(tr(" Canceled"));
59    m_console->write_dir(m_conn, ".");
60    this->close();
61    mainWin->resetFocus();
62    m_console->beginNewCommand(m_conn);
63    m_console->notify(m_conn, true);
64 }