• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

blogilo

  • sources
  • kde-4.14
  • kdepim
  • blogilo
  • src
bilbopost.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Blogilo, A KDE Blogging Client
3 
4  Copyright (C) 2008-2010 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5  Copyright (C) 2008-2010 Golnaz Nilieh <g382nilieh@gmail.com>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License or (at your option) version 3 or any later version
11  accepted by the membership of KDE e.V. (or its successor approved
12  by the membership of KDE e.V.), which shall act as a proxy
13  defined in Section 14 of version 3 of the license.
14 
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, see http://www.gnu.org/licenses/
23 */
24 
25 #include "bilbopost.h"
26 #include <kdatetime.h>
27 #include <kdebug.h>
28 #include <QStringList>
29 
30 class BilboPostPrivate
31 {
32 public:
33  QString mAuthor;
34  int mId;
35  int localId;
36  bool mModifyTimeStamp;
37  QList<Category> mCategoryList;
38 };
39 
40 BilboPost::BilboPost()
41  : KBlog::BlogPost(), d_ptr(new BilboPostPrivate)
42 {
43  this->setCreationDateTime( KDateTime::currentLocalDateTime() );
44  this->setModificationDateTime( KDateTime::currentLocalDateTime() );
45  this->setCommentAllowed( true );
46  this->setPrivate( false );
47  this->setTrackBackAllowed( true );
48  d_ptr->mModifyTimeStamp = false;
49  this->setId( -1 );
50  this->setLocalId( -1 );
51  this->setStatus( KBlog::BlogPost::New );
52 }
53 
54 BilboPost::BilboPost( const KBlog::BlogPost &post )
55  : KBlog::BlogPost( post ), d_ptr(new BilboPostPrivate)
56 {
57  d_ptr->mId = -1;
58  d_ptr->localId = -1;
59  d_ptr->mModifyTimeStamp = false;
60 }
61 
62 BilboPost::BilboPost( const BilboPost &post )
63  : KBlog::BlogPost(post), d_ptr(new BilboPostPrivate)
64 {
65  this->setAuthor( post.author() );
66  this->setModifyTimeStamp( post.isModifyTimeStamp() );
67  this->setId( post.id() );
68  setLocalId( post.localId() );
69  this->setCategoryList( post.categoryList() );
70 }
71 
72 BilboPost::~BilboPost()
73 {
74  delete d_ptr;
75 }
76 
77 QString BilboPost::author() const
78 {
79  return d_ptr->mAuthor;
80 }
81 
82 void BilboPost::setId( const int id )
83 {
84  d_ptr->mId = id;
85 }
86 
87 int BilboPost::id() const
88 {
89  return d_ptr->mId;
90 }
91 
92 void BilboPost::setAuthor( const QString &author )
93 {
94  d_ptr->mAuthor = author;
95 }
96 
97 int BilboPost::localId() const
98 {
99  return d_ptr->localId;
100 }
101 
102 void BilboPost::setLocalId(const int localId)
103 {
104  d_ptr->localId = localId;
105 }
106 
107 QString BilboPost::toString() const
108 {
109  // if(!title().isEmpty())
110  // qDebug("BilboPost::toString: title is %s", this->title());
111  QString ret;
112  ret = QLatin1String("\n******* Post Info **********");
113  ret += QLatin1String( "\nID: " ) + postId();
114  ret += QLatin1String( "\nTitle: " ) + title();
115  ret += QLatin1String( "\nContent: " ) + content();
116  ret += QLatin1String("\nAdditionalContent: ") + additionalContent();
117  ret += QLatin1String("\nTags: ") + tags().join( QLatin1String(","));
118  ret += QLatin1String("\nCategories: ") + categories().join( QLatin1String(",") );
119  ret += QLatin1String("\nCreation Date Time: ") + creationDateTime().toString();
120  ret += QLatin1String("\nStatus: ") + QString::number(status());
121  ret += QLatin1String("\nIsPrivate: ") + QVariant(isPrivate()).toString();
122  ret += QLatin1String("\n******* End Post Info ********\n");
123  return ret;
124 }
125 
126 bool BilboPost::isModifyTimeStamp() const
127 {
128  return d_ptr->mModifyTimeStamp;
129 }
130 
131 void BilboPost::setModifyTimeStamp( bool isModify )
132 {
133  d_ptr->mModifyTimeStamp = isModify;
134 }
135 
136 QList< Category > BilboPost::categoryList() const
137 {
138  return d_ptr->mCategoryList;
139 }
140 
141 void BilboPost::setCategoryList( const QList< Category > & list )
142 {
143  d_ptr->mCategoryList = list;
144  QStringList cats;
145  const int count = list.count();
146  for ( int i = 0; i < count; ++i ) {
147  cats.append( list.at(i).name );
148  }
149  setCategories( cats );
150 }
151 
152 void BilboPost::setProperties( const BilboPost& postProp )
153 {
154  kDebug();
155  this->setCreationDateTime( postProp.creationDateTime() );
156  this->setModificationDateTime( postProp.modificationDateTime() );
157  this->setLink( postProp.link() );
158  this->setPermaLink( postProp.permaLink() );
159  this->setCategories( postProp.categories() );
160  this->setCategoryList( postProp.categoryList() );
161  this->setCommentAllowed( postProp.isCommentAllowed() );
162  this->setTags( postProp.tags() );
163  this->setMood( postProp.mood() );
164  this->setMusic( postProp.music() );
165  this->setSummary( postProp.summary() );
166  this->setTrackBackAllowed( postProp.isTrackBackAllowed() );
167  this->setAuthor( postProp.author() );
168  this->setModifyTimeStamp( postProp.isModifyTimeStamp() );
169  this->setSlug( postProp.slug() );
170 }
171 
172 BilboPost& BilboPost::operator=(const BilboPost& other)
173 {
174  KBlog::BlogPost other2 = KBlog::BlogPost::operator=(other);
175  BilboPost copy( other2 );
176  swap( copy );
177  return *this;
178 }
BilboPost::localId
int localId() const
Definition: bilbopost.cpp:97
BilboPost::setAuthor
void setAuthor(const QString &)
Definition: bilbopost.cpp:92
BilboPost::setLocalId
void setLocalId(const int)
Definition: bilbopost.cpp:102
QList::at
const T & at(int i) const
BilboPost::~BilboPost
~BilboPost()
Definition: bilbopost.cpp:72
BilboPost
Definition of a blog post! it's implemented to decrease dependency to KBlog :)
Definition: bilbopost.h:41
bilbopost.h
QString::number
QString number(int n, int base)
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
BilboPost::setModifyTimeStamp
void setModifyTimeStamp(bool willModify)
Definition: bilbopost.cpp:131
BilboPost::setProperties
void setProperties(const BilboPost &postProp)
Set all properties of post to new one, instead of Title and Content!
Definition: bilbopost.cpp:152
QString
QList< Category >
BilboPost::author
QString author() const
Definition: bilbopost.cpp:77
BilboPost::setId
void setId(const int)
Definition: bilbopost.cpp:82
QStringList
BilboPost::BilboPost
BilboPost()
Definition: bilbopost.cpp:40
BilboPost::categoryList
QList< Category > categoryList() const
Definition: bilbopost.cpp:136
QLatin1String
BilboPost::toString
QString toString() const
Definition: bilbopost.cpp:107
BilboPost::operator=
BilboPost & operator=(const BilboPost &other)
The overloaed = operator.
Definition: bilbopost.cpp:172
BilboPost::id
int id() const
Definition: bilbopost.cpp:87
BilboPost::isModifyTimeStamp
bool isModifyTimeStamp() const
Definition: bilbopost.cpp:126
QVariant::toString
QString toString() const
QVariant
BilboPost::setCategoryList
void setCategoryList(const QList< Category > &list)
Definition: bilbopost.cpp:141
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:16 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

blogilo

Skip menu "blogilo"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal