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

KBlog Client Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kblog
gdata.cpp
1 /*
2  This file is part of the kblog library.
3 
4  Copyright (c) 2007 Christian Weilbach <christian_weilbach@web.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "gdata.h"
23 #include "gdata_p.h"
24 #include "blogpost.h"
25 #include "blogcomment.h"
26 
27 #include <syndication/loader.h>
28 #include <syndication/item.h>
29 #include <syndication/category.h>
30 
31 #include <kio/netaccess.h>
32 #include <kio/http.h>
33 #include <kio/job.h>
34 #include <KDebug>
35 #include <KLocalizedString>
36 #include <KDateTime>
37 
38 #include <QByteArray>
39 #include <QRegExp>
40 #include <QDomDocument>
41 
42 #define TIMEOUT 600
43 
44 using namespace KBlog;
45 
46 GData::GData( const KUrl &server, QObject *parent )
47  : Blog( server, *new GDataPrivate, parent )
48 {
49  kDebug();
50  setUrl( server );
51 }
52 
53 GData::~GData()
54 {
55  kDebug();
56 }
57 
58 QString GData::interfaceName() const
59 {
60  kDebug();
61  return QLatin1String( "Google Blogger Data" );
62 }
63 
64 QString GData::fullName() const
65 {
66  kDebug();
67  return d_func()->mFullName;
68 }
69 
70 void GData::setFullName( const QString &fullName )
71 {
72  kDebug();
73  Q_D( GData );
74  d->mFullName = fullName;
75 }
76 
77 QString GData::profileId() const
78 {
79  kDebug();
80  return d_func()->mProfileId;
81 }
82 
83 void GData::setProfileId( const QString &pid )
84 {
85  kDebug();
86  Q_D( GData );
87  d->mProfileId = pid;
88 }
89 
90 void GData::fetchProfileId()
91 {
92  kDebug();
93  QByteArray data;
94  KIO::StoredTransferJob *job = KIO::storedGet( url(), KIO::NoReload, KIO::HideProgressInfo );
95  KUrl blogUrl = url();
96  connect( job, SIGNAL(result(KJob*)),
97  this, SLOT(slotFetchProfileId(KJob*)) );
98 }
99 
100 void GData::listBlogs()
101 {
102  kDebug();
103  Syndication::Loader *loader = Syndication::Loader::create();
104  connect( loader,
105  SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
106  this,
107  SLOT(slotListBlogs(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
108  loader->loadFrom( QString::fromLatin1("http://www.blogger.com/feeds/%1/blogs").arg(profileId()) );
109 }
110 
111 void GData::listRecentPosts( const QStringList &labels, int number,
112  const KDateTime &upMinTime, const KDateTime &upMaxTime,
113  const KDateTime &pubMinTime, const KDateTime &pubMaxTime )
114 {
115  kDebug();
116  Q_D( GData );
117  QString urlString( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/posts/default") );
118  if ( ! labels.empty() ) {
119  urlString += QLatin1String("/-/") + labels.join( QLatin1String("/") );
120  }
121  kDebug() << "listRecentPosts()";
122  KUrl url( urlString );
123 
124  if ( !upMinTime.isNull() ) {
125  url.addQueryItem( QLatin1String("updated-min"), upMinTime.toString() );
126  }
127 
128  if ( !upMaxTime.isNull() ) {
129  url.addQueryItem( QLatin1String("updated-max"), upMaxTime.toString() );
130  }
131 
132  if ( !pubMinTime.isNull() ) {
133  url.addQueryItem( QLatin1String("published-min"), pubMinTime.toString() );
134  }
135 
136  if ( !pubMaxTime.isNull() ) {
137  url.addQueryItem( QLatin1String("published-max"), pubMaxTime.toString() );
138  }
139 
140  Syndication::Loader *loader = Syndication::Loader::create();
141  if ( number > 0 ) {
142  d->mListRecentPostsMap[ loader ] = number;
143  }
144  connect( loader,
145  SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
146  this,
147  SLOT(slotListRecentPosts(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
148  loader->loadFrom( url.url() );
149 }
150 
151 void GData::listRecentPosts( int number )
152 {
153  kDebug();
154  listRecentPosts( QStringList(), number );
155 }
156 
157 void GData::listComments( KBlog::BlogPost *post )
158 {
159  kDebug();
160  Q_D( GData );
161  Syndication::Loader *loader = Syndication::Loader::create();
162  d->mListCommentsMap[ loader ] = post;
163  connect( loader,
164  SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
165  this,
166  SLOT(slotListComments(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
167  loader->loadFrom( QString(QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1Char('/') +
168  post->postId() + QLatin1String("/comments/default")) );
169 }
170 
171 void GData::listAllComments()
172 {
173  kDebug();
174  Syndication::Loader *loader = Syndication::Loader::create();
175  connect( loader,
176  SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
177  this,
178  SLOT(slotListAllComments(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
179  loader->loadFrom( QString::fromLatin1("http://www.blogger.com/feeds/%1/comments/default").arg(blogId()) );
180 }
181 
182 void GData::fetchPost( KBlog::BlogPost *post )
183 {
184  kDebug();
185  Q_D( GData );
186 
187  if ( !post ) {
188  kError() << "post is null pointer";
189  return;
190  }
191 
192  kDebug();
193  Syndication::Loader *loader = Syndication::Loader::create();
194  d->mFetchPostMap[ loader ] = post;
195  connect( loader,
196  SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
197  this,
198  SLOT(slotFetchPost(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
199  loader->loadFrom( QString::fromLatin1("http://www.blogger.com/feeds/%1/posts/default").arg(blogId()));
200 }
201 
202 void GData::modifyPost( KBlog::BlogPost *post )
203 {
204  kDebug();
205  Q_D( GData );
206 
207  if ( !post ) {
208  kError() << "post is null pointer";
209  return;
210  }
211 
212  if ( !d->authenticate() ) {
213  kError() << "Authentication failed.";
214  emit errorPost( Atom, i18n( "Authentication failed." ), post );
215  return;
216  }
217 
218  QString atomMarkup = QLatin1String("<entry xmlns='http://www.w3.org/2005/Atom'>");
219  atomMarkup += QLatin1String("<id>tag:blogger.com,1999:blog-") + blogId();
220  atomMarkup += QLatin1String(".post-") + post->postId() + QLatin1String("</id>");
221  atomMarkup += QLatin1String("<published>") + post->creationDateTime().toString() + QLatin1String("</published>");
222  atomMarkup += QLatin1String("<updated>") + post->modificationDateTime().toString() + QLatin1String("</updated>");
223  atomMarkup += QLatin1String("<title type='text'>") + post->title() + QLatin1String("</title>");
224  if ( post->isPrivate() ) {
225  atomMarkup += QLatin1String("<app:control xmlns:app='http://purl.org/atom/app#'>");
226  atomMarkup += QLatin1String("<app:draft>yes</app:draft></app:control>");
227  }
228  atomMarkup += QLatin1String("<content type='xhtml'>");
229  atomMarkup += QLatin1String("<div xmlns='http://www.w3.org/1999/xhtml'>");
230  atomMarkup += post->content();
231  atomMarkup += QLatin1String("</div></content>");
232  QList<QString>::ConstIterator it = post->tags().constBegin();
233  QList<QString>::ConstIterator end = post->tags().constEnd();
234  for ( ; it != end; ++it ) {
235  atomMarkup += QLatin1String("<category scheme='http://www.blogger.com/atom/ns#' term='") + ( *it ) + QLatin1String("' />");
236  }
237  atomMarkup += QLatin1String("<author>");
238  if ( !fullName().isEmpty() ) {
239  atomMarkup += QLatin1String("<name>") + fullName() + QLatin1String("</name>");
240  }
241  atomMarkup += QLatin1String("<email>") + username() + QLatin1String("</email>");
242  atomMarkup += QLatin1String("</author>");
243  atomMarkup += QLatin1String("</entry>");
244  QByteArray postData;
245  QDataStream stream( &postData, QIODevice::WriteOnly );
246  stream.writeRawData( atomMarkup.toUtf8(), atomMarkup.toUtf8().length() );
247 
248  KIO::StoredTransferJob *job = KIO::storedHttpPost( postData,
249  KUrl( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/posts/default/") + post->postId() ),
250  KIO::HideProgressInfo );
251 
252  Q_ASSERT( job );
253 
254  d->mModifyPostMap[ job ] = post;
255 
256  job->addMetaData( QLatin1String("content-type"), QLatin1String("Content-Type: application/atom+xml; charset=utf-8") );
257  job->addMetaData( QLatin1String("ConnectTimeout"), QLatin1String("50") );
258  job->addMetaData( QLatin1String("UserAgent"), userAgent() );
259  job->addMetaData( QLatin1String("customHTTPHeader"),
260  QLatin1String("Authorization: GoogleLogin auth=") + d->mAuthenticationString +
261  QLatin1String("\r\nX-HTTP-Method-Override: PUT") );
262 
263  connect( job, SIGNAL(result(KJob*)),
264  this, SLOT(slotModifyPost(KJob*)) );
265 }
266 
267 void GData::createPost( KBlog::BlogPost *post )
268 {
269  kDebug();
270  Q_D( GData );
271 
272  if ( !post ) {
273  kError() << "post is null pointer";
274  return;
275  }
276 
277  if ( !d->authenticate() ) {
278  kError() << "Authentication failed.";
279  emit errorPost( Atom, i18n( "Authentication failed." ), post );
280  return;
281  }
282 
283  QString atomMarkup = QLatin1String("<entry xmlns='http://www.w3.org/2005/Atom'>");
284  atomMarkup += QLatin1String("<title type='text'>") + post->title() + QLatin1String("</title>");
285  if ( post->isPrivate() ) {
286  atomMarkup += QLatin1String("<app:control xmlns:app='http://purl.org/atom/app#'>");
287  atomMarkup += QLatin1String("<app:draft>yes</app:draft></app:control>");
288  }
289  atomMarkup += QLatin1String("<content type='xhtml'>");
290  atomMarkup += QLatin1String("<div xmlns='http://www.w3.org/1999/xhtml'>");
291  atomMarkup += post->content(); // FIXME check for Utf
292  atomMarkup += QLatin1String("</div></content>");
293  QList<QString>::ConstIterator it = post->tags().constBegin();
294  QList<QString>::ConstIterator end = post->tags().constEnd();
295  for ( ; it != end; ++it ) {
296  atomMarkup += QLatin1String("<category scheme='http://www.blogger.com/atom/ns#' term='") + ( *it ) + QLatin1String("' />");
297  }
298  atomMarkup += QLatin1String("<author>");
299  if ( !fullName().isEmpty() ) {
300  atomMarkup += QLatin1String("<name>") + fullName() + QLatin1String("</name>");
301  }
302  atomMarkup += QLatin1String("<email>") + username() + QLatin1String("</email>");
303  atomMarkup += QLatin1String("</author>");
304  atomMarkup += QLatin1String("</entry>");
305 
306  QByteArray postData;
307  QDataStream stream( &postData, QIODevice::WriteOnly );
308  stream.writeRawData( atomMarkup.toUtf8(), atomMarkup.toUtf8().length() );
309 
310  KIO::StoredTransferJob *job = KIO::storedHttpPost( postData,
311  KUrl( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/posts/default") ),
312  KIO::HideProgressInfo );
313 
314  Q_ASSERT ( job );
315  d->mCreatePostMap[ job ] = post;
316 
317  job->addMetaData( QLatin1String("content-type"), QLatin1String("Content-Type: application/atom+xml; charset=utf-8") );
318  job->addMetaData( QLatin1String("ConnectTimeout"), QLatin1String("50") );
319  job->addMetaData( QLatin1String("UserAgent"), userAgent() );
320  job->addMetaData( QLatin1String("customHTTPHeader"),
321  QLatin1String("Authorization: GoogleLogin auth=") + d->mAuthenticationString );
322 
323  connect( job, SIGNAL(result(KJob*)),
324  this, SLOT(slotCreatePost(KJob*)) );
325 }
326 
327 void GData::removePost( KBlog::BlogPost *post )
328 {
329  kDebug();
330  Q_D( GData );
331 
332  if ( !post ) {
333  kError() << "post is null pointer";
334  return;
335  }
336 
337  if ( !d->authenticate() ) {
338  kError() << "Authentication failed.";
339  emit errorPost( Atom, i18n( "Authentication failed." ), post );
340  return;
341  }
342 
343  QByteArray postData;
344 
345  KIO::StoredTransferJob *job = KIO::storedHttpPost( postData,
346  KUrl( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/posts/default/") + post->postId() ),
347  KIO::HideProgressInfo );
348 
349  d->mRemovePostMap[ job ] = post;
350 
351  if ( !job ) {
352  kWarning() << "Unable to create KIO job for http://www.blogger.com/feeds/"
353  << blogId() << QLatin1String("/posts/default/") + post->postId();
354  }
355 
356  job->addMetaData( QLatin1String("ConnectTimeout"), QLatin1String("50") );
357  job->addMetaData( QLatin1String("UserAgent"), userAgent() );
358  job->addMetaData( QLatin1String("customHTTPHeader"),
359  QLatin1String("Authorization: GoogleLogin auth=") + d->mAuthenticationString +
360  QLatin1String("\r\nX-HTTP-Method-Override: DELETE") );
361 
362  connect( job, SIGNAL(result(KJob*)),
363  this, SLOT(slotRemovePost(KJob*)) );
364 }
365 
366 void GData::createComment( KBlog::BlogPost *post, KBlog::BlogComment *comment )
367 {
368  kDebug();
369 
370  if ( !comment ) {
371  kError() << "comment is null pointer";
372  return;
373  }
374 
375  if ( !post ) {
376  kError() << "post is null pointer";
377  return;
378  }
379 
380  Q_D( GData );
381  if ( !d->authenticate() ) {
382  kError() << "Authentication failed.";
383  emit errorComment( Atom, i18n( "Authentication failed." ), post, comment );
384  return;
385  }
386  QString atomMarkup = QLatin1String("<entry xmlns='http://www.w3.org/2005/Atom'>");
387  atomMarkup += QLatin1String("<title type=\"text\">") + comment->title() + QLatin1String("</title>");
388  atomMarkup += QLatin1String("<content type=\"html\">") + comment->content() + QLatin1String("</content>");
389  atomMarkup += QLatin1String("<author>");
390  atomMarkup += QLatin1String("<name>") + comment->name() + QLatin1String("</name>");
391  atomMarkup += QLatin1String("<email>") + comment->email() + QLatin1String("</email>");
392  atomMarkup += QLatin1String("</author></entry>");
393 
394  QByteArray postData;
395  kDebug() << postData;
396  QDataStream stream( &postData, QIODevice::WriteOnly );
397  stream.writeRawData( atomMarkup.toUtf8(), atomMarkup.toUtf8().length() );
398 
399  KIO::StoredTransferJob *job = KIO::storedHttpPost( postData,
400  KUrl( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/") + post->postId() + QLatin1String("/comments/default") ),
401  KIO::HideProgressInfo );
402 
403  d->mCreateCommentMap[ job ][post] = comment;
404 
405  if ( !job ) {
406  kWarning() << "Unable to create KIO job for http://www.blogger.com/feeds/"
407  << blogId() << "/" << post->postId() << "/comments/default";
408  }
409 
410  job->addMetaData( QLatin1String("content-type"), QLatin1String("Content-Type: application/atom+xml; charset=utf-8") );
411  job->addMetaData( QLatin1String("ConnectTimeout"), QLatin1String("50") );
412  job->addMetaData( QLatin1String("customHTTPHeader"),
413  QLatin1String("Authorization: GoogleLogin auth=") + d->mAuthenticationString );
414  job->addMetaData( QLatin1String("UserAgent"), userAgent() );
415 
416  connect( job, SIGNAL(result(KJob*)),
417  this, SLOT(slotCreateComment(KJob*)) );
418 }
419 
420 void GData::removeComment( KBlog::BlogPost *post, KBlog::BlogComment *comment )
421 {
422  kDebug();
423  Q_D( GData );
424  kDebug();
425 
426  if ( !comment ) {
427  kError() << "comment is null pointer";
428  return;
429  }
430 
431  if ( !post ) {
432  kError() << "post is null pointer";
433  return;
434  }
435 
436  if ( !d->authenticate() ) {
437  kError() << "Authentication failed.";
438  emit errorComment( Atom, i18n( "Authentication failed." ), post, comment );
439  return;
440  }
441 
442  QByteArray postData;
443 
444  KIO::StoredTransferJob *job = KIO::storedHttpPost(postData,
445  KUrl( QLatin1String("http://www.blogger.com/feeds/") + blogId() + QLatin1String("/") + post->postId() +
446  QLatin1String("/comments/default/") + comment->commentId() ), KIO::HideProgressInfo );
447  d->mRemoveCommentMap[ job ][ post ] = comment;
448 
449  if ( !job ) {
450  kWarning() << "Unable to create KIO job for http://www.blogger.com/feeds/"
451  << blogId() << post->postId()
452  << "/comments/default/" << comment->commentId();
453  }
454 
455  job->addMetaData( QLatin1String("ConnectTimeout"), QLatin1String("50") );
456  job->addMetaData( QLatin1String("UserAgent"), userAgent() );
457  job->addMetaData( QLatin1String("customHTTPHeader"),
458  QLatin1String("Authorization: GoogleLogin auth=") +
459  d->mAuthenticationString + QLatin1String("\r\nX-HTTP-Method-Override: DELETE") );
460 
461  connect( job, SIGNAL(result(KJob*)),
462  this, SLOT(slotRemoveComment(KJob*)) );
463 }
464 
465 GDataPrivate::GDataPrivate():mAuthenticationString(), mAuthenticationTime()
466 {
467  kDebug();
468 }
469 
470 GDataPrivate::~GDataPrivate()
471 {
472  kDebug();
473 }
474 
475 bool GDataPrivate::authenticate()
476 {
477  kDebug();
478  Q_Q( GData );
479  QByteArray data;
480  KUrl authGateway( QLatin1String("https://www.google.com/accounts/ClientLogin") );
481  authGateway.addQueryItem( QLatin1String("Email"), q->username() );
482  authGateway.addQueryItem( QLatin1String("Passwd"), q->password() );
483  authGateway.addQueryItem( QLatin1String("source"), q->userAgent() );
484  authGateway.addQueryItem( QLatin1String("service"), QLatin1String("blogger") );
485  if ( !mAuthenticationTime.isValid() ||
486  QDateTime::currentDateTime().toTime_t() - mAuthenticationTime.toTime_t() > TIMEOUT ||
487  mAuthenticationString.isEmpty() ) {
488  KIO::Job *job = KIO::http_post( authGateway, QByteArray(), KIO::HideProgressInfo );
489  if ( KIO::NetAccess::synchronousRun( job, (QWidget*)0, &data, &authGateway ) ) {
490  QRegExp rx( QLatin1String("Auth=(.+)") );
491  if ( rx.indexIn( QLatin1String(data) ) != -1 ) {
492  kDebug() << "RegExp got authentication string:" << rx.cap( 1 );
493  mAuthenticationString = rx.cap( 1 );
494  mAuthenticationTime = QDateTime::currentDateTime();
495  return true;
496  }
497  }
498  return false;
499  }
500  return true;
501 }
502 
503 void GDataPrivate::slotFetchProfileId( KJob *job )
504 {
505  kDebug();
506  if ( !job ) {
507  kError() << "job is a null pointer.";
508  return;
509  }
510  Q_Q( GData );
511  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
512  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
513  if ( !job->error() ) {
514  QRegExp pid( QLatin1String("http://www.blogger.com/profile/(\\d+)") );
515  if ( pid.indexIn( data ) != -1 ) {
516  q->setProfileId( pid.cap( 1 ) );
517  kDebug() << "QRegExp bid( 'http://www.blogger.com/profile/(\\d+)' matches" << pid.cap( 1 );
518  emit q->fetchedProfileId( pid.cap( 1 ) );
519  } else {
520  kError() << "QRegExp bid( 'http://www.blogger.com/profile/(\\d+)' "
521  << " could not regexp the Profile ID";
522  emit q->error( GData::Other, i18n( "Could not regexp the Profile ID." ) );
523  emit q->fetchedProfileId( QString() );
524  }
525  } else {
526  kError() << "Job Error: " << job->errorString();
527  emit q->error( GData::Other, job->errorString() );
528  emit q->fetchedProfileId( QString() );
529  }
530 }
531 
532 void GDataPrivate::slotListBlogs( Syndication::Loader *loader,
533  Syndication::FeedPtr feed,
534  Syndication::ErrorCode status ) {
535  kDebug();
536  Q_Q( GData );
537  if ( !loader ) {
538  kError() << "loader is a null pointer.";
539  return;
540  }
541  if ( status != Syndication::Success ) {
542  emit q->error( GData::Atom, i18n( "Could not get blogs." ) );
543  return;
544  }
545 
546  QList<QMap<QString,QString> > blogsList;
547 
548  QList<Syndication::ItemPtr> items = feed->items();
549  QList<Syndication::ItemPtr>::ConstIterator it = items.constBegin();
550  QList<Syndication::ItemPtr>::ConstIterator end = items.constEnd();
551  for ( ; it != end; ++it ) {
552  QRegExp rx( QLatin1String("blog-(\\d+)") );
553  QMap<QString,QString> blogInfo;
554  if ( rx.indexIn( ( *it )->id() ) != -1 ) {
555  kDebug() << "QRegExp rx( 'blog-(\\d+)' matches" << rx.cap( 1 );
556  blogInfo[QLatin1String("id")] = rx.cap( 1 );
557  blogInfo[QLatin1String("title")] = ( *it )->title();
558  blogInfo[QLatin1String("url")] = ( *it )->link();
559  blogInfo[QLatin1String("summary")] = ( *it )->description(); //TODO fix/add more
560  blogsList << blogInfo;
561  } else {
562  kError() << "QRegExp rx( 'blog-(\\d+)' does not match anything in:"
563  << ( *it )->id();
564  emit q->error( GData::Other, i18n( "Could not regexp the blog id path." ) );
565  }
566  }
567  kDebug() << "Emitting listedBlogs(); ";
568  emit q->listedBlogs( blogsList );
569 }
570 
571 void GDataPrivate::slotListComments( Syndication::Loader *loader,
572  Syndication::FeedPtr feed,
573  Syndication::ErrorCode status )
574 {
575  kDebug();
576  Q_Q( GData );
577  if ( !loader ) {
578  kError() << "loader is a null pointer.";
579  return;
580  }
581  BlogPost *post = mListCommentsMap[ loader ];
582  mListCommentsMap.remove( loader );
583 
584  if ( status != Syndication::Success ) {
585  emit q->errorPost( GData::Atom, i18n( "Could not get comments." ), post );
586  return;
587  }
588 
589  QList<KBlog::BlogComment> commentList;
590 
591  QList<Syndication::ItemPtr> items = feed->items();
592  QList<Syndication::ItemPtr>::ConstIterator it = items.constBegin();
593  QList<Syndication::ItemPtr>::ConstIterator end = items.constEnd();
594  for ( ; it != end; ++it ) {
595  BlogComment comment;
596  QRegExp rx( QLatin1String("post-(\\d+)") );
597  if ( rx.indexIn( ( *it )->id() ) == -1 ) {
598  kError() << "QRegExp rx( 'post-(\\d+)' does not match" << rx.cap( 1 );
599  emit q->error( GData::Other, i18n( "Could not regexp the comment id path." ) );
600  } else {
601  comment.setCommentId( rx.cap( 1 ) );
602  }
603  kDebug() << "QRegExp rx( 'post-(\\d+)' matches" << rx.cap( 1 );
604  comment.setTitle( ( *it )->title() );
605  comment.setContent( ( *it )->content() );
606 // FIXME: assuming UTC for now
607  comment.setCreationDateTime(
608  KDateTime( QDateTime::fromTime_t( ( *it )->datePublished() ),
609  KDateTime::Spec::UTC() ) );
610  comment.setModificationDateTime(
611  KDateTime( QDateTime::fromTime_t( ( *it )->dateUpdated() ),
612  KDateTime::Spec::UTC() ) );
613  commentList.append( comment );
614  }
615  kDebug() << "Emitting listedComments()";
616  emit q->listedComments( post, commentList );
617 }
618 
619 void GDataPrivate::slotListAllComments( Syndication::Loader *loader,
620  Syndication::FeedPtr feed,
621  Syndication::ErrorCode status )
622 {
623  kDebug();
624  Q_Q( GData );
625  if ( !loader ) {
626  kError() << "loader is a null pointer.";
627  return;
628  }
629 
630  if ( status != Syndication::Success ) {
631  emit q->error( GData::Atom, i18n( "Could not get comments." ) );
632  return;
633  }
634 
635  QList<KBlog::BlogComment> commentList;
636 
637  QList<Syndication::ItemPtr> items = feed->items();
638  QList<Syndication::ItemPtr>::ConstIterator it = items.constBegin();
639  QList<Syndication::ItemPtr>::ConstIterator end = items.constEnd();
640  for ( ; it != end; ++it ) {
641  BlogComment comment;
642  QRegExp rx( QLatin1String("post-(\\d+)") );
643  if ( rx.indexIn( ( *it )->id() ) == -1 ) {
644  kError() << "QRegExp rx( 'post-(\\d+)' does not match" << rx.cap( 1 );
645  emit q->error( GData::Other, i18n( "Could not regexp the comment id path." ) );
646  } else {
647  comment.setCommentId( rx.cap( 1 ) );
648  }
649 
650  kDebug() << "QRegExp rx( 'post-(\\d+)' matches" << rx.cap( 1 );
651  comment.setTitle( ( *it )->title() );
652  comment.setContent( ( *it )->content() );
653 // FIXME: assuming UTC for now
654  comment.setCreationDateTime(
655  KDateTime( QDateTime::fromTime_t( ( *it )->datePublished() ),
656  KDateTime::Spec::UTC() ) );
657  comment.setModificationDateTime(
658  KDateTime( QDateTime::fromTime_t( ( *it )->dateUpdated() ),
659  KDateTime::Spec::UTC() ) );
660  commentList.append( comment );
661  }
662  kDebug() << "Emitting listedAllComments()";
663  emit q->listedAllComments( commentList );
664 }
665 
666 void GDataPrivate::slotListRecentPosts( Syndication::Loader *loader,
667  Syndication::FeedPtr feed,
668  Syndication::ErrorCode status ) {
669  kDebug();
670  Q_Q( GData );
671  if ( !loader ) {
672  kError() << "loader is a null pointer.";
673  return;
674  }
675 
676  if ( status != Syndication::Success ) {
677  emit q->error( GData::Atom, i18n( "Could not get posts." ) );
678  return;
679  }
680  int number = 0;
681 
682  if ( mListRecentPostsMap.contains( loader ) ) {
683  number = mListRecentPostsMap[ loader ];
684  }
685  mListRecentPostsMap.remove( loader );
686 
687  QList<KBlog::BlogPost> postList;
688 
689  QList<Syndication::ItemPtr> items = feed->items();
690  QList<Syndication::ItemPtr>::ConstIterator it = items.constBegin();
691  QList<Syndication::ItemPtr>::ConstIterator end = items.constEnd();
692  for ( ; it != end; ++it ) {
693  BlogPost post;
694  QRegExp rx( QLatin1String("post-(\\d+)") );
695  if ( rx.indexIn( ( *it )->id() ) == -1 ) {
696  kError() << "QRegExp rx( 'post-(\\d+)' does not match" << rx.cap( 1 );
697  emit q->error( GData::Other, i18n( "Could not regexp the post id path." ) );
698  } else {
699  post.setPostId( rx.cap( 1 ) );
700  }
701 
702  kDebug() << "QRegExp rx( 'post-(\\d+)' matches" << rx.cap( 1 );
703  post.setTitle( ( *it )->title() );
704  post.setContent( ( *it )->content() );
705  post.setLink( ( *it )->link() );
706  QStringList labels;
707  int catCount = ( *it )->categories().count();
708  QList< Syndication::CategoryPtr > cats = ( *it )->categories();
709  for ( int i=0; i < catCount; ++i ) {
710  if ( cats[i].get()->label().isEmpty() ) {
711  labels.append( cats[i].get()->term() );
712  } else {
713  labels.append( cats[i].get()->label() );
714  }
715  }
716  post.setTags( labels );
717 // FIXME: assuming UTC for now
718  post.setCreationDateTime(
719  KDateTime( QDateTime::fromTime_t( ( *it )->datePublished() ),
720  KDateTime::Spec::UTC() ).toLocalZone() );
721  post.setModificationDateTime(
722  KDateTime( QDateTime::fromTime_t( ( *it )->dateUpdated() ),
723  KDateTime::Spec::UTC() ).toLocalZone() );
724  post.setStatus( BlogPost::Fetched );
725  postList.append( post );
726  if ( number-- == 0 ) {
727  break;
728  }
729  }
730  kDebug() << "Emitting listedRecentPosts()";
731  emit q->listedRecentPosts( postList );
732 }
733 
734 void GDataPrivate::slotFetchPost( Syndication::Loader *loader,
735  Syndication::FeedPtr feed,
736  Syndication::ErrorCode status )
737 {
738  kDebug();
739  Q_Q( GData );
740  if ( !loader ) {
741  kError() << "loader is a null pointer.";
742  return;
743  }
744 
745  bool success = false;
746 
747  BlogPost *post = mFetchPostMap.take( loader );
748  kError() << "Post" << post;
749  post->postId();
750 
751  if ( status != Syndication::Success ) {
752  emit q->errorPost( GData::Atom, i18n( "Could not get posts." ), post );
753  return;
754  }
755 
756  QString postId = post->postId();
757  QList<Syndication::ItemPtr> items = feed->items();
758  QList<Syndication::ItemPtr>::ConstIterator it = items.constBegin();
759  QList<Syndication::ItemPtr>::ConstIterator end = items.constEnd();
760  for ( ; it != end; ++it ) {
761  QRegExp rx( QLatin1String("post-(\\d+)") );
762  if ( rx.indexIn( ( *it )->id() ) != -1 &&
763  rx.cap( 1 ) == postId ) {
764  kDebug() << "QRegExp rx( 'post-(\\d+)' matches" << rx.cap( 1 );
765  post->setPostId( rx.cap( 1 ) );
766  post->setTitle( ( *it )->title() );
767  post->setContent( ( *it )->content() );
768  post->setStatus( BlogPost::Fetched );
769  post->setLink( ( *it )->link() );
770  post->setCreationDateTime(
771  KDateTime( QDateTime::fromTime_t( ( *it )->datePublished() ),
772  KDateTime::Spec::UTC() ).toLocalZone() );
773  post->setModificationDateTime(
774  KDateTime( QDateTime::fromTime_t( ( *it )->dateUpdated() ),
775  KDateTime::Spec::UTC() ).toLocalZone() );
776  kDebug() << "Emitting fetchedPost( postId=" << postId << ");";
777  success = true;
778  emit q->fetchedPost( post );
779  break;
780  }
781  }
782  if ( !success ) {
783  kError() << "QRegExp rx( 'post-(\\d+)' does not match"
784  << mFetchPostMap[ loader ]->postId() << ".";
785  emit q->errorPost( GData::Other, i18n( "Could not regexp the blog id path." ), post );
786  }
787 }
788 
789 void GDataPrivate::slotCreatePost( KJob *job )
790 {
791  kDebug();
792  if ( !job ) {
793  kError() << "job is a null pointer.";
794  return;
795  }
796  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
797  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
798 
799  Q_Q( GData );
800 
801  KBlog::BlogPost *post = mCreatePostMap[ job ];
802  mCreatePostMap.remove( job );
803 
804  if ( job->error() != 0 ) {
805  kError() << "slotCreatePost error:" << job->errorString();
806  emit q->errorPost( GData::Atom, job->errorString(), post );
807  return;
808  }
809 
810  QRegExp rxId( QLatin1String("post-(\\d+)") ); //FIXME check and do better handling, esp the creation date time
811  if ( rxId.indexIn( data ) == -1 ) {
812  kError() << "Could not regexp the id out of the result:" << data;
813  emit q->errorPost( GData::Atom,
814  i18n( "Could not regexp the id out of the result." ), post );
815  return;
816  }
817  kDebug() << "QRegExp rx( 'post-(\\d+)' ) matches" << rxId.cap( 1 );
818 
819  QRegExp rxPub( QLatin1String("<published>(.+)</published>") );
820  if ( rxPub.indexIn( data ) == -1 ) {
821  kError() << "Could not regexp the published time out of the result:" << data;
822  emit q->errorPost( GData::Atom,
823  i18n( "Could not regexp the published time out of the result." ), post );
824  return;
825  }
826  kDebug() << "QRegExp rx( '<published>(.+)</published>' ) matches" << rxPub.cap( 1 );
827 
828  QRegExp rxUp( QLatin1String("<updated>(.+)</updated>") );
829  if ( rxUp.indexIn( data ) == -1 ) {
830  kError() << "Could not regexp the update time out of the result:" << data;
831  emit q->errorPost( GData::Atom,
832  i18n( "Could not regexp the update time out of the result." ), post );
833  return;
834  }
835  kDebug() << "QRegExp rx( '<updated>(.+)</updated>' ) matches" << rxUp.cap( 1 );
836 
837  post->setPostId( rxId.cap( 1 ) );
838  post->setCreationDateTime( KDateTime().fromString( rxPub.cap( 1 ) ).toLocalZone() );
839  post->setModificationDateTime( KDateTime().fromString( rxUp.cap( 1 ) ) );
840  post->setStatus( BlogPost::Created );
841  kDebug() << "Emitting createdPost()";
842  emit q->createdPost( post );
843 }
844 
845 void GDataPrivate::slotModifyPost( KJob *job )
846 {
847  kDebug();
848  if ( !job ) {
849  kError() << "job is a null pointer.";
850  return;
851  }
852  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
853  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
854 
855  KBlog::BlogPost *post = mModifyPostMap[ job ];
856  mModifyPostMap.remove( job );
857  Q_Q( GData );
858  if ( job->error() != 0 ) {
859  kError() << "slotModifyPost error:" << job->errorString();
860  emit q->errorPost( GData::Atom, job->errorString(), post );
861  return;
862  }
863 
864  QRegExp rxId( QLatin1String("post-(\\d+)") ); //FIXME check and do better handling, esp creation date time
865  if ( rxId.indexIn( data ) == -1 ) {
866  kError() << "Could not regexp the id out of the result:" << data;
867  emit q->errorPost( GData::Atom,
868  i18n( "Could not regexp the id out of the result." ), post );
869  return;
870  }
871  kDebug() << "QRegExp rx( 'post-(\\d+)' ) matches" << rxId.cap( 1 );
872 
873  QRegExp rxPub( QLatin1String("<published>(.+)</published>") );
874  if ( rxPub.indexIn( data ) == -1 ) {
875  kError() << "Could not regexp the published time out of the result:" << data;
876  emit q->errorPost( GData::Atom,
877  i18n( "Could not regexp the published time out of the result." ), post );
878  return;
879  }
880  kDebug() << "QRegExp rx( '<published>(.+)</published>' ) matches" << rxPub.cap( 1 );
881 
882  QRegExp rxUp( QLatin1String("<updated>(.+)</updated>") );
883  if ( rxUp.indexIn( data ) == -1 ) {
884  kError() << "Could not regexp the update time out of the result:" << data;
885  emit q->errorPost( GData::Atom,
886  i18n( "Could not regexp the update time out of the result." ), post );
887  return;
888  }
889  kDebug() << "QRegExp rx( '<updated>(.+)</updated>' ) matches" << rxUp.cap( 1 );
890  post->setPostId( rxId.cap( 1 ) );
891  post->setCreationDateTime( KDateTime().fromString( rxPub.cap( 1 ) ) );
892  post->setModificationDateTime( KDateTime().fromString( rxUp.cap( 1 ) ) );
893  post->setStatus( BlogPost::Modified );
894  emit q->modifiedPost( post );
895 }
896 
897 void GDataPrivate::slotRemovePost( KJob *job )
898 {
899  kDebug();
900  if ( !job ) {
901  kError() << "job is a null pointer.";
902  return;
903  }
904  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
905  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
906 
907  KBlog::BlogPost *post = mRemovePostMap[ job ];
908  mRemovePostMap.remove( job );
909  Q_Q( GData );
910  if ( job->error() != 0 ) {
911  kError() << "slotRemovePost error:" << job->errorString();
912  emit q->errorPost( GData::Atom, job->errorString(), post );
913  return;
914  }
915 
916  post->setStatus( BlogPost::Removed );
917  kDebug() << "Emitting removedPost()";
918  emit q->removedPost( post );
919 }
920 
921 void GDataPrivate::slotCreateComment( KJob *job )
922 {
923  kDebug();
924  if ( !job ) {
925  kError() << "job is a null pointer.";
926  return;
927  }
928  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
929  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
930  kDebug() << "Dump data: " << data;
931 
932  Q_Q( GData );
933 
934  KBlog::BlogComment *comment = mCreateCommentMap[ job ].values().first();
935  KBlog::BlogPost *post = mCreateCommentMap[ job ].keys().first();
936  mCreateCommentMap.remove( job );
937 
938  if ( job->error() != 0 ) {
939  kError() << "slotCreateComment error:" << job->errorString();
940  emit q->errorComment( GData::Atom, job->errorString(), post, comment );
941  return;
942  }
943 
944 // TODO check for result and fit appropriately
945  QRegExp rxId( QLatin1String("post-(\\d+)") );
946  if ( rxId.indexIn( data ) == -1 ) {
947  kError() << "Could not regexp the id out of the result:" << data;
948  emit q->errorPost( GData::Atom,
949  i18n( "Could not regexp the id out of the result." ), post );
950  return;
951  }
952  kDebug() << "QRegExp rx( 'post-(\\d+)' ) matches" << rxId.cap( 1 );
953 
954  QRegExp rxPub( QLatin1String("<published>(.+)</published>") );
955  if ( rxPub.indexIn( data ) == -1 ) {
956  kError() << "Could not regexp the published time out of the result:" << data;
957  emit q->errorPost( GData::Atom,
958  i18n( "Could not regexp the published time out of the result." ), post );
959  return;
960  }
961  kDebug() << "QRegExp rx( '<published>(.+)</published>' ) matches" << rxPub.cap( 1 );
962 
963  QRegExp rxUp( QLatin1String("<updated>(.+)</updated>") );
964  if ( rxUp.indexIn( data ) == -1 ) {
965  kError() << "Could not regexp the update time out of the result:" << data;
966  emit q->errorPost( GData::Atom,
967  i18n( "Could not regexp the update time out of the result." ), post );
968  return;
969  }
970  kDebug() << "QRegExp rx( '<updated>(.+)</updated>' ) matches" << rxUp.cap( 1 );
971  comment->setCommentId( rxId.cap( 1 ) );
972  comment->setCreationDateTime( KDateTime().fromString( rxPub.cap( 1 ) ) );
973  comment->setModificationDateTime( KDateTime().fromString( rxUp.cap( 1 ) ) );
974  comment->setStatus( BlogComment::Created );
975  kDebug() << "Emitting createdComment()";
976  emit q->createdComment( post, comment );
977 }
978 
979 void GDataPrivate::slotRemoveComment( KJob *job )
980 {
981  kDebug();
982  if ( !job ) {
983  kError() << "job is a null pointer.";
984  return;
985  }
986  KIO::StoredTransferJob *stj = qobject_cast<KIO::StoredTransferJob*>( job );
987  const QString data = QString::fromUtf8( stj->data(), stj->data().size() );
988 
989  Q_Q( GData );
990 
991  KBlog::BlogComment *comment = mRemoveCommentMap[ job ].values().first();
992  KBlog::BlogPost *post = mRemoveCommentMap[ job ].keys().first();
993  mRemoveCommentMap.remove( job );
994 
995  if ( job->error() != 0 ) {
996  kError() << "slotRemoveComment error:" << job->errorString();
997  emit q->errorComment( GData::Atom, job->errorString(), post, comment );
998  return;
999  }
1000 
1001  comment->setStatus( BlogComment::Created );
1002  kDebug() << "Emitting removedComment()";
1003  emit q->removedComment( post, comment );
1004 }
1005 
1006 #include "moc_gdata.cpp"
KBlog::BlogPost::title
QString title() const
Returns the title.
Definition: blogpost.cpp:154
KBlog::BlogComment::setStatus
void setStatus(Status status)
Sets the status.
Definition: blogcomment.cpp:146
KBlog::Blog::setUrl
virtual void setUrl(const KUrl &url)
Sets the URL for the blog's XML-RPC interface.
Definition: blog.cpp:115
KBlog::BlogPost::creationDateTime
KDateTime creationDateTime() const
Returns the creation date time.
Definition: blogpost.cpp:308
KBlog::GData::modifyPost
void modifyPost(KBlog::BlogPost *post)
Modify a post on server.
Definition: gdata.cpp:202
KBlog::BlogPost::Fetched
Status of a successfully fetched post.
Definition: blogpost.h:398
KBlog::BlogPost::setLink
void setLink(const KUrl &link) const
Set the link path.
Definition: blogpost.cpp:211
KBlog::GData::removePost
void removePost(KBlog::BlogPost *post)
Remove a post from the server.
Definition: gdata.cpp:327
KBlog::GData::listBlogs
virtual void listBlogs()
List the blogs available for this authentication on the server.
Definition: gdata.cpp:100
KBlog::BlogComment::setCommentId
void setCommentId(const QString &id)
Sets the comment's id.
Definition: blogcomment.cpp:87
KBlog::BlogPost::tags
QStringList tags() const
Returns the tags list as a QStringList.
Definition: blogpost.cpp:256
KBlog::GData::profileId
QString profileId() const
Returns the profile id of the blog.
Definition: gdata.cpp:77
KBlog::BlogPost::Created
Status of a successfully created post.
Definition: blogpost.h:401
KBlog::GData
A class that can be used for access to GData blogs.
Definition: gdata.h:70
KBlog::GData::GData
GData(const KUrl &server, QObject *parent=0)
Create an object for GData.
Definition: gdata.cpp:46
KBlog::GData::~GData
~GData()
Destructor.
Definition: gdata.cpp:53
KBlog::BlogComment::email
QString email() const
Returns the E-Mail address of the commentator.
Definition: blogcomment.cpp:92
KBlog::BlogComment::commentId
QString commentId() const
Returns the comment's id.
Definition: blogcomment.cpp:82
KBlog::BlogPost::setTitle
void setTitle(const QString &title)
Sets the title.
Definition: blogpost.cpp:159
KBlog::GData::removeComment
virtual void removeComment(KBlog::BlogPost *post, KBlog::BlogComment *comment)
Remove a comment from the server.
Definition: gdata.cpp:420
KBlog::BlogPost::setPostId
void setPostId(const QString &postId)
Sets the post id value.
Definition: blogpost.cpp:149
KBlog::Blog::username
QString username() const
Returns the username used in blog authentication.
Definition: blog.cpp:91
KBlog::GData::listAllComments
virtual void listAllComments()
List the all comments available for this authentication on the server.
Definition: gdata.cpp:171
KBlog::BlogPost::setCreationDateTime
void setCreationDateTime(const KDateTime &datetime)
Sets the creation time.
Definition: blogpost.cpp:313
KBlog::BlogComment
A class that represents a blog comment on the blog post.
Definition: blogcomment.h:50
KBlog::BlogComment::setContent
void setContent(const QString &content)
Sets the content.
Definition: blogcomment.cpp:77
KBlog::GData::setProfileId
virtual void setProfileId(const QString &pid)
Get the profile's id of the blog.
Definition: gdata.cpp:83
KBlog::BlogComment::title
QString title() const
Returns the title.
Definition: blogcomment.cpp:62
gdata.h
This file is part of the for accessing Blog Servers and defines the GData class.
KBlog::GData::createComment
virtual void createComment(KBlog::BlogPost *post, KBlog::BlogComment *comment)
Create a comment on the server.
Definition: gdata.cpp:366
KBlog::Blog::errorPost
void errorPost(KBlog::Blog::ErrorType type, const QString &errorMessage, KBlog::BlogPost *post)
This signal is emitted when an error occurs with XML parsing or a structural problem in an operation ...
KBlog::GData::setFullName
virtual void setFullName(const QString &fullName)
Sets the user's name for the blog.
Definition: gdata.cpp:70
KBlog::BlogComment::name
QString name() const
Returns the commentator's name.
Definition: blogcomment.cpp:102
KBlog::BlogPost::setContent
void setContent(const QString &content)
Sets the content.
Definition: blogpost.cpp:169
KBlog::BlogPost::modificationDateTime
KDateTime modificationDateTime() const
Returns the modification date time.
Definition: blogpost.cpp:318
KBlog::BlogPost::setModificationDateTime
void setModificationDateTime(const KDateTime &datetime)
Sets the modification time.
Definition: blogpost.cpp:323
KBlog::Blog::blogId
QString blogId() const
Returns the unique ID for the specific blog on the server.
Definition: blog.cpp:109
KBlog::BlogPost::setStatus
void setStatus(Status status)
Sets the status.
Definition: blogpost.cpp:333
KBlog::BlogComment::setCreationDateTime
void setCreationDateTime(const KDateTime &datetime)
Sets the creation date-time.
Definition: blogcomment.cpp:136
KBlog::BlogPost::Modified
Status of a successfully modified post.
Definition: blogpost.h:404
KBlog::Blog::url
KUrl url() const
Get the URL for the blog's XML-RPC interface.
Definition: blog.cpp:121
KBlog::GData::listRecentPosts
void listRecentPosts(int number)
List recent posts on the server.
Definition: gdata.cpp:151
KBlog::GData::fetchPost
void fetchPost(KBlog::BlogPost *post)
Fetch the Post with a specific id.
Definition: gdata.cpp:182
KBlog::GData::fullName
QString fullName() const
Returns the full name of user of the blog.
Definition: gdata.cpp:64
KBlog::BlogPost::content
QString content() const
Returns the content.
Definition: blogpost.cpp:164
KBlog::GData::listComments
virtual void listComments(KBlog::BlogPost *post)
List the comments available for this post on the server.
Definition: gdata.cpp:157
KBlog::BlogComment::content
QString content() const
Returns the content.
Definition: blogcomment.cpp:72
KBlog::BlogComment::setModificationDateTime
void setModificationDateTime(const KDateTime &datetime)
Sets the modification date-time.
Definition: blogcomment.cpp:126
KBlog::Blog::Atom
An error in the syndication client.
Definition: blog.h:101
KBlog::BlogPost
A class that represents a blog post on the server.
Definition: blogpost.h:68
KBlog::GData::interfaceName
QString interfaceName() const
Returns the of the inherited object.
Definition: gdata.cpp:58
KBlog::BlogComment::Created
Status of a successfully created comment.
Definition: blogcomment.h:209
KBlog::BlogComment::setTitle
void setTitle(const QString &title)
Sets the title.
Definition: blogcomment.cpp:67
KBlog::GData::fetchProfileId
void fetchProfileId()
Get information about the profile from the blog.
Definition: gdata.cpp:90
KBlog::BlogPost::setTags
void setTags(const QStringList &tags)
Set the tags list.
Definition: blogpost.cpp:261
KBlog::Blog
A class that provides methods to call functions on a supported blog web application.
Definition: blog.h:71
KBlog::BlogPost::Removed
Status of a successfully removed post.
Definition: blogpost.h:407
KBlog::GData::createPost
void createPost(KBlog::BlogPost *post)
Create a new post on server.
Definition: gdata.cpp:267
KBlog::Blog::errorComment
void errorComment(KBlog::Blog::ErrorType type, const QString &errorMessage, KBlog::BlogPost *post, KBlog::BlogComment *comment)
This signal is emitted when an error occurs with XML parsing or a structural problem in an operation ...
KBlog::BlogPost::isPrivate
bool isPrivate() const
Returns if the post is published or not.
Definition: blogpost.cpp:134
KBlog::Blog::Other
Any other miscellaneous error.
Definition: blog.h:109
KBlog::BlogPost::postId
QString postId() const
Returns the postId.
Definition: blogpost.cpp:144
KBlog::Blog::userAgent
QString userAgent() const
Returns the HTTP user agent string used to make the HTTP requests.
Definition: blog.cpp:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:55 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KBlog Client Library

Skip menu "KBlog Client Library"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

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