Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 878b0baf authored by Laurent Montel's avatar Laurent Montel 😁

Fix show grammar error

parent 127a4e34
......@@ -47,14 +47,16 @@ void GrammarResultJob::start()
file->close();
mProcess->setProgram(mPythonPath);
//TODO add argument!!!
mProcess->setArguments(QStringList() << mGrammarlecteCliPath << mArguments << file->fileName());
connect(mProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &GrammarResultJob::slotFinished);
mProcess->setArguments(QStringList() << mGrammarlecteCliPath << mArguments << QStringLiteral("-f") << file->fileName());
qDebug() << " ARGUMENT " << mProcess->arguments();
connect(mProcess, QOverload<int,QProcess::ExitStatus>::of(&QProcess::finished), this, &GrammarResultJob::slotFinished);
connect(mProcess, QOverload<QProcess::ProcessError>::of(&QProcess::error),
this, &GrammarResultJob::receivedError);
connect(mProcess, &QProcess::readyReadStandardError, this, &GrammarResultJob::receivedStdErr);
connect(mProcess, &QProcess::readAllStandardOutput, this, &GrammarResultJob::receivedStandardOutput);
connect(mProcess, &QProcess::readyReadStandardOutput, this, &GrammarResultJob::receivedStandardOutput);
qDebug() << "mPythonPath " << mPythonPath;
mProcess->start();
if (!mProcess->waitForStarted()) {
qCWarning(KMAIL_EDITOR_GRAMMALECTE_PLUGIN_LOG) << "Impossible to start grammarresultjob";
Q_EMIT error();
......
......@@ -52,15 +52,18 @@ GrammalecteWidget::~GrammalecteWidget()
void GrammalecteWidget::slotCheckGrammar()
{
GrammarResultJob *job = new GrammarResultJob(this);
job->setPythonPath(QStringLiteral(""));
job->setGrammarlecteCliPath(QStringLiteral(""));
job->setArguments(QStringList() << QStringLiteral(""));
job->setPythonPath(QStringLiteral("/usr/bin/python3"));
job->setGrammarlecteCliPath(QStringLiteral("/compile/kde5/framework/kde/pim/grammalecte/grammalecte-cli.py"));
job->setArguments(QStringList() << QStringLiteral("-j"));
job->setText(mInput->toPlainText());
connect(job, &GrammarResultJob::finished, this, &GrammalecteWidget::slotResultFinished);
job->start();
}
void GrammalecteWidget::slotResultFinished(const QString &result)
{
qDebug() << " result" << result;
mResultWidget->setText(mInput->toPlainText());
GrammalecteParser parser;
const QJsonDocument doc = QJsonDocument::fromJson(result.toUtf8());
const QJsonObject fields = doc.object();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment