1/*
2 This file is part of the kblog library.
3
4 Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5 Copyright (c) 2006-2007 Christian Weilbach <christian_weilbach@web.de>
6 Copyright (c) 2007 Mike McQuaid <mike@mikemcquaid.com>
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#ifndef KBLOG_METAWEBLOG_H
25#define KBLOG_METAWEBLOG_H
26
27#include <kblog/blogger1.h>
28
29class KUrl;
30
31/**
32 @file
33 This file is part of the for accessing Blog Servers
34 and defines the MetaWeblog class.
35
36 @author Reinhold Kainhofer \<reinhold\@kainhofer.com\>
37 @author Christian Weilbach \<christian\@whiletaker.homeip.net\>
38*/
39
40namespace KBlog {
41
42 class MetaWeblogPrivate;
43/**
44 @brief
45 A class that can be used for access to MetaWeblog blogs. Almost every
46 blog server supports MetaWeblog. Compared to Blogger 1.0 it is a
47 superset of functions added to the its definition. MetaWeblog is much
48 more functional, but has some drawbacks, e.g. security when compared to
49 GData which is based on Atom API and is quite new.
50
51 @code
52 Blog* myblog = new MetaWeblog("http://example.com/xmlrpc/gateway.php");
53 myblog->setUsername( "some_user_id" );
54 myblog->setPassword( "YouRFuNNYPasSwoRD" );
55 myblog->setBlogId( "1" ); // can be caught by listBlogs()
56 KBlog::BlogPost *post = new BlogPost();
57 post->setTitle( "This is the title." );
58 post->setContent( "Here is some the content..." );
59 myblog->createPost( post );
60 @endcode
61
62 @author Christian Weilbach \<christian\@whiletaker.homeip.net\>
63 @author Reinhold Kainhofer \<reinhold\@kainhofer.com\>
64*/
65class KBLOG_EXPORT MetaWeblog : public Blogger1
66{
67 Q_OBJECT
68 public:
69 /**
70 Create an object for MetaWeblog
71
72 @param server is the url for the xmlrpc gateway.
73 @param parent is the parent object.
74 */
75 explicit MetaWeblog( const KUrl &server, QObject *parent = 0 );
76
77 /**
78 Destroy the object.
79 */
80 virtual ~MetaWeblog();
81
82 /**
83 Returns the of the inherited object.
84 */
85 QString interfaceName() const;
86
87 /**
88 List the categories of the blog.
89
90 @see listedCategories( const QList\<QMap\<QString,QString\> \>& )
91 */
92 virtual void listCategories();
93
94 /**
95 Create a new media object, e.g. picture, on server.
96
97 @param media The media to send.
98 */
99 virtual void createMedia( KBlog::BlogMedia *media );
100
101 Q_SIGNALS:
102
103 /**
104 This signal is emitted when a media has been created
105 on the server.
106
107 @param media The created media.
108
109 @see createMedia( KBlog::BlogMedia *media )
110 */
111 void createdMedia( KBlog::BlogMedia *media );
112
113 /**
114 This signal is emitted when the last category of the listCategories()
115 job has been fetched.
116
117 @param categories This list contains the categories. Each map has the keys:
118 name, description, htmlUrl, rssUrl.
119
120 @see listCategories()
121 */
122 void listedCategories( const QList<QMap<QString,QString> >& categories );
123
124 protected:
125 /**
126 Constructor needed for private inheritance.
127 */
128 MetaWeblog( const KUrl &server, MetaWeblogPrivate &dd, QObject *parent = 0 );
129
130 private:
131 Q_DECLARE_PRIVATE( MetaWeblog )
132 Q_PRIVATE_SLOT( d_func(),
133 void slotListCategories( const QList<QVariant> &, const QVariant & ) )
134 Q_PRIVATE_SLOT( d_func(),
135 void slotCreateMedia( const QList<QVariant> &, const QVariant & ) )
136};
137
138} //namespace KBlog
139#endif
140