File indexing completed on 2024-12-22 05:16:04

0001 /*
0002     SPDX-FileCopyrightText: 2016-2018 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "fingerprintmodel.h"
0010 #include "usermodel.h"
0011 #include <KQuickConfigModule>
0012 
0013 class OrgFreedesktopAccountsInterface;
0014 
0015 class QQuickView;
0016 class QQuickItemGrabResult;
0017 
0018 class KCMUser : public KQuickConfigModule
0019 {
0020     Q_OBJECT
0021     Q_PROPERTY(UserModel *userModel MEMBER m_model CONSTANT)
0022     Q_PROPERTY(QStringList avatarFiles MEMBER m_avatarFiles CONSTANT)
0023     Q_PROPERTY(FingerprintModel *fingerprintModel MEMBER m_fingerprintModel CONSTANT)
0024 
0025 private:
0026     OrgFreedesktopAccountsInterface *m_dbusInterface;
0027     UserModel *m_model;
0028     QStringList m_avatarFiles;
0029     FingerprintModel *m_fingerprintModel;
0030 
0031 public:
0032     KCMUser(QObject *parent, const KPluginMetaData &data);
0033     ~KCMUser() override;
0034 
0035     Q_SCRIPTABLE bool createUser(const QString &name, const QString &realName, const QString &password, bool admin);
0036     Q_SCRIPTABLE bool deleteUser(qint64 index, bool deleteHome);
0037     Q_SCRIPTABLE QUrl recolorSVG(const QUrl &url, const QColor &color);
0038     // Grab the initials of a string
0039     Q_SCRIPTABLE QString initializeString(const QString &stringToGrabInitialsOf);
0040     Q_SCRIPTABLE QString plonkImageInTempfile(const QImage &image);
0041 
0042 Q_SIGNALS:
0043     Q_SCRIPTABLE void apply();
0044     Q_SCRIPTABLE void reset();
0045 
0046 public Q_SLOTS:
0047     void save() override;
0048     void load() override;
0049 };