File indexing completed on 2024-05-12 05:38:21

0001 /*
0002     SPDX-FileCopyrightText: 2006 Aaron Seigo <aseigo@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #pragma once
0008 
0009 #include <kdisplaymanager.h>
0010 #include <krunner/abstractrunner.h>
0011 
0012 #include <sessionmanagement.h>
0013 
0014 /**
0015  * This class provides matches for running sessions as well as
0016  * an action to start a new session, etc.
0017  */
0018 class SessionRunner : public KRunner::AbstractRunner
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     SessionRunner(QObject *parent, const KPluginMetaData &metaData);
0024 
0025     void match(KRunner::RunnerContext &context) override;
0026     void run(const KRunner::RunnerContext &context, const KRunner::QueryMatch &action) override;
0027 
0028     enum {
0029         LogoutAction = 1,
0030         ShutdownAction,
0031         RestartAction,
0032         LockAction,
0033         SaveAction,
0034     };
0035 
0036 private:
0037     void matchCommands(QList<KRunner::QueryMatch> &matches, const QString &term);
0038 
0039     QStringList m_logoutKeywords;
0040     QStringList m_shutdownKeywords;
0041     QStringList m_restartKeywords;
0042     QStringList m_lockKeywords;
0043     QStringList m_saveKeywords;
0044     QStringList m_usersKeywords;
0045     QString m_sessionsKeyword;
0046     QString m_switchKeyword;
0047     KDisplayManager dm;
0048     SessionManagement m_session;
0049 };