Port away from deprecated AbstarctRunner::actions method

This was deprecated, because having string based key-actions values
does not fit the usecases we have.

Consequently we should check if the runner has any QAction children, this
works if the runner created the QActions manually or if the actions
are registered in the abstract runner.

Also we can drop the ugly hack.
wilder-5.24
Alexander Lohnau 4 years ago
parent a790b8d7a7
commit 0bf22ff9b7
No known key found for this signature in database
GPG Key ID: 1F58708D54A003E7
  1. 13
      applets/kicker/plugin/runnermatchesmodel.cpp

@ -65,18 +65,7 @@ QVariant RunnerMatchesModel::data(const QModelIndex &index, int role) const
}
}
} else if (role == Kicker::HasActionListRole) {
// Hack to expose the protected Plasma::AbstractRunner::actions() method.
class MyRunner : public Plasma::AbstractRunner
{
public:
using Plasma::AbstractRunner::actions;
};
MyRunner *runner = static_cast<MyRunner *>(match.runner());
Q_ASSERT(runner);
return match.runner()->id() == QLatin1String("services") || !runner->actions().isEmpty();
return match.runner()->id() == QLatin1String("services") || !match.runner()->findChildren<QAction *>().isEmpty();
} else if (role == Kicker::ActionListRole) {
QVariantList actionList;
const QList<QAction *> actions = m_runnerManager->actionsForMatch(match);

Loading…
Cancel
Save