[Kde-pim] KDE/kdepimlibs/kblog

Christian Weilbach christian_weilbach at web.de
Tue Jul 24 07:59:11 BST 2007


Hi,

> There are MovableType keys that are returned in the MetaWeblog.getPost
> Query
>
> I think that this vars will be added in the BlogPosting class, and all
> the getter and setter function (for this vars) will be public.
>
> STEP A) Add the var in BlogPosting + getter and setter function.
> Note: For MetaWeblog only the first two vars are really needed;
> 	The others are used from MovableType.
>
> a. MetaWeblog Keys:
> QString link;          //String link like
> "http://typekeytest111.typepad.com/my_weblog/2005/12/this_is_a_post_1.html"
> QString permalink;     //String permalink  like
> "http://typekeytest111.typepad.com/my_weblog/2005/12/this_is_a_post_1
>
> b. MovableType keys
> 	     See:
> http://www.sixapart.com/developers/xmlrpc/metaweblog_api/metawebloggetpost.
>html
>
> //VAR NAME      TYPE_TO_SEND   KEY_NAME               DESCRIPTION OF THE
> KEY bool allowComments;    //int mt_allow_comments={0,1} the value for the
> allow_comments field;
> bool allowPings;       //int mt_allow_pings={0,1} the value for the
> allow_pings field;
> QString convertBreaks="__default__";  //mt_convert_breaks:// the value
> for the convert_breaks field;
>
> QString excerpt;       //String mt_excerpt, the value for the excerpt
> field; QString keywords;      //String mt_keywords, the value for the
> keywords field;
>
> .html"
>
> QStringList tbPingUrls? //array mt_tb_ping_urls, the list of TrackBack
> ping URLs for this entry;
> QString textMore       //String mt_text_more, the value for the
> additional entry text;
>
>
>
> STEP B) Modify MetaWeblog_private and add the added lines in the BEGIN/END
> tags. Movable type will use also the commented lines.
>
> bool APIMetaWeblog::APIMetaWeblogPrivate::readPostingFromMap( BlogPosting
> *post, const
> QMap<QString, QVariant> &postInfo )
> {
>   // FIXME: integrate error handling
>   if ( !post ) {
>     return false;
>   }
>   QStringList mapkeys = postInfo.keys();
>   kDebug(5323) << endl << "Keys: " << mapkeys.join( ", " ) << endl << endl;
>
>   KDateTime dt =
>     KDateTime( postInfo["dateCreated"].toDateTime(), KDateTime::UTC );
>   if ( dt.isValid() && !dt.isNull() ) {
>     post->setCreationDateTime( dt );
>   }
>
>   dt =
>     KDateTime( postInfo["lastModified"].toDateTime(), KDateTime::UTC );
>   if ( dt.isValid() && !dt.isNull() ) {
>     post->setModificationDateTime( dt );
>   }
>
>   post->setPostingId( postInfo["postid"].toString() );
>
>   QString title( postInfo["title"].toString() );
>   QString description( postInfo["description"].toString() );
>   QStringList categories( postInfo["categories"].toStringList() );
>   //BEGIN- NEW CODE TO ADD
>   QString link( postInfo["link"].toString() );
>   QString permalink( postInfo["permalink"].toString() );
> //   QString convertBreaks( postInfo["mt_convert_breaks"].toString()
> ); This commented code will be added in the MovableType API, not in
> the MetaWeblog!
> //   QString excerpt( postInfo["mt_excerpt"].toString() );
> //   QString keywords( postInfo["mt_keywords"].toString() );
>
> //   QString textMore( postInfo["m_text_more"].toString() );
>   //END- NEW CODE TO ADD
>   post->setTitle( title );
>   post->setContent( description );
>   if ( !categories.isEmpty() ){
>     kDebug(5323) << "Categories: " << categories << endl;
>     post->setCategories( categories );
>   }
>   //BEGIN- NEW CODE TO ADD
> //   post->setConvertBreaks( convertBreaks );
> //   post->setExcerpt( excerpt );
> //   post->setKeywords( keywords);
>   post->setLink( link );
>   post->setPermalink( permalink );
>   //END- NEW CODE TO ADD
>   return true;
> }
>
> If anyone don't have time to add this, i can add the needed vars and
> function and i can commit it!
>
> Cheers,
> Antonio

O.k. first of all good work and I like to see MoveableType support.
But 1) I don't think it is good to add code to API's that are not officially 
supported, just because Wordpress or some other implementation does it. I 
didn't like the idea with Blogger API 1.0 and Mike at first and now we do all 
fancy stuff in all APIs. For me this is a no go!
If a server side supports the better API than it should use it and otherwise 
specify its own API but not extend any existing API. If we want to do so, 
than please add a new inheritance for this special implementation. 
Now this has been said, I would add APIBloggerExtended or something inbetween 
APIBlogger and APIMetaWeblog. I know that this makes things a bit more 
complicated, but it is definetly cleaner. That way the app/user can adjust 
the api, e.g. offer "Wordpress pre 2.3" for APIBloggerExtended to fix the 
dateTime bug.
I know this is even later than last evening to move stuff, but we should 
definetly not add undocumented code and hack around some special server 
settings, if we can do better. And yes I know that we use XML and that it 
should work normally, but I think this is the better/saner way!
Additionally 2) I would not add the Moveable Type code to BlogPosting in 
general, because once again, this should be in a general base class ( I would 
keep the dateTime stuff, though, but I'm not sure ). If you want to use 
extended features, than lets do a BlogPostingMoveableType inheritance and a 
maybe (dateTime support) BlogPostingMetaWeblog:
BlogPosting->BlogPostingMetaWeblog->BlogPostingMoveableType

This is my proposal and I would do it this afternoon, if you are o.k. with it.

Cheers,
Christian

P.S.: Otherwise we should think about what we want in BlogPosting in general 
and what not and this has to be the same for the next 5 years. I would 
*really* suggest using inheritance here, too, since this is the great 
advantage of OO and we can extend it *and* keep binary compatibility.
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/



More information about the kde-pim mailing list