File indexing completed on 2024-04-28 08:54:24
0001 /* 0002 This class handles the homes shares 0003 0004 SPDX-FileCopyrightText: 2006-2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SMB4KHOMESSHARESHANDLER_H 0009 #define SMB4KHOMESSHARESHANDLER_H 0010 0011 // application specific includes 0012 #include "smb4kglobal.h" 0013 0014 // Qt includes 0015 #include <QList> 0016 #include <QObject> 0017 #include <QScopedPointer> 0018 #include <QString> 0019 #include <QStringList> 0020 0021 // forward declarations 0022 class Smb4KAuthInfo; 0023 class Smb4KHomesUsers; 0024 class Smb4KHomesSharesHandlerPrivate; 0025 0026 /** 0027 * This class belongs to the core of Smb4K and takes care of the 0028 * user names that are/were defined for a certain 'homes' share. 0029 * 0030 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0031 */ 0032 0033 class Q_DECL_EXPORT Smb4KHomesSharesHandler : public QObject 0034 { 0035 Q_OBJECT 0036 0037 friend class Smb4KHomesSharesHandlerPrivate; 0038 0039 public: 0040 /** 0041 * The constructor 0042 */ 0043 explicit Smb4KHomesSharesHandler(QObject *parent = nullptr); 0044 0045 /** 0046 * The destructor 0047 */ 0048 ~Smb4KHomesSharesHandler(); 0049 0050 /** 0051 * Returns a static pointer to this class. 0052 */ 0053 static Smb4KHomesSharesHandler *self(); 0054 0055 /** 0056 * Return the list of users defined for a certain homes share. 0057 * 0058 * @param share The share 0059 * 0060 * @returns a list of users for the homes share 0061 */ 0062 QStringList homesUsers(const SharePtr &share); 0063 0064 /** 0065 * Add users to a homes share. 0066 * 0067 * @param share The share 0068 * 0069 * @param userList The list of users for this share 0070 */ 0071 void addHomesUsers(const SharePtr &share, const QStringList &userList); 0072 0073 protected Q_SLOTS: 0074 /** 0075 * Called when a profile was removed 0076 * 0077 * @param name The name of the profile 0078 */ 0079 void slotProfileRemoved(const QString &name); 0080 0081 /** 0082 * Called when a profile was migrated 0083 * 0084 * @param oldName The old profile name 0085 * @param newName The new profile name 0086 */ 0087 void slotProfileMigrated(const QString &oldName, const QString &newName); 0088 0089 private: 0090 /** 0091 * Load the host and user names into a map. 0092 */ 0093 void readUserNames(); 0094 0095 /** 0096 * This function writes the homes user entries to the disk. 0097 */ 0098 void writeUserNames(); 0099 0100 /** 0101 * Pointer to the Smb4KHomesSharesHandlerPrivate class 0102 */ 0103 const QScopedPointer<Smb4KHomesSharesHandlerPrivate> d; 0104 }; 0105 0106 #endif