Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
KCron
Commits
4b40a566
Commit
4b40a566
authored
May 03, 2021
by
Laurent Montel
😁
Browse files
Modernize code
parent
b6e66193
Pipeline
#60534
passed with stage
in 3 minutes and 41 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/crontabPrinter.cpp
View file @
4b40a566
...
...
@@ -56,7 +56,7 @@ bool CrontabPrinter::start()
*/
// initialize the printer using the print dialog
QPrintDialog
*
printDialog
=
new
QPrintDialog
(
mPrinter
,
nullptr
);
auto
printDialog
=
new
QPrintDialog
(
mPrinter
,
nullptr
);
printDialog
->
setOptionTabs
(
QList
<
QWidget
*>
()
<<
mCrontabWidget
);
printDialog
->
setEnabledOptions
(
QAbstractPrintDialog
::
PrintToFile
);
if
(
printDialog
->
exec
()
==
QDialog
::
Rejected
)
{
...
...
src/crontabPrinterWidget.cpp
View file @
4b40a566
...
...
@@ -19,7 +19,7 @@ CrontabPrinterWidget::CrontabPrinterWidget(bool root)
{
setWindowTitle
(
i18n
(
"Cron Options"
));
QVBoxLayout
*
main_
=
new
QVBoxLayout
(
this
);
auto
main_
=
new
QVBoxLayout
(
this
);
mChkPrintCrontab
=
new
QCheckBox
(
i18n
(
"Print cron&tab"
),
this
);
mChkPrintCrontab
->
setObjectName
(
QStringLiteral
(
"chkPrintCrontab"
));
...
...
src/crontabWidget.cpp
View file @
4b40a566
...
...
@@ -95,11 +95,11 @@ bool CrontabWidget::hasClipboardContent()
QHBoxLayout
*
CrontabWidget
::
createCronSelector
()
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
auto
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
new
QLabel
(
i18n
(
"Show the following Cron:"
),
this
));
QButtonGroup
*
group
=
new
QButtonGroup
(
this
);
auto
group
=
new
QButtonGroup
(
this
);
mCurrentUserCronRadio
=
new
QRadioButton
(
i18n
(
"Personal Cron"
),
this
);
mCurrentUserCronRadio
->
setChecked
(
true
);
...
...
@@ -152,7 +152,7 @@ QHBoxLayout *CrontabWidget::createCronSelector()
void
CrontabWidget
::
initialize
()
{
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
auto
layout
=
new
QVBoxLayout
(
this
);
logDebug
()
<<
"Begin view refresh"
;
...
...
@@ -161,7 +161,7 @@ void CrontabWidget::initialize()
QHBoxLayout
*
cronSelector
=
createCronSelector
();
layout
->
addLayout
(
cronSelector
);
QSplitter
*
splitter
=
new
QSplitter
(
this
);
auto
splitter
=
new
QSplitter
(
this
);
splitter
->
setOrientation
(
Qt
::
Vertical
);
layout
->
addWidget
(
splitter
);
...
...
@@ -219,7 +219,7 @@ void CrontabWidget::copy()
const
QList
<
TaskWidget
*>
tasksWidget
=
mTasksWidget
->
selectedTasksWidget
();
for
(
TaskWidget
*
taskWidget
:
tasksWidget
)
{
CTTask
*
task
=
new
CTTask
(
*
(
taskWidget
->
getCTTask
()));
auto
task
=
new
CTTask
(
*
(
taskWidget
->
getCTTask
()));
mClipboardTasks
.
append
(
task
);
clipboardText
+=
task
->
exportTask
()
+
QLatin1String
(
"
\n
"
);
...
...
@@ -231,7 +231,7 @@ void CrontabWidget::copy()
const
QList
<
VariableWidget
*>
variablesWidget
=
mVariablesWidget
->
selectedVariablesWidget
();
for
(
VariableWidget
*
variableWidget
:
variablesWidget
)
{
CTVariable
*
variable
=
new
CTVariable
(
*
(
variableWidget
->
getCTVariable
()));
auto
variable
=
new
CTVariable
(
*
(
variableWidget
->
getCTVariable
()));
mClipboardVariables
.
append
(
variable
);
clipboardText
+=
variable
->
exportVariable
()
+
QLatin1String
(
"
\n
"
);
...
...
src/crontablib/ctcron.cpp
View file @
4b40a566
...
...
@@ -144,14 +144,14 @@ CTCron &CTCron::operator=(const CTCron &source)
d
->
variable
.
clear
();
const
auto
variables
=
source
.
variables
();
for
(
CTVariable
*
ctVariable
:
variables
)
{
CTVariable
*
tmp
=
new
CTVariable
(
*
ctVariable
);
auto
tmp
=
new
CTVariable
(
*
ctVariable
);
d
->
variable
.
append
(
tmp
);
}
d
->
task
.
clear
();
const
auto
tasks
=
source
.
tasks
();
for
(
CTTask
*
ctTask
:
tasks
)
{
CTTask
*
tmp
=
new
CTTask
(
*
ctTask
);
auto
tmp
=
new
CTTask
(
*
ctTask
);
d
->
task
.
append
(
tmp
);
}
...
...
@@ -206,14 +206,14 @@ void CTCron::parseFile(const QString &fileName)
// sign, it must be a variable
if
((
firstEquals
>
0
)
&&
((
firstWhiteSpace
==
-
1
)
||
firstWhiteSpace
>
firstEquals
))
{
// create variable
CTVariable
*
tmp
=
new
CTVariable
(
line
,
comment
,
d
->
userLogin
);
auto
tmp
=
new
CTVariable
(
line
,
comment
,
d
->
userLogin
);
d
->
variable
.
append
(
tmp
);
comment
.
clear
();
}
// must be a task, either enabled or disabled
else
{
if
(
firstWhiteSpace
>
0
)
{
CTTask
*
tmp
=
new
CTTask
(
line
,
comment
,
d
->
userLogin
,
d
->
multiUserCron
);
auto
tmp
=
new
CTTask
(
line
,
comment
,
d
->
userLogin
,
d
->
multiUserCron
);
d
->
task
.
append
(
tmp
);
comment
.
clear
();
}
...
...
src/crontablib/cthost.cpp
View file @
4b40a566
...
...
@@ -180,7 +180,7 @@ QString CTHost::createCTCron(const struct passwd *userInfos)
}
CTInitializationError
ctInitializationError
;
CTCron
*
p
=
new
CTCron
(
mCrontabBinary
,
userInfos
,
currentUserCron
,
ctInitializationError
);
auto
p
=
new
CTCron
(
mCrontabBinary
,
userInfos
,
currentUserCron
,
ctInitializationError
);
if
(
ctInitializationError
.
hasErrorMessage
())
{
delete
p
;
return
ctInitializationError
.
errorMessage
();
...
...
src/crontablib/ctunit.h
View file @
4b40a566
...
...
@@ -124,12 +124,12 @@ public:
/**
* Constant indicating short format.
*/
static
const
bool
shortFormat
=
0
;
static
const
bool
shortFormat
=
false
;
/**
* Constant indicating long format.
*/
static
const
bool
longFormat
=
1
;
static
const
bool
longFormat
=
true
;
};
#endif // CTUNIT_H
src/genericListWidget.cpp
View file @
4b40a566
...
...
@@ -28,25 +28,25 @@
GenericListWidget
::
GenericListWidget
(
CrontabWidget
*
crontabWidget
,
const
QString
&
label
,
const
QIcon
&
icon
)
:
QWidget
(
crontabWidget
)
{
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
(
this
);
auto
mainLayout
=
new
QVBoxLayout
(
this
);
mainLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mCrontabWidget
=
crontabWidget
;
// Label layout
QHBoxLayout
*
labelLayout
=
new
QHBoxLayout
();
auto
labelLayout
=
new
QHBoxLayout
();
QLabel
*
tasksIcon
=
new
QLabel
(
this
);
auto
tasksIcon
=
new
QLabel
(
this
);
tasksIcon
->
setPixmap
(
icon
.
pixmap
(
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
,
nullptr
,
this
)));
labelLayout
->
addWidget
(
tasksIcon
);
QLabel
*
tasksLabel
=
new
QLabel
(
label
,
this
);
auto
tasksLabel
=
new
QLabel
(
label
,
this
);
labelLayout
->
addWidget
(
tasksLabel
,
1
,
Qt
::
AlignLeft
);
mainLayout
->
addLayout
(
labelLayout
);
// Tree layout
QHBoxLayout
*
treeLayout
=
new
QHBoxLayout
();
auto
treeLayout
=
new
QHBoxLayout
();
mTreeWidget
=
new
QTreeWidget
(
this
);
...
...
@@ -135,7 +135,7 @@ void GenericListWidget::removeAll()
QAction
*
GenericListWidget
::
createSeparator
()
{
QAction
*
action
=
new
QAction
(
this
);
auto
action
=
new
QAction
(
this
);
action
->
setSeparator
(
true
);
return
action
;
...
...
@@ -143,7 +143,7 @@ QAction *GenericListWidget::createSeparator()
void
GenericListWidget
::
addRightAction
(
QAction
*
action
,
const
QObject
*
receiver
,
const
char
*
member
)
{
QPushButton
*
button
=
new
QPushButton
(
action
->
text
(),
this
);
auto
button
=
new
QPushButton
(
action
->
text
(),
this
);
button
->
setIcon
(
action
->
icon
());
button
->
setWhatsThis
(
action
->
whatsThis
());
button
->
setToolTip
(
action
->
toolTip
());
...
...
@@ -166,7 +166,7 @@ void GenericListWidget::setActionEnabled(QAction *action, bool enabled)
const
auto
associatedWidgets
=
action
->
associatedWidgets
();
for
(
QWidget
*
widget
:
associatedWidgets
)
{
// Only change status of associated Buttons
QPushButton
*
button
=
qobject_cast
<
QPushButton
*>
(
widget
);
auto
button
=
qobject_cast
<
QPushButton
*>
(
widget
);
if
(
button
)
{
button
->
setEnabled
(
enabled
);
}
...
...
src/kcmCron.cpp
View file @
4b40a566
...
...
@@ -29,12 +29,12 @@ K_PLUGIN_FACTORY(KCMCronFactory, registerPlugin<KCMCron>();)
KCMCron
::
KCMCron
(
QWidget
*
parent
,
const
QVariantList
&
/*args*/
)
:
KCModule
(
parent
)
{
KAboutData
*
aboutData
=
new
KAboutData
(
QStringLiteral
(
"kcm_cron"
),
i18n
(
"Task Scheduler"
),
QStringLiteral
(
"5.0"
),
i18n
(
"KDE Task Scheduler"
),
KAboutLicense
::
GPL
,
i18n
(
"(c) 2008, Nicolas Ternisien
\n
(c) 1999-2000, Gary Meyer"
));
auto
aboutData
=
new
KAboutData
(
QStringLiteral
(
"kcm_cron"
),
i18n
(
"Task Scheduler"
),
QStringLiteral
(
"5.0"
),
i18n
(
"KDE Task Scheduler"
),
KAboutLicense
::
GPL
,
i18n
(
"(c) 2008, Nicolas Ternisien
\n
(c) 1999-2000, Gary Meyer"
));
aboutData
->
addAuthor
(
i18n
(
"Nicolas Ternisien"
),
QString
(),
QStringLiteral
(
"nicolas.ternisien@gmail.com"
));
aboutData
->
addAuthor
(
i18n
(
"Gary Meyer"
),
QString
(),
QStringLiteral
(
"gary@meyer.net"
));
...
...
@@ -62,7 +62,7 @@ KCMCron::KCMCron(QWidget *parent, const QVariantList & /*args*/)
connect
(
mCrontabWidget
->
variablesWidget
(),
SIGNAL
(
variableModified
(
bool
)),
this
,
SIGNAL
(
changed
(
bool
)));
// Initialize view.
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
auto
layout
=
new
QVBoxLayout
(
this
);
layout
->
addWidget
(
mCrontabWidget
);
...
...
src/kcronHelper.cpp
View file @
4b40a566
...
...
@@ -48,7 +48,7 @@ void KCronHelper::initUserCombo(QComboBox *userCombo, CrontabWidget *crontabWidg
QTextEdit
*
KCronHelper
::
createCommentEdit
(
QWidget
*
parent
)
{
QTextEdit
*
edit
=
new
QTextEdit
(
parent
);
auto
edit
=
new
QTextEdit
(
parent
);
edit
->
setAcceptRichText
(
false
);
edit
->
setSizePolicy
(
QSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Minimum
));
edit
->
setTabChangesFocus
(
true
);
...
...
src/taskEditorDialog.cpp
View file @
4b40a566
...
...
@@ -52,14 +52,14 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
mCtTask
=
_ctTask
;
mCrontabWidget
=
_crontabWidget
;
QWidget
*
main
=
new
QWidget
(
this
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
(
main
);
auto
main
=
new
QWidget
(
this
);
auto
mainLayout
=
new
QVBoxLayout
(
main
);
mainLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
mOkButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
QVBoxLayout
*
dialogLayout
=
new
QVBoxLayout
();
auto
dialogLayout
=
new
QVBoxLayout
();
dialogLayout
->
addWidget
(
main
);
dialogLayout
->
addWidget
(
buttonBox
);
setLayout
(
dialogLayout
);
...
...
@@ -71,14 +71,14 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
mainLayout
->
addWidget
(
mTitleWidget
);
QGridLayout
*
commandConfigurationLayout
=
new
QGridLayout
();
auto
commandConfigurationLayout
=
new
QGridLayout
();
mainLayout
->
addLayout
(
commandConfigurationLayout
);
// command
QLabel
*
labCommand
=
new
QLabel
(
i18n
(
"&Command:"
),
main
);
auto
labCommand
=
new
QLabel
(
i18n
(
"&Command:"
),
main
);
commandConfigurationLayout
->
addWidget
(
labCommand
,
0
,
0
);
QHBoxLayout
*
commandLayout
=
new
QHBoxLayout
();
auto
commandLayout
=
new
QHBoxLayout
();
mCommandIcon
=
new
QLabel
(
main
);
mMissingCommandPixmap
=
QIcon
::
fromTheme
(
QStringLiteral
(
"image-missing"
)).
pixmap
(
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
,
nullptr
,
this
));
commandLayout
->
addWidget
(
mCommandIcon
);
...
...
@@ -96,7 +96,7 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
commandConfigurationLayout
->
addLayout
(
commandLayout
,
0
,
1
);
// User Combo
QLabel
*
userLabel
=
new
QLabel
(
i18n
(
"&Run as:"
),
main
);
auto
userLabel
=
new
QLabel
(
i18n
(
"&Run as:"
),
main
);
commandConfigurationLayout
->
addWidget
(
userLabel
,
1
,
0
);
mUserCombo
=
new
QComboBox
(
main
);
...
...
@@ -112,7 +112,7 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
}
// comment
QLabel
*
labComment
=
new
QLabel
(
i18n
(
"Co&mment:"
),
main
);
auto
labComment
=
new
QLabel
(
i18n
(
"Co&mment:"
),
main
);
commandConfigurationLayout
->
addWidget
(
labComment
,
2
,
0
,
Qt
::
AlignTop
);
mLeComment
=
KCronHelper
::
createCommentEdit
(
main
);
...
...
@@ -121,7 +121,7 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
mLeComment
->
setText
(
mCtTask
->
comment
);
QHBoxLayout
*
checkboxesLayout
=
new
QHBoxLayout
();
auto
checkboxesLayout
=
new
QHBoxLayout
();
mainLayout
->
addLayout
(
checkboxesLayout
);
// enabled
...
...
@@ -140,10 +140,10 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
mCbEveryDay
->
setChecked
(
everyDay
);
checkboxesLayout
->
addWidget
(
mCbEveryDay
);
QHBoxLayout
*
schedulingLayout
=
new
QHBoxLayout
();
auto
schedulingLayout
=
new
QHBoxLayout
();
mainLayout
->
addLayout
(
schedulingLayout
);
QVBoxLayout
*
monthLayout
=
new
QVBoxLayout
();
auto
monthLayout
=
new
QVBoxLayout
();
schedulingLayout
->
addLayout
(
monthLayout
);
// months
...
...
@@ -151,7 +151,7 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
monthLayout
->
addWidget
(
mBgMonth
);
monthLayout
->
addStretch
(
1
);
QVBoxLayout
*
v1
=
new
QVBoxLayout
();
auto
v1
=
new
QVBoxLayout
();
schedulingLayout
->
addLayout
(
v1
);
// days of the month
...
...
@@ -164,7 +164,7 @@ TaskEditorDialog::TaskEditorDialog(CTTask *_ctTask, const QString &_caption, Cro
v1
->
addStretch
(
1
);
QVBoxLayout
*
v2
=
new
QVBoxLayout
();
auto
v2
=
new
QVBoxLayout
();
schedulingLayout
->
addLayout
(
v2
);
mHoursGroup
=
createHoursGroup
(
main
);
...
...
@@ -239,13 +239,13 @@ bool TaskEditorDialog::isEveryDay()
QGroupBox
*
TaskEditorDialog
::
createDaysOfMonthGroup
(
QWidget
*
main
)
{
QGroupBox
*
daysOfMonthGroup
=
new
QGroupBox
(
i18n
(
"Days of Month"
),
main
);
QGridLayout
*
daysOfMonthLayout
=
new
QGridLayout
(
daysOfMonthGroup
);
auto
daysOfMonthGroup
=
new
QGroupBox
(
i18n
(
"Days of Month"
),
main
);
auto
daysOfMonthLayout
=
new
QGridLayout
(
daysOfMonthGroup
);
int
dm
=
CTDayOfMonth
::
MINIMUM
;
for
(
int
row
=
0
;
row
<
5
;
++
row
)
{
for
(
int
column
=
0
;
column
<
7
;
++
column
)
{
NumberPushButton
*
day
=
new
NumberPushButton
(
true
,
daysOfMonthGroup
);
auto
day
=
new
NumberPushButton
(
true
,
daysOfMonthGroup
);
day
->
setText
(
QString
::
number
(
dm
));
day
->
setCheckable
(
true
);
day
->
setChecked
(
mCtTask
->
dayOfMonth
.
isEnabled
(
dm
));
...
...
@@ -276,8 +276,8 @@ QGroupBox *TaskEditorDialog::createDaysOfMonthGroup(QWidget *main)
QGroupBox
*
TaskEditorDialog
::
createMonthsGroup
(
QWidget
*
main
)
{
QGroupBox
*
monthsGroup
=
new
QGroupBox
(
i18n
(
"Months"
),
main
);
QGridLayout
*
monthsLayout
=
new
QGridLayout
(
monthsGroup
);
auto
monthsGroup
=
new
QGroupBox
(
i18n
(
"Months"
),
main
);
auto
monthsLayout
=
new
QGridLayout
(
monthsGroup
);
int
column
=
0
;
int
row
=
0
;
...
...
@@ -312,8 +312,8 @@ QGroupBox *TaskEditorDialog::createMonthsGroup(QWidget *main)
QGroupBox
*
TaskEditorDialog
::
createDaysOfWeekGroup
(
QWidget
*
main
)
{
QGroupBox
*
daysOfWeekGroup
=
new
QGroupBox
(
i18n
(
"Days of Week"
),
main
);
QGridLayout
*
daysOfWeekLayout
=
new
QGridLayout
(
daysOfWeekGroup
);
auto
daysOfWeekGroup
=
new
QGroupBox
(
i18n
(
"Days of Week"
),
main
);
auto
daysOfWeekLayout
=
new
QGridLayout
(
daysOfWeekGroup
);
int
column
=
0
;
int
row
=
0
;
...
...
@@ -433,7 +433,7 @@ void TaskEditorDialog::reduceMinutesGroup()
NumberPushButton
*
TaskEditorDialog
::
createMinuteButton
(
int
minuteIndex
)
{
NumberPushButton
*
minuteButton
=
new
NumberPushButton
(
true
,
mMinutesGroup
);
auto
minuteButton
=
new
NumberPushButton
(
true
,
mMinutesGroup
);
minuteButton
->
setText
(
QString
::
number
(
minuteIndex
));
minuteButton
->
setCheckable
(
true
);
minuteButton
->
setChecked
(
mCtTask
->
minute
.
isEnabled
(
minuteIndex
));
...
...
@@ -458,7 +458,7 @@ void TaskEditorDialog::createMinutesGroup(QWidget *main)
mMinutesPreselectionLayout
=
new
QHBoxLayout
();
QLabel
*
minutesPreselectionLabel
=
new
QLabel
(
i18n
(
"Preselection:"
));
auto
minutesPreselectionLabel
=
new
QLabel
(
i18n
(
"Preselection:"
));
mMinutesPreselectionLayout
->
addWidget
(
minutesPreselectionLabel
);
mMinutesPreselection
=
new
QComboBox
(
this
);
...
...
@@ -492,7 +492,7 @@ void TaskEditorDialog::createMinutesGroup(QWidget *main)
NumberPushButton
*
TaskEditorDialog
::
createHourButton
(
QGroupBox
*
hoursGroup
,
int
hour
)
{
NumberPushButton
*
hourButton
=
new
NumberPushButton
(
true
,
hoursGroup
);
auto
hourButton
=
new
NumberPushButton
(
true
,
hoursGroup
);
hourButton
->
setText
(
QString
::
number
(
hour
));
hourButton
->
setCheckable
(
true
);
hourButton
->
setChecked
(
mCtTask
->
hour
.
isEnabled
(
hour
));
...
...
@@ -506,9 +506,9 @@ NumberPushButton *TaskEditorDialog::createHourButton(QGroupBox *hoursGroup, int
QGroupBox
*
TaskEditorDialog
::
createHoursGroup
(
QWidget
*
main
)
{
logDebug
()
<<
"Creating hours group"
;
QGroupBox
*
hoursGroup
=
new
QGroupBox
(
i18n
(
"Hours"
),
main
);
auto
hoursGroup
=
new
QGroupBox
(
i18n
(
"Hours"
),
main
);
QGridLayout
*
hoursLayout
=
new
QGridLayout
(
hoursGroup
);
// 5 x 7
auto
hoursLayout
=
new
QGridLayout
(
hoursGroup
);
// 5 x 7
mMorningLabel
=
new
QLabel
(
i18n
(
"AM:"
),
this
);
mMorningLabel
->
setAlignment
(
Qt
::
AlignLeft
|
Qt
::
AlignVCenter
);
...
...
@@ -648,7 +648,7 @@ void TaskEditorDialog::slotOK()
if
((
weekDaysSelected
==
0
)
&&
(
monthDaysSelected
>
0
))
{
for
(
int
dw
=
1
;
dw
<=
7
;
dw
++
)
{
mDayOfWeekButtons
[
dw
]
->
setChecked
(
1
);
mDayOfWeekButtons
[
dw
]
->
setChecked
(
true
);
}
}
...
...
src/tasksWidget.cpp
View file @
4b40a566
...
...
@@ -54,7 +54,7 @@ QList<TaskWidget *> TasksWidget::selectedTasksWidget() const
const
QList
<
QTreeWidgetItem
*>
tasksItems
=
treeWidget
()
->
selectedItems
();
tasksWidget
.
reserve
(
tasksItems
.
count
());
for
(
QTreeWidgetItem
*
item
:
tasksItems
)
{
TaskWidget
*
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
auto
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
tasksWidget
.
append
(
taskWidget
);
}
...
...
@@ -120,7 +120,7 @@ void TasksWidget::runTaskNow() const
void
TasksWidget
::
createTask
()
{
CTTask
*
task
=
auto
task
=
new
CTTask
(
QLatin1String
(
""
),
QLatin1String
(
""
),
crontabWidget
()
->
currentCron
()
->
userLogin
(),
crontabWidget
()
->
currentCron
()
->
isMultiUserCron
());
TaskEditorDialog
taskEditorDialog
(
task
,
i18n
(
"New Task"
),
crontabWidget
());
...
...
@@ -151,7 +151,7 @@ void TasksWidget::modifySelection()
void
TasksWidget
::
modifySelection
(
QTreeWidgetItem
*
item
,
int
position
)
{
TaskWidget
*
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
auto
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
if
(
taskWidget
)
{
if
(
position
==
statusColumnIndex
())
{
taskWidget
->
toggleEnable
();
...
...
@@ -181,7 +181,7 @@ void TasksWidget::deleteSelection()
bool
deleteSomething
=
!
(
tasksItems
.
isEmpty
());
for
(
QTreeWidgetItem
*
item
:
tasksItems
)
{
TaskWidget
*
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
auto
taskWidget
=
static_cast
<
TaskWidget
*>
(
item
);
crontabWidget
()
->
currentCron
()
->
removeTask
(
taskWidget
->
getCTTask
());
delete
taskWidget
->
getCTTask
();
...
...
src/variableEditorDialog.cpp
View file @
4b40a566
...
...
@@ -30,10 +30,10 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
setModal
(
true
);
setWindowTitle
(
_caption
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
mOkButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
QGridLayout
*
layout
=
new
QGridLayout
;
auto
layout
=
new
QGridLayout
;
setLayout
(
layout
);
layout
->
setColumnMinimumWidth
(
1
,
270
);
...
...
@@ -50,7 +50,7 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
layout
->
addWidget
(
mTitleWidget
,
layoutPosition
,
0
,
1
,
2
);
// variable
QLabel
*
labVariable
=
new
QLabel
(
i18nc
(
"The environmental variable name ie HOME, MAILTO etc"
,
"&Variable:"
),
this
);
auto
labVariable
=
new
QLabel
(
i18nc
(
"The environmental variable name ie HOME, MAILTO etc"
,
"&Variable:"
),
this
);
layout
->
addWidget
(
labVariable
,
++
layoutPosition
,
0
,
Qt
::
AlignLeft
);
mCmbVariable
=
new
QComboBox
(
this
);
...
...
@@ -66,10 +66,10 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
labVariable
->
setBuddy
(
mCmbVariable
);
// details
QLabel
*
labDetails
=
new
QLabel
(
QLatin1String
(
""
),
this
);
auto
labDetails
=
new
QLabel
(
QLatin1String
(
""
),
this
);
layout
->
addWidget
(
labDetails
,
++
layoutPosition
,
0
,
Qt
::
AlignLeft
);
QHBoxLayout
*
detailsLayout
=
new
QHBoxLayout
;
auto
detailsLayout
=
new
QHBoxLayout
;
mDetailsIcon
=
new
QLabel
(
this
);
detailsLayout
->
addWidget
(
mDetailsIcon
);
...
...
@@ -79,7 +79,7 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
layout
->
addLayout
(
detailsLayout
,
layoutPosition
,
1
,
Qt
::
AlignLeft
);
// value
QLabel
*
labValue
=
new
QLabel
(
i18n
(
"Va&lue:"
),
this
);
auto
labValue
=
new
QLabel
(
i18n
(
"Va&lue:"
),
this
);
layout
->
addWidget
(
labValue
,
++
layoutPosition
,
0
,
Qt
::
AlignLeft
);
mLeValue
=
new
QLineEdit
(
this
);
...
...
@@ -88,7 +88,7 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
labValue
->
setBuddy
(
mLeValue
);
// User Combo
QLabel
*
userLabel
=
new
QLabel
(
i18n
(
"&Run as:"
),
this
);
auto
userLabel
=
new
QLabel
(
i18n
(
"&Run as:"
),
this
);
layout
->
addWidget
(
userLabel
,
++
layoutPosition
,
0
);
mUserCombo
=
new
QComboBox
(
this
);
...
...
@@ -104,7 +104,7 @@ VariableEditorDialog::VariableEditorDialog(CTVariable *_ctVariable, const QStrin
}
// comment
QLabel
*
labComment
=
new
QLabel
(
i18n
(
"Co&mment:"
),
this
);
auto
labComment
=
new
QLabel
(
i18n
(
"Co&mment:"
),
this
);
layout
->
addWidget
(
labComment
,
++
layoutPosition
,
0
,
Qt
::
AlignLeft
);
mTeComment
=
KCronHelper
::
createCommentEdit
(
this
);
...
...
src/variablesWidget.cpp
View file @
4b40a566
...
...
@@ -52,7 +52,7 @@ void VariablesWidget::modifySelection()
void
VariablesWidget
::
modifySelection
(
QTreeWidgetItem
*
item
,
int
position
)
{
VariableWidget
*
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
auto
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
if
(
variableWidget
)
{
if
(
position
==
statusColumnIndex
())
{
...
...
@@ -80,7 +80,7 @@ QList<VariableWidget *> VariablesWidget::selectedVariablesWidget() const
const
QList
<
QTreeWidgetItem
*>
variablesItems
=
treeWidget
()
->
selectedItems
();
variablesWidget
.
reserve
(
variablesItems
.
count
());
for
(
QTreeWidgetItem
*
item
:
variablesItems
)
{
VariableWidget
*
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
auto
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
variablesWidget
.
append
(
variableWidget
);
}
...
...
@@ -103,7 +103,7 @@ void VariablesWidget::deleteSelection()
bool
deleteSomething
=
!
(
variablesItems
.
isEmpty
());
for
(
QTreeWidgetItem
*
item
:
variablesItems
)
{
VariableWidget
*
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
auto
variableWidget
=
static_cast
<
VariableWidget
*>
(
item
);
crontabWidget
()
->
currentCron
()
->
removeVariable
(
variableWidget
->
getCTVariable
());
delete
variableWidget
->
getCTVariable
();
...
...
@@ -138,7 +138,7 @@ int VariablesWidget::statusColumnIndex()
void
VariablesWidget
::
createVariable
()
{
CTVariable
*
variable
=
new
CTVariable
(
QLatin1String
(
""
),
QLatin1String
(
""
),
crontabWidget
()
->
currentCron
()
->
userLogin
());
auto
variable
=
new
CTVariable
(
QLatin1String
(
""
),
QLatin1String
(
""
),
crontabWidget
()
->
currentCron
()
->
userLogin
());
VariableEditorDialog
variableEditorDialog
(
variable
,
i18n
(
"New Variable"
),
crontabWidget
());
int
result
=
variableEditorDialog
.
exec
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment