File indexing completed on 2024-05-05 17:45:03
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 Plasma::AbstractRunner 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 SessionRunner(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args); 0024 ~SessionRunner() override; 0025 0026 void match(Plasma::RunnerContext &context) override; 0027 void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action) override; 0028 0029 enum { 0030 LogoutAction = 1, 0031 ShutdownAction, 0032 RestartAction, 0033 LockAction, 0034 SaveAction, 0035 }; 0036 0037 private: 0038 void matchCommands(QList<Plasma::QueryMatch> &matches, const QString &term); 0039 0040 QStringList m_logoutKeywords; 0041 QStringList m_shutdownKeywords; 0042 QStringList m_restartKeywords; 0043 QStringList m_lockKeywords; 0044 QStringList m_saveKeywords; 0045 QStringList m_usersKeywords; 0046 QString m_sessionsKeyword; 0047 QString m_switchKeyword; 0048 KDisplayManager dm; 0049 SessionManagement m_session; 0050 };