KNewStuff

core/author.cpp
1 /*
2  This file is part of KNewStuff2.
3  SPDX-FileCopyrightText: 2002 Cornelius Schumacher <[email protected]>
4  SPDX-FileCopyrightText: 2003-2007 Josef Spillner <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8 
9 #include "author.h"
10 
11 #include <QHash>
12 
13 // BCI: Add a real d-pointer
14 namespace KNSCore {
15 struct AuthorPrivate {
16 public:
17  QString id;
18  QString profilepage;
19  QUrl avatarUrl;
20  QString description;
21 };
22 }
23 
24 using namespace KNSCore;
25 
27 Q_GLOBAL_STATIC(AuthorPrivateHash, d_func)
28 
29 static AuthorPrivate *d(const Author *author)
30 {
31  AuthorPrivate *ret = d_func()->value(author);
32  if (!ret) {
33  ret = new AuthorPrivate;
34  d_func()->insert(author, ret);
35  }
36  return ret;
37 }
38 
39 static void delete_d(const Author *author)
40 {
41  if (auto d = d_func()) {
42  delete d->take(author);
43  }
44 }
45 
46 Author::Author()
47 {
48 }
49 
50 KNSCore::Author::Author(const KNSCore::Author &other)
51 {
52  this->setAvatarUrl(other.avatarUrl());
53  this->setDescription(other.description());
54  this->setEmail(other.email());
55  this->setHomepage(other.homepage());
56  this->setId(other.id());
57  this->setJabber(other.jabber());
58  this->setName(other.name());
59  this->setProfilepage(other.profilepage());
60 }
61 
62 Author::~Author()
63 {
64  delete_d(this);
65 }
66 
68 {
69  d(this)->id = id;
70 }
71 
73 {
74  return d(this)->id;
75 }
76 
77 void Author::setName(const QString &_name)
78 {
79  mName = _name;
80 }
81 
83 {
84  return mName;
85 }
86 
87 void Author::setEmail(const QString &_email)
88 {
89  mEmail = _email;
90 }
91 
93 {
94  return mEmail;
95 }
96 
97 void Author::setJabber(const QString &_jabber)
98 {
99  mJabber = _jabber;
100 }
101 
103 {
104  return mJabber;
105 }
106 
107 void Author::setHomepage(const QString &_homepage)
108 {
109  mHomepage = _homepage;
110 }
111 
113 {
114  return mHomepage;
115 }
116 
117 void Author::setProfilepage(const QString &profilepage)
118 {
119  d(this)->profilepage = profilepage;
120 }
121 
123 {
124  return d(this)->profilepage;
125 }
126 
127 void Author::setAvatarUrl(const QUrl &avatarUrl)
128 {
129  d(this)->avatarUrl = avatarUrl;
130 }
131 
133 {
134  return d(this)->avatarUrl;
135 }
136 
137 void Author::setDescription(const QString &description)
138 {
139  d(this)->description = description;
140 }
141 
143 {
144  return d(this)->description;
145 }
void setName(const QString &name)
Sets the full name of the author.
Definition: core/author.cpp:77
void setId(const QString &id)
Sets the user ID of the author.
Definition: core/author.cpp:67
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:30
QString id() const
Retrieve the author&#39;s user ID.
Definition: core/author.cpp:72
void setJabber(const QString &jabber)
Sets the jabber address of the author.
Definition: core/author.cpp:97
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.
Definition: core/author.cpp:92
void setEmail(const QString &email)
Sets the email address of the author.
Definition: core/author.cpp:87
QString name() const
Retrieve the author&#39;s name.
Definition: core/author.cpp:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.