]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mount/mount.cpp
475e486ba7969334ab5c5e6c1378c6c84c4fc6d0
[bacula/bacula] / bacula / src / qt-console / mount / mount.cpp
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20  
21 /*
22  *  Label Dialog class
23  *
24  *   Kern Sibbald, February MMVII
25  *
26  */ 
27
28 #include "bat.h"
29 #include "mount/mount.h"
30 #include <QMessageBox>
31
32 /*
33  * A constructor 
34  */
35 mountDialog::mountDialog(Console *console, QString &storageName) : QDialog()
36 {
37    m_console = console;
38    m_storageName = storageName;
39    m_conn = m_console->notifyOff();
40    setupUi(this);
41    this->show();
42
43    QString labelText( tr("Storage : %1").arg(storageName) );
44    storageLabel->setText(labelText);
45 }
46
47 void mountDialog::accept()
48 {
49    QString scmd;
50    if (m_storageName == "") {
51       QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"),
52                            QMessageBox::Ok, QMessageBox::Ok);
53       return;
54    }
55    this->hide();
56    scmd = QString("mount storage=\"%1\" slot=%2")
57                   .arg(m_storageName)
58                   .arg(slotSpin->value());
59    if (mainWin->m_commandDebug) {
60       Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
61    }
62
63    m_console->display_text( tr("Context sensitive command :\n\n"));
64    m_console->display_text("****    ");
65    m_console->display_text(scmd + "    ****\n");
66    m_console->display_text(tr("Director Response :\n\n"));
67
68    m_console->write_dir(scmd.toUtf8().data());
69    m_console->displayToPrompt(m_conn);
70    m_console->notify(m_conn, true);
71    delete this;
72    mainWin->resetFocus();
73 }
74
75 void mountDialog::reject()
76 {
77    this->hide();
78    m_console->notify(m_conn, true);
79    delete this;
80    mainWin->resetFocus();
81 }