From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kresources/blogging/API_Blog.cpp | 121 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 kresources/blogging/API_Blog.cpp (limited to 'kresources/blogging/API_Blog.cpp') diff --git a/kresources/blogging/API_Blog.cpp b/kresources/blogging/API_Blog.cpp new file mode 100644 index 00000000..670cd166 --- /dev/null +++ b/kresources/blogging/API_Blog.cpp @@ -0,0 +1,121 @@ +/*************************************************************************** +* Copyright (C) 2004-05 Reinhold Kainhofer * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ +#include "API_Blog.h" +#include +#include + +using namespace KBlog; + +APIBlog::APIBlog( const KURL &url, QObject *parent, const char *name ) : + QObject( parent, name ), + mServerURL( url ), mAppID( QString::null ), mDownloadCount( 20 ) +{} + +APIBlog::~APIBlog() +{} + +void APIBlog::dumpBlog( BlogPosting *blog ) +{ + kdDebug() << "-----------------------------------" << endl; + kdDebug() << "Post " << blog->postID() << " by \"" << + blog->userID() << "\" on " << + blog->dateTime().toString() << endl; + kdDebug() << "Title: " << blog->title() << endl; + kdDebug() << blog->content() <setPostID( postID ); + deletePost( post ); + delete post; +}*/ + +QValueList APIBlog::defaultArgs( const QString &id ) +{ + QValueList args; + args << QVariant( mAppID ); + if ( !id.isNull() ) { + args << QVariant( id ); + } + args << QVariant( mUsername ) + << QVariant( mPassword ); + return args; +} + + +KCal::Journal *APIBlog::journalFromPosting( KBlog::BlogPosting *blog ) +{ + if ( !blog ) return 0; + KCal::Journal *j = new KCal::Journal(); + QDateTime dt = blog->dateTime(); + QDateTime creationDt = blog->creationDateTime(); + QDateTime modificationDt = blog->modificationDateTime(); +kdDebug() << "dt ="<title() << " is " + << blog->dateTime().toString()<setSummary( blog->title() ); + j->setDescription( blog->content() ); + j->setCategories( QStringList( blog->category() ) ); + j->setOrganizer( blog->userID() ); + j->setCustomProperty( "KCalBloggerRes", "UserID", blog->userID() ); + j->setCustomProperty( "KCalBloggerRes", "BlogID", blog->blogID() ); + j->setCustomProperty( "KCalBloggerRes", "PostID", blog->postID() ); + + // TODO: Set the read-only flag in the resource! +// j->setReadOnly( readOnly() ); + + return j; +} + +KBlog::BlogPosting *APIBlog::postingFromJournal( KCal::Journal *journal ) +{ + KBlog::BlogPosting *item = new KBlog::BlogPosting(); + if ( journal && item ) { + item->setContent( journal->description() ); + item->setTitle( journal->summary() ); + item->setCategory( journal->categories().first() ); + item->setDateTime( journal->dtStart() ); + item->setModificationDateTime( journal->lastModified() ); + item->setCreationDateTime( journal->created() ); + item->setUserID( journal->customProperty( "KCalBloggerRes", "UserID" ) ); + item->setBlogID( journal->customProperty( "KCalBloggerRes", "BlogID" ) ); + item->setPostID( journal->customProperty( "KCalBloggerRes", "PostID" ) ); + } + return item; +} + + +#include "API_Blog.moc" -- cgit v1.2.3