1 /***************************************************************************
2 * Copyright (C) 2007 by Jorge Cuadrado *
3 * kuadrosxx@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "userprofile.h"
22 #include <dash/network/permission.h>
27 struct UserProfile::Private
29 QList
<Dash::Network::Permission
> permissions
;
33 UserProfile::UserProfile(): d(new Private
)
37 UserProfile::UserProfile(const UserProfile
& copy
): d(new Private
)
39 d
->name
= copy
.d
->name
;
40 d
->permissions
= copy
.d
->permissions
;
43 UserProfile::UserProfile(const QString
& name
, const QList
<Dash::Network::Permission
> & permissions
) : d(new Private
)
45 d
->permissions
= permissions
;
50 UserProfile::~UserProfile()
55 bool UserProfile::isThisProfile(const QList
<Dash::Network::Permission
> & permissions
) const
57 foreach(Dash::Network::Permission perm
, permissions
)
60 foreach(Dash::Network::Permission perm1
, d
->permissions
)
62 if(perm
.name() == perm1
.name())
64 if(perm
.write() != perm1
.write() && perm
.write() != perm1
.write())
80 QString
UserProfile::name() const
85 void UserProfile::setName( const QString
& name
)
90 QList
<Dash::Network::Permission
> UserProfile::permissions() const
92 return d
->permissions
;
95 void UserProfile::setPermission(const QList
<Dash::Network::Permission
>& permissions
)
97 d
->permissions
= permissions
;
100 UserProfile
*UserProfile::operator=(const UserProfile
& copy
)
102 d
->name
= copy
.d
->name
;
103 d
->permissions
= copy
.d
->permissions
;