A few deprecations eradicated involving QCheckBox.
[kdenetwork.git] / filesharing / advanced / kcm_sambaconf / smbpasswdfile.h
blob9c6d4561c39d2b4a7c218ef72430d9a115d9ac85
1 /***************************************************************************
2 smbpasswdfile.h - description
3 -------------------
4 begin : Tue June 6 2002
5 copyright : (C) 2002 by Jan Schäfer
6 email : janschaefer@users.sourceforge.net
7 ***************************************************************************/
9 /******************************************************************************
10 * *
11 * This file is part of KSambaPlugin. *
12 * *
13 * KSambaPlugin is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 * KSambaPlugin is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21 * GNU General Public License for more details. *
22 * *
23 * You should have received a copy of the GNU General Public License *
24 * along with KSambaPlugin; if not, write to the Free Software *
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
26 * *
27 ******************************************************************************/
29 #ifndef SMBPASSWDFILE_H
30 #define SMBPASSWDFILE_H
33 /**
34 *@author Jan Schäfer
37 #include <qstring.h>
38 //Added by qt3to4:
39 #include <Q3PtrList>
40 #include <kurl.h>
42 class SambaFile;
43 class K3Process;
45 /**
46 * Simple class to store a Samba User
47 **/
48 class SambaUser
50 public:
51 SambaUser(const QString & aName = QString(), int anUid = -1) {name = aName; uid = anUid;}
53 QString name;
54 int uid;
55 int gid;
56 bool isUserAccount;
57 bool hasNoPassword;
58 bool isDisabled;
59 bool isWorkstationTrustAccount;
62 /**
63 * A QPtrList of SambaUser
64 **/
65 class SambaUserList : public Q3PtrList<SambaUser>
67 public:
68 QStringList getUserNames();
71 /**
72 * This class represents the SAMBA smbpasswd file.
73 * It provides :
74 * - getting a list of all SAMBA users
75 * - adding a new user -> uses smbpasswd program
76 * - removing an existing user -> uses smbpasswd program
77 **/
78 class SmbPasswdFile : public QObject
80 Q_OBJECT
81 public:
82 SmbPasswdFile();
83 SmbPasswdFile(const KUrl &);
84 ~SmbPasswdFile();
86 void setUrl(const KUrl &);
88 /**
89 * Returns a list of all users stored in
90 * the smbpasswd file
91 **/
92 SambaUserList getSambaUserList();
94 /**
95 * Calls smbpasswd with the given arguments
96 **/
97 bool executeSmbpasswd(const QStringList & args);
99 /**
100 * Tries to add the passed user to the smbpasswd file
101 * returns true if successful otherwise false
103 bool addUser(const SambaUser &, const QString & password);
106 * Tries to remove the passed user from the smbpasswd file
107 * returns true if successful otherwise false
109 bool removeUser(const SambaUser &);
112 * Tries to change the password of the passed user
113 * if it fails returns false otherwise true
115 bool changePassword(const SambaUser &, const QString & password);
117 bool enableUser(const SambaUser &);
119 bool disableUser(const SambaUser &);
121 bool setNoPassword(const SambaUser &);
123 bool setMachineTrustAccount(const SambaUser &);
125 bool joinADomain(const QString &, const QString &, const QString &, const QString &);
128 * Returns the Url of the smbpasswd file
129 * specified in the [global] section of
130 * the smb.conf file.
131 * If there is no entry in the [global] section
132 * it tries to guess the location.
134 static KUrl getUrlFromSambaFile(const SambaFile *file);
135 protected:
136 KUrl _url;
137 QString _smbpasswdOutput;
139 protected slots:
140 void smbpasswdStdOutReceived(K3Process*,char*,int);
143 #endif