• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. KDE PIM
  3. KBlog
  • KDE Home
  • Contact Us

Quick Links

Skip menu "KBlog"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Dependencies
  • Related Pages

Class Picker

About

A blogging library

Maintainer
Daniel Vrátil
Supported platforms
Linux
Community
IRC: #kontact on Freenode
Mailing list: kde-pim
Use with CMake
find_package(KF5Blog)
target_link_libraries(yourapp KF5::Blog)
Use with QMake
QT += KBlog 
Clone
git clone git://anongit.kde.org/kblog.git
Browse source
KBlog on cgit.kde.org

KBlog

  • kde
  • pim
  • kblog
  • src
movabletype.cpp
1 /*
2  This file is part of the kblog library.
3 
4  Copyright (c) 2004 Reinhold Kainhofer <[email protected]>
5  Copyright (c) 2006-2009 Christian Weilbach <[email protected]>
6  Copyright (c) 2007-2008 Mike McQuaid <[email protected]>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #include "movabletype.h"
25 #include "movabletype_p.h"
26 #include "blogpost.h"
27 
28 #include <kxmlrpcclient/client.h>
29 #include <kio/job.h>
30 
31 #include "kblog_debug.h"
32 #include <KLocalizedString>
33 
34 #include <QStringList>
35 
36 using namespace KBlog;
37 
38 MovableType::MovableType(const QUrl &server, QObject *parent)
39  : MetaWeblog(server, *new MovableTypePrivate, parent)
40 {
41  qCDebug(KBLOG_LOG);
42 }
43 
44 MovableType::MovableType(const QUrl &server, MovableTypePrivate &dd,
45  QObject *parent)
46  : MetaWeblog(server, dd, parent)
47 {
48  qCDebug(KBLOG_LOG);
49 }
50 
51 MovableType::~MovableType()
52 {
53  qCDebug(KBLOG_LOG);
54 }
55 
56 QString MovableType::interfaceName() const
57 {
58  return QStringLiteral("Movable Type");
59 }
60 
61 void MovableType::listRecentPosts(int number)
62 {
63  Q_D(MovableType);
64  qCDebug(KBLOG_LOG);
65  QList<QVariant> args(d->defaultArgs(blogId()));
66  args << QVariant(number);
67  d->mXmlRpcClient->call(
68  QStringLiteral("metaWeblog.getRecentPosts"), args,
69  this, SLOT(slotListRecentPosts(QList<QVariant>,QVariant)),
70  this, SLOT(slotError(int,QString,QVariant)),
71  QVariant(number));
72 }
73 
74 void MovableType::listTrackBackPings(KBlog::BlogPost *post)
75 {
76  Q_D(MovableType);
77  qCDebug(KBLOG_LOG);
78  QList<QVariant> args;
79  args << QVariant(post->postId());
80  unsigned int i = d->mCallCounter++;
81  d->mCallMap[ i ] = post;
82  d->mXmlRpcClient->call(
83  QStringLiteral("mt.getTrackbackPings"), args,
84  this, SLOT(slotListTrackbackPings(QList<QVariant>,QVariant)),
85  this, SLOT(slotError(int,QString,QVariant)),
86  QVariant(i));
87 }
88 
89 void MovableType::fetchPost(BlogPost *post)
90 {
91  Q_D(MovableType);
92  qCDebug(KBLOG_LOG);
93  d->loadCategories();
94  if (d->mCategoriesList.isEmpty() &&
95  post->categories().count()) {
96  d->mFetchPostCache << post;
97  if (d->mFetchPostCache.count()) {
98  // we are already trying to fetch another post, so we don't need to start
99  // another listCategories() job
100  return;
101  }
102 
103  connect(this, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
104  this, SLOT(slotTriggerFetchPost()));
105  listCategories();
106  } else {
107  MetaWeblog::fetchPost(post);
108  }
109 }
110 
111 void MovableType::createPost(BlogPost *post)
112 {
113  // reimplemented because we do this:
114  // http://comox.textdrive.com/pipermail/wp-testers/2005-July/000284.html
115  qCDebug(KBLOG_LOG);
116  Q_D(MovableType);
117 
118  // we need mCategoriesList to be loaded first, since we cannot use the post->categories()
119  // names later, but we need to map them to categoryId of the blog
120  d->loadCategories();
121  if (d->mCategoriesList.isEmpty() &&
122  !post->categories().isEmpty()) {
123  qCDebug(KBLOG_LOG) << "No categories in the cache yet. Have to fetch them first.";
124  d->mCreatePostCache << post;
125  connect(this, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
126  this, SLOT(slotTriggerCreatePost()));
127  listCategories();
128  } else {
129  bool publish = post->isPrivate();
130  // If we do setPostCategories() later than we disable publishing first.
131  if (!post->categories().isEmpty()) {
132  post->setPrivate(true);
133  if (d->mSilentCreationList.contains(post)) {
134  qCDebug(KBLOG_LOG) << "Post already in mSilentCreationList, this *should* never happen!";
135  } else {
136  d->mSilentCreationList << post;
137  }
138  }
139  MetaWeblog::createPost(post);
140  // HACK: uuh this a bit ugly now... reenable the original publish argument,
141  // since createPost should have parsed now
142  post->setPrivate(publish);
143  }
144 }
145 
146 void MovableType::modifyPost(BlogPost *post)
147 {
148  // reimplemented because we do this:
149  // http://comox.textdrive.com/pipermail/wp-testers/2005-July/000284.html
150  qCDebug(KBLOG_LOG);
151  Q_D(MovableType);
152 
153  // we need mCategoriesList to be loaded first, since we cannot use the post->categories()
154  // names later, but we need to map them to categoryId of the blog
155  d->loadCategories();
156  if (d->mCategoriesList.isEmpty() &&
157  !post->categories().isEmpty()) {
158  qCDebug(KBLOG_LOG) << "No categories in the cache yet. Have to fetch them first.";
159  d->mModifyPostCache << post;
160  connect(this, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
161  this, SLOT(slotTriggerModifyPost()));
162  listCategories();
163  } else {
164  MetaWeblog::modifyPost(post);
165  }
166 }
167 
168 void MovableTypePrivate::slotTriggerCreatePost()
169 {
170  qCDebug(KBLOG_LOG);
171  Q_Q(MovableType);
172 
173  q->disconnect(q, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
174  q, SLOT(slotTriggerCreatePost()));
175  // now we can recall createPost with the posts from the cache
176  QList<BlogPost *>::Iterator it = mCreatePostCache.begin();
177  QList<BlogPost *>::Iterator end = mCreatePostCache.end();
178  for (; it != end; it++) {
179  q->createPost(*it);
180  }
181  mCreatePostCache.clear();
182 }
183 
184 void MovableTypePrivate::slotTriggerModifyPost()
185 {
186  qCDebug(KBLOG_LOG);
187  Q_Q(MovableType);
188 
189  q->disconnect(q, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
190  q, SLOT(slotTriggerModifyPost()));
191  // now we can recall createPost with the posts from the cache
192  QList<BlogPost *>::Iterator it = mModifyPostCache.begin();
193  QList<BlogPost *>::Iterator end = mModifyPostCache.end();
194  for (; it != end; it++) {
195  q->modifyPost(*it);
196  }
197  mModifyPostCache.clear();
198 }
199 
200 void MovableTypePrivate::slotTriggerFetchPost()
201 {
202  qCDebug(KBLOG_LOG);
203  Q_Q(MovableType);
204 
205  q->disconnect(q, SIGNAL(listedCategories(QList<QMap<QString,QString> >)),
206  q, SLOT(slotTriggerFetchPost()));
207  QList<BlogPost *>::Iterator it = mFetchPostCache.begin();
208  QList<BlogPost *>::Iterator end = mFetchPostCache.end();
209  for (; it != end; it++) {
210  q->fetchPost(*it);
211  }
212  mFetchPostCache.clear();
213 }
214 
215 MovableTypePrivate::MovableTypePrivate()
216 {
217  qCDebug(KBLOG_LOG);
218 }
219 
220 MovableTypePrivate::~MovableTypePrivate()
221 {
222  qCDebug(KBLOG_LOG);
223 }
224 
225 void MovableTypePrivate::slotCreatePost(const QList<QVariant> &result, const QVariant &id)
226 {
227  Q_Q(MovableType);
228  // reimplement from Blogger1 to chainload the categories stuff before emit()
229  qCDebug(KBLOG_LOG);
230  KBlog::BlogPost *post = mCallMap[ id.toInt() ];
231  mCallMap.remove(id.toInt());
232 
233  qCDebug(KBLOG_LOG);
234  //array of structs containing ISO.8601
235  // dateCreated, String userid, String postid, String content;
236  qCDebug(KBLOG_LOG) << "TOP:" << result[0].typeName();
237  if (result[0].type() != QVariant::String &&
238  result[0].type() != QVariant::Int) {
239  qCritical() << "Could not read the postId, not a string or an integer.";
240  emit q->errorPost(Blogger1::ParsingError,
241  i18n("Could not read the postId, not a string or an integer."),
242  post);
243  return;
244  }
245  QString serverID;
246  if (result[0].type() == QVariant::String) {
247  serverID = result[0].toString();
248  }
249  if (result[0].type() == QVariant::Int) {
250  serverID = QStringLiteral("%1").arg(result[0].toInt());
251  }
252  post->setPostId(serverID);
253  if (mSilentCreationList.contains(post)) {
254  // set the categories and publish afterwards
255  setPostCategories(post, !post->isPrivate());
256  } else {
257  qCDebug(KBLOG_LOG) << "emitting createdPost()"
258  << "for title: \"" << post->title()
259  << "\" server id: " << serverID;
260  post->setStatus(KBlog::BlogPost::Created);
261  emit q->createdPost(post);
262  }
263 }
264 
265 void MovableTypePrivate::slotFetchPost(const QList<QVariant> &result, const QVariant &id)
266 {
267  Q_Q(MovableType);
268  qCDebug(KBLOG_LOG);
269 
270  KBlog::BlogPost *post = mCallMap[ id.toInt() ];
271  mCallMap.remove(id.toInt());
272 
273  //array of structs containing ISO.8601
274  // dateCreated, String userid, String postid, String content;
275  qCDebug(KBLOG_LOG) << "TOP:" << result[0].typeName();
276  if (result[0].type() == QVariant::Map &&
277  readPostFromMap(post, result[0].toMap())) {
278  } else {
279  qCritical() << "Could not fetch post out of the result from the server.";
280  post->setError(i18n("Could not fetch post out of the result from the server."));
281  post->setStatus(BlogPost::Error);
282  emit q->errorPost(Blogger1::ParsingError,
283  i18n("Could not fetch post out of the result from the server."), post);
284  }
285  if (post->categories().isEmpty()) {
286  QList<QVariant> args(defaultArgs(post->postId()));
287  unsigned int i = mCallCounter++;
288  mCallMap[ i ] = post;
289  mXmlRpcClient->call(
290  QStringLiteral("mt.getPostCategories"), args,
291  q, SLOT(slotGetPostCategories(QList<QVariant>,QVariant)),
292  q, SLOT(slotError(int,QString,QVariant)),
293  QVariant(i));
294  } else {
295  qCDebug(KBLOG_LOG) << "Emitting fetchedPost()";
296  post->setStatus(KBlog::BlogPost::Fetched);
297  emit q->fetchedPost(post);
298  }
299 }
300 
301 void MovableTypePrivate::slotModifyPost(const QList<QVariant> &result, const QVariant &id)
302 {
303  Q_Q(MovableType);
304  // reimplement from Blogger1
305  qCDebug(KBLOG_LOG);
306  KBlog::BlogPost *post = mCallMap[ id.toInt() ];
307  mCallMap.remove(id.toInt());
308 
309  //array of structs containing ISO.8601
310  // dateCreated, String userid, String postid, String content;
311  qCDebug(KBLOG_LOG) << "TOP:" << result[0].typeName();
312  if (result[0].type() != QVariant::Bool &&
313  result[0].type() != QVariant::Int) {
314  qCritical() << "Could not read the result, not a boolean.";
315  emit q->errorPost(Blogger1::ParsingError,
316  i18n("Could not read the result, not a boolean."),
317  post);
318  return;
319  }
320  if (mSilentCreationList.contains(post)) {
321  post->setStatus(KBlog::BlogPost::Created);
322  mSilentCreationList.removeOne(post);
323  emit q->createdPost(post);
324  } else {
325  if (!post->categories().isEmpty()) {
326  setPostCategories(post, false);
327  }
328  }
329 }
330 
331 void MovableTypePrivate::setPostCategories(BlogPost *post, bool publishAfterCategories)
332 {
333  qCDebug(KBLOG_LOG);
334  Q_Q(MovableType);
335 
336  unsigned int i = mCallCounter++;
337  mCallMap[ i ] = post;
338  mPublishAfterCategories[ i ] = publishAfterCategories;
339  QList<QVariant> catList;
340  QList<QVariant> args(defaultArgs(post->postId()));
341 
342  // map the categoryId of the server to the name
343  QStringList categories = post->categories();
344  for (int j = 0; j < categories.count(); j++) {
345  for (int k = 0; k < mCategoriesList.count(); k++) {
346  if (mCategoriesList[k][QStringLiteral("name")] == categories[j]) {
347  qCDebug(KBLOG_LOG) << "Matched category with name: " << categories[ j ] << " and id: " << mCategoriesList[ k ][ QStringLiteral("categoryId") ];
348  QMap<QString, QVariant> category;
349  //the first in the QStringList of post->categories()
350  // is the primary category
351  category[QStringLiteral("categoryId")] = mCategoriesList[k][QStringLiteral("categoryId")].toInt();
352  catList << QVariant(category);
353  break;
354  }
355  if (k == mCategoriesList.count()) {
356  qCDebug(KBLOG_LOG) << "Couldn't find categoryId for: " << categories[j];
357  }
358  }
359  }
360  args << QVariant(catList);
361 
362  mXmlRpcClient->call(
363  QStringLiteral("mt.setPostCategories"), args,
364  q, SLOT(slotSetPostCategories(QList<QVariant>,QVariant)),
365  q, SLOT(slotError(int,QString,QVariant)),
366  QVariant(i));
367 }
368 
369 void MovableTypePrivate::slotGetPostCategories(const QList<QVariant> &result, const QVariant &id)
370 {
371  qCDebug(KBLOG_LOG);
372  Q_Q(MovableType);
373 
374  int i = id.toInt();
375  BlogPost *post = mCallMap[ i ];
376  mCallMap.remove(i);
377 
378  if (result[ 0 ].type() != QVariant::List) {
379  qCritical() << "Could not read the result, not a list. Category fetching failed! We will still emit fetched post now.";
380  emit q->errorPost(Blogger1::ParsingError,
381  i18n("Could not read the result - is not a list. Category fetching failed."), post);
382 
383  post->setStatus(KBlog::BlogPost::Fetched);
384  emit q->fetchedPost(post);
385  } else {
386  QList<QVariant> categoryList = result[ 0 ].toList();
387  QList<QString> newCatList;
388  QList<QVariant>::ConstIterator it = categoryList.constBegin();
389  QList<QVariant>::ConstIterator end = categoryList.constEnd();
390  newCatList.reserve(categoryList.count());
391  for (; it != end; it++) {
392  newCatList << (*it).toMap()[ QStringLiteral("categoryName") ].toString();
393  }
394  qCDebug(KBLOG_LOG) << "categories list: " << newCatList;
395  post->setCategories(newCatList);
396  post->setStatus(KBlog::BlogPost::Fetched);
397  emit q->fetchedPost(post);
398  }
399 }
400 
401 void MovableTypePrivate::slotSetPostCategories(const QList<QVariant> &result, const QVariant &id)
402 {
403  qCDebug(KBLOG_LOG);
404  Q_Q(MovableType);
405 
406  int i = id.toInt();
407  BlogPost *post = mCallMap[ i ];
408  bool publish = mPublishAfterCategories[ i ];
409  mCallMap.remove(i);
410  mPublishAfterCategories.remove(i);
411 
412  if (result[0].type() != QVariant::Bool) {
413  qCritical() << "Could not read the result, not a boolean. Category setting failed! We will still publish if now if necessary. ";
414  emit q->errorPost(Blogger1::ParsingError,
415  i18n("Could not read the result - is not a boolean value. Category setting failed. Will still publish now if necessary."),
416  post);
417  }
418  // Finally publish now, if the post was meant to be published in the beginning.
419  // The first boolean is necessary to only publish if the post is created, not
420  // modified.
421  if (publish && !post->isPrivate()) {
422  q->modifyPost(post);
423  }
424 
425  // this is the end of the chain then
426  if (!publish) {
427  if (mSilentCreationList.contains(post)) {
428  qCDebug(KBLOG_LOG) << "emitting createdPost() for title: \""
429  << post->title() << "\"";
430  post->setStatus(KBlog::BlogPost::Created);
431  mSilentCreationList.removeOne(post);
432  emit q->createdPost(post);
433  } else {
434  qCDebug(KBLOG_LOG) << "emitting modifiedPost() for title: \""
435  << post->title() << "\"";
436  post->setStatus(KBlog::BlogPost::Modified);
437  emit q->modifiedPost(post);
438  }
439  }
440 }
441 
442 QList<QVariant> MovableTypePrivate::defaultArgs(const QString &id)
443 {
444  Q_Q(MovableType);
445  QList<QVariant> args;
446  if (!id.isEmpty()) {
447  args << QVariant(id);
448  }
449  args << QVariant(q->username())
450  << QVariant(q->password());
451  return args;
452 }
453 
454 bool MovableTypePrivate::readPostFromMap(BlogPost *post, const QMap<QString, QVariant> &postInfo)
455 {
456 
457  // FIXME: integrate error handling
458  qCDebug(KBLOG_LOG) << "readPostFromMap()";
459  if (!post) {
460  return false;
461  }
462 
463  qCDebug(KBLOG_LOG) << endl << "Keys:" << QStringList(postInfo.keys()).join(QLatin1String(", "));
464  qCDebug(KBLOG_LOG) << endl;
465 
466  QDateTime dt = postInfo[QStringLiteral("dateCreated")].toDateTime();
467  if (dt.isValid() && !dt.isNull()) {
468  post->setCreationDateTime(dt.toLocalTime());
469  }
470 
471  dt = postInfo[QStringLiteral("lastModified")].toDateTime();
472  if (dt.isValid() && !dt.isNull()) {
473  post->setModificationDateTime(dt.toLocalTime());
474  }
475 
476  post->setPostId(postInfo[QStringLiteral("postid")].toString().isEmpty() ? postInfo[QStringLiteral("postId")].toString() :
477  postInfo[QStringLiteral("postid")].toString());
478 
479  QString title(postInfo[QStringLiteral("title")].toString());
480  QString description(postInfo[QStringLiteral("description")].toString());
481  QStringList categoryIdList = postInfo[QStringLiteral("categories")].toStringList();
482  QStringList categories;
483  // since the metaweblog definition is ambigious, we try different
484  // category mappings
485  for (int i = 0; i < categoryIdList.count(); i++) {
486  for (int k = 0; k < mCategoriesList.count(); k++) {
487  if (mCategoriesList[ k ][ QStringLiteral("name") ] == categoryIdList[ i ]) {
488  categories << mCategoriesList[ k ][ QStringLiteral("name") ];
489  } else if (mCategoriesList[ k ][ QStringLiteral("categoryId") ] == categoryIdList[ i ]) {
490  categories << mCategoriesList[ k ][ QStringLiteral("name") ];
491  }
492  }
493  }
494 
495  //TODO 2 new keys are:
496  // String mt_convert_breaks, the value for the convert_breaks field
497  post->setSlug(postInfo[QStringLiteral("wp_slug")].toString());
498  post->setAdditionalContent(postInfo[QStringLiteral("mt_text_more")].toString());
499  post->setTitle(title);
500  post->setContent(description);
501  post->setCommentAllowed((bool)postInfo[QStringLiteral("mt_allow_comments")].toInt());
502  post->setTrackBackAllowed((bool)postInfo[QStringLiteral("mt_allow_pings")].toInt());
503  post->setSummary(postInfo[QStringLiteral("mt_excerpt")].toString());
504  post->setTags(postInfo[QStringLiteral("mt_keywords")].toStringList());
505  post->setLink(QUrl(postInfo[QStringLiteral("link")].toString()));
506  post->setPermaLink(QUrl(postInfo[QStringLiteral("permaLink")].toString()));
507  QString postStatus = postInfo[QStringLiteral("post_status")].toString();
508  if (postStatus != QLatin1String("publish") &&
509  !postStatus.isEmpty()) {
515  post->setPrivate(true);
516  }
517  if (!categories.isEmpty()) {
518  qCDebug(KBLOG_LOG) << "Categories:" << categories;
519  post->setCategories(categories);
520  }
521  return true;
522 }
523 
524 void MovableTypePrivate::slotListTrackBackPings(
525  const QList<QVariant> &result, const QVariant &id)
526 {
527  Q_Q(MovableType);
528  qCDebug(KBLOG_LOG) << "slotTrackbackPings()";
529  BlogPost *post = mCallMap[ id.toInt() ];
530  mCallMap.remove(id.toInt());
531  QList<QMap<QString, QString> > trackBackList;
532  if (result[0].type() != QVariant::List) {
533  qCritical() << "Could not fetch list of trackback pings out of the"
534  << "result from the server.";
535  emit q->error(MovableType::ParsingError,
536  i18n("Could not fetch list of trackback pings out of the "
537  "result from the server."));
538  return;
539  }
540  const QList<QVariant> trackBackReceived = result[0].toList();
541  QList<QVariant>::ConstIterator it = trackBackReceived.begin();
542  QList<QVariant>::ConstIterator end = trackBackReceived.end();
543  for (; it != end; ++it) {
544  QMap<QString, QString> tping;
545  qCDebug(KBLOG_LOG) << "MIDDLE:" << (*it).typeName();
546  const QMap<QString, QVariant> trackBackInfo = (*it).toMap();
547  tping[ QStringLiteral("title") ] = trackBackInfo[ QStringLiteral("pingTitle")].toString();
548  tping[ QStringLiteral("url") ] = trackBackInfo[ QStringLiteral("pingURL")].toString();
549  tping[ QStringLiteral("ip") ] = trackBackInfo[ QStringLiteral("pingIP")].toString();
550  trackBackList << tping;
551  }
552  qCDebug(KBLOG_LOG) << "Emitting listedTrackBackPings()";
553  emit q->listedTrackBackPings(post, trackBackList);
554 }
555 
556 bool MovableTypePrivate::readArgsFromPost(QList<QVariant> *args, const BlogPost &post)
557 {
558  //TODO 2 new keys are:
559  // String mt_convert_breaks, the value for the convert_breaks field
560  // array mt_tb_ping_urls, the list of TrackBack ping URLs for this entry
561  if (!args) {
562  return false;
563  }
564  QMap<QString, QVariant> map;
565  map[QStringLiteral("categories")] = post.categories();
566  map[QStringLiteral("description")] = post.content();
567  if (!post.additionalContent().isEmpty()) {
568  map[QStringLiteral("mt_text_more")] = post.additionalContent();
569  }
570  map[QStringLiteral("title")] = post.title();
571  map[QStringLiteral("dateCreated")] = post.creationDateTime().toUTC();
572  map[QStringLiteral("mt_allow_comments")] = (int)post.isCommentAllowed();
573  map[QStringLiteral("mt_allow_pings")] = (int)post.isTrackBackAllowed();
574  map[QStringLiteral("mt_excerpt")] = post.summary();
575  map[QStringLiteral("mt_keywords")] = post.tags().join(QLatin1Char(','));
576  //map["mt_tb_ping_urls"] check for that, i think this should only be done on the server.
577  *args << map;
578  *args << QVariant(!post.isPrivate());
579  return true;
580 }
581 
582 #include "moc_movabletype.cpp"
KBlog::BlogPost::title
QString title() const
Returns the title.
Definition: blogpost.cpp:152
KBlog::MovableType::fetchPost
void fetchPost(KBlog::BlogPost *post) override
Fetch a post from the server.
Definition: movabletype.cpp:89
KBlog::BlogPost::setCreationDateTime
void setCreationDateTime(const QDateTime &datetime)
Sets the creation time.
Definition: blogpost.cpp:311
QDateTime::toUTC
QDateTime toUTC() const
KBlog::MetaWeblog::listCategories
virtual void listCategories()
List the categories of the blog.
Definition: metaweblog.cpp:63
KBlog::BlogPost::Fetched
Status of a successfully fetched post.
Definition: blogpost.h:395
KBlog::BlogPost::setLink
void setLink(const QUrl &link) const
Set the link path.
Definition: blogpost.cpp:209
KBlog::BlogPost::tags
QStringList tags() const
Returns the tags list as a QStringList.
Definition: blogpost.cpp:254
QList::reserve
void reserve(int alloc)
KBlog::MovableType::listTrackBackPings
virtual void listTrackBackPings(KBlog::BlogPost *post)
Get the list of trackback pings from the server.
Definition: movabletype.cpp:74
QMap< QString, QString >
KBlog::BlogPost::Created
Status of a successfully created post.
Definition: blogpost.h:398
KBlog::Blogger1::modifyPost
void modifyPost(KBlog::BlogPost *post) override
Modify a post on server.
Definition: blogger1.cpp:126
KBlog::MovableType::~MovableType
virtual ~MovableType()
Destroy the object.
Definition: movabletype.cpp:51
KBlog::MovableType::modifyPost
void modifyPost(KBlog::BlogPost *post) override
Modify a post on server.
Definition: movabletype.cpp:146
QStringList::join
QString join(const QString &separator) const
KBlog::BlogPost::isCommentAllowed
bool isCommentAllowed() const
Returns whether comments should be allowed.
Definition: blogpost.cpp:224
KBlog::Blogger1::fetchPost
void fetchPost(KBlog::BlogPost *post) override
Fetch a post from the server.
Definition: blogger1.cpp:107
KBlog::BlogPost::isTrackBackAllowed
bool isTrackBackAllowed() const
Returns whether track back should be allowed.
Definition: blogpost.cpp:234
KBlog::MetaWeblog
A class that can be used for access to MetaWeblog blogs.
Definition: metaweblog.h:66
KBlog::BlogPost::summary
QString summary() const
Returns the summary.
Definition: blogpost.cpp:244
KBlog::BlogPost::creationDateTime
QDateTime creationDateTime() const
Returns the creation date time.
Definition: blogpost.cpp:306
KBlog::BlogPost::setTitle
void setTitle(const QString &title)
Sets the title.
Definition: blogpost.cpp:157
KBlog::Blog::ParsingError
A parsing error.
Definition: blog.h:104
KBlog::BlogPost::setPostId
void setPostId(const QString &postId)
Sets the post id value.
Definition: blogpost.cpp:147
QMap::keys
QList< Key > keys() const
QList::count
int count(const T &value) const
KBlog::BlogPost::additionalContent
QString additionalContent() const
Returns the additional content, (mt_text_more of MovableType API)
Definition: blogpost.cpp:184
QObject
KBlog::Blogger1::createPost
void createPost(KBlog::BlogPost *post) override
Create a new post on server.
Definition: blogger1.cpp:147
QList::isEmpty
bool isEmpty() const
KBlog::BlogPost::setAdditionalContent
void setAdditionalContent(const QString &additionalContent)
Sets the additional content, (mt_text_more of MovableType API)
Definition: blogpost.cpp:189
QString::isEmpty
bool isEmpty() const
movabletype.h
This file is part of the for accessing Blog Servers and defines the MovableType class.
KBlog::BlogPost::setContent
void setContent(const QString &content)
Sets the content.
Definition: blogpost.cpp:167
KBlog::BlogPost::Error
Status when an error on the server side occurred.
Definition: blogpost.h:407
KBlog::Blog::blogId
QString blogId() const
Returns the unique ID for the specific blog on the server.
Definition: blog.cpp:108
KBlog::BlogPost::setStatus
void setStatus(Status status)
Sets the status.
Definition: blogpost.cpp:331
KBlog::BlogPost::Modified
Status of a successfully modified post.
Definition: blogpost.h:401
KBlog::BlogPost::setTrackBackAllowed
void setTrackBackAllowed(bool allowTrackBacks)
Set whether track back should be allowed.
Definition: blogpost.cpp:239
QString
QList
KBlog::BlogPost::setSlug
void setSlug(const QString &slug)
Sets the Wordpress slug property! (will use to set post&#39;s permalink) Currently just wordpress support...
Definition: blogpost.cpp:199
KBlog::MovableType::MovableType
MovableType(const QUrl &server, QObject *parent=nullptr)
Create an object for Movable Type.
Definition: movabletype.cpp:38
KBlog::MovableType::interfaceName
QString interfaceName() const override
Returns the of the inherited object.
Definition: movabletype.cpp:56
QStringList
KBlog::MovableType
A class that can be used for access to Movable Type blogs.
Definition: movabletype.h:61
KBlog::BlogPost::setCommentAllowed
void setCommentAllowed(bool commentAllowed)
Set whether comments should be allowed.
Definition: blogpost.cpp:229
KBlog::BlogPost::setPrivate
void setPrivate(bool privatePost)
Sets the post to private viewings only.
Definition: blogpost.cpp:137
KBlog::BlogPost::content
QString content() const
Returns the content.
Definition: blogpost.cpp:162
QList::end
iterator end()
QUrl
QLatin1Char
QDateTime::isValid
bool isValid() const
i18n
QString i18n(const char *text, const TYPE &arg...)
KBlog
Namespace for blog related classes.
Definition: blog.h:53
KBlog::BlogPost::setPermaLink
void setPermaLink(const QUrl &permalink) const
Set the perma link path.
Definition: blogpost.cpp:219
QDateTime::isNull
bool isNull() const
KBlog::BlogPost
A class that represents a blog post on the server.
Definition: blogpost.h:65
QLatin1String
KBlog::BlogPost::setCategories
void setCategories(const QStringList &categories)
Sets the categories.
Definition: blogpost.cpp:301
KBlog::MovableType::createPost
void createPost(KBlog::BlogPost *post) override
Create a new post on server.
Definition: movabletype.cpp:111
KBlog::BlogPost::setSummary
void setSummary(const QString &summary)
Set the summary.
Definition: blogpost.cpp:249
KBlog::BlogPost::categories
QStringList categories() const
Returns the categories.
Definition: blogpost.cpp:296
QDateTime::toLocalTime
QDateTime toLocalTime() const
KBlog::BlogPost::setTags
void setTags(const QStringList &tags)
Set the tags list.
Definition: blogpost.cpp:259
KBlog::BlogPost::setModificationDateTime
void setModificationDateTime(const QDateTime &datetime)
Sets the modification time.
Definition: blogpost.cpp:321
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
QObject::connect
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::parent
QObject * parent() const
KBlog::MovableType::listRecentPosts
void listRecentPosts(int number) override
List recent posts on the server.
Definition: movabletype.cpp:61
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const
QList::begin
iterator begin()
KBlog::BlogPost::isPrivate
bool isPrivate() const
Returns if the post is published or not.
Definition: blogpost.cpp:132
KBlog::MetaWeblog::listedCategories
void listedCategories(const QList< QMap< QString, QString > > &categories)
This signal is emitted when the last category of the listCategories() job has been fetched...
KBlog::BlogPost::postId
QString postId() const
Returns the postId.
Definition: blogpost.cpp:142
QDateTime
QVariant
KBlog::BlogPost::setError
void setError(const QString &error)
Sets the error.
Definition: blogpost.cpp:341
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sat Dec 14 2019 02:13:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

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