Warning, file /plasma/plasma-mobile/components/mobileshell/shellutil.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003  *  SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include <QObject>
0011 #include <QQuickItem>
0012 
0013 #include <KConfigWatcher>
0014 #include <KIO/ApplicationLauncherJob>
0015 #include <KSharedConfig>
0016 
0017 /**
0018  * Miscellaneous class to put utility functions used in the shell.
0019  *
0020  * @author Devin Lin <devin@kde.org>
0021  **/
0022 class ShellUtil : public QObject
0023 {
0024     Q_OBJECT
0025     Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged)
0026 
0027 public:
0028     ShellUtil(QObject *parent = nullptr);
0029     static ShellUtil *instance();
0030 
0031     /**
0032      * Change the stacking order to have the first item behind the second item.
0033      *
0034      * @param item1 The item to move behind.
0035      * @param item2 The item to move in front.
0036      */
0037     Q_INVOKABLE void stackItemBefore(QQuickItem *item1, QQuickItem *item2);
0038 
0039     /**
0040      * Change the stacking order to have the first item in front of the second item.
0041      *
0042      * @param item1 The item to move in front.
0043      * @param item2 The item to move behind.
0044      */
0045     Q_INVOKABLE void stackItemAfter(QQuickItem *item1, QQuickItem *item2);
0046 
0047     /**
0048      * Execute the command given.
0049      *
0050      * @param command The command to execute.
0051      */
0052     Q_INVOKABLE void executeCommand(const QString &command);
0053 
0054     /**
0055      * Launch an application by name. Sets the internal "launched app" state.
0056      *
0057      * @param storageId The storage id of the application to launch.
0058      */
0059     Q_INVOKABLE void launchApp(const QString &storageId);
0060 
0061     /**
0062      * Whether the system is using 24 hour format.
0063      */
0064     Q_INVOKABLE bool isSystem24HourFormat();
0065 
0066 Q_SIGNALS:
0067     void isSystem24HourFormatChanged();
0068 
0069 private:
0070     KConfigWatcher::Ptr m_localeConfigWatcher;
0071     KSharedConfig::Ptr m_localeConfig;
0072 };