• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDECore

kuser.h

Go to the documentation of this file.
00001 /*
00002  *  KUser - represent a user/account
00003  *  Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
00004  *  Copyright (C) 2003 Oswald Buddenhagen <ossi@kde.org>
00005  *  Copyright (C) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de>
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Library General Public
00009  *  License as published by the Free Software Foundation; either
00010  *  version 2 of the License, or (at your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  Library General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Library General Public License
00018  *  along with this library; see the file COPYING.LIB.  If not, write to
00019  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  *  Boston, MA 02110-1301, USA.
00021  */
00022 #ifndef KUSER_H
00023 #define KUSER_H
00024 
00025 #include <kdecore_export.h>
00026 #include <ksharedptr.h>
00027 
00028 #include <QtCore/QVariant>
00029 
00030 class KUserGroup;
00031 class QString;
00032 class QStringList;
00033 template <class T> class QList;
00034 
00035 #ifdef Q_OS_WIN
00036 typedef void *K_UID;
00037 typedef void *K_GID;
00038 #else
00039 #include <sys/types.h>
00040 typedef uid_t K_UID;
00041 typedef gid_t K_GID;
00042 struct passwd;
00043 struct group;
00044 #endif
00045 
00046 
00059 class KDECORE_EXPORT KUser {
00060 
00061 public:
00062 
00063   enum UIDMode {
00064     UseEffectiveUID, 
00065     UseRealUserID    
00066   };
00067 
00081   explicit KUser(UIDMode mode = UseEffectiveUID);
00082 
00088   explicit KUser(K_UID uid);
00089 
00096   explicit KUser(const QString& name);
00097 
00104   explicit KUser(const char* name);
00105 
00106 #ifndef Q_OS_WIN
00107 
00113   explicit KUser(const passwd *p);
00114 #endif
00115 
00120   KUser(const KUser & user);
00121 
00127   KUser& operator =(const KUser& user);
00128 
00133   bool operator ==(const KUser& user) const;
00134 
00139   bool operator !=(const KUser &user) const;
00140 
00146   bool isValid() const;
00147 
00152   K_UID uid() const;
00153 
00154 #ifndef Q_OS_WIN
00155 
00159   K_GID gid() const;
00160 #endif
00161 
00166   bool isSuperUser() const;
00167 
00172   QString loginName() const;
00173 
00179 #ifndef KDE_NO_DEPRECATED
00180   KDE_DEPRECATED QString fullName() const;
00181 #endif
00182 
00188   QString homeDir() const;
00189 
00195   QString faceIconPath() const;
00196 
00202   QString shell() const;
00203 
00208   QList<KUserGroup> groups() const;
00209 
00214   QStringList groupNames() const;
00215 
00216   enum UserProperty { FullName, RoomNumber, WorkPhone, HomePhone };
00217 
00226   QVariant property(UserProperty which) const;
00227 
00231   ~KUser();
00232 
00237   static QList<KUser> allUsers();
00238 
00243   static QStringList allUserNames();
00244 
00245 private:
00246   class Private;
00247   KSharedPtr<Private> d;
00248 };
00249 
00262 class KDECORE_EXPORT KUserGroup {
00263 
00264 public:
00265 
00271   explicit KUserGroup(const QString& name);
00272 
00278   explicit KUserGroup(const char *name);
00279 
00280 #ifndef Q_OS_WIN
00281 
00291   explicit KUserGroup(KUser::UIDMode mode = KUser::UseEffectiveUID);
00292 
00298   explicit KUserGroup(K_GID gid);
00299 
00305   explicit KUserGroup(const group *g);
00306 #endif
00307 
00312   KUserGroup(const KUserGroup & group);
00313 
00319   KUserGroup& operator =(const KUserGroup& group);
00320 
00326   bool operator ==(const KUserGroup& group) const;
00327 
00333   bool operator !=(const KUserGroup& group) const;
00334 
00341   bool isValid() const;
00342 
00343 #ifndef Q_OS_WIN
00344 
00348   K_GID gid() const;
00349 #endif
00350 
00355   QString name() const;
00356 
00361   QList<KUser> users() const;
00362 
00367   QStringList userNames() const;
00368 
00372   ~KUserGroup();
00373 
00377   static QList<KUserGroup> allGroups();
00378 
00382   static QStringList allGroupNames();
00383 
00384 private:
00385   class Private;
00386   KSharedPtr<Private> d;
00387 };
00388 
00389 #endif

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal