void ActivityRunner::match(Plasma::RunnerContext &context) { if (!m_enabled) { return; } const QString term = context.query().trimmed(); bool list = false; QString name; if (term.startsWith(m_keywordi18n, Qt::CaseInsensitive)) { if (term.size() == m_keywordi18n.size()) { list = true; } else { name = term.right(term.size() - m_keywordi18n.size()).trimmed(); list = name.isEmpty(); } } else if (term.startsWith(m_keyword, Qt::CaseInsensitive)) { if (term.size() == m_keyword.size()) { list = true; } else { name = term.right(term.size() - m_keyword.size()).trimmed(); list = name.isEmpty(); } } else if (context.singleRunnerQueryMode()) { name = term; } else { return; } QList<Plasma::QueryMatch> matches; QStringList activities = m_activities->listActivities(); qSort(activities); const QString current = m_activities->currentActivity(); if (!context.isValid()) { return; } if (list) { foreach (const QString &activity, activities) { if (current == activity) { continue; } KActivities::Info info(activity); addMatch(info, matches); if (!context.isValid()) { return; } } } else {
void BookmarksRunner::match(Plasma::RunnerContext &context) { if(! m_browser) return; const QString term = context.query(); if ((term.length() < 3) && (!context.singleRunnerQueryMode())) { return; } bool allBookmarks = term.compare(i18nc("list of all konqueror bookmarks", "bookmarks"), Qt::CaseInsensitive) == 0; QList<BookmarkMatch> matches = m_browser->match(term, allBookmarks); foreach(BookmarkMatch match, matches) { if(!context.isValid()) return; context.addMatch(match.asQueryMatch(this)); } }