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
0a854708
Commit
0a854708
authored
Mar 28, 2021
by
Laurent Montel
😁
Browse files
Return error messages
parent
73af59f4
Pipeline
#55802
passed with stage
in 54 minutes and 53 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kmail/grammarplugins/grammalecte/src/grammalecteresultjob.cpp
View file @
0a854708
...
...
@@ -7,6 +7,7 @@
#include "grammalecteresultjob.h"
#include "libgrammalecte_debug.h"
#include <QFileInfo>
#include <QTemporaryFile>
GrammalecteResultJob
::
GrammalecteResultJob
(
QObject
*
parent
)
...
...
@@ -135,6 +136,14 @@ bool GrammalecteResultJob::canStart()
mErrorType
=
ErrorType
::
PythonPathMissing
;
return
false
;
}
if
(
!
QFileInfo
::
exists
(
mPythonPath
))
{
mErrorType
=
ErrorType
::
PythonPathNotExist
;
return
false
;
}
if
(
!
QFileInfo
::
exists
(
mGrammarlecteCliPath
))
{
mErrorType
=
ErrorType
::
GrammarlectCliNotExist
;
return
false
;
}
return
true
;
}
...
...
kmail/grammarplugins/grammalecte/src/grammalecteresultjob.h
View file @
0a854708
...
...
@@ -21,7 +21,9 @@ public:
TextIsEmpty
=
1
,
PythonPathMissing
=
2
,
GrammalecteMissing
=
3
,
Unknown
=
4
,
PythonPathNotExist
=
4
,
GrammarlectCliNotExist
=
5
,
Unknown
=
6
,
};
void
start
();
...
...
kmail/grammarplugins/grammalecte/src/grammalecteresultwidget.cpp
View file @
0a854708
...
...
@@ -9,6 +9,8 @@
#include "grammalecteparser.h"
#include "grammarresulttextedit.h"
#include "libgrammalecte_debug.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <QJsonDocument>
GrammalecteResultWidget
::
GrammalecteResultWidget
(
QWidget
*
parent
)
...
...
@@ -42,6 +44,7 @@ void GrammalecteResultWidget::slotCheckGrammarFinished(const QString &result)
void
GrammalecteResultWidget
::
slotError
(
GrammalecteResultJob
::
ErrorType
error
)
{
QString
str
;
switch
(
error
)
{
case
GrammalecteResultJob
::
ErrorType
::
NoError
:
break
;
...
...
@@ -50,12 +53,25 @@ void GrammalecteResultWidget::slotError(GrammalecteResultJob::ErrorType error)
break
;
case
GrammalecteResultJob
::
ErrorType
::
PythonPathMissing
:
qCWarning
(
LIBGRAMMALECTE_PLUGIN_LOG
)
<<
"An error found during executing GrammalecteResultJob: missing python path"
;
str
=
i18n
(
"Python path is missing."
);
break
;
case
GrammalecteResultJob
::
ErrorType
::
GrammalecteMissing
:
qCWarning
(
LIBGRAMMALECTE_PLUGIN_LOG
)
<<
"An error found during executing GrammalecteResultJob: missing grammalectepath"
;
str
=
i18n
(
"Grammalecte path not found."
);
break
;
case
GrammalecteResultJob
::
ErrorType
::
Unknown
:
qCWarning
(
LIBGRAMMALECTE_PLUGIN_LOG
)
<<
"An error found during executing GrammalecteResultJob: unknow error"
;
break
;
case
GrammalecteResultJob
::
ErrorType
::
PythonPathNotExist
:
qCWarning
(
LIBGRAMMALECTE_PLUGIN_LOG
)
<<
"An error found during executing GrammalecteResultJob: python exec doesn't exist"
;
str
=
i18n
(
"Grammalecte program file not found."
);
break
;
case
GrammalecteResultJob
::
ErrorType
::
GrammarlectCliNotExist
:
qCWarning
(
LIBGRAMMALECTE_PLUGIN_LOG
)
<<
"An error found during executing GrammalecteResultJob: grammalecte cli not found."
;
str
=
i18n
(
"Grammalecte cli file not found."
);
break
;
}
if
(
!
str
.
isEmpty
())
{
KMessageBox
::
error
(
this
,
str
,
i18n
(
"Grammalecte error"
));
}
}
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