KBlog Client Library
blog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KBLOG_BLOG_H
00025 #define KBLOG_BLOG_H
00026
00027 #include <kblog/kblog_export.h>
00028
00029 #include <QtCore/QObject>
00030
00031 template <class T,class S> class QMap;
00032
00033 class KTimeZone;
00034 class KUrl;
00035
00053 namespace KBlog {
00054
00055 class BlogPost;
00056 class BlogComment;
00057 class BlogMedia;
00058 class BlogPrivate;
00059
00071 class KBLOG_EXPORT Blog : public QObject
00072 {
00073 Q_OBJECT
00074 public:
00085 explicit Blog( const KUrl &server, QObject *parent = 0,
00086 const QString &applicationName = QString(),
00087 const QString &applicationVersion = QString() );
00088
00092 virtual ~Blog();
00093
00097 enum ErrorType {
00099 XmlRpc,
00101 Atom,
00103 ParsingError,
00105 AuthenticationError,
00107 NotSupported,
00109 Other
00110 };
00111
00115 QString userAgent() const;
00116
00120 virtual QString interfaceName() const = 0;
00121
00127 virtual void setBlogId( const QString &blogId );
00128
00133 QString blogId() const;
00134
00141 virtual void setPassword( const QString &password );
00142
00147 QString password() const;
00148
00154 virtual void setUsername( const QString &username );
00155
00161 QString username() const;
00162
00169 virtual void setUrl( const KUrl &url );
00170
00176 KUrl url() const;
00177
00184 virtual void setTimeZone( const KTimeZone &timeZone );
00185
00191 KTimeZone timeZone();
00192
00200 virtual void listRecentPosts( int number ) = 0;
00201
00212 virtual void fetchPost( KBlog::BlogPost *post ) = 0;
00213
00224 virtual void modifyPost( KBlog::BlogPost *post ) = 0;
00225
00232 virtual void createPost( KBlog::BlogPost *post ) = 0;
00233
00243 virtual void removePost( KBlog::BlogPost *post ) = 0;
00244
00245 Q_SIGNALS:
00253 void listedRecentPosts(
00254 const QList<KBlog::BlogPost>& posts );
00255
00263 void createdPost( KBlog::BlogPost *post );
00264
00272 void fetchedPost( KBlog::BlogPost *post );
00273
00281 void modifiedPost( KBlog::BlogPost *post );
00282
00290 void removedPost( KBlog::BlogPost *post );
00291
00300 void error( KBlog::Blog::ErrorType type, const QString &errorMessage );
00301
00311 void errorPost( KBlog::Blog::ErrorType type,
00312 const QString &errorMessage, KBlog::BlogPost *post );
00313
00323 void errorMedia( KBlog::Blog::ErrorType type,
00324 const QString &errorMessage, KBlog::BlogMedia *media );
00325
00336 void errorComment( KBlog::Blog::ErrorType type,
00337 const QString &errorMessage, KBlog::BlogPost *post,
00338 KBlog::BlogComment *comment );
00339
00340 protected:
00342 BlogPrivate *const d_ptr;
00343
00355 Blog( const KUrl &server, BlogPrivate &dd, QObject *parent = 0,
00356 const QString &applicationName = QString(),
00357 const QString &applicationVersion = QString() );
00358
00359 private:
00369 void setUserAgent( const QString &applicationName,
00370 const QString &applicationVersion );
00371 Q_DECLARE_PRIVATE( Blog )
00372 };
00373
00374 }
00375 #endif