From d4755df23b1c3a5791da4b176a56bbfdc4203255 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Sep 2016 17:28:11 +0200 Subject: Really disable xsession button this time --- src/dialog.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index 9dba767..8766981 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -20,7 +20,7 @@ #include "vsession.h" #include "choosersettings.h" -Dialog::Dialog(int defaultTab, bool allowNative, QWidget *parent) +Dialog::Dialog(int defaultTab, bool examMode, QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { model_[0] = new SessionTreeModel(parent); model_[1] = new SessionTreeModel(parent); @@ -30,6 +30,7 @@ Dialog::Dialog(int defaultTab, bool allowNative, QWidget *parent) qDebug() << "Default tab: " << defaultTab; userInteracted_ = false; genericExpandedOnce_ = false; + examMode_ = examMode; ui->setupUi(this); @@ -64,12 +65,12 @@ Dialog::Dialog(int defaultTab, bool allowNative, QWidget *parent) this, SLOT(treeView_selectionChanged(const QModelIndex&, const QModelIndex&))); */ - if (allowNative) { - this->onTabButtonChanged(TAB_NATIVE); - this->selectPreviousSession(); - } else { + if (examMode_) { ui->tabButtonLocal->setEnabled(false); this->onTabButtonChanged(TAB_ALL_VMS); + } else { + this->onTabButtonChanged(TAB_NATIVE); + this->selectPreviousSession(); } //activeTab_ = 2; //ui->tabButtonAllClasses->setChecked(true); @@ -180,6 +181,8 @@ void Dialog::addItems(const QList& entries, int tab) { if (tab < 0 || tab > 2) { return; } + if (examMode_ && tab == TAB_NATIVE) + return; this->model_[tab]->addItems(entries); tabs_[tab]->setEnabled(this->model_[tab]->rowCount() != 0); if (tab == activeTab_) { -- cgit v1.2.3-55-g7522