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
68f21786
Commit
68f21786
authored
Oct 05, 2021
by
Corbin Schwimmbeck
Browse files
Added comments for clarification, unrelated to other changes.
parent
d39fd100
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/crontablib/ctcron.cpp
View file @
68f21786
...
...
@@ -122,6 +122,7 @@ CTCron::CTCron(const QString &crontabBinary, const struct passwd *userInfos, boo
CTCron
::
CTCron
()
:
d
(
new
CTCronPrivate
())
{
// Empty constructor, new CTCronPrivate created.
}
bool
CTCron
::
initializeFromUserInfos
(
const
struct
passwd
*
userInfos
)
...
...
@@ -141,6 +142,7 @@ CTCron &CTCron::operator=(const CTCron &source)
return
*
this
;
}
// Not sure when this would tigger.
if
(
source
.
isSystemCron
())
{
qCDebug
(
KCM_CRON_LOG
)
<<
"Affect the system cron"
;
}
...
...
src/crontablib/ctcron.h
View file @
68f21786
...
...
@@ -206,6 +206,7 @@ protected:
bool
saveToFile
(
const
QString
&
fileName
);
// d probably stands for data.
CTCronPrivate
*
const
d
;
};
src/crontablib/cthost.cpp
View file @
68f21786
...
...
@@ -77,7 +77,6 @@ CTHost::CTHost(const QString &cronBinary, CTInitializationError &ctInitializatio
// delete currentUserPassword;
}
// Create the system cron table.
createSystemCron
();
}
...
...
@@ -184,6 +183,7 @@ QString CTHost::createCTCron(const struct passwd *userInfos)
CTCron
*
CTHost
::
findCurrentUserCron
()
const
{
// Because multiple users may exist, return only the currently logged in user's cron in user cron mode.
for
(
CTCron
*
ctCron
:
std
::
as_const
(
mCrons
))
{
if
(
ctCron
->
isCurrentUserCron
())
{
return
ctCron
;
...
...
@@ -196,6 +196,7 @@ CTCron *CTHost::findCurrentUserCron() const
CTCron
*
CTHost
::
findSystemCron
()
const
{
// Return the cron belonging to root.
for
(
CTCron
*
ctCron
:
std
::
as_const
(
mCrons
))
{
if
(
ctCron
->
isMultiUserCron
())
{
return
ctCron
;
...
...
src/crontablib/cttask.cpp
View file @
68f21786
...
...
@@ -59,7 +59,6 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
int
spacePos
(
tokStr
.
indexOf
(
QRegExp
(
QLatin1String
(
"[
\t
]"
))));
// If reboot bypass initialize functions so no keys selected in modify task
if
(
!
reboot
)
{
// qCDebug(KCM_CRON_LOG) << "Line : " << tokStr;
minute
.
initialize
(
tokStr
.
mid
(
0
,
spacePos
));
while
(
isSpaceAt
(
tokStr
,
spacePos
+
1
))
{
...
...
@@ -91,6 +90,10 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
dayOfWeek
.
initialize
(
tokStr
.
mid
(
0
,
spacePos
));
}
// Since it's a multiuser(system) task, the token contains the user login,
// and the command, separated by a tab (\t).
// The two need to subsequently be separated again.
// E.g. "root\tmy_test_script.sh"
if
(
mSystemCrontab
)
{
while
(
isSpaceAt
(
tokStr
,
spacePos
+
1
))
{
spacePos
++
;
...
...
@@ -101,7 +104,6 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
}
else
{
userLogin
=
_userLogin
;
}
command
=
tokStr
.
mid
(
spacePos
+
1
,
tokStr
.
length
()
-
1
);
// remove leading whitespace
while
(
command
.
indexOf
(
QRegExp
(
QLatin1String
(
"[
\t
]"
)))
==
0
)
{
...
...
src/tasksWidget.cpp
View file @
68f21786
...
...
@@ -120,12 +120,14 @@ void TasksWidget::runTaskNow() const
void
TasksWidget
::
createTask
()
{
// Gather necessary data to combine it into a CTTask, opening the taskEditor dialog.
auto
task
=
new
CTTask
(
QLatin1String
(
""
),
QLatin1String
(
""
),
crontabWidget
()
->
currentCron
()
->
userLogin
(),
crontabWidget
()
->
currentCron
()
->
isMultiUserCron
());
TaskEditorDialog
taskEditorDialog
(
task
,
i18n
(
"New Task"
),
crontabWidget
());
const
int
result
=
taskEditorDialog
.
exec
();
// Signal that changes were made if the task was created, or clean up if not.
if
(
result
==
QDialog
::
Accepted
)
{
addTask
(
task
);
Q_EMIT
taskModified
(
true
);
...
...
Write
Preview
Supports
Markdown
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