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
KDE PIM Add-ons
Commits
8722dba8
Commit
8722dba8
authored
Aug 12, 2021
by
Laurent Montel
😁
Browse files
Use new ConfirmBeforeDeletingMessageBoxDialog
parent
a99b2587
Pipeline
#74466
passed with stage
in 54 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kmail/checkbeforedeletemailplugins/confirmbeforedeleting/confirmbeforedeletinginterface.cpp
View file @
8722dba8
...
...
@@ -5,8 +5,10 @@
*/
#include
"confirmbeforedeletinginterface.h"
#include
"confirmbeforedeletingmanager.h"
#include
"confirmbeforedeletingmessageboxdialog.h"
#include
<KLocalizedString>
#include
<KMessageBox>
#include
<QPointer>
ConfirmBeforeDeletingInterface
::
ConfirmBeforeDeletingInterface
(
QObject
*
parent
)
:
MessageViewer
::
MessageViewerCheckBeforeDeletingInterface
(
parent
)
...
...
@@ -27,7 +29,6 @@ Akonadi::Item::List ConfirmBeforeDeletingInterface::exec(const Akonadi::Item::Li
for
(
const
auto
&
item
:
list
)
{
ConfirmBeforeDeletingRule
r
;
if
(
ConfirmBeforeDeletingManager
::
self
()
->
deletingNeedToConfirm
(
item
,
checkFoundStr
,
r
))
{
// TODO add checkbox for use same result for a specific check
if
(
ruleDelete
.
contains
(
r
))
{
lst
<<
item
;
continue
;
...
...
@@ -36,15 +37,24 @@ Akonadi::Item::List ConfirmBeforeDeletingInterface::exec(const Akonadi::Item::Li
continue
;
}
auto
result
=
KMessageBox
::
questionYesNoCancel
(
parentWidget
(),
i18n
(
"Do you want to delete this email?
\n
%1"
,
checkFoundStr
),
i18n
(
"Confirm Delete Mail"
));
if
(
result
==
KMessageBox
::
Yes
)
{
QPointer
<
ConfirmBeforeDeletingMessageBoxDialog
>
dlg
=
new
ConfirmBeforeDeletingMessageBoxDialog
(
parentWidget
());
dlg
->
setInfo
(
i18n
(
"Do you want to delete this email?
\n
%1"
,
checkFoundStr
));
const
int
result
=
dlg
->
exec
();
auto
button
=
static_cast
<
QDialogButtonBox
::
StandardButton
>
(
result
);
if
(
button
==
QDialogButtonBox
::
StandardButton
::
Yes
)
{
lst
<<
item
;
ruleDelete
.
append
(
r
);
}
else
if
(
result
==
KMessageBox
::
No
)
{
ruleNotDelete
.
append
(
r
);
}
else
if
(
result
==
KMessageBox
::
Cancel
)
{
if
(
dlg
->
useSameResult
())
{
ruleDelete
.
append
(
r
);
}
delete
dlg
;
}
else
if
(
button
==
QDialogButtonBox
::
StandardButton
::
No
)
{
if
(
dlg
->
useSameResult
())
{
ruleNotDelete
.
append
(
r
);
}
delete
dlg
;
}
else
if
(
button
==
QDialogButtonBox
::
StandardButton
::
Cancel
)
{
lst
.
clear
();
delete
dlg
;
break
;
}
}
else
{
...
...
kmail/checkbeforedeletemailplugins/confirmbeforedeleting/confirmbeforedeletingmessageboxdialog.cpp
View file @
8722dba8
...
...
@@ -9,6 +9,7 @@
#include
<KLocalizedString>
#include
<QDialogButtonBox>
#include
<QPushButton>
#include
<QVBoxLayout>
ConfirmBeforeDeletingMessageBoxDialog
::
ConfirmBeforeDeletingMessageBoxDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
)
...
...
@@ -24,8 +25,15 @@ ConfirmBeforeDeletingMessageBoxDialog::ConfirmBeforeDeletingMessageBoxDialog(QWi
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Yes
|
QDialogButtonBox
::
Cancel
|
QDialogButtonBox
::
No
,
this
);
buttonBox
->
setObjectName
(
QStringLiteral
(
"buttonBox"
));
mainLayout
->
addWidget
(
buttonBox
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
ConfirmBeforeDeletingMessageBoxDialog
::
accept
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
ConfirmBeforeDeletingMessageBoxDialog
::
reject
);
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
Yes
),
&
QPushButton
::
clicked
,
this
,
[
this
]()
{
done
(
QDialogButtonBox
::
Yes
);
});
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
No
),
&
QPushButton
::
clicked
,
this
,
[
this
]()
{
done
(
QDialogButtonBox
::
No
);
});
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
Cancel
),
&
QPushButton
::
clicked
,
this
,
[
this
]()
{
done
(
QDialogButtonBox
::
Cancel
);
});
}
ConfirmBeforeDeletingMessageBoxDialog
::~
ConfirmBeforeDeletingMessageBoxDialog
()
...
...
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