Commit b049d683 authored by Laurent Montel's avatar Laurent Montel 😁

Don't enable ok button when we don't have test apps

parent 786046f8
......@@ -81,7 +81,9 @@ void SieveScriptDebuggerDialog::debugButtonEnableStateChanged(bool state)
void SieveScriptDebuggerDialog::slotScriptTextChanged()
{
mOkButton->setEnabled(mOriginScript != mSieveScriptDebuggerWidget->script());
if (mSieveScriptDebuggerWidget->haveDebugApps()) {
mOkButton->setEnabled(mOriginScript != mSieveScriptDebuggerWidget->script());
}
}
void SieveScriptDebuggerDialog::slotAccepted()
......
......@@ -94,9 +94,16 @@ QString SieveScriptDebuggerWidget::script() const
void SieveScriptDebuggerWidget::checkSieveTestApplication()
{
if (QStandardPaths::findExecutable(QStringLiteral("sieve-test")).isEmpty()) {
mHaveDebugApps = false;
mStackedWidget->setCurrentWidget(mSieveNoExistingFrontEnd);
Q_EMIT sieveTestNotFound();
} else {
mHaveDebugApps = true;
mStackedWidget->setCurrentWidget(mSieveScriptFrontEnd);
}
}
bool SieveScriptDebuggerWidget::haveDebugApps() const
{
return mHaveDebugApps;
}
......@@ -38,13 +38,15 @@ public:
~SieveScriptDebuggerWidget();
void setScript(const QString &script);
QString script() const;
Q_REQUIRED_RESULT QString script() const;
bool canAccept() const;
QList<int> splitterSizes() const;
void setSplitterSizes(const QList<int> &sizes);
Q_REQUIRED_RESULT bool haveDebugApps() const;
Q_SIGNALS:
void scriptTextChanged();
void debugScriptButtonClicked();
......@@ -56,6 +58,7 @@ private:
QStackedWidget *mStackedWidget = nullptr;
SieveScriptDebuggerFrontEndWidget *mSieveScriptFrontEnd = nullptr;
QLabel *mSieveNoExistingFrontEnd = nullptr;
bool mHaveDebugApps = false;
};
}
#endif // SIEVESCRIPTDEBUGGERWIDGET_H
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