1/*
2 This file is part of the kblog library.
3
4 Copyright (c) 2007-2009 Christian Weilbach <christian_weilbach@web.de>
5 Copyright (c) 2007 Mike McQuaid <mike@mikemcquaid.com>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#ifndef KBLOG_MOVABLETYPE_H
24#define KBLOG_MOVABLETYPE_H
25
26#include <kblog/metaweblog.h>
27
28class KUrl;
29
30/**
31 @file
32 This file is part of the for accessing Blog Servers
33 and defines the MovableType class.
34
35 @author Christian Weilbach \<christian_weilbach\@web.de\>
36 @author Mike McQuaid \<mike\@mikemcquaid.com\>
37*/
38
39namespace KBlog {
40
41 class MovableTypePrivate;
42/**
43 @brief
44 A class that can be used for access to Movable Type blogs. Almost every
45 blog server supports Movable Type.
46 @code
47 Blog* myblog = new MovableType("http://example.com/xmlrpc/gateway.php");
48 myblog->setUsername( "some_user_id" );
49 myblog->setPassword( "YoURFunnyPAsSwoRD" );
50 myblog->setBlogId( "1" ); // can be caught by listBlogs()
51 KBlog::BlogPost *post = new BlogPost();
52 post->setTitle( "This is the title." );
53 post->setContent( "Here is some the content..." );
54 myblog->createPost( post );
55 @endcode
56
57 @author Christian Weilbach \<christian_weilbach\@web.de\>
58 @author Mike McQuaid \<mike\@mikemcquaid.com\>
59*/
60class KBLOG_EXPORT MovableType : public MetaWeblog
61{
62 Q_OBJECT
63 public:
64 /**
65 Create an object for Movable Type
66
67 @param server is the url for the xmlrpc gateway.
68 @param parent is the parent object.
69 */
70 explicit MovableType( const KUrl &server, QObject *parent = 0 );
71
72 /**
73 Destroy the object.
74 */
75 virtual ~MovableType();
76
77 /**
78 Returns the of the inherited object.
79 */
80 QString interfaceName() const;
81
82 /**
83 List recent posts on the server. The status of the posts will be Fetched.
84
85 @param number The number of posts to fetch. Latest first.
86
87 @see void listedRecentPosts( const QList\<KBlog::BlogPost\>& )
88 @see BlogPost::Status
89 */
90 void listRecentPosts( int number );
91
92 /**
93 Get the list of trackback pings from the server.
94
95 @param post This is the post to get the trackback pings from.
96 You need to set its id correctly.
97
98 @see BlogPost::setPostId( const QString& )
99 @see listedTrackBackPings( KBlog::BlogPost *, const QList\<QMap\<QString,QString\> \>& )
100
101 */
102 virtual void listTrackBackPings( KBlog::BlogPost *post );
103
104 void createPost( KBlog::BlogPost *post );
105
106 void modifyPost( KBlog::BlogPost *post );
107
108 void fetchPost( KBlog::BlogPost *post );
109
110 Q_SIGNALS:
111 /**
112 This signal is emitted when the trackback pings are fetched completely.
113
114 @param post This is the post of the trackback ping list.
115 @param pings This is the list itself. The map contains the keys: id, url, ip.
116
117 @see listTrackBackPings()
118 */
119 void listedTrackBackPings( KBlog::BlogPost *post, const QList<QMap<QString,QString> > &pings );
120
121 protected:
122 /**
123 Constructor needed for private inheritance.
124 */
125 MovableType( const KUrl &server, MovableTypePrivate &dd, QObject *parent = 0 );
126
127 private:
128 Q_DECLARE_PRIVATE( MovableType )
129 Q_PRIVATE_SLOT( d_func(),
130 void slotListTrackBackPings( const QList<QVariant> &, const QVariant & ) )
131 Q_PRIVATE_SLOT( d_func(),
132 void slotCreatePost( const QList<QVariant> &, const QVariant & ) )
133 Q_PRIVATE_SLOT( d_func(),
134 void slotModifyPost( const QList<QVariant> &, const QVariant & ) )
135 Q_PRIVATE_SLOT( d_func(),
136 void slotGetPostCategories(const QList<QVariant>&,const QVariant&) )
137 Q_PRIVATE_SLOT( d_func(),
138 void slotSetPostCategories(const QList<QVariant>&,const QVariant&) )
139 Q_PRIVATE_SLOT( d_func(),
140 void slotTriggerCreatePost() )
141 Q_PRIVATE_SLOT( d_func(),
142 void slotTriggerModifyPost() )
143 Q_PRIVATE_SLOT( d_func(),
144 void slotTriggerFetchPost() )
145};
146
147} //namespace KBlog
148#endif
149