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
3900fac2
Commit
3900fac2
authored
Jan 14, 2021
by
Laurent Montel
😁
Browse files
Rename variable as private variable. Not necessary to create private
class in apps directly
parent
43cb1a84
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/crontabPrinterWidget.cpp
View file @
3900fac2
...
...
@@ -21,17 +21,17 @@ CrontabPrinterWidget::CrontabPrinterWidget(bool root)
QVBoxLayout
*
main_
=
new
QVBoxLayout
(
this
);
c
hkPrintCrontab
=
new
QCheckBox
(
i18n
(
"Print cron&tab"
),
this
);
c
hkPrintCrontab
->
setObjectName
(
QStringLiteral
(
"chkPrintCrontab"
));
main_
->
addWidget
(
c
hkPrintCrontab
);
mC
hkPrintCrontab
=
new
QCheckBox
(
i18n
(
"Print cron&tab"
),
this
);
mC
hkPrintCrontab
->
setObjectName
(
QStringLiteral
(
"chkPrintCrontab"
));
main_
->
addWidget
(
mC
hkPrintCrontab
);
c
hkPrintAllUsers
=
new
QCheckBox
(
i18n
(
"Print &all users"
),
this
);
c
hkPrintAllUsers
->
setObjectName
(
QStringLiteral
(
"chkPrintAllUsers"
));
main_
->
addWidget
(
c
hkPrintAllUsers
);
mC
hkPrintAllUsers
=
new
QCheckBox
(
i18n
(
"Print &all users"
),
this
);
mC
hkPrintAllUsers
->
setObjectName
(
QStringLiteral
(
"chkPrintAllUsers"
));
main_
->
addWidget
(
mC
hkPrintAllUsers
);
if
(
!
root
)
{
c
hkPrintAllUsers
->
setChecked
(
false
);
c
hkPrintAllUsers
->
setEnabled
(
false
);
mC
hkPrintAllUsers
->
setChecked
(
false
);
mC
hkPrintAllUsers
->
setEnabled
(
false
);
}
}
...
...
@@ -41,20 +41,20 @@ CrontabPrinterWidget::~CrontabPrinterWidget()
bool
CrontabPrinterWidget
::
printCrontab
()
{
return
c
hkPrintCrontab
->
isChecked
();
return
mC
hkPrintCrontab
->
isChecked
();
}
void
CrontabPrinterWidget
::
setPrintCrontab
(
bool
setStatus
)
{
c
hkPrintCrontab
->
setChecked
(
setStatus
);
mC
hkPrintCrontab
->
setChecked
(
setStatus
);
}
bool
CrontabPrinterWidget
::
printAllUsers
()
{
return
c
hkPrintAllUsers
->
isChecked
();
return
mC
hkPrintAllUsers
->
isChecked
();
}
void
CrontabPrinterWidget
::
setPrintAllUsers
(
bool
setStatus
)
{
c
hkPrintAllUsers
->
setChecked
(
setStatus
);
mC
hkPrintAllUsers
->
setChecked
(
setStatus
);
}
src/crontabPrinterWidget.h
View file @
3900fac2
...
...
@@ -38,8 +38,8 @@ public:
void
setPrintAllUsers
(
bool
setStatus
);
private:
QCheckBox
*
c
hkPrintCrontab
;
QCheckBox
*
c
hkPrintAllUsers
;
QCheckBox
*
mC
hkPrintCrontab
=
nullptr
;
QCheckBox
*
mC
hkPrintAllUsers
=
nullptr
;
};
#endif
src/crontabWidget.cpp
View file @
3900fac2
...
...
@@ -43,61 +43,15 @@
class
CTGlobalCron
;
class
CrontabWidgetPrivate
{
public:
/**
* The application.
*/
CTHost
*
ctHost
=
nullptr
;
/**
* Tree view of the crontab tasks.
*/
TasksWidget
*
tasksWidget
=
nullptr
;
/**
* Tree view of the crontab tasks.
*/
VariablesWidget
*
variablesWidget
=
nullptr
;
QAction
*
cutAction
=
nullptr
;
QAction
*
copyAction
=
nullptr
;
QAction
*
pasteAction
=
nullptr
;
/**
* Clipboard tasks.
*/
QList
<
CTTask
*>
clipboardTasks
;
/**
* Clipboard variable.
*/
QList
<
CTVariable
*>
clipboardVariables
;
QRadioButton
*
currentUserCronRadio
=
nullptr
;
QRadioButton
*
systemCronRadio
=
nullptr
;
QRadioButton
*
otherUserCronRadio
=
nullptr
;
QComboBox
*
otherUsers
=
nullptr
;
/**
* Pointer to the pseudo Global Cron object
*/
CTGlobalCron
*
ctGlobalCron
=
nullptr
;
};
CrontabWidget
::
CrontabWidget
(
QWidget
*
parent
,
CTHost
*
ctHost
)
:
QWidget
(
parent
)
,
d
(
new
CrontabWidgetPrivate
())
{
d
->
c
tHost
=
ctHost
;
mC
tHost
=
ctHost
;
if
(
d
->
c
tHost
->
isRootUser
())
{
d
->
c
tGlobalCron
=
new
CTGlobalCron
(
d
->
c
tHost
);
if
(
mC
tHost
->
isRootUser
())
{
mC
tGlobalCron
=
new
CTGlobalCron
(
mC
tHost
);
}
else
{
d
->
c
tGlobalCron
=
nullptr
;
mC
tGlobalCron
=
nullptr
;
}
setupActions
();
...
...
@@ -106,35 +60,33 @@ CrontabWidget::CrontabWidget(QWidget *parent, CTHost *ctHost)
logDebug
()
<<
"Clipboard Status "
<<
hasClipboardContent
();
d
->
t
asksWidget
->
setFocus
();
mT
asksWidget
->
setFocus
();
QTreeWidgetItem
*
item
=
d
->
t
asksWidget
->
treeWidget
()
->
topLevelItem
(
0
);
QTreeWidgetItem
*
item
=
mT
asksWidget
->
treeWidget
()
->
topLevelItem
(
0
);
if
(
item
!=
nullptr
)
{
logDebug
()
<<
"First item found"
<<
d
->
t
asksWidget
->
treeWidget
()
->
topLevelItemCount
();
logDebug
()
<<
"First item found"
<<
mT
asksWidget
->
treeWidget
()
->
topLevelItemCount
();
item
->
setSelected
(
true
);
}
d
->
t
asksWidget
->
changeCurrentSelection
();
d
->
v
ariablesWidget
->
changeCurrentSelection
();
mT
asksWidget
->
changeCurrentSelection
();
mV
ariablesWidget
->
changeCurrentSelection
();
}
CrontabWidget
::~
CrontabWidget
()
{
delete
d
->
tasksWidget
;
delete
d
->
variablesWidget
;
delete
d
->
ctGlobalCron
;
delete
mTasksWidget
;
delete
mVariablesWidget
;
delete
d
;
delete
mCtGlobalCron
;
}
bool
CrontabWidget
::
hasClipboardContent
()
{
if
(
!
d
->
c
lipboardTasks
.
isEmpty
())
{
if
(
!
mC
lipboardTasks
.
isEmpty
())
{
return
true
;
}
if
(
!
d
->
c
lipboardVariables
.
isEmpty
())
{
if
(
!
mC
lipboardVariables
.
isEmpty
())
{
return
true
;
}
...
...
@@ -149,22 +101,22 @@ QHBoxLayout *CrontabWidget::createCronSelector()
QButtonGroup
*
group
=
new
QButtonGroup
(
this
);
d
->
c
urrentUserCronRadio
=
new
QRadioButton
(
i18n
(
"Personal Cron"
),
this
);
d
->
c
urrentUserCronRadio
->
setChecked
(
true
);
group
->
addButton
(
d
->
c
urrentUserCronRadio
);
layout
->
addWidget
(
d
->
c
urrentUserCronRadio
);
mC
urrentUserCronRadio
=
new
QRadioButton
(
i18n
(
"Personal Cron"
),
this
);
mC
urrentUserCronRadio
->
setChecked
(
true
);
group
->
addButton
(
mC
urrentUserCronRadio
);
layout
->
addWidget
(
mC
urrentUserCronRadio
);
d
->
s
ystemCronRadio
=
new
QRadioButton
(
i18n
(
"System Cron"
),
this
);
group
->
addButton
(
d
->
s
ystemCronRadio
);
layout
->
addWidget
(
d
->
s
ystemCronRadio
);
mS
ystemCronRadio
=
new
QRadioButton
(
i18n
(
"System Cron"
),
this
);
group
->
addButton
(
mS
ystemCronRadio
);
layout
->
addWidget
(
mS
ystemCronRadio
);
d
->
o
therUserCronRadio
=
new
QRadioButton
(
i18n
(
"Cron of User:"
),
this
);
group
->
addButton
(
d
->
o
therUserCronRadio
);
mO
therUserCronRadio
=
new
QRadioButton
(
i18n
(
"Cron of User:"
),
this
);
group
->
addButton
(
mO
therUserCronRadio
);
d
->
o
therUsers
=
new
QComboBox
(
this
);
mO
therUsers
=
new
QComboBox
(
this
);
layout
->
addWidget
(
d
->
o
therUserCronRadio
);
layout
->
addWidget
(
d
->
o
therUsers
);
layout
->
addWidget
(
mO
therUserCronRadio
);
layout
->
addWidget
(
mO
therUsers
);
if
(
ctHost
()
->
isRootUser
())
{
QStringList
users
;
...
...
@@ -183,15 +135,15 @@ QHBoxLayout *CrontabWidget::createCronSelector()
}
users
.
sort
();
d
->
o
therUsers
->
addItems
(
users
);
d
->
o
therUsers
->
addItem
(
QIcon
::
fromTheme
(
QStringLiteral
(
"users"
)),
i18n
(
"Show All Personal Crons"
));
mO
therUsers
->
addItems
(
users
);
mO
therUsers
->
addItem
(
QIcon
::
fromTheme
(
QStringLiteral
(
"users"
)),
i18n
(
"Show All Personal Crons"
));
}
else
{
d
->
o
therUserCronRadio
->
hide
();
d
->
o
therUsers
->
hide
();
mO
therUserCronRadio
->
hide
();
mO
therUsers
->
hide
();
}
connect
(
group
,
static_cast
<
void
(
QButtonGroup
::*
)(
QAbstractButton
*
)
>
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
CrontabWidget
::
refreshCron
);
connect
(
d
->
o
therUsers
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
CrontabWidget
::
checkOtherUsers
);
connect
(
mO
therUsers
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
CrontabWidget
::
checkOtherUsers
);
layout
->
addStretch
(
1
);
...
...
@@ -213,12 +165,12 @@ void CrontabWidget::initialize()
splitter
->
setOrientation
(
Qt
::
Vertical
);
layout
->
addWidget
(
splitter
);
d
->
t
asksWidget
=
new
TasksWidget
(
this
);
splitter
->
addWidget
(
d
->
t
asksWidget
);
mT
asksWidget
=
new
TasksWidget
(
this
);
splitter
->
addWidget
(
mT
asksWidget
);
splitter
->
setStretchFactor
(
0
,
2
);
d
->
v
ariablesWidget
=
new
VariablesWidget
(
this
);
splitter
->
addWidget
(
d
->
v
ariablesWidget
);
mV
ariablesWidget
=
new
VariablesWidget
(
this
);
splitter
->
addWidget
(
mV
ariablesWidget
);
splitter
->
setStretchFactor
(
1
,
1
);
refreshCron
();
...
...
@@ -228,24 +180,24 @@ void CrontabWidget::refreshCron()
{
CTCron
*
ctCron
=
currentCron
();
d
->
t
asksWidget
->
refreshTasks
(
ctCron
);
d
->
v
ariablesWidget
->
refreshVariables
(
ctCron
);
mT
asksWidget
->
refreshTasks
(
ctCron
);
mV
ariablesWidget
->
refreshVariables
(
ctCron
);
if
(
ctCron
->
isMultiUserCron
()
&&
ctHost
()
->
isRootUser
()
==
false
)
{
logDebug
()
<<
"Disabling view..."
;
d
->
t
asksWidget
->
treeWidget
()
->
setEnabled
(
false
);
d
->
v
ariablesWidget
->
treeWidget
()
->
setEnabled
(
false
);
mT
asksWidget
->
treeWidget
()
->
setEnabled
(
false
);
mV
ariablesWidget
->
treeWidget
()
->
setEnabled
(
false
);
toggleNewEntryActions
(
false
);
toggleModificationActions
(
false
);
togglePasteAction
(
false
);
d
->
t
asksWidget
->
toggleRunNowAction
(
false
);
mT
asksWidget
->
toggleRunNowAction
(
false
);
}
else
{
logDebug
()
<<
"Enabling view..."
;
d
->
t
asksWidget
->
treeWidget
()
->
setEnabled
(
true
);
d
->
v
ariablesWidget
->
treeWidget
()
->
setEnabled
(
true
);
mT
asksWidget
->
treeWidget
()
->
setEnabled
(
true
);
mV
ariablesWidget
->
treeWidget
()
->
setEnabled
(
true
);
toggleNewEntryActions
(
true
);
togglePasteAction
(
hasClipboardContent
());
...
...
@@ -254,37 +206,37 @@ void CrontabWidget::refreshCron()
void
CrontabWidget
::
copy
()
{
foreach
(
CTTask
*
task
,
d
->
c
lipboardTasks
)
{
foreach
(
CTTask
*
task
,
mC
lipboardTasks
)
{
delete
task
;
}
d
->
c
lipboardTasks
.
clear
();
mC
lipboardTasks
.
clear
();
foreach
(
CTVariable
*
variable
,
d
->
c
lipboardVariables
)
{
foreach
(
CTVariable
*
variable
,
mC
lipboardVariables
)
{
delete
variable
;
}
d
->
c
lipboardVariables
.
clear
();
mC
lipboardVariables
.
clear
();
QString
clipboardText
;
if
(
d
->
t
asksWidget
->
treeWidget
()
->
hasFocus
())
{
if
(
mT
asksWidget
->
treeWidget
()
->
hasFocus
())
{
logDebug
()
<<
"Tasks copying"
;
const
QList
<
TaskWidget
*>
tasksWidget
=
d
->
t
asksWidget
->
selectedTasksWidget
();
const
QList
<
TaskWidget
*>
tasksWidget
=
mT
asksWidget
->
selectedTasksWidget
();
for
(
TaskWidget
*
taskWidget
:
tasksWidget
)
{
CTTask
*
task
=
new
CTTask
(
*
(
taskWidget
->
getCTTask
()));
d
->
c
lipboardTasks
.
append
(
task
);
mC
lipboardTasks
.
append
(
task
);
clipboardText
+=
task
->
exportTask
()
+
QLatin1String
(
"
\n
"
);
}
}
if
(
d
->
v
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
if
(
mV
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
logDebug
()
<<
"Variables copying"
;
QList
<
VariableWidget
*>
variablesWidget
=
d
->
v
ariablesWidget
->
selectedVariablesWidget
();
QList
<
VariableWidget
*>
variablesWidget
=
mV
ariablesWidget
->
selectedVariablesWidget
();
foreach
(
VariableWidget
*
variableWidget
,
variablesWidget
)
{
CTVariable
*
variable
=
new
CTVariable
(
*
(
variableWidget
->
getCTVariable
()));
d
->
c
lipboardVariables
.
append
(
variable
);
mC
lipboardVariables
.
append
(
variable
);
clipboardText
+=
variable
->
exportVariable
()
+
QLatin1String
(
"
\n
"
);
}
...
...
@@ -303,14 +255,14 @@ void CrontabWidget::cut()
copy
();
if
(
d
->
t
asksWidget
->
treeWidget
()
->
hasFocus
())
{
if
(
mT
asksWidget
->
treeWidget
()
->
hasFocus
())
{
logDebug
()
<<
"Tasks cutting"
;
d
->
t
asksWidget
->
deleteSelection
();
mT
asksWidget
->
deleteSelection
();
}
if
(
d
->
v
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
if
(
mV
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
logDebug
()
<<
"Variables cutting"
;
d
->
v
ariablesWidget
->
deleteSelection
();
mV
ariablesWidget
->
deleteSelection
();
}
}
...
...
@@ -318,54 +270,54 @@ void CrontabWidget::paste()
{
logDebug
()
<<
"Paste content"
;
if
(
d
->
t
asksWidget
->
treeWidget
()
->
hasFocus
())
{
foreach
(
CTTask
*
task
,
d
->
c
lipboardTasks
)
{
d
->
t
asksWidget
->
addTask
(
new
CTTask
(
*
task
));
if
(
mT
asksWidget
->
treeWidget
()
->
hasFocus
())
{
foreach
(
CTTask
*
task
,
mC
lipboardTasks
)
{
mT
asksWidget
->
addTask
(
new
CTTask
(
*
task
));
}
}
if
(
d
->
v
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
foreach
(
CTVariable
*
variable
,
d
->
c
lipboardVariables
)
{
d
->
v
ariablesWidget
->
addVariable
(
new
CTVariable
(
*
variable
));
if
(
mV
ariablesWidget
->
treeWidget
()
->
hasFocus
())
{
foreach
(
CTVariable
*
variable
,
mC
lipboardVariables
)
{
mV
ariablesWidget
->
addVariable
(
new
CTVariable
(
*
variable
));
}
}
}
CTCron
*
CrontabWidget
::
currentCron
()
const
{
if
(
d
->
c
urrentUserCronRadio
->
isChecked
())
{
return
d
->
c
tHost
->
findCurrentUserCron
();
}
else
if
(
d
->
s
ystemCronRadio
->
isChecked
())
{
return
d
->
c
tHost
->
findSystemCron
();
if
(
mC
urrentUserCronRadio
->
isChecked
())
{
return
mC
tHost
->
findCurrentUserCron
();
}
else
if
(
mS
ystemCronRadio
->
isChecked
())
{
return
mC
tHost
->
findSystemCron
();
}
if
(
d
->
o
therUsers
->
currentIndex
()
==
d
->
o
therUsers
->
count
()
-
1
)
{
if
(
mO
therUsers
->
currentIndex
()
==
mO
therUsers
->
count
()
-
1
)
{
logDebug
()
<<
"Using Global Cron"
;
return
d
->
c
tGlobalCron
;
return
mC
tGlobalCron
;
}
QString
currentUserLogin
=
d
->
o
therUsers
->
currentText
();
return
d
->
c
tHost
->
findUserCron
(
currentUserLogin
);
QString
currentUserLogin
=
mO
therUsers
->
currentText
();
return
mC
tHost
->
findUserCron
(
currentUserLogin
);
}
TasksWidget
*
CrontabWidget
::
tasksWidget
()
const
{
return
d
->
t
asksWidget
;
return
mT
asksWidget
;
}
VariablesWidget
*
CrontabWidget
::
variablesWidget
()
const
{
return
d
->
v
ariablesWidget
;
return
mV
ariablesWidget
;
}
CTHost
*
CrontabWidget
::
ctHost
()
const
{
return
d
->
c
tHost
;
return
mC
tHost
;
}
void
CrontabWidget
::
checkOtherUsers
()
{
d
->
o
therUserCronRadio
->
setChecked
(
true
);
mO
therUserCronRadio
->
setChecked
(
true
);
refreshCron
();
}
...
...
@@ -375,9 +327,9 @@ void CrontabWidget::setupActions()
logDebug
()
<<
"Setup actions"
;
//Edit menu
d
->
c
utAction
=
KStandardAction
::
cut
(
this
,
SLOT
(
cut
()),
this
);
d
->
c
opyAction
=
KStandardAction
::
copy
(
this
,
SLOT
(
copy
()),
this
);
d
->
p
asteAction
=
KStandardAction
::
paste
(
this
,
SLOT
(
paste
()),
this
);
mC
utAction
=
KStandardAction
::
cut
(
this
,
SLOT
(
cut
()),
this
);
mC
opyAction
=
KStandardAction
::
copy
(
this
,
SLOT
(
copy
()),
this
);
mP
asteAction
=
KStandardAction
::
paste
(
this
,
SLOT
(
paste
()),
this
);
togglePasteAction
(
false
);
logDebug
()
<<
"Actions initialized"
;
...
...
@@ -386,31 +338,31 @@ void CrontabWidget::setupActions()
QList
<
QAction
*>
CrontabWidget
::
cutCopyPasteActions
()
{
QList
<
QAction
*>
actions
;
actions
.
append
(
d
->
c
utAction
);
actions
.
append
(
d
->
c
opyAction
);
actions
.
append
(
d
->
p
asteAction
);
actions
.
append
(
mC
utAction
);
actions
.
append
(
mC
opyAction
);
actions
.
append
(
mP
asteAction
);
return
actions
;
}
void
CrontabWidget
::
togglePasteAction
(
bool
state
)
{
d
->
p
asteAction
->
setEnabled
(
state
);
mP
asteAction
->
setEnabled
(
state
);
}
void
CrontabWidget
::
toggleModificationActions
(
bool
state
)
{
d
->
c
utAction
->
setEnabled
(
state
);
d
->
c
opyAction
->
setEnabled
(
state
);
mC
utAction
->
setEnabled
(
state
);
mC
opyAction
->
setEnabled
(
state
);
d
->
t
asksWidget
->
toggleModificationActions
(
state
);
d
->
v
ariablesWidget
->
toggleModificationActions
(
state
);
mT
asksWidget
->
toggleModificationActions
(
state
);
mV
ariablesWidget
->
toggleModificationActions
(
state
);
}
void
CrontabWidget
::
toggleNewEntryActions
(
bool
state
)
{
d
->
t
asksWidget
->
toggleNewEntryAction
(
state
);
d
->
v
ariablesWidget
->
toggleNewEntryAction
(
state
);
mT
asksWidget
->
toggleNewEntryAction
(
state
);
mV
ariablesWidget
->
toggleNewEntryAction
(
state
);
}
void
CrontabWidget
::
print
()
...
...
src/crontabWidget.h
View file @
3900fac2
...
...
@@ -18,8 +18,9 @@ class QHBoxLayout;
class
CTHost
;
class
CTCron
;
class
CrontabWidgetPrivate
;
class
QRadioButton
;
class
QComboBox
;
class
CTGlobalCron
;
/**
* Main GUI view of the crontab entries.
...
...
@@ -107,7 +108,46 @@ private:
bool
hasClipboardContent
();
CrontabWidgetPrivate
*
const
d
;
/**
* The application.
*/
CTHost
*
mCtHost
=
nullptr
;
/**
* Tree view of the crontab tasks.
*/
TasksWidget
*
mTasksWidget
=
nullptr
;
/**
* Tree view of the crontab tasks.
*/
VariablesWidget
*
mVariablesWidget
=
nullptr
;
QAction
*
mCutAction
=
nullptr
;
QAction
*
mCopyAction
=
nullptr
;
QAction
*
mPasteAction
=
nullptr
;
/**
* Clipboard tasks.
*/
QList
<
CTTask
*>
mClipboardTasks
;
/**
* Clipboard variable.
*/
QList
<
CTVariable
*>
mClipboardVariables
;
QRadioButton
*
mCurrentUserCronRadio
=
nullptr
;
QRadioButton
*
mSystemCronRadio
=
nullptr
;
QRadioButton
*
mOtherUserCronRadio
=
nullptr
;
QComboBox
*
mOtherUsers
=
nullptr
;
/**
* Pointer to the pseudo Global Cron object
*/
CTGlobalCron
*
mCtGlobalCron
=
nullptr
;
};
#endif // CRONTABWIDGET_H
src/genericListWidget.cpp
View file @
3900fac2
...
...
@@ -24,28 +24,16 @@
#include "logging.h"
class
GenericListWidgetPrivate
{
public:
QTreeWidget
*
treeWidget
=
nullptr
;
CrontabWidget
*
crontabWidget
=
nullptr
;
QVBoxLayout
*
actionsLayout
=
nullptr
;
};
/**
* Construct tasks folder from branch.
*/
GenericListWidget
::
GenericListWidget
(
CrontabWidget
*
crontabWidget
,
const
QString
&
label
,
const
QIcon
&
icon
)
:
QWidget
(
crontabWidget
)
,
d
(
new
GenericListWidgetPrivate
())
{
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
(
this
);
mainLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
d
->
c
rontabWidget
=
crontabWidget
;
mC
rontabWidget
=
crontabWidget
;
// Label layout
QHBoxLayout
*
labelLayout
=
new
QHBoxLayout
();
...
...
@@ -62,32 +50,32 @@ GenericListWidget::GenericListWidget(CrontabWidget *crontabWidget, const QString
// Tree layout
QHBoxLayout
*
treeLayout
=
new
QHBoxLayout
();
d
->
t
reeWidget
=
new
QTreeWidget
(
this
);
mT
reeWidget
=
new
QTreeWidget
(
this
);
d
->
t
reeWidget
->
setRootIsDecorated
(
true
);
d
->
t
reeWidget
->
setAllColumnsShowFocus
(
true
);
mT
reeWidget
->
setRootIsDecorated
(
true
);
mT
reeWidget
->
setAllColumnsShowFocus
(
true
);
d
->
t
reeWidget
->
header
()
->
setSortIndicatorShown
(
true
);
d
->
t
reeWidget
->
header
()
->
setStretchLastSection
(
true
);
d
->
t
reeWidget
->
header
()
->
setSectionsMovable
(
true
);
mT
reeWidget
->
header
()
->
setSortIndicatorShown
(
true
);
mT
reeWidget
->
header
()
->
setStretchLastSection
(
true
);
mT
reeWidget
->
header
()
->
setSectionsMovable
(
true
);
d
->
t
reeWidget
->
setSortingEnabled
(
true
);
d
->
t
reeWidget
->
setAnimated
(
true
);
mT
reeWidget
->
setSortingEnabled
(
true
);
mT
reeWidget
->
setAnimated
(
true
);
d
->
t
reeWidget
->
setRootIsDecorated
(
false
);
mT
reeWidget
->
setRootIsDecorated
(
false
);
d
->
t
reeWidget
->
setAllColumnsShowFocus
(
true
);
mT
reeWidget
->
setAllColumnsShowFocus
(
true
);
d
->
t
reeWidget
->
setAlternatingRowColors
(
true
);
mT
reeWidget
->
setAlternatingRowColors
(
true
);
d
->
t
reeWidget
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
d
->
t
reeWidget
->
setContextMenuPolicy
(
Qt
::
ActionsContextMenu
);
mT
reeWidget
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
mT
reeWidget
->
setContextMenuPolicy
(
Qt
::
ActionsContextMenu
);
treeLayout
->
addWidget
(
d
->
t
reeWidget
);
treeLayout
->
addWidget
(
mT
reeWidget
);
d
->
a
ctionsLayout
=
new
QVBoxLayout
();
mA
ctionsLayout
=
new
QVBoxLayout
();
treeLayout
->
addLayout
(
d
->
a
ctionsLayout
);
treeLayout
->
addLayout
(
mA
ctionsLayout
);
mainLayout
->
addLayout
(
treeLayout
);
...
...
@@ -97,29 +85,28 @@ GenericListWidget::GenericListWidget(CrontabWidget *crontabWidget, const QString