KNewStuff

core/author.cpp
1 /*
2  This file is part of KNewStuff2.
3  Copyright (c) 2002 Cornelius Schumacher <[email protected]>
4  Copyright (c) 2003 - 2007 Josef Spillner <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "author.h"
21 
22 #include <QHash>
23 
24 // BCI: Add a real d-pointer
25 namespace KNSCore {
26 struct AuthorPrivate {
27 public:
28  QString id;
29  QString profilepage;
30  QUrl avatarUrl;
31  QString description;
32 };
33 }
34 
35 using namespace KNSCore;
36 
38 Q_GLOBAL_STATIC(AuthorPrivateHash, d_func)
39 
40 static AuthorPrivate *d(const Author *author)
41 {
42  AuthorPrivate *ret = d_func()->value(author);
43  if (!ret) {
44  ret = new AuthorPrivate;
45  d_func()->insert(author, ret);
46  }
47  return ret;
48 }
49 
50 static void delete_d(const Author *author)
51 {
52  if (auto d = d_func()) {
53  delete d->take(author);
54  }
55 }
56 
57 Author::Author()
58 {
59 }
60 
61 KNSCore::Author::Author(const KNSCore::Author &other)
62 {
63  this->setAvatarUrl(other.avatarUrl());
64  this->setDescription(other.description());
65  this->setEmail(other.email());
66  this->setHomepage(other.homepage());
67  this->setId(other.id());
68  this->setJabber(other.jabber());
69  this->setName(other.name());
70  this->setProfilepage(other.profilepage());
71 }
72 
73 Author::~Author()
74 {
75  delete_d(this);
76 }
77 
79 {
80  d(this)->id = id;
81 }
82 
84 {
85  return d(this)->id;
86 }
87 
88 void Author::setName(const QString &_name)
89 {
90  mName = _name;
91 }
92 
94 {
95  return mName;
96 }
97 
98 void Author::setEmail(const QString &_email)
99 {
100  mEmail = _email;
101 }
102 
104 {
105  return mEmail;
106 }
107 
108 void Author::setJabber(const QString &_jabber)
109 {
110  mJabber = _jabber;
111 }
112 
114 {
115  return mJabber;
116 }
117 
118 void Author::setHomepage(const QString &_homepage)
119 {
120  mHomepage = _homepage;
121 }
122 
124 {
125  return mHomepage;
126 }
127 
128 void Author::setProfilepage(const QString &profilepage)
129 {
130  d(this)->profilepage = profilepage;
131 }
132 
134 {
135  return d(this)->profilepage;
136 }
137 
138 void Author::setAvatarUrl(const QUrl &avatarUrl)
139 {
140  d(this)->avatarUrl = avatarUrl;
141 }
142 
144 {
145  return d(this)->avatarUrl;
146 }
147 
148 void Author::setDescription(const QString &description)
149 {
150  d(this)->description = description;
151 }
152 
154 {
155  return d(this)->description;
156 }
void setName(const QString &name)
Sets the full name of the author.
Definition: core/author.cpp:88
void setId(const QString &id)
Sets the user ID of the author.
Definition: core/author.cpp:78
void setHomepage(const QString &homepage)
Sets the homepage of the author.
Contains the core functionality for handling interaction with NewStuff providers. ...
QUrl avatarUrl() const
Retrieve the url of the user&#39;s avatar image.
KNewStuff author information.
Definition: core/author.h:40
QString id() const
Retrieve the author&#39;s user ID.
Definition: core/author.cpp:83
void setJabber(const QString &jabber)
Sets the jabber address of the author.
QString description() const
Retrieve the user&#39;s description text.
QString homepage() const
Retrieve the author&#39;s homepage.
const T value(const Key &key) const const
void setDescription(const QString &description)
Set the user&#39;s description.
void setProfilepage(const QString &profilepage)
Sets the profile page of the author, usually located on the server hosting the content.
void setAvatarUrl(const QUrl &avatarUrl)
Sets the url for the user&#39;s avatar image.
QString profilepage() const
Retrieve the author&#39;s profile page.
QString jabber() const
Retrieve the author&#39;s jabber address.
QString email() const
Retrieve the author&#39;s email address.
void setEmail(const QString &email)
Sets the email address of the author.
Definition: core/author.cpp:98
QString name() const
Retrieve the author&#39;s name.
Definition: core/author.cpp:93
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.