Fix behavior of "runners" property
This commit changes the behavior of the "runners" property when no manager has been created yet: - Setting the property emits runnersChanged() (unless it is the same as the old value) - Reading the property after setting it returns the new value REVIEW: 105024
This commit is contained in:
parent
fb6b4ecc09
commit
f145e1de8e
@ -69,14 +69,20 @@ int RunnerModel::count() const
|
||||
|
||||
QStringList RunnerModel::runners() const
|
||||
{
|
||||
return m_manager ? m_manager->allowedRunners() : QStringList();
|
||||
return m_manager ? m_manager->allowedRunners() : m_pendingRunnersList;
|
||||
}
|
||||
|
||||
void RunnerModel::setRunners(const QStringList &allowedRunners)
|
||||
{
|
||||
//use sets to ensure comparison is order-independent
|
||||
if (allowedRunners.toSet() == runners().toSet()) {
|
||||
return;
|
||||
}
|
||||
if (m_manager) {
|
||||
m_manager->setAllowedRunners(allowedRunners);
|
||||
emit runnersChanged();
|
||||
|
||||
//automagically enter single runner mode if there's only 1 allowed runner
|
||||
m_manager->setSingleMode(allowedRunners.count() == 1);
|
||||
} else {
|
||||
m_pendingRunnersList = allowedRunners;
|
||||
kDebug() << "runners set" << m_pendingRunnersList.count();
|
||||
@ -89,6 +95,7 @@ void RunnerModel::setRunners(const QStringList &allowedRunners)
|
||||
} else {
|
||||
m_singleRunnerId.clear();
|
||||
}
|
||||
emit runnersChanged();
|
||||
}
|
||||
|
||||
void RunnerModel::run(int index)
|
||||
|
Loading…
Reference in New Issue
Block a user