void PowerDevilRunner::updateSyntaxes() { QList<Plasma::RunnerSyntax> syntaxes; syntaxes.append(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "power profile"), i18n("Lists all power profiles and allows them to be activated"))); syntaxes.append(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "suspend"), i18n("Lists system suspend (e.g. sleep, hibernate) options " "and allows them to be activated"))); QSet< Solid::PowerManagement::SleepState > states = Solid::PowerManagement::supportedSleepStates(); if (states.contains(Solid::PowerManagement::SuspendState)) { Plasma::RunnerSyntax sleepSyntax(i18nc("Note this is a KRunner keyword", "sleep"), i18n("Suspends the system to RAM")); sleepSyntax.addExampleQuery(i18nc("Note this is a KRunner keyword", "to ram")); syntaxes.append(sleepSyntax); } if (states.contains(Solid::PowerManagement::HibernateState)) { Plasma::RunnerSyntax hibernateSyntax(i18nc("Note this is a KRunner keyword", "hibernate"), i18n("Suspends the system to disk")); hibernateSyntax.addExampleQuery(i18nc("Note this is a KRunner keyword", "to disk")); syntaxes.append(hibernateSyntax); } Plasma::RunnerSyntax brightnessSyntax(i18nc("Note this is a KRunner keyword", "screen brightness"), // xgettext:no-c-format i18n("Lists screen brightness options or sets it to the brightness defined by :q:; " "e.g. screen brightness 50 would dim the screen to 50% maximum brightness")); brightnessSyntax.addExampleQuery(i18nc("Note this is a KRunner keyword", "dim screen")); syntaxes.append(brightnessSyntax); setSyntaxes(syntaxes); }
void AudioPlayerControlRunner::reloadConfiguration() { KConfigGroup grp = config(); m_player = grp.readEntry(CONFIG_PLAYER, "amarok"); m_useCommands = grp.readEntry(CONFIG_COMMANDS, true); m_searchCollection = grp.readEntry(CONFIG_COLLECTION, true); m_comPlay = grp.readEntry(CONFIG_PLAY, i18n("play")); m_comAppend = grp.readEntry(CONFIG_APPEND, i18n("append")); m_comQueue = grp.readEntry(CONFIG_QUEUE, i18n("queue")); m_comPause = grp.readEntry(CONFIG_PAUSE, i18n("pause")); m_comNext = grp.readEntry(CONFIG_NEXT, i18n("next")); m_comMute = grp.readEntry(CONFIG_MUTE, i18n("mute")); m_comIncrease = grp.readEntry(CONFIG_INCREASE, i18n("increase")); m_increaseBy = qBound(0, grp.readEntry(CONFIG_INCREASE_BY, 15), 100); m_comDecrease = grp.readEntry(CONFIG_DECREASE, i18n("decrease")); m_decreaseBy = qBound(0, grp.readEntry(CONFIG_DECREASE_BY, 15), 100); m_comPrev = grp.readEntry(CONFIG_PREV, i18n("prev")); m_comStop = grp.readEntry(CONFIG_STOP, i18n("stop")); m_comVolume = grp.readEntry(CONFIG_VOLUME, i18n("volume")); m_comQuit = grp.readEntry(CONFIG_QUIT, i18n("quit")); /* Adding the syntaxes for helping the user */ QList<Plasma::RunnerSyntax> syntaxes; if (m_player == QLatin1String( "amarok" )) { syntaxes << Plasma::RunnerSyntax(m_comPlay + QLatin1String( " :q:" ), i18n("Plays the selected song. If :q: is not empty it lists songs matching :q: to play them")); syntaxes << Plasma::RunnerSyntax(m_comAppend + QLatin1String( " :q:" ), i18n("Displays songs matching :q: for appending the selected to the playlist")); syntaxes << Plasma::RunnerSyntax(m_comQueue + QLatin1String( " :q:" ), i18n("Displays songs matching :q: for queueing them")); } else { syntaxes << Plasma::RunnerSyntax(m_comPlay, i18n("Plays a song from playlist")); } syntaxes << Plasma::RunnerSyntax(m_comPause,i18n("Pauses the playing")); syntaxes << Plasma::RunnerSyntax(m_comNext, i18n("Plays the next song in the playlist if one is available")); syntaxes << Plasma::RunnerSyntax(m_comMute, i18n("Mutes/unmutes the player")); syntaxes << Plasma::RunnerSyntax(m_comIncrease + QLatin1String( " :q:" ), i18n("Increases the volume by :q:. If :q: is empty it increases by the configured value")); syntaxes << Plasma::RunnerSyntax(m_comDecrease + QLatin1String( " :q:" ), i18n("Decreases the volume by :q:. If :q: is empty it decreases by the configured value")); syntaxes << Plasma::RunnerSyntax(m_comPrev, i18n("Plays the previous song if one is available")); syntaxes << Plasma::RunnerSyntax(m_comStop, i18n("Stops the playing")); syntaxes << Plasma::RunnerSyntax(m_comVolume + QLatin1String( " :q:" ), i18n("Sets the volume to :q:")); syntaxes << Plasma::RunnerSyntax(m_comQuit, i18n("Quits the player")); setSyntaxes(syntaxes); }
void WebshortcutRunner::loadSyntaxes() { KUriFilterData filterData (QLatin1String(":q")); filterData.setSearchFilteringOptions(KUriFilterData::RetrieveAvailableSearchProvidersOnly); if (KUriFilter::self()->filterSearchUri(filterData, KUriFilter::NormalTextFilter)) { m_delimiter = filterData.searchTermSeparator(); } //qDebug() << "keyword delimiter:" << m_delimiter; //qDebug() << "search providers:" << filterData.preferredSearchProviders(); QList<Plasma::RunnerSyntax> syns; Q_FOREACH (const QString &provider, filterData.preferredSearchProviders()) { //qDebug() << "checking out" << provider; Plasma::RunnerSyntax s(filterData.queryForPreferredSearchProvider(provider), /*":q:",*/ i18n("Opens \"%1\" in a web browser with the query :q:.", provider)); syns << s; } setSyntaxes(syns); }
Translator::Translator(QObject* parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args) setObjectName(QLatin1String("Translator")); setHasRunOptions(false); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation); setSpeed(AbstractRunner::SlowSpeed); QList<Plasma::RunnerSyntax> syntaxes; Plasma::RunnerSyntax autoSyntax(QString::fromLatin1("%1:q:").arg(i18n("<language code>")), i18n("Translates the word(s) :q: into target language")); syntaxes.append(autoSyntax); Plasma::RunnerSyntax syntax(QString::fromLatin1("%1:q:").arg(i18n("<source language>-<target language>")), i18n("Translates the word(s) :q: from the source into target language")); syntaxes.append(syntax); setSyntaxes(syntaxes); }