summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-25 17:01:59 +0200
committerSimon Rettberg2017-05-25 17:01:59 +0200
commit11cffc5d7ff9233aa0c5a06da49bfb7399cd2130 (patch)
tree13e95947edf867b895dec61ee62a870d7a551fbb /src/dialog.cpp
parentAdd option to make pvs box checked by default (diff)
downloadvmchooser2-11cffc5d7ff9233aa0c5a06da49bfb7399cd2130.tar.gz
vmchooser2-11cffc5d7ff9233aa0c5a06da49bfb7399cd2130.tar.xz
vmchooser2-11cffc5d7ff9233aa0c5a06da49bfb7399cd2130.zip
Fix admin mode checkbox handling
Diffstat (limited to 'src/dialog.cpp')
-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: ";