summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dialog.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index a7c86e4..f93a8bd 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -132,7 +132,7 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index)
setenv("PVS_AUTO_CONNECT", "FALSE", 1);
}
}
- if (g_allowVmEdit && ui->chkAdminMode->isChecked()) {
+ if (ui->chkAdminMode->isEnabled() && ui->chkAdminMode->isChecked()) {
setenv("VMCHOOSER_ADMIN_MODE", "TRUE", 1);
} else {
setenv("VMCHOOSER_ADMIN_MODE", "FALSE", 1);
@@ -479,12 +479,16 @@ void Dialog::mousePressEvent(QMouseEvent * event) {
void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelIndex&) {
SessionTreeItem* item =
static_cast<SessionTreeItem*>(current.internalPointer());
- if (item == NULL) return;
+ if (item == NULL) {
+ ui->chkAdminMode->setEnabled(false);
+ return;
+ }
const Session* s(item->session());
if (!s) {
qDebug() << "invalid selection";
// no valid session has been selected, do nothing
+ ui->chkAdminMode->setEnabled(false);
return;
}
@@ -501,7 +505,7 @@ void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelI
ui->label_platform->setText(vs->getAttribute("virtualizer_name", "param"));
ui->label_platform->setToolTip(vs->getAttribute("virtualizer_name", "param"));
- ui->chkAdminMode->setEnabled(vs->canEdit());
+ ui->chkAdminMode->setEnabled(vs->canEdit() || g_allowVmEdit);
if (vs->keywords().length() > 0) {
description = "\n\nKeywords: ";