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
PIM
libksieve
Commits
f029ff81
Commit
f029ff81
authored
Jul 06, 2021
by
Laurent Montel
😁
Browse files
Extract code for updating global script
parent
fc9a3ea5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ksieveui/widgets/managesievewidget.cpp
View file @
f029ff81
...
...
@@ -318,22 +318,8 @@ void ManageSieveWidget::slotDeactivateScript()
}
}
void
ManageSieveWidget
::
changeActive
Script
(
QTreeWidgetItem
*
item
,
bool
activate
)
bool
ManageSieveWidget
::
updateGlobal
Script
(
QTreeWidgetItem
*
item
,
const
QUrl
&
u
)
{
if
(
!
item
)
{
return
;
}
if
(
!
mUrls
.
contains
(
item
))
{
return
;
}
if
(
!
d
->
mSelectedItems
.
contains
(
item
))
{
return
;
}
QUrl
u
=
mUrls
[
item
];
if
(
u
.
isEmpty
())
{
return
;
}
if
(
item
->
data
(
0
,
SIEVE_SERVER_MODE
).
toInt
()
==
Kep14EditorMode
)
{
QStringList
activeScripts
;
for
(
int
i
=
0
;
i
<
item
->
childCount
();
++
i
)
{
...
...
@@ -348,8 +334,28 @@ void ManageSieveWidget::changeActiveScript(QTreeWidgetItem *item, bool activate)
connect
(
job
,
&
GenerateGlobalScriptJob
::
success
,
this
,
&
ManageSieveWidget
::
slotRefresh
);
connect
(
job
,
&
GenerateGlobalScriptJob
::
error
,
this
,
&
ManageSieveWidget
::
slotGenerateGlobalScriptError
);
job
->
start
();
return
true
;
}
return
false
;
}
void
ManageSieveWidget
::
changeActiveScript
(
QTreeWidgetItem
*
item
,
bool
activate
)
{
if
(
!
item
)
{
return
;
}
if
(
!
mUrls
.
contains
(
item
))
{
return
;
}
if
(
!
d
->
mSelectedItems
.
contains
(
item
))
{
return
;
}
QUrl
u
=
mUrls
[
item
];
if
(
u
.
isEmpty
())
{
return
;
}
if
(
updateGlobalScript
(
item
,
u
))
return
;
QTreeWidgetItem
*
selected
=
d
->
mSelectedItems
[
item
];
if
(
!
selected
)
{
...
...
src/ksieveui/widgets/managesievewidget.h
View file @
f029ff81
...
...
@@ -103,6 +103,7 @@ private:
bool
isFileNameItem
(
QTreeWidgetItem
*
item
)
const
;
bool
itemIsActived
(
QTreeWidgetItem
*
item
)
const
;
void
changeActiveScript
(
QTreeWidgetItem
*
item
,
bool
activate
);
Q_REQUIRED_RESULT
bool
updateGlobalScript
(
QTreeWidgetItem
*
item
,
const
QUrl
&
u
);
void
slotGenerateGlobalScriptError
(
const
QString
&
errorStr
);
std
::
unique_ptr
<
ManageSieveWidgetPrivate
>
const
d
;
};
...
...
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