Warning, file /plasma/plasma-workspace/kcms/cursortheme/kcmcursortheme.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: 2003-2007 Fredrik Höglund <fredrik@kde.org> 0003 SPDX-FileCopyrightText: 2019 Benjamin Port <benjamin.port@enioka.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <KNSCore/EntryWrapper> 0011 #include <KQuickAddons/ManagedConfigModule> 0012 0013 #include "cursorthemesettings.h" 0014 #include "launchfeedbacksettings.h" 0015 0016 class QQmlListReference; 0017 class QStandardItemModel; 0018 class QTemporaryFile; 0019 0020 class CursorThemeModel; 0021 class SortProxyModel; 0022 class CursorTheme; 0023 class CursorThemeData; 0024 0025 namespace KIO 0026 { 0027 class FileCopyJob; 0028 } 0029 0030 class CursorThemeConfig : public KQuickAddons::ManagedConfigModule 0031 { 0032 Q_OBJECT 0033 0034 Q_PROPERTY(CursorThemeSettings *cursorThemeSettings READ cursorThemeSettings CONSTANT) 0035 Q_PROPERTY(LaunchFeedbackSettings *launchFeedbackSettings READ launchFeedbackSettings CONSTANT) 0036 Q_PROPERTY(bool canInstall READ canInstall WRITE setCanInstall NOTIFY canInstallChanged) 0037 Q_PROPERTY(bool canResize READ canResize WRITE setCanResize NOTIFY canResizeChanged) 0038 Q_PROPERTY(bool canConfigure READ canConfigure WRITE setCanConfigure NOTIFY canConfigureChanged) 0039 Q_PROPERTY(QAbstractItemModel *cursorsModel READ cursorsModel CONSTANT) 0040 Q_PROPERTY(QAbstractItemModel *sizesModel READ sizesModel CONSTANT) 0041 0042 Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) 0043 Q_PROPERTY(int preferredSize READ preferredSize WRITE setPreferredSize NOTIFY preferredSizeChanged) 0044 0045 public: 0046 CursorThemeConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &); 0047 ~CursorThemeConfig() override; 0048 0049 void load() override; 0050 void save() override; 0051 void defaults() override; 0052 0053 // for QML properties 0054 CursorThemeSettings *cursorThemeSettings() const; 0055 LaunchFeedbackSettings *launchFeedbackSettings() const; 0056 0057 bool canInstall() const; 0058 void setCanInstall(bool can); 0059 0060 bool canResize() const; 0061 void setCanResize(bool can); 0062 0063 bool canConfigure() const; 0064 void setCanConfigure(bool can); 0065 0066 int preferredSize() const; 0067 void setPreferredSize(int size); 0068 0069 bool downloadingFile() const; 0070 0071 QAbstractItemModel *cursorsModel(); 0072 QAbstractItemModel *sizesModel(); 0073 0074 Q_INVOKABLE int cursorSizeIndex(int cursorSize) const; 0075 Q_INVOKABLE int cursorSizeFromIndex(int index); 0076 Q_INVOKABLE int cursorThemeIndex(const QString &cursorTheme) const; 0077 Q_INVOKABLE QString cursorThemeFromIndex(int index) const; 0078 0079 Q_SIGNALS: 0080 void canInstallChanged(); 0081 void canResizeChanged(); 0082 void canConfigureChanged(); 0083 void downloadingFileChanged(); 0084 void preferredSizeChanged(); 0085 void themeApplied(); 0086 0087 void showSuccessMessage(const QString &message); 0088 void showInfoMessage(const QString &message); 0089 void showErrorMessage(const QString &message); 0090 0091 public Q_SLOTS: 0092 void ghnsEntryChanged(KNSCore::EntryWrapper *entry); 0093 void installThemeFromFile(const QUrl &url); 0094 0095 private Q_SLOTS: 0096 /** Updates the size combo box. It loads the size list of the selected cursor 0097 theme with the corresponding icons and chooses an appropriate entry. It 0098 enables the combo box and the label if the theme provides more than one 0099 size, otherwise it disables it. If the size setting is looked in kiosk 0100 mode, it stays always disabled. */ 0101 void updateSizeComboBox(); 0102 0103 private: 0104 bool isSaveNeeded() const override; 0105 void installThemeFile(const QString &path); 0106 bool iconsIsWritable() const; 0107 void removeThemes(); 0108 0109 CursorThemeModel *m_themeModel; 0110 SortProxyModel *m_themeProxyModel; 0111 QStandardItemModel *m_sizesModel; 0112 CursorThemeData *m_data; 0113 0114 /** Holds the last size that was chosen by the user. Example: The user chooses 0115 theme1 which provides the sizes 24 and 36. He chooses 36. preferredSize gets 0116 set to 36. Now, he switches to theme2 which provides the sizes 30 and 40. 0117 preferredSize still is 36, so the UI will default to 40, which is next to 36. 0118 Now, he chooses theme3 which provides the sizes 34 and 44. preferredSize is 0119 still 36, so the UI defaults to 34. Now the user changes manually to 44. This 0120 will also change preferredSize. */ 0121 int m_preferredSize; 0122 0123 bool m_canInstall; 0124 bool m_canResize; 0125 bool m_canConfigure; 0126 0127 std::unique_ptr<QTemporaryFile> m_tempInstallFile; 0128 QPointer<KIO::FileCopyJob> m_tempCopyJob; 0129 };