1 | /* |
---|---|
2 | This file is part of the kblog library. |
3 | |
4 | Copyright (c) 2006-2007 Christian Weilbach <christian_weilbach@web.de> |
5 | Copyright (c) 2007 Mike McQuaid <mike@mikemcquaid.com> |
6 | |
7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. |
11 | |
12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #include "blogmedia.h" |
24 | |
25 | #include <QByteArray> |
26 | #include <QString> |
27 | #include <kurl.h> |
28 | |
29 | namespace KBlog { |
30 | |
31 | class BlogMediaPrivate |
32 | { |
33 | public: |
34 | BlogMedia *q_ptr; |
35 | QString mName; |
36 | KUrl mUrl; |
37 | QString mMimetype; |
38 | QString mError; |
39 | QByteArray mData; |
40 | BlogMedia::Status mStatus; |
41 | }; |
42 | |
43 | BlogMedia::BlogMedia(): d_ptr( new BlogMediaPrivate ) |
44 | { |
45 | d_ptr->q_ptr=this; |
46 | } |
47 | |
48 | BlogMedia::BlogMedia( const BlogMedia &m ) |
49 | : d_ptr( new BlogMediaPrivate ) |
50 | { |
51 | d_ptr->q_ptr = this; |
52 | d_ptr->mName = m.name(); |
53 | d_ptr->mUrl = m.url(); |
54 | d_ptr->mMimetype = m.mimetype(); |
55 | d_ptr->mData = m.data(); |
56 | d_ptr->mStatus = m.status(); |
57 | d_ptr->mError = m.error(); |
58 | } |
59 | |
60 | BlogMedia::~BlogMedia() |
61 | { |
62 | delete d_ptr; |
63 | } |
64 | |
65 | QString BlogMedia::name() const |
66 | { |
67 | return d_ptr->mName; |
68 | } |
69 | |
70 | void BlogMedia::setName( const QString &name ) |
71 | { |
72 | d_ptr->mName = name; |
73 | } |
74 | |
75 | KUrl BlogMedia::url() const |
76 | { |
77 | return d_ptr->mUrl; |
78 | } |
79 | |
80 | void BlogMedia::setUrl( const KUrl &url ) |
81 | { |
82 | d_ptr->mUrl = url; |
83 | } |
84 | |
85 | QString BlogMedia::mimetype() const |
86 | { |
87 | return d_ptr->mMimetype; |
88 | } |
89 | |
90 | void BlogMedia::setMimetype( const QString &mimetype ) |
91 | { |
92 | d_ptr->mMimetype = mimetype; |
93 | } |
94 | |
95 | QByteArray BlogMedia::data() const |
96 | { |
97 | return d_ptr->mData; |
98 | } |
99 | |
100 | void BlogMedia::setData( const QByteArray &data ) |
101 | { |
102 | d_ptr->mData = data; |
103 | } |
104 | |
105 | BlogMedia::Status BlogMedia::status() const |
106 | { |
107 | return d_ptr->mStatus; |
108 | } |
109 | |
110 | void BlogMedia::setStatus( BlogMedia::Status status ) |
111 | { |
112 | d_ptr->mStatus = status; |
113 | } |
114 | |
115 | QString BlogMedia::error() const |
116 | { |
117 | return d_ptr->mError; |
118 | } |
119 | |
120 | void BlogMedia::setError( const QString &error ) |
121 | { |
122 | d_ptr->mError = error; |
123 | } |
124 | |
125 | BlogMedia &BlogMedia::operator=( const BlogMedia &m ) |
126 | { |
127 | BlogMedia copy( m ); |
128 | swap( copy ); |
129 | return *this; |
130 | } |
131 | |
132 | } //namespace KBlog |
133 |