#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;
}
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);
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();
}