Commit 5d47dba6 authored by David Jarvie's avatar David Jarvie
Browse files

Disable command output option for display alarms if user unauthorised

If the user is not authorised to run shell commands, don't offer the
command output option for display alarms in the edit alarm dialog.
parent ce24ad9a
......@@ -73,6 +73,7 @@ using namespace KCal;
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDragEnterEvent>
#include <QStandardItemModel>
enum { tTEXT, tFILE, tCOMMAND }; // order of mTypeCombo items
......@@ -160,6 +161,18 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mTypeCombo->addItem(commandItem); // index = tCOMMAND
mTypeCombo->setFixedSize(mTypeCombo->sizeHint());
mTypeCombo->setCurrentIndex(-1); // ensure slotAlarmTypeChanged() is called when index is set
if (!ShellProcess::authorised())
{
// User not authorised to issue shell commands - disable Command Output option
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(mTypeCombo->model());
if (model)
{
QModelIndex index = model->index(2, mTypeCombo->modelColumn(), mTypeCombo->rootModelIndex());
QStandardItem* item = model->itemFromIndex(index);
if (item)
item->setEnabled(false);
}
}
connect(mTypeCombo, SIGNAL(currentIndexChanged(int)), SLOT(slotAlarmTypeChanged(int)));
connect(mTypeCombo, SIGNAL(currentIndexChanged(int)), SLOT(contentsChanged()));
label->setBuddy(mTypeCombo);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment