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 {
16 struct AuthorPrivate {
17 public:
18  QString id;
19  QString profilepage;
20  QUrl avatarUrl;
21  QString description;
22 };
23 }
24 
25 using namespace KNSCore;
26 
29 
30 static AuthorPrivate *d(const Author *author)
31 {
32  AuthorPrivate *ret = d_func()->value(author);
33  if (!ret) {
34  ret = new AuthorPrivate;
35  d_func()->insert(author, ret);
36  }
37  return ret;
38 }
39 
40 static void delete_d(const Author *author)
41 {
42  if (auto d = d_func()) {
43  delete d->take(author);
44  }
45 }
46 
47 Author::Author()
48 {
49 }
50 
51 KNSCore::Author::Author(const KNSCore::Author &other)
52 {
53  this->setAvatarUrl(other.avatarUrl());
54  this->setDescription(other.description());
55  this->setEmail(other.email());
56  this->setHomepage(other.homepage());
57  this->setId(other.id());
58  this->setJabber(other.jabber());
59  this->setName(other.name());
60  this->setProfilepage(other.profilepage());
61 }
62 
63 Author::~Author()
64 {
65  delete_d(this);
66 }
67 
69 {
70  d(this)->id = id;
71 }
72 
74 {
75  return d(this)->id;
76 }
77 
78 void Author::setName(const QString &_name)
79 {
80  mName = _name;
81 }
82 
84 {
85  return mName;
86 }
87 
88 void Author::setEmail(const QString &_email)
89 {
90  mEmail = _email;
91 }
92 
94 {
95  return mEmail;
96 }
97 
98 void Author::setJabber(const QString &_jabber)
99 {
100  mJabber = _jabber;
101 }
102 
104 {
105  return mJabber;
106 }
107 
108 void Author::setHomepage(const QString &_homepage)
109 {
110  mHomepage = _homepage;
111 }
112 
114 {
115  return mHomepage;
116 }
117 
118 void Author::setProfilepage(const QString &profilepage)
119 {
120  d(this)->profilepage = profilepage;
121 }
122 
124 {
125  return d(this)->profilepage;
126 }
127 
128 void Author::setAvatarUrl(const QUrl &avatarUrl)
129 {
130  d(this)->avatarUrl = avatarUrl;
131 }
132 
134 {
135  return d(this)->avatarUrl;
136 }
137 
138 void Author::setDescription(const QString &description)
139 {
140  d(this)->description = description;
141 }
142 
144 {
145  return d(this)->description;
146 }
QString profilepage() const
Retrieve the author's profile page.
QString description() const
Retrieve the user's description text.
QString email() const
Retrieve the author's email address.
Definition: core/author.cpp:93
QString homepage() const
Retrieve the author's homepage.
void setHomepage(const QString &homepage)
Sets the homepage of the author.
void setId(const QString &id)
Sets the user ID of the author.
Definition: core/author.cpp:68
QUrl avatarUrl() const
Retrieve the url of the user's avatar image.
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
KNewStuff author information.
Definition: core/author.h:30
void setJabber(const QString &jabber)
Sets the jabber address of the author.
Definition: core/author.cpp:98
void setDescription(const QString &description)
Set the user'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's avatar image.
QString jabber() const
Retrieve the author's jabber address.
QString id() const
Retrieve the author's user ID.
Definition: core/author.cpp:73
void setEmail(const QString &email)
Sets the email address of the author.
Definition: core/author.cpp:88
Contains the core functionality for handling interaction with NewStuff providers.
QString name() const
Retrieve the author's name.
Definition: core/author.cpp:83
void setName(const QString &name)
Sets the full name of the author.
Definition: core/author.cpp:78
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 04:12:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.