Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Sieve Editor
Commits
efb2a43c
Commit
efb2a43c
authored
Oct 15, 2022
by
Laurent Montel
Browse files
Adapt to new api (scripted)
parent
04e26598
Pipeline
#248506
passed with stage
in 3 minutes and 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/sieveeditorconfigureserverwidget.cpp
View file @
efb2a43c
...
...
@@ -10,6 +10,7 @@
#include
<KLocalizedString>
#include
<KMessageBox>
#include
<kwidgetsaddons_version.h>
SieveEditorConfigureServerWidget
::
SieveEditorConfigureServerWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
...
@@ -54,12 +55,17 @@ void SieveEditorConfigureServerWidget::slotDeleteServer()
if
(
!
item
)
{
return
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
ButtonCode
::
PrimaryAction
==
KMessageBox
::
questionTwoActions
(
this
,
#else
if
(
KMessageBox
::
Yes
==
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"Do you want to remove this server
\'
%1
\'
?"
,
item
->
text
()),
i18nc
(
"@title:window"
,
"Remove Sieve Server"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
()))
{
#endif
i18n
(
"Do you want to remove this server
\'
%1
\'
?"
,
item
->
text
()),
i18nc
(
"@title:window"
,
"Remove Sieve Server"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
()))
{
ui
->
serverSieveListWidget
->
deleteServerConfig
(
item
);
delete
item
;
slotItemSelectionChanged
();
...
...
src/sieveeditormainwidget.cpp
View file @
efb2a43c
...
...
@@ -21,6 +21,7 @@
#include
<QApplication>
#include
<QStackedWidget>
#include
<QTabBar>
#include
<kwidgetsaddons_version.h>
namespace
{
...
...
@@ -605,13 +606,21 @@ void SieveEditorMainWidget::slotTabCloseRequested(int index)
auto
page
=
qobject_cast
<
SieveEditorPageWidget
*>
(
mTabWidget
->
widget
(
index
));
if
(
page
)
{
if
(
page
->
isModified
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
result
=
KMessageBox
::
questionTwoActionsCancel
(
this
,
#else
const
int
result
=
KMessageBox
::
questionYesNoCancel
(
this
,
i18n
(
"Script was modified. Do you want to save before closing?"
),
i18n
(
"Close script"
),
KStandardGuiItem
::
save
(),
KStandardGuiItem
::
no
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Script was modified. Do you want to save before closing?"
),
i18n
(
"Close script"
),
KStandardGuiItem
::
save
(),
KStandardGuiItem
::
close
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
if
(
page
->
uploadScriptAndCloseTab
(
index
))
{
return
;
}
...
...
src/sieveeditorpagewidget.cpp
View file @
efb2a43c
...
...
@@ -15,6 +15,7 @@
#include
"sieveeditor_debug.h"
#include
<QVBoxLayout>
#include
<kwidgetsaddons_version.h>
SieveEditorPageWidget
::
SieveEditorPageWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
...
@@ -162,8 +163,20 @@ bool SieveEditorPageWidget::needToSaveScript()
{
bool
result
=
false
;
if
(
mIsNewScript
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
resultQuestion
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
i18n
(
"Script '%1' is new. Do you want to save it?"
,
mCurrentURL
.
fileName
()),
i18n
(
"Save Script"
),
KStandardGuiItem
::
save
(),
KStandardGuiItem
::
cancel
());
#else
const
int
resultQuestion
=
KMessageBox
::
warningYesNoCancel
(
this
,
i18n
(
"Script '%1' is new. Do you want to save it?"
,
mCurrentURL
.
fileName
()));
#endif
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
resultQuestion
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
resultQuestion
==
KMessageBox
::
Yes
)
{
#endif
uploadScript
();
result
=
true
;
}
else
if
(
resultQuestion
==
KMessageBox
::
Cancel
)
{
...
...
@@ -171,8 +184,20 @@ bool SieveEditorPageWidget::needToSaveScript()
}
}
else
{
if
(
mSieveEditorWidget
->
isModified
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
resultQuestion
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
i18n
(
"Script '%1' was changed. Do you want to save it ?"
,
mCurrentURL
.
fileName
()),
i18n
(
"Save Script"
),
KStandardGuiItem
::
save
(),
KStandardGuiItem
::
cancel
());
#else
const
int
resultQuestion
=
KMessageBox
::
warningYesNoCancel
(
this
,
i18n
(
"Script '%1' was changed. Do you want to save it ?"
,
mCurrentURL
.
fileName
()));
#endif
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
resultQuestion
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
resultQuestion
==
KMessageBox
::
Yes
)
{
#endif
uploadScript
();
result
=
true
;
}
else
if
(
resultQuestion
==
KMessageBox
::
Cancel
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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