Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
libksieve
Commits
17d441b6
Commit
17d441b6
authored
Jun 02, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix comment after true/false condition
parent
52b8bbea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
6 deletions
+71
-6
src/ksieveui/autocreatescripts/autotests/data/test-comment9-ref.siv
...ui/autocreatescripts/autotests/data/test-comment9-ref.siv
+9
-0
src/ksieveui/autocreatescripts/autotests/data/test-comment9.siv
...ieveui/autocreatescripts/autotests/data/test-comment9.siv
+8
-0
src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
...escripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
+1
-0
src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp
...autocreatescripts/sieveconditions/sieveconditionfalse.cpp
+26
-3
src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp
.../autocreatescripts/sieveconditions/sieveconditiontrue.cpp
+27
-3
No files found.
src/ksieveui/autocreatescripts/autotests/data/test-comment9-ref.siv
0 → 100644
View file @
17d441b6
#SCRIPTNAME: Script part 0
if false # allof(not header :contains "X-Spam-Flag" "YES")
{
}
#SCRIPTNAME: Script part 1
if true # allof(not header :contains "X-Spam-Flag" "YES")
{
}
\ No newline at end of file
src/ksieveui/autocreatescripts/autotests/data/test-comment9.siv
0 → 100644
View file @
17d441b6
if false # allof(not header :contains "X-Spam-Flag" "YES")
{
}
if true # allof(not header :contains "X-Spam-Flag" "YES")
{
}
src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
View file @
17d441b6
...
...
@@ -208,6 +208,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
QTest
::
newRow
(
"test-comment6"
)
<<
QStringLiteral
(
"test-comment6"
)
<<
false
<<
true
;
QTest
::
newRow
(
"test-comment7"
)
<<
QStringLiteral
(
"test-comment7"
)
<<
false
<<
true
;
QTest
::
newRow
(
"test-comment8"
)
<<
QStringLiteral
(
"test-comment8"
)
<<
false
<<
true
;
QTest
::
newRow
(
"test-comment9"
)
<<
QStringLiteral
(
"test-comment9"
)
<<
false
<<
true
;
}
QTEST_MAIN
(
SieveEditorGraphicalModeWidgetTest
)
src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp
View file @
17d441b6
...
...
@@ -18,11 +18,14 @@
*/
#include "sieveconditionfalse.h"
#include "editor/sieveeditorutil.h"
#include "libksieve_debug.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QLabel>
#include <QDomNode>
using
namespace
KSieveUi
;
...
...
@@ -45,7 +48,7 @@ QWidget *SieveConditionFalse::createParamWidget(QWidget *parent) const
QString
SieveConditionFalse
::
code
(
QWidget
*
)
const
{
return
QStringLiteral
(
"false"
);
return
QStringLiteral
(
"false"
)
+
AutoCreateScriptUtil
::
generateConditionComment
(
comment
())
;
}
QString
SieveConditionFalse
::
help
()
const
...
...
@@ -53,9 +56,29 @@ QString SieveConditionFalse::help() const
return
i18n
(
"The
\"
false
\"
test always evaluates to false."
);
}
bool
SieveConditionFalse
::
setParamWidgetValue
(
const
QDomElement
&
,
QWidget
*
,
bool
,
QString
&
)
bool
SieveConditionFalse
::
setParamWidgetValue
(
const
QDomElement
&
element
,
QWidget
*
,
bool
,
QString
&
error
)
{
//Nothing
QDomNode
node
=
element
.
firstChild
();
QString
commentStr
;
while
(
!
node
.
isNull
())
{
QDomElement
e
=
node
.
toElement
();
if
(
!
e
.
isNull
())
{
const
QString
tagName
=
e
.
tagName
();
if
(
tagName
==
QLatin1String
(
"comment"
))
{
commentStr
=
AutoCreateScriptUtil
::
loadConditionComment
(
commentStr
,
e
.
text
());
}
else
if
(
tagName
==
QLatin1String
(
"crlf"
))
{
//nothing
}
else
{
unknownTag
(
tagName
,
error
);
qCDebug
(
LIBKSIEVE_LOG
)
<<
" SieveConditionFalse::setParamWidgetValue unknown tagName "
<<
tagName
;
}
}
node
=
node
.
nextSibling
();
}
if
(
!
commentStr
.
isEmpty
())
{
setComment
(
commentStr
);
}
return
true
;
}
...
...
src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp
View file @
17d441b6
...
...
@@ -18,8 +18,12 @@
*/
#include "sieveconditiontrue.h"
#include "editor/sieveeditorutil.h"
#include "libksieve_debug.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include <KLocalizedString>
#include <QDomNode>
#include <QHBoxLayout>
#include <QLabel>
...
...
@@ -44,7 +48,7 @@ QWidget *SieveConditionTrue::createParamWidget(QWidget *parent) const
QString
SieveConditionTrue
::
code
(
QWidget
*
)
const
{
return
QStringLiteral
(
"true"
);
return
QStringLiteral
(
"true"
)
+
AutoCreateScriptUtil
::
generateConditionComment
(
comment
())
;
}
QString
SieveConditionTrue
::
help
()
const
...
...
@@ -52,9 +56,29 @@ QString SieveConditionTrue::help() const
return
i18n
(
"The
\"
true
\"
test always evaluates to true."
);
}
bool
SieveConditionTrue
::
setParamWidgetValue
(
const
QDomElement
&
,
QWidget
*
,
bool
,
QString
&
)
bool
SieveConditionTrue
::
setParamWidgetValue
(
const
QDomElement
&
element
,
QWidget
*
,
bool
,
QString
&
error
)
{
//Nothing
QDomNode
node
=
element
.
firstChild
();
QString
commentStr
;
while
(
!
node
.
isNull
())
{
QDomElement
e
=
node
.
toElement
();
if
(
!
e
.
isNull
())
{
const
QString
tagName
=
e
.
tagName
();
if
(
tagName
==
QLatin1String
(
"comment"
))
{
commentStr
=
AutoCreateScriptUtil
::
loadConditionComment
(
commentStr
,
e
.
text
());
}
else
if
(
tagName
==
QLatin1String
(
"crlf"
))
{
//nothing
}
else
{
unknownTag
(
tagName
,
error
);
qCDebug
(
LIBKSIEVE_LOG
)
<<
" SieveConditionTrue::setParamWidgetValue unknown tagName "
<<
tagName
;
}
}
node
=
node
.
nextSibling
();
}
if
(
!
commentStr
.
isEmpty
())
{
setComment
(
commentStr
);
}
return
true
;
}
...
...
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