Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/common/effectsmodel.cpp
Show First 20 Lines • Show All 628 Lines • ▼ Show 20 Line(s) | |||||
629 | } | 629 | } | ||
630 | 630 | | |||
631 | void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transientParent) | 631 | void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transientParent) | ||
632 | { | 632 | { | ||
633 | if (!index.isValid()) { | 633 | if (!index.isValid()) { | ||
634 | return; | 634 | return; | ||
635 | } | 635 | } | ||
636 | 636 | | |||
637 | QPointer<QDialog> dialog = new QDialog(); | 637 | auto dialog = new QDialog(); | ||
638 | 638 | | |||
639 | KCModule *module = index.data(ScriptedRole).toBool() | 639 | KCModule *module = index.data(ScriptedRole).toBool() | ||
640 | ? findScriptedConfig(index.data(ServiceNameRole).toString(), dialog) | 640 | ? findScriptedConfig(index.data(ServiceNameRole).toString(), dialog) | ||
641 | : findBinaryConfig(index.data(ServiceNameRole).toString(), dialog); | 641 | : findBinaryConfig(index.data(ServiceNameRole).toString(), dialog); | ||
642 | if (!module) { | 642 | if (!module) { | ||
643 | delete dialog; | 643 | delete dialog; | ||
644 | return; | 644 | return; | ||
645 | } | 645 | } | ||
Show All 15 Lines | |||||
661 | connect(module, &KCModule::defaulted, this, [=](bool defaulted) { | 661 | connect(module, &KCModule::defaulted, this, [=](bool defaulted) { | ||
662 | buttons->button(QDialogButtonBox::RestoreDefaults)->setEnabled(!defaulted); | 662 | buttons->button(QDialogButtonBox::RestoreDefaults)->setEnabled(!defaulted); | ||
663 | }); | 663 | }); | ||
664 | 664 | | |||
665 | auto layout = new QVBoxLayout(dialog); | 665 | auto layout = new QVBoxLayout(dialog); | ||
666 | layout->addWidget(module); | 666 | layout->addWidget(module); | ||
667 | layout->addWidget(buttons); | 667 | layout->addWidget(buttons); | ||
668 | 668 | | |||
669 | if (dialog->exec() == QDialog::Accepted) { | 669 | connect(dialog, &QDialog::accepted, module, [module]() { | ||
670 | module->save(); | 670 | module->save(); | ||
671 | } | 671 | }); | ||
zzag: The lambda is redundant. I think you could just connect KCModule::save() directly, e.g. | |||||
672 | 672 | | |||
673 | delete dialog; | 673 | dialog->setModal(true); | ||
674 | dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||
675 | dialog->show(); | ||||
674 | } | 676 | } | ||
675 | 677 | | |||
676 | bool EffectsModel::shouldStore(const EffectData &data) const | 678 | bool EffectsModel::shouldStore(const EffectData &data) const | ||
677 | { | 679 | { | ||
678 | Q_UNUSED(data) | 680 | Q_UNUSED(data) | ||
679 | return true; | 681 | return true; | ||
680 | } | 682 | } | ||
681 | 683 | | |||
682 | } | 684 | } |
The lambda is redundant. I think you could just connect KCModule::save() directly, e.g.