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())); }
void CharacterRunner::reloadConfiguration() { KConfigGroup grp = config(); //Create config-object m_triggerWord = grp.readEntry(CONFIG_TRIGGERWORD, "#"); //read out the triggerword m_aliases = grp.readEntry(CONFIG_ALIASES, QStringList()); m_codes = grp.readEntry(CONFIG_CODES, QStringList()); addSyntax(Plasma::RunnerSyntax(m_triggerWord + QLatin1String( ":q:" ), i18n("Creates Characters from :q: if it is a hexadecimal code or defined alias."))); }
LocationsRunner::LocationsRunner(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); // set the name shown after the result in krunner window setObjectName(QStringLiteral("Locations")); setIgnoredTypes(Plasma::RunnerContext::Executable | Plasma::RunnerContext::ShellCommand); addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds local directories and files, network locations and Internet sites with paths matching :q:."))); }
ServiceRunner::ServiceRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args) setObjectName( QLatin1String("Application" )); setPriority(AbstractRunner::HighestPriority); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds applications whose name or description match :q:"))); }
KJiebaRunner::KJiebaRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args), kjiebaPtr(new KJiebaInterface) { Q_UNUSED(args) setObjectName(QLatin1String("KJieba")); setPriority(AbstractRunner::HighestPriority); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Find App matches :q:"))); }
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."))); } }
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName( QStringLiteral("Recent Documents" )); loadRecentDocuments(); // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); connect(recentDocWatch, &KDirWatch::created, this, &RecentDocuments::loadRecentDocuments); connect(recentDocWatch, &KDirWatch::deleted, this, &RecentDocuments::loadRecentDocuments); connect(recentDocWatch, &KDirWatch::dirty, this, &RecentDocuments::loadRecentDocuments); addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Looks for documents recently used with names matching :q:."))); }
ShellRunner::ShellRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args), m_inTerminal(false), m_asOtherUser(false) { setObjectName( QLatin1String("Command" )); setPriority(AbstractRunner::HighestPriority); setHasRunOptions(true); m_enabled = KAuthorized::authorizeKAction("run_command") && KAuthorized::authorizeKAction("shell_access"); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::UnknownType | Plasma::RunnerContext::Help); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds commands that match :q:, using common shell syntax"))); }
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName( QLatin1String("Recent Documents" )); m_icon = QIcon::fromTheme("document-open-recent"); loadRecentDocuments(); // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); connect(recentDocWatch,SIGNAL(created(QString)),this,SLOT(loadRecentDocuments())); connect(recentDocWatch,SIGNAL(deleted(QString)),this,SLOT(loadRecentDocuments())); connect(recentDocWatch,SIGNAL(dirty(QString)),this,SLOT(loadRecentDocuments())); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Looks for documents recently used with names matching :q:."))); }
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"))); }
KGetRunner::KGetRunner(QObject* parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args), m_icon("kget") { setObjectName("KGet"); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Find all links in :q: and download them with KGet."))); }