summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-29 07:05:28 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-29 07:05:28 (GMT)
commita51663a888953b893bfed71f00b1da2d7bd9ff3f (patch)
treeff8933b9c3f78cd087ac524627302ac4c5ef41c8
parentff4f28421e21b75183d8170f1a9cd2b612e28ca4 (diff)
Make sure that script is valid
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternalconfigurewidget.cpp2
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.cpp6
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.h2
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.cpp8
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.h4
-rw-r--r--plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptsloadjob.cpp1
6 files changed, 16 insertions, 7 deletions
diff --git a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternalconfigurewidget.cpp b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternalconfigurewidget.cpp
index 9f065c1..c46962f 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternalconfigurewidget.cpp
+++ b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternalconfigurewidget.cpp
@@ -167,6 +167,7 @@ void ViewerPluginExternalConfigureWidget::save()
qWarning() << " Impossible to delete " << path;
}
}
+ qDebug()<<" void ViewerPluginExternalConfigureWidget::save()" << mListExternal->count();
for (int i = 0; i < mListExternal->count(); ++i) {
ViewerPluginExternalScriptItem *item = static_cast<ViewerPluginExternalScriptItem *>(mListExternal->item(i));
const ViewerPluginExternalScriptInfo &scriptInfo = item->scriptInfo();
@@ -180,6 +181,7 @@ void ViewerPluginExternalConfigureWidget::save()
desktopFile.desktopGroup().writeEntry(QStringLiteral("Executable"), scriptInfo.executable());
desktopFile.desktopGroup().writeEntry(QStringLiteral("CommandLine"), scriptInfo.commandLine());
desktopFile.desktopGroup().sync();
+ qDebug()<<" filenamepath"<<filenamepath;
}
}
diff --git a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.cpp b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.cpp
index 5fac18d..4991be6 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.cpp
+++ b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.cpp
@@ -32,7 +32,7 @@ ViewerPluginExternalEditDialog::ViewerPluginExternalEditDialog(QWidget *parent)
mEditWidget = new ViewerPluginExternalEditWidget(this);
mEditWidget->setObjectName(QStringLiteral("editwidget"));
mainLayout->addWidget(mEditWidget);
- connect(mEditWidget, &ViewerPluginExternalEditWidget::nameChanged, this, &ViewerPluginExternalEditDialog::slotNameChanged);
+ connect(mEditWidget, &ViewerPluginExternalEditWidget::scriptIsValid, this, &ViewerPluginExternalEditDialog::slotScriptIsValid);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
@@ -48,9 +48,9 @@ ViewerPluginExternalEditDialog::~ViewerPluginExternalEditDialog()
}
-void ViewerPluginExternalEditDialog::slotNameChanged(const QString &name)
+void ViewerPluginExternalEditDialog::slotScriptIsValid(bool valid)
{
- mOkButton->setEnabled(!name.trimmed().isEmpty());
+ mOkButton->setEnabled(valid);
}
void ViewerPluginExternalEditDialog::slotAccepted()
diff --git a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.h b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.h
index acb39b9..c390b85 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.h
+++ b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditdialog.h
@@ -37,7 +37,7 @@ public:
ViewerPluginExternalScriptInfo scriptInfo() const;
private:
- void slotNameChanged(const QString &name);
+ void slotScriptIsValid(bool valid);
void slotAccepted();
ViewerPluginExternalEditWidget *mEditWidget;
QPushButton *mOkButton;
diff --git a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.cpp b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.cpp
index d901890..1b554ab 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.cpp
+++ b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.cpp
@@ -47,7 +47,8 @@ ViewerPluginExternalEditWidget::ViewerPluginExternalEditWidget(QWidget *parent)
mExecutable = new QLineEdit(this);
mExecutable->setObjectName(QStringLiteral("executable"));
mainLayout->addRow(i18n("Executable:"), mExecutable);
- connect(mName, &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::nameChanged);
+ connect(mName, &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
+ connect(mExecutable, &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
}
ViewerPluginExternalEditWidget::~ViewerPluginExternalEditWidget()
@@ -55,6 +56,11 @@ ViewerPluginExternalEditWidget::~ViewerPluginExternalEditWidget()
}
+void ViewerPluginExternalEditWidget::slotInfoChanged()
+{
+ Q_EMIT scriptIsValid(!mExecutable->text().trimmed().isEmpty() && !mName->text().trimmed().isEmpty());
+}
+
void ViewerPluginExternalEditWidget::setScriptInfo(const ViewerPluginExternalScriptInfo &info)
{
mScriptInfo = info;
diff --git a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.h b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.h
index a551520..4edaf0b 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.h
+++ b/plugins/messageviewerplugins/externalscriptplugin/configuredialog/viewerpluginexternaleditwidget.h
@@ -35,8 +35,10 @@ public:
void save();
Q_SIGNALS:
- void nameChanged(const QString &name);
+ void scriptIsValid(bool valid);
+
private:
+ void slotInfoChanged();
ViewerPluginExternalScriptInfo mScriptInfo;
QLineEdit *mName;
QLineEdit *mDescription;
diff --git a/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptsloadjob.cpp b/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptsloadjob.cpp
index c2a07c5..a9a7745 100644
--- a/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptsloadjob.cpp
+++ b/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptsloadjob.cpp
@@ -53,7 +53,6 @@ void ViewerPluginExternalScriptsLoadJob::start()
KConfig config(filePath);
qCDebug(EXTERNALSCRIPTPLUGIN_LOG) << "load file " << filePath;
KConfigGroup group(&config, QStringLiteral("Desktop Entry"));
-
if (group.isValid()) {
ViewerPluginExternalScriptInfo info;
const QString name = group.readEntry("Name", QString());