| 65 | } |
| 66 | |
| 67 | void ActionsQuickOpenProvider::setFilterText(const QString& text) |
| 68 | { |
| 69 | if (text.size() < 2) { |
| 70 | return; |
| 71 | } |
| 72 | m_results.clear(); |
| 73 | const QList<KActionCollection*> collections = KActionCollection::allCollections(); |
| 74 | QRegularExpression mnemonicRx(QStringLiteral("^(.*)&(.+)$")); |
| 75 | for (KActionCollection* c : collections) { |
| 76 | const QList<QAction*> actions = c->actions(); |
| 77 | for (QAction* action : actions) { |
| 78 | if (!action->isEnabled()) { |
| 79 | continue; |
| 80 | } |
| 81 | |
| 82 | QString display = action->text(); |
| 83 | QRegularExpressionMatch match = mnemonicRx.match(display); |
| 84 | if (match.hasMatch()) { |
| 85 | display = match.capturedView(1) + match.capturedView(2); |
| 86 | } |
| 87 | |
| 88 | if (display.contains(text, Qt::CaseInsensitive)) { |
| 89 | m_results += QuickOpenDataPointer(new ActionsQuickOpenItem(display, action)); |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | uint ActionsQuickOpenProvider::unfilteredItemCount() const |
| 96 | { |