~ubuntu-branches/ubuntu/vivid/krusader/vivid-proposed

« back to all changes in this revision

Viewing changes to krusader/VFS/krpermhandler.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-05-05 22:26:37 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505222637-ydv3cwjwy365on2r
Tags: 1:2.1.0~beta1-1ubuntu1
* Merge from Debian Unstable.  Remaining changes:
  - Retain Kubuntu doc path

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#ifndef KRPERMHANDLER_H
33
33
#define KRPERMHANDLER_H
34
34
 
35
 
#include <qstring.h>
36
 
#include <qfileinfo.h>
 
35
#include <QtCore/QString>
 
36
#include <QtCore/QFileInfo>
37
37
#include <sys/types.h>
38
 
#include <qhash.h>
 
38
#include <QtCore/QHash>
39
39
#include <kio/global.h>
40
40
 
41
41
#define NO_PERM      0
42
42
#define UNKNOWN_PERM 1
43
43
#define ALLOWED_PERM 2
44
44
 
45
 
class KRpermHandler {
46
 
public: 
47
 
         KRpermHandler(){}
48
 
        ~KRpermHandler(){}
49
 
        
50
 
        static void init();
51
 
        
52
 
        static gid_t group2gid(QString group);
53
 
        static uid_t user2uid (QString user);
54
 
 
55
 
        static QString gid2group(gid_t groupId);
56
 
        static QString uid2user (uid_t userId);
57
 
 
58
 
        static char writeable (QString perm, gid_t gid, uid_t uid, int rwx=-1);
59
 
        static char readable  (QString perm, gid_t gid, uid_t uid, int rwx=-1);
60
 
        static char executable(QString perm, gid_t gid, uid_t uid, int rwx=-1);
61
 
        
62
 
  static bool fileWriteable (QString localFile);
63
 
        static bool fileReadable  (QString localFile);
64
 
        static bool fileExecutable(QString localFile);
65
 
        
66
 
        static char ftpWriteable ( QString fileOwner, QString userName, QString perm );
67
 
        static char ftpReadable ( QString fileOwner, QString userName, QString perm );
68
 
        static char ftpExecutable( QString fileOwner, QString userName, QString perm );
69
 
 
70
 
        static bool dirExist (QString path);
71
 
        static bool fileExist(QString fullPath);
72
 
  static bool fileExist(QString Path, QString name);
73
 
 
74
 
        static QString mode2QString(mode_t m);
75
 
  static QString parseSize(KIO::filesize_t val);
76
 
        static QString date2qstring(QString date);
77
 
        static time_t  QString2time(QString date);
 
45
class KRpermHandler
 
46
{
 
47
public:
 
48
    KRpermHandler() {}
 
49
    ~KRpermHandler() {}
 
50
 
 
51
    static void init();
 
52
 
 
53
    static gid_t group2gid(QString group);
 
54
    static uid_t user2uid(QString user);
 
55
 
 
56
    static QString gid2group(gid_t groupId);
 
57
    static QString uid2user(uid_t userId);
 
58
 
 
59
    static char writeable(QString perm, gid_t gid, uid_t uid, int rwx = -1);
 
60
    static char readable(QString perm, gid_t gid, uid_t uid, int rwx = -1);
 
61
    static char executable(QString perm, gid_t gid, uid_t uid, int rwx = -1);
 
62
 
 
63
    static bool fileWriteable(QString localFile);
 
64
    static bool fileReadable(QString localFile);
 
65
    static bool fileExecutable(QString localFile);
 
66
 
 
67
    static char ftpWriteable(QString fileOwner, QString userName, QString perm);
 
68
    static char ftpReadable(QString fileOwner, QString userName, QString perm);
 
69
    static char ftpExecutable(QString fileOwner, QString userName, QString perm);
 
70
 
 
71
    static bool dirExist(QString path);
 
72
    static bool fileExist(QString fullPath);
 
73
    static bool fileExist(QString Path, QString name);
 
74
 
 
75
    static QString mode2QString(mode_t m);
 
76
    static QString parseSize(KIO::filesize_t val);
 
77
    static QString date2qstring(QString date);
 
78
    static time_t  QString2time(QString date);
78
79
 
79
80
private:
80
 
        // cache for passwd and group entries
81
 
  static QHash<QString, uid_t> *passwdCache;
82
 
  static QHash<QString, gid_t> *groupCache;
83
 
  static QHash<int, char>      *currentGroups;
84
 
  static QHash<int, QString>   *uidCache;
85
 
  static QHash<int, QString>   *gidCache;
 
81
    // cache for passwd and group entries
 
82
    static QHash<QString, uid_t> *passwdCache;
 
83
    static QHash<QString, gid_t> *groupCache;
 
84
    static QHash<int, char>      *currentGroups;
 
85
    static QHash<int, QString>   *uidCache;
 
86
    static QHash<int, QString>   *gidCache;
86
87
};
87
88
 
88
89
#endif