WindowsRunner::WindowsRunner(QObject* parent, const QVariantList& args) : AbstractRunner(parent, args), m_inSession(false), m_ready(false) { Q_UNUSED(args) setObjectName( QLatin1String("Windows" )); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds windows whose name, window class or window role match :q:. " "It is possible to interact with the windows by using one of the following keywords: " "activate, close, min(imize), max(imize), fullscreen, shade, keep above and keep below."))); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds windows which are on desktop named :q: " "It is possible to interact with the windows by using one of the following keywords: " "activate, close, min(imize), max(imize), fullscreen, shade, keep above and keep below."))); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Switch to desktop named :q:"))); setDefaultSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "window"), i18n("Lists all windows and allows to activate them. " "With name=, class=, role= and desktop= the list can be reduced to " "windows matching these restrictions. " "It is possible to interact with the windows by using one of the following keywords: " "activate, close, min(imize), max(imize), fullscreen, shade, keep above and keep below."))); addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "desktop"), i18n("Lists all other desktops and allows to switch to them."))); connect(this, SIGNAL(prepare()), this, SLOT(prepareForMatchSession())); connect(this, SIGNAL(teardown()), this, SLOT(matchSessionComplete())); }
Translator::Translator(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName(QLatin1String("Translator")); reloadConfiguration(); setHasRunOptions(true); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation); setSpeed(AbstractRunner::SlowSpeed); setPriority(HighestPriority); setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<language code>")),i18n("Translates the word(s) :q: into target language"))); setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<source languagce>-<target languagce>")), i18n("Translates the word(s) :q: from the source into target language"))); }
BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args ) : Plasma::AbstractRunner(parent, args), m_browser(0), m_browserFactory(new BrowserFactory(this)) { Q_UNUSED(args) //qDebug() << "Creating BookmarksRunner"; setObjectName( QStringLiteral("Bookmarks" )); addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds web browser bookmarks matching :q:."))); setDefaultSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", "bookmarks"), i18n("List all web browser bookmarks"))); connect(this, &Plasma::AbstractRunner::prepare, this, &BookmarksRunner::prep); }
void ActivityRunner::serviceStatusChanged(KActivities::Consumer::ServiceStatus status) { const bool active = status != KActivities::Consumer::NotRunning; if (m_enabled == active) { return; } m_enabled = active; QList<Plasma::RunnerSyntax> syntaxes; if (m_enabled) { setDefaultSyntax(Plasma::RunnerSyntax(i18nc("KRunner keyword", "activity :q:"), i18n("Switches to activity :q:."))); addSyntax(Plasma::RunnerSyntax(m_keywordi18n, i18n("Lists all activities currently available to be run."))); } }
BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args ) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args) setObjectName( QLatin1String("Bookmarks" )); m_icon = KIcon("bookmarks"); m_bookmarkManager = KBookmarkManager::userBookmarksManager(); m_browser = whichBrowser(); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds web browser bookmarks matching :q:."))); setDefaultSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", "bookmarks"), i18n("List all web browser bookmarks"))); connect(this, SIGNAL(prepare()), this, SLOT(prep())); connect(this, SIGNAL(teardown()), this, SLOT(down())); reloadConfiguration(); }
SessionRunner::SessionRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { setObjectName( QLatin1String("Sessions" )); setPriority(LowPriority); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation); m_canLogout = KAuthorized::authorizeAction(QStringLiteral("logout")) && KAuthorized::authorize(QStringLiteral("logout")); if (m_canLogout) { addSyntax(Plasma::RunnerSyntax(i18nc("log out command", "logout"), i18n("Logs out, exiting the current desktop session"))); addSyntax(Plasma::RunnerSyntax(i18nc("shutdown computer command", "shutdown"), i18n("Turns off the computer"))); } if (KAuthorized::authorizeAction(QStringLiteral("lock_screen")) && m_canLogout) { addSyntax(Plasma::RunnerSyntax(i18nc("lock screen command", "lock"), i18n("Locks the current sessions and starts the screen saver"))); } Plasma::RunnerSyntax rebootSyntax(i18nc("restart computer command", "restart"), i18n("Reboots the computer")); rebootSyntax.addExampleQuery(i18nc("restart computer command", "reboot")); addSyntax(rebootSyntax); m_triggerWord = i18nc("switch user command", "switch"); addSyntax(Plasma::RunnerSyntax(i18nc("switch user command", "switch :q:"), i18n("Switches to the active session for the user :q:, " "or lists all active sessions if :q: is not provided"))); Plasma::RunnerSyntax fastUserSwitchSyntax(i18n("switch user"), i18n("Starts a new session as a different user")); fastUserSwitchSyntax.addExampleQuery(i18n("new session")); addSyntax(fastUserSwitchSyntax); //"SESSIONS" should not be translated; it's used programmaticaly setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("SESSIONS"), i18n("Lists all sessions"))); }