Commit cfc703d5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify

parent ce64acad
......@@ -102,7 +102,7 @@ void CrontabPrinter::printTasks()
tasksContent.append(values);
}
QList<int> tasksColumnWidths = findColumnWidths(tasksContent, 3);
const QList<int> tasksColumnWidths = findColumnWidths(tasksContent, 3);
QStringList taskHeaders;
taskHeaders << i18n("Scheduling") << i18n("Command") << i18n("Description");
......
......@@ -7,3 +7,30 @@
*/
#include "ctSaveStatus.h"
CTSaveStatus::CTSaveStatus()
{
mErrorStatus = false;
}
CTSaveStatus::CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage)
{
mErrorStatus = true;
mError = errorMessage;
mDetailError = detailErrorMessage;
}
QString CTSaveStatus::errorMessage() const
{
return mError;
}
QString CTSaveStatus::detailErrorMessage() const
{
return mDetailError;
}
bool CTSaveStatus::isError() const
{
return mErrorStatus;
}
......@@ -15,32 +15,15 @@ class CTSaveStatus
{
public:
CTSaveStatus()
{
this->mErrorStatus = false;
}
CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage)
{
this->mErrorStatus = true;
this->mError = errorMessage;
this->mDetailError = detailErrorMessage;
}
QString errorMessage() const
{
return mError;
}
QString detailErrorMessage() const
{
return mDetailError;
}
bool isError() const
{
return mErrorStatus;
}
CTSaveStatus();
CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage);
QString errorMessage() const;
QString detailErrorMessage() const;
bool isError() const;
private:
bool mErrorStatus;
......
......@@ -131,8 +131,6 @@ void CTUnit::parse(const QString &tokenString)
tokStr = tokStr.mid(commapos+1, tokStr.length()-commapos-1);
}
return;
}
QString CTUnit::exportUnit() const
......@@ -244,7 +242,6 @@ void CTUnit::apply()
mInitialEnabled[i] = mEnabled[i];
}
mDirty = false;
return;
}
void CTUnit::cancel()
......@@ -253,7 +250,6 @@ void CTUnit::cancel()
mEnabled[i] = mInitialEnabled[i];
}
mDirty = false;
return;
}
int CTUnit::fieldToValue(const QString &entry) const
......
......@@ -85,9 +85,6 @@ void TasksWidget::runTaskNow() const
if (taskWidget == nullptr) {
return;
}
QString taskCommand = taskWidget->getCTTask()->command;
QString echoMessage = i18nc("Do not use any quote characters (') in this string", "End of script execution. Type Enter or Ctrl+C to exit.");
CTCron *ctCron = crontabWidget()->currentCron();
if (!ctCron) {
......@@ -95,6 +92,9 @@ void TasksWidget::runTaskNow() const
return;
}
const QString taskCommand = taskWidget->getCTTask()->command;
const QString echoMessage = i18nc("Do not use any quote characters (') in this string", "End of script execution. Type Enter or Ctrl+C to exit.");
QStringList commandList;
const auto variables = ctCron->variables();
......@@ -121,7 +121,7 @@ void TasksWidget::createTask()
CTTask *task = new CTTask(QLatin1String(""), QLatin1String(""), crontabWidget()->currentCron()->userLogin(), crontabWidget()->currentCron()->isMultiUserCron());
TaskEditorDialog taskEditorDialog(task, i18n("New Task"), crontabWidget());
int result = taskEditorDialog.exec();
const int result = taskEditorDialog.exec();
if (result == QDialog::Accepted) {
addTask(task);
......
......@@ -54,7 +54,7 @@ void VariablesWidget::modifySelection(QTreeWidgetItem *item, int position)
{
VariableWidget *variableWidget = static_cast<VariableWidget *>(item);
if (variableWidget != nullptr) {
if (variableWidget) {
if (position == statusColumnIndex()) {
variableWidget->toggleEnable();
Q_EMIT variableModified(true);
......
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