Commit 91d5a01d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

We use c++17 now here

parent 21f917d7
Pipeline #70023 passed with stage
in 4 minutes and 26 seconds
......@@ -108,7 +108,7 @@ void CrontabPrinter::printTasks()
taskHeaders << i18n("Scheduling") << i18n("Command") << i18n("Description");
drawHeader(tasksColumnWidths, taskHeaders);
for (const QStringList &contents : qAsConst(tasksContent)) {
for (const QStringList &contents : std::as_const(tasksContent)) {
drawContentRow(tasksColumnWidths, contents);
needNewPage();
......@@ -349,7 +349,7 @@ QList<int> CrontabPrinter::findColumnWidths(const QList<QStringList> &contents,
int pageWidth = mPainter->device()->width() - 2 * margin;
int columnWidthSum = 0;
for (int width : qAsConst(columnWidths)) {
for (int width : std::as_const(columnWidths)) {
logDebug() << "Column : " << width;
columnWidthSum += width;
}
......
......@@ -267,13 +267,13 @@ void CrontabWidget::paste()
logDebug() << "Paste content";
if (mTasksWidget->treeWidget()->hasFocus()) {
for (CTTask *task : qAsConst(mClipboardTasks)) {
for (CTTask *task : std::as_const(mClipboardTasks)) {
mTasksWidget->addTask(new CTTask(*task));
}
}
if (mVariablesWidget->treeWidget()->hasFocus()) {
for (CTVariable *variable : qAsConst(mClipboardVariables)) {
for (CTVariable *variable : std::as_const(mClipboardVariables)) {
mVariablesWidget->addVariable(new CTVariable(*variable));
}
}
......
......@@ -225,12 +225,12 @@ QString CTCron::exportCron() const
{
QString exportCron;
for (CTVariable *ctVariable : qAsConst(d->variable)) {
for (CTVariable *ctVariable : std::as_const(d->variable)) {
exportCron += ctVariable->exportVariable();
exportCron += QLatin1String("\n");
}
for (CTTask *ctTask : qAsConst(d->task)) {
for (CTTask *ctTask : std::as_const(d->task)) {
exportCron += ctTask->exportTask();
exportCron += QLatin1String("\n");
}
......@@ -317,11 +317,11 @@ CTSaveStatus CTCron::save()
}
// Mark as applied
for (CTTask *ctTask : qAsConst(d->task)) {
for (CTTask *ctTask : std::as_const(d->task)) {
ctTask->apply();
}
for (CTVariable *ctVariable : qAsConst(d->variable)) {
for (CTVariable *ctVariable : std::as_const(d->variable)) {
ctVariable->apply();
}
......@@ -354,13 +354,13 @@ bool CTCron::isDirty() const
return true;
}
for (CTTask *ctTask : qAsConst(d->task)) {
for (CTTask *ctTask : std::as_const(d->task)) {
if (ctTask->dirty()) {
return true;
}
}
for (CTVariable *ctVariable : qAsConst(d->variable)) {
for (CTVariable *ctVariable : std::as_const(d->variable)) {
if (ctVariable->dirty()) {
return true;
}
......@@ -373,7 +373,7 @@ QString CTCron::path() const
{
QString path;
for (CTVariable *ctVariable : qAsConst(d->variable)) {
for (CTVariable *ctVariable : std::as_const(d->variable)) {
if (ctVariable->variable == QLatin1String("PATH")) {
path = ctVariable->value;
}
......
......@@ -131,7 +131,7 @@ CTSaveStatus CTHost::save()
return ctCron->save();
}
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
const CTSaveStatus ctSaveStatus = ctCron->save();
if (ctSaveStatus.isError()) {
......@@ -145,7 +145,7 @@ CTSaveStatus CTHost::save()
void CTHost::cancel()
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
ctCron->cancel();
}
}
......@@ -154,7 +154,7 @@ bool CTHost::isDirty()
{
bool isDirty = false;
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->isDirty()) {
isDirty = true;
}
......@@ -193,7 +193,7 @@ QString CTHost::createCTCron(const struct passwd *userInfos)
CTCron *CTHost::findCurrentUserCron() const
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->isCurrentUserCron()) {
return ctCron;
}
......@@ -205,7 +205,7 @@ CTCron *CTHost::findCurrentUserCron() const
CTCron *CTHost::findSystemCron() const
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->isMultiUserCron()) {
return ctCron;
}
......@@ -217,7 +217,7 @@ CTCron *CTHost::findSystemCron() const
CTCron *CTHost::findUserCron(const QString &userLogin) const
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->userLogin() == userLogin) {
return ctCron;
}
......@@ -229,7 +229,7 @@ CTCron *CTHost::findUserCron(const QString &userLogin) const
CTCron *CTHost::findCronContaining(CTTask *ctTask) const
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->tasks().contains(ctTask)) {
return ctCron;
}
......@@ -241,7 +241,7 @@ CTCron *CTHost::findCronContaining(CTTask *ctTask) const
CTCron *CTHost::findCronContaining(CTVariable *ctVariable) const
{
for (CTCron *ctCron : qAsConst(mCrons)) {
for (CTCron *ctCron : std::as_const(mCrons)) {
if (ctCron->variables().contains(ctVariable)) {
return ctCron;
}
......
......@@ -110,7 +110,7 @@ bool KCMCron::init()
// if there currently are no scheduled tasks...
if (!mCtHost->isRootUser()) {
int taskCount = 0;
for (CTCron *ctCron : qAsConst(mCtHost->mCrons)) {
for (CTCron *ctCron : std::as_const(mCtHost->mCrons)) {
taskCount += ctCron->tasks().count();
}
......
Supports Markdown
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