Commit 4d6c48ca authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename variables + port to for(...:...)

parent ce110b26
......@@ -121,7 +121,7 @@ QHBoxLayout *CrontabWidget::createCronSelector()
if (ctHost()->isRootUser()) {
QStringList users;
const auto crons = ctHost()->crons;
const auto crons = ctHost()->mCrons;
for (CTCron *ctCron : crons) {
if (ctCron->isCurrentUserCron()) {
continue;
......
......@@ -40,7 +40,7 @@ QList<CTTask *> CTGlobalCron::tasks() const
logDebug() << "Global Cron Tasks";
QList<CTTask *> tasks;
const auto crons = mCtHost->crons;
const auto crons = mCtHost->mCrons;
for (CTCron *cron : crons) {
if (cron->isSystemCron()) {
continue;
......@@ -60,7 +60,7 @@ QList<CTVariable *> CTGlobalCron::variables() const
logDebug() << "Global Cron Variables";
QList<CTVariable *> variables;
const auto crons = mCtHost->crons;
const auto crons = mCtHost->mCrons;
for (CTCron *cron : crons) {
if (cron->isSystemCron()) {
continue;
......
......@@ -61,7 +61,7 @@ CommandLineStatus CommandLine::execute()
CTCron::CTCron(const QString &crontabBinary, const struct passwd *userInfos, bool currentUserCron, CTInitializationError &ctInitializationError)
: d(new CTCronPrivate())
{
Q_ASSERT(userInfos != NULL);
Q_ASSERT(userInfos);
d->multiUserCron = false;
d->systemCron = false;
......@@ -332,11 +332,13 @@ CTSaveStatus CTCron::save()
void CTCron::cancel()
{
foreach (CTTask *ctTask, d->task) {
const auto tasks = d->task;
for (CTTask *ctTask : tasks) {
ctTask->cancel();
}
foreach (CTVariable *ctVariable, d->variable) {
const auto variables = d->variable;
for (CTVariable *ctVariable : variables) {
ctVariable->cancel();
}
}
......
......@@ -28,7 +28,7 @@ CTHost::CTHost(const QString &cronBinary, CTInitializationError &ctInitializatio
{
struct passwd *userInfos = nullptr;
this->mCrontabBinary = cronBinary;
mCrontabBinary = cronBinary;
// If it is the root user
if (getuid() == 0) {
......@@ -82,7 +82,7 @@ CTHost::CTHost(const QString &cronBinary, CTInitializationError &ctInitializatio
CTHost::~CTHost()
{
foreach (CTCron *ctCron, crons) {
foreach (CTCron *ctCron, mCrons) {
delete ctCron;
}
}
......@@ -133,8 +133,8 @@ CTSaveStatus CTHost::save()
return ctCron->save();
}
foreach (CTCron *ctCron, crons) {
CTSaveStatus ctSaveStatus = ctCron->save();
for (CTCron *ctCron : qAsConst(mCrons)) {
const CTSaveStatus ctSaveStatus = ctCron->save();
if (ctSaveStatus.isError()) {
return CTSaveStatus(i18nc("User login: errorMessage", "User %1: %2", ctCron->userLogin(), ctSaveStatus.errorMessage()), ctSaveStatus.detailErrorMessage());
......@@ -146,7 +146,7 @@ CTSaveStatus CTHost::save()
void CTHost::cancel()
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
ctCron->cancel();
}
}
......@@ -155,7 +155,7 @@ bool CTHost::isDirty()
{
bool isDirty = false;
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->isDirty()) {
isDirty = true;
}
......@@ -168,7 +168,7 @@ CTCron *CTHost::createSystemCron()
{
CTCron *p = new CTSystemCron(mCrontabBinary);
crons.append(p);
mCrons.append(p);
return p;
}
......@@ -187,14 +187,14 @@ QString CTHost::createCTCron(const struct passwd *userInfos)
return ctInitializationError.errorMessage();
}
crons.append(p);
mCrons.append(p);
return QString();
}
CTCron *CTHost::findCurrentUserCron() const
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->isCurrentUserCron()) {
return ctCron;
}
......@@ -206,7 +206,7 @@ CTCron *CTHost::findCurrentUserCron() const
CTCron *CTHost::findSystemCron() const
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->isMultiUserCron()) {
return ctCron;
}
......@@ -218,7 +218,7 @@ CTCron *CTHost::findSystemCron() const
CTCron *CTHost::findUserCron(const QString &userLogin) const
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->userLogin() == userLogin) {
return ctCron;
}
......@@ -230,7 +230,7 @@ CTCron *CTHost::findUserCron(const QString &userLogin) const
CTCron *CTHost::findCronContaining(CTTask *ctTask) const
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->tasks().contains(ctTask)) {
return ctCron;
}
......@@ -242,7 +242,7 @@ CTCron *CTHost::findCronContaining(CTTask *ctTask) const
CTCron *CTHost::findCronContaining(CTVariable *ctVariable) const
{
foreach (CTCron *ctCron, crons) {
for (CTCron *ctCron : qAsConst(mCrons)) {
if (ctCron->variables().contains(ctVariable)) {
return ctCron;
}
......
......@@ -85,7 +85,7 @@ public:
* If the user is a non-root user, there will be only one member in the
* cron vector.
*/
QList<CTCron *> crons;
QList<CTCron *> mCrons;
private:
......
......@@ -105,7 +105,7 @@ bool KCMCron::init()
// if there currently are no scheduled tasks...
if (!mCtHost->isRootUser()) {
int taskCount = 0;
foreach (CTCron *ctCron, mCtHost->crons) {
foreach (CTCron *ctCron, mCtHost->mCrons) {
taskCount += ctCron->tasks().count();
}
......
......@@ -24,7 +24,7 @@ void KCronHelper::initUserCombo(QComboBox *userCombo, CrontabWidget *crontabWidg
QStringList users;
int selectedIndex = 0;
const auto crons = crontabWidget->ctHost()->crons;
const auto crons = crontabWidget->ctHost()->mCrons;
for (CTCron *ctCron : crons) {
if (ctCron->isSystemCron()) {
continue;
......
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