Changeset View
Changeset View
Standalone View
Standalone View
runners/powerdevil/PowerDevilRunner.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
55 | commands << i18nc("Note this is a KRunner keyword", "suspend") | 55 | commands << i18nc("Note this is a KRunner keyword", "suspend") | ||
56 | << i18nc("Note this is a KRunner keyword", "sleep") | 56 | << i18nc("Note this is a KRunner keyword", "sleep") | ||
57 | << i18nc("Note this is a KRunner keyword", "hibernate") | 57 | << i18nc("Note this is a KRunner keyword", "hibernate") | ||
58 | << i18nc("Note this is a KRunner keyword", "to disk") | 58 | << i18nc("Note this is a KRunner keyword", "to disk") | ||
59 | << i18nc("Note this is a KRunner keyword", "to ram") | 59 | << i18nc("Note this is a KRunner keyword", "to ram") | ||
60 | << i18nc("Note this is a KRunner keyword", "screen brightness") | 60 | << i18nc("Note this is a KRunner keyword", "screen brightness") | ||
61 | << i18nc("Note this is a KRunner keyword", "dim screen"); | 61 | << i18nc("Note this is a KRunner keyword", "dim screen"); | ||
62 | 62 | | |||
63 | foreach (const QString &command, commands) { | 63 | for (const QString &command : qAsConst(commands)) { | ||
64 | if (command.length() < m_shortestCommand) { | 64 | if (command.length() < m_shortestCommand) { | ||
65 | m_shortestCommand = command.length(); | 65 | m_shortestCommand = command.length(); | ||
66 | } | 66 | } | ||
67 | } | 67 | } | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | void PowerDevilRunner::updateSyntaxes() | 70 | void PowerDevilRunner::updateSyntaxes() | ||
71 | { | 71 | { | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
119 | 119 | | |||
120 | void PowerDevilRunner::updateStatus() | 120 | void PowerDevilRunner::updateStatus() | ||
121 | { | 121 | { | ||
122 | updateSyntaxes(); | 122 | updateSyntaxes(); | ||
123 | } | 123 | } | ||
124 | 124 | | |||
125 | bool PowerDevilRunner::parseQuery(const QString& query, const QList<QRegExp>& rxList, QString& parameter) const | 125 | bool PowerDevilRunner::parseQuery(const QString& query, const QList<QRegExp>& rxList, QString& parameter) const | ||
126 | { | 126 | { | ||
127 | foreach (const QRegExp& rx, rxList) { | 127 | for (const QRegExp& rx : rxList) { | ||
128 | if (rx.exactMatch(query)) { | 128 | if (rx.exactMatch(query)) { | ||
129 | parameter = rx.cap(1).trimmed(); | 129 | parameter = rx.cap(1).trimmed(); | ||
130 | return true; | 130 | return true; | ||
131 | } | 131 | } | ||
132 | } | 132 | } | ||
133 | return false; | 133 | return false; | ||
134 | } | 134 | } | ||
135 | 135 | | |||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |