File indexing completed on 2024-05-12 17:08:59
0001 /* 0002 SPDX-FileCopyrightText: 2009 Chani Armitage <chani@kde.org> 0003 SPDX-FileCopyrightText: 2018 Eike Hein <hein@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "ui_config.h" 0011 #include <plasma/containmentactions.h> 0012 0013 class QAction; 0014 0015 namespace TaskManager 0016 { 0017 class ActivityInfo; 0018 class TasksModel; 0019 class VirtualDesktopInfo; 0020 } 0021 0022 class SwitchWindow : public Plasma::ContainmentActions 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit SwitchWindow(QObject *parent, const QVariantList &args); 0027 ~SwitchWindow() override; 0028 0029 void restore(const KConfigGroup &config) override; 0030 QWidget *createConfigurationInterface(QWidget *parent) override; 0031 void configurationAccepted() override; 0032 void save(KConfigGroup &config) override; 0033 0034 void performNextAction() override; 0035 void performPreviousAction() override; 0036 void doSwitch(bool up); 0037 QList<QAction *> contextualActions() override; 0038 0039 private: 0040 void makeMenu(); 0041 0042 private Q_SLOTS: 0043 void switchTo(QAction *action); 0044 0045 private: 0046 enum MenuMode { 0047 AllFlat = 0, 0048 DesktopSubmenus, 0049 CurrentDesktop, 0050 }; 0051 0052 QList<QAction *> m_actions; 0053 Ui::Config m_ui; 0054 MenuMode m_mode; 0055 0056 TaskManager::VirtualDesktopInfo *const m_virtualDesktopInfo; 0057 0058 static TaskManager::ActivityInfo *s_activityInfo; 0059 static TaskManager::TasksModel *s_tasksModel; 0060 static int s_instanceCount; 0061 };