File indexing completed on 2024-11-24 04:50:43

0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 #pragma once
0004 #include "actionsmodel.h"
0005 #include <KActionCollection>
0006 #include <QObject>
0007 #include <QSortFilterProxyModel>
0008 
0009 class AbstractApplication : public QObject
0010 {
0011     Q_OBJECT
0012     Q_PROPERTY(QSortFilterProxyModel *actionsModel READ actionsModel CONSTANT)
0013 
0014 public:
0015     explicit AbstractApplication(QObject *parent = nullptr);
0016     ~AbstractApplication();
0017 
0018     Q_INVOKABLE void configureShortcuts();
0019     Q_INVOKABLE QAction *action(const QString &actionName);
0020 
0021     virtual QList<KActionCollection *> actionCollections() const = 0;
0022     QSortFilterProxyModel *actionsModel();
0023 
0024 Q_SIGNALS:
0025     void openLanguageSwitcher();
0026     void openSettings();
0027     void openAboutPage();
0028     void openAboutKDEPage();
0029     void openKCommandBarAction();
0030     void openTagManager();
0031 
0032 protected:
0033     virtual void setupActions();
0034     KActionCollection *mCollection = nullptr;
0035 
0036 private:
0037     void quit();
0038 
0039     KalCommandBarModel *m_actionModel = nullptr;
0040     QSortFilterProxyModel *m_proxyModel = nullptr;
0041 };