Commit 39957193 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add info about arguments

parent 43c422bc
......@@ -8,6 +8,7 @@
#include "../configuredialog/viewerpluginexternaleditwidget.h"
#include <KUrlRequester>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
#include <QTest>
......@@ -38,6 +39,9 @@ void ViewerPluginExternalEditWidgetTest::shouldHaveDefaultValue()
auto mExecutable = w.findChild<KUrlRequester *>(QStringLiteral("mEditorRequester"));
QVERIFY(mExecutable);
auto formatHelp = w.findChild<QLabel *>(QStringLiteral("formatHelp"));
QVERIFY(formatHelp);
}
void ViewerPluginExternalEditWidgetTest::shouldGetSaveInfo_data()
......
......@@ -9,6 +9,8 @@
#include <KLocalizedString>
#include <KUrlRequester>
#include <QFormLayout>
#include <QLabel>
#include <QWhatsThis>
ViewerPluginExternalEditWidget::ViewerPluginExternalEditWidget(QWidget *parent)
: QWidget(parent)
......@@ -30,6 +32,27 @@ ViewerPluginExternalEditWidget::ViewerPluginExternalEditWidget(QWidget *parent)
mCommandLine->setObjectName(QStringLiteral("commandline"));
mainLayout->addRow(i18n("Command Line:"), mCommandLine);
auto formatHelp = new QLabel(i18n("<qt><a href=\"whatsthis1\">Argument format information...</a></qt>"), this);
formatHelp->setObjectName(QStringLiteral("formatHelp"));
formatHelp->setContextMenuPolicy(Qt::NoContextMenu);
connect(formatHelp, &QLabel::linkActivated, this, &ViewerPluginExternalEditWidget::slotLinkClicked);
mCommandWhatsThis = i18n(
"<qt><p><strong>These expressions may be used for the date:"
"</strong></p>"
"<ul>"
"<li>%s - the subject of message</li>"
"<li>%from - the from email address</li>"
"<li>%cc - the list of cc email address</li>"
"<li>%bcc - the list of bcc email address</li>"
"<li>%body - the body of message</li>"
"<li>%inreplyto - the reply email address</li>"
"</ul>"
"</strong></p></qt>");
formatHelp->setWhatsThis(mCommandWhatsThis);
mainLayout->addWidget(formatHelp);
mExecutable = new KUrlRequester(this);
mExecutable->setObjectName(QStringLiteral("mEditorRequester"));
......@@ -47,6 +70,13 @@ ViewerPluginExternalEditWidget::~ViewerPluginExternalEditWidget()
{
}
void ViewerPluginExternalEditWidget::slotLinkClicked(const QString &link)
{
if (link == QLatin1String("whatsthis1")) {
QWhatsThis::showText(QCursor::pos(), mCommandWhatsThis);
}
}
void ViewerPluginExternalEditWidget::slotInfoChanged()
{
Q_EMIT scriptIsValid(!mExecutable->text().trimmed().isEmpty() && !mName->text().trimmed().isEmpty() && !mExistingsNames.contains(mName->text()));
......
......@@ -27,9 +27,11 @@ Q_SIGNALS:
void scriptIsValid(bool valid);
private:
void slotLinkClicked(const QString &link);
void slotInfoChanged();
ViewerPluginExternalScriptInfo mScriptInfo;
QStringList mExistingsNames;
QString mCommandWhatsThis;
QLineEdit *mName = nullptr;
QLineEdit *mDescription = nullptr;
QLineEdit *mCommandLine = nullptr;
......
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