]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/select/select.cpp
I could not get a few files to compile until I opened and saved these
[bacula/bacula] / bacula / src / qt-console / select / select.cpp
index 8772bbdb85dde8b0b14efa2c5f919a8aaef5a6d7..11acd6deaa2aebd2a80f35a9a23af6fa943b51c5 100644 (file)
@@ -7,8 +7,8 @@
    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 plus additions
-   that are listed in the file LICENSE.
+   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
  *
  *   Kern Sibbald, March MMVII
  *
- *  $Id$
+ *  $Id$
  */ 
 
 #include "bat.h"
 #include "select.h"
 
 /*
- * Setup all the combo boxes and display the dialog
+ * Read the items for the selection
  */
 selectDialog::selectDialog(Console *console) 
 {
@@ -50,6 +50,7 @@ selectDialog::selectDialog(Console *console)
    m_console = console;
    setupUi(this);
    connect(listBox, SIGNAL(currentRowChanged(int)), this, SLOT(index_change(int)));
+   setAttribute(Qt::WA_DeleteOnClose);
    m_console->read();                 /* get title */
    labelWidget->setText(m_console->msg());
    while ((stat=m_console->read()) > 0) {
@@ -57,10 +58,7 @@ selectDialog::selectDialog(Console *console)
       item->setText(m_console->msg());
       listBox->insertItem(row++, item);
    }
-// Dmsg1(000, "Stat=%d\n", stat);
-   m_console->read();                 /* get prompt signal */
-   m_console->read();                 /* get prompt */
-// Dmsg1(000, "Prompt=%s", m_console->msg());
+   m_console->displayToPrompt();
    this->show();
 }
 
@@ -69,21 +67,23 @@ void selectDialog::accept()
    char cmd[100];
 
    this->hide();
-   
    bsnprintf(cmd, sizeof(cmd), "%d", m_index+1);
    m_console->write_dir(cmd);
    m_console->displayToPrompt();
-   delete this;
+   this->close();
    mainWin->resetFocus();
+   m_console->displayToPrompt();
+
 }
 
 
 void selectDialog::reject()
 {
-   mainWin->set_status(" Canceled");
    this->hide();
-   delete this;
+   mainWin->set_status(" Canceled");
+   this->close();
    mainWin->resetFocus();
+   m_console->beginNewCommand();
 }
 
 /*
@@ -93,6 +93,33 @@ void selectDialog::reject()
  */
 void selectDialog::index_change(int index)
 {
-// Dmsg1(000, "Index=%d\n", index);
    m_index = index;
 }
+
+/*
+ * Handle yesno PopUp when Bacula asks a yes/no question.
+ */
+/*
+ * Read the items for the selection
+ */
+yesnoPopUp::yesnoPopUp(Console *console) 
+{
+   QMessageBox msgBox;
+
+   setAttribute(Qt::WA_DeleteOnClose);
+   console->read();                 /* get yesno question */
+   msgBox.setWindowTitle("Bat Question");
+   msgBox.setText(console->msg());
+   msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+   console->displayToPrompt();
+   switch (msgBox.exec()) {
+   case QMessageBox::Yes:
+      console->write_dir("yes");
+      break;
+   case QMessageBox::No:
+      console->write_dir("no");
+      break;
+   }
+   console->displayToPrompt();
+   mainWin->resetFocus();
+}