]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/label/label.cpp
kes Correct incorrect installation of LICENSE in Win32 installer.
[bacula/bacula] / bacula / src / qt-console / label / label.cpp
index bb5e08dba133c9c9489d28f6fa7f7a4d7f36bd30..9f5556c8c742fcd20864d8b89e67f4f9b1a8fa9f 100644 (file)
 #include <QMessageBox>
 
 labelDialog::labelDialog(Console *console)
+{
+   QString deflt("");
+   showDialog(console, deflt);
+}
+
+/*
+ * An overload of the constructor to have a default storage show in the
+ * combobox on start.  Used from context sensitive in storage class.
+ */
+labelDialog::labelDialog(Console *console, QString &defString)
+{
+   showDialog(console, defString);
+}
+
+/*
+ * moved the constructor code here for the overload.
+ */
+void labelDialog::showDialog(Console *console, QString &defString)
 {
    m_console = console;
    m_console->notify(false);
    setupUi(this);
    storageCombo->addItems(console->storage_list);
+   int index = storageCombo->findText(defString, Qt::MatchExactly);
+   if (index != -1) {
+      storageCombo->setCurrentIndex(index);
+   }
    poolCombo->addItems(console->pool_list);
    this->show();
 }
 
+
 void labelDialog::accept()
 {
    QString scmd;
@@ -57,9 +80,12 @@ void labelDialog::accept()
    }
    this->hide();
    scmd = QString("label volume=\"%1\" pool=\"%2\" storage=\"%3\" slot=%4\n")
-         .arg(volumeName->text()).arg(storageCombo->currentText()) 
-         .arg(poolCombo->currentText())
-         .arg(slotSpin->value());
+                  .arg(volumeName->text())
+                  .arg(poolCombo->currentText())
+                  .arg(storageCombo->currentText()) 
+                  .arg(slotSpin->value());
+   /* FIXME Make this a user configurable logging action and dont use printf */
+   //printf("sending command : %s\n",scmd.toUtf8().data());
    m_console->write_dir(scmd.toUtf8().data());
    m_console->displayToPrompt();
    m_console->notify(true);
@@ -69,14 +95,8 @@ void labelDialog::accept()
 
 void labelDialog::reject()
 {
-   printf("Rejected\n");
    this->hide();
    m_console->notify(true);
-   /*  believe use of member must occur before delete 
- *  FIXME which do you like better
- *  delete this;
- *    or
- *  close(); */ 
-   close();
+   delete this;
    mainWin->resetFocus();
 }