| 1 |
/* This file is part of the KDE project |
| 2 |
* SPDX-FileCopyrightText: 2019 Dag Andersen <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
// clazy:excludeall=qstring-arg |
| 8 |
#include "NamedCommand.h" |
| 9 |
#include "kptschedule.h" |
| 10 |
#include "kptappointment.h" |
| 11 |
#include "kptdebug.h" |
| 12 |
|
| 13 |
#include <QApplication> |
| 14 |
|
| 15 |
|
| 16 |
using namespace KPlato; |
| 17 |
|
| 18 |
|
| 19 |
void NamedCommand::setSchScheduled() |
| 20 |
{ |
| 21 |
QHash<Schedule*, bool>::ConstIterator it; |
| 22 |
for (it = m_schedules.constBegin(); it != m_schedules.constEnd(); ++it) { |
| 23 |
//debugPlan << it.key() ->name() <<":" << it.value(); |
| 24 |
it.key() ->setScheduled(it.value()); |
| 25 |
} |
| 26 |
} |
| 27 |
void NamedCommand::setSchScheduled(bool state) |
| 28 |
{ |
| 29 |
QHash<Schedule*, bool>::ConstIterator it; |
| 30 |
for (it = m_schedules.constBegin(); it != m_schedules.constEnd(); ++it) { |
| 31 |
//debugPlan << it.key() ->name() <<":" << state; |
| 32 |
it.key() ->setScheduled(state); |
| 33 |
} |
| 34 |
} |
| 35 |
void NamedCommand::addSchScheduled(Schedule *sch) |
| 36 |
{ |
| 37 |
//debugPlan << sch->id() <<":" << sch->isScheduled(); |
| 38 |
m_schedules.insert(sch, sch->isScheduled()); |
| 39 |
const auto appointments = sch->appointments(); |
| 40 |
for (Appointment * a : appointments) { |
| 41 |
if (a->node() == sch) { |
| 42 |
m_schedules.insert(a->resource(), a->resource() ->isScheduled()); |
| 43 |
} else if (a->resource() == sch) { |
| 44 |
m_schedules.insert(a->node(), a->node() ->isScheduled()); |
| 45 |
} |
| 46 |
} |
| 47 |
} |