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>
23 #include <dcore/debug.h>
28 struct UserProfile::Private
30 QList
<Dash::Network::Permission
> permissions
;
34 UserProfile::UserProfile(): d(new Private
)
38 UserProfile::UserProfile(const UserProfile
& copy
): d(new Private
)
40 d
->name
= copy
.d
->name
;
41 d
->permissions
= copy
.d
->permissions
;
44 UserProfile::UserProfile(const QString
& name
, const QList
<Dash::Network::Permission
> & permissions
) : d(new Private
)
46 d
->permissions
= permissions
;
51 UserProfile::~UserProfile()
56 bool UserProfile::isThisProfile(const QList
<Dash::Network::Permission
> & permissions
) const
58 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
.read() != perm1
.read())
74 QString
UserProfile::name() const
79 void UserProfile::setName( const QString
& name
)
84 QList
<Dash::Network::Permission
> UserProfile::permissions() const
86 return d
->permissions
;
89 void UserProfile::setPermission(const QList
<Dash::Network::Permission
>& permissions
)
91 d
->permissions
= permissions
;
94 UserProfile
*UserProfile::operator=(const UserProfile
& copy
)
96 d
->name
= copy
.d
->name
;
97 d
->permissions
= copy
.d
->permissions
;