Commit 513534e2 authored by Vivek Yadav's avatar Vivek Yadav

resolved edit custom effect description issue

parent c75ac2a8
......@@ -110,10 +110,12 @@ void EffectListWidget::reloadEffectMenu(QMenu *effectsMenu, KActionCategory *eff
void EffectListWidget::editCustomAsset(const QModelIndex &index)
{
QDialog dialog(this);
QDialog dialog(this);
QFormLayout form(&dialog);
QLineEdit *effectName = new QLineEdit(getName(index), &dialog);
QString currentName = getName(index);
QLineEdit *effectName = new QLineEdit(currentName, &dialog);
QTextEdit *descriptionBox = new QTextEdit(getDescription(true, index), &dialog);
QString currentDescription = descriptionBox->toPlainText();
form.addRow(i18n("Name : "), effectName);
form.addRow(i18n("Comments : "), descriptionBox);
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
......@@ -121,12 +123,15 @@ void EffectListWidget::editCustomAsset(const QModelIndex &index)
QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
if(dialog.exec() == QDialog::Accepted) {
QString name = effectName->text();
QString enteredDescription = descriptionBox->toPlainText();
if (name.trimmed().isEmpty() && enteredDescription.trimmed().isEmpty()) {
return;
}
m_model->editCustomAsset(name, enteredDescription, m_proxyModel->mapToSource(index));
}
QString name = effectName->text();
QString enteredDescription = descriptionBox->toPlainText();
if (name.trimmed().isEmpty() && enteredDescription.trimmed().isEmpty()) {
return;
}
if(enteredDescription.trimmed().right(currentName.size() + 2 ) == "(" + currentName + ")"){
//removing previous effect name from the string
enteredDescription = enteredDescription.left(enteredDescription.size() - currentName.size() - 2);
}
m_model->editCustomAsset(name, enteredDescription, m_proxyModel->mapToSource(index));
}
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