~lightdm-team/lightdm/1.4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "user.h"

#include <QtCore/QSharedData>

using namespace QLightDM;

class UserPrivate : public QSharedData
{
public:
    QString name;
    QString realName;
    QString homeDirectory;
    QString image;
    bool isLoggedIn;
};

User::User():
    d(new UserPrivate)
{
}

User::User(const QString& name, const QString& realName, const QString& homeDirectory, const QString& image, bool isLoggedIn) :
    d(new UserPrivate)
{
    d->name = name;
    d->realName = realName;
    d->homeDirectory = homeDirectory;
    d->image = image;
    d->isLoggedIn = isLoggedIn;
}

User::User(const User &other)
    : d(other.d)
{
}

User::~User()
{
}


User& User::operator=(const User& other)
{
    d = other.d;
    return *this;
}

bool User::update(const QString& realName, const QString& homeDirectory, const QString& image, bool isLoggedIn)
{
    if (d->realName == realName && d->homeDirectory == homeDirectory && d->image == image && d->isLoggedIn == isLoggedIn) {
        return false;
    }

    d->realName = realName;
    d->homeDirectory = homeDirectory;
    d->image = image;
    d->isLoggedIn = isLoggedIn;

    return true;
}

QString User::displayName() const
{
    if (!d->realName.isEmpty()) {
        return d->realName;
    }
    else {
        return d->name;
    }
}

QString User::name() const
{
    return d->name;
}

QString User::realName() const
{
    return d->realName;
}

QString User::homeDirectory() const
{
    return d->homeDirectory;
}

QString User::image() const
{
    return d->image;
}

bool User::isLoggedIn() const
{
    return d->isLoggedIn;
}