You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
5.5 KiB
164 lines
5.5 KiB
15 years ago
|
/**************************************************************************
|
||
|
* Copyright (C) 2004 by Reinhold Kainhofer <reinhold@kainhofer.com> *
|
||
|
* *
|
||
|
* 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. *
|
||
|
***************************************************************************/
|
||
|
#ifndef API_BLOG_H
|
||
|
#define API_BLOG_H
|
||
|
|
||
|
#include <kurl.h>
|
||
|
#include <kio/job.h>
|
||
|
#include <libkcal/journal.h>
|
||
|
|
||
14 years ago
|
#include <tqobject.h>
|
||
|
#include <tqstring.h>
|
||
|
#include <tqvaluelist.h>
|
||
|
#include <tqdatetime.h>
|
||
15 years ago
|
|
||
|
/**
|
||
|
This is the main interface for blog backends
|
||
|
@author ian reinhart geiser, Reinhold Kainhofer
|
||
|
*/
|
||
|
|
||
|
namespace KBlog {
|
||
|
|
||
|
class BlogPosting
|
||
|
{
|
||
|
public:
|
||
|
BlogPosting() {}
|
||
|
virtual ~BlogPosting() {}
|
||
|
|
||
14 years ago
|
TQString userID() const { return mUserID; }
|
||
|
void setUserID( const TQString &userID ) { mUserID = userID; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString blogID() const { return mBlogID; }
|
||
|
void setBlogID( const TQString &blogID ) { mBlogID = blogID; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString postID() const { return mPostID; }
|
||
|
void setPostID( const TQString &postID ) { assignPostID( postID ); mPostID = postID; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString title() const { return mTitle; }
|
||
|
void setTitle( const TQString &title ) { mTitle = title; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString content() const { return mContent; }
|
||
|
void setContent( const TQString &content ) { mContent = content; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString category() const { return mCategory; }
|
||
|
void setCategory( const TQString &category ) { mCategory = category; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString fingerprint() const { return mFingerprint; }
|
||
|
void setFingerprint( const TQString &fp ) { mFingerprint = fp; }
|
||
15 years ago
|
|
||
14 years ago
|
TQDateTime dateTime() const { return mDateTime; }
|
||
|
void setDateTime( const TQDateTime &datetime ) { mDateTime = datetime; }
|
||
15 years ago
|
|
||
14 years ago
|
TQDateTime creationDateTime() const { return mCreationDateTime; }
|
||
|
void setCreationDateTime( const TQDateTime &datetime ) { mCreationDateTime = datetime; }
|
||
15 years ago
|
|
||
14 years ago
|
TQDateTime modificationDateTime() const { return mModificationDateTime; }
|
||
|
void setModificationDateTime( const TQDateTime &datetime ) { mModificationDateTime = datetime; }
|
||
15 years ago
|
|
||
|
virtual void wasDeleted( bool ) {}
|
||
|
virtual void wasUploaded( bool ) {}
|
||
14 years ago
|
virtual void error( int /*code*/, const TQString &/*error*/ ) {}
|
||
15 years ago
|
|
||
|
protected:
|
||
|
// Override this method to detect the new postID assigned when adding a new post
|
||
14 years ago
|
virtual void assignPostID( const TQString &/*postID*/ ) {}
|
||
|
TQString mUserID;
|
||
|
TQString mBlogID;
|
||
|
TQString mPostID;
|
||
|
TQString mTitle;
|
||
|
TQString mContent;
|
||
|
TQString mCategory;
|
||
|
TQString mFingerprint;
|
||
|
TQDateTime mDateTime;
|
||
|
TQDateTime mCreationDateTime;
|
||
|
TQDateTime mModificationDateTime;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
14 years ago
|
class APIBlog : public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
public:
|
||
13 years ago
|
APIBlog( const KURL &server, TQObject *parent = 0L, const char *name = 0L );
|
||
15 years ago
|
virtual ~APIBlog();
|
||
14 years ago
|
virtual TQString interfaceName() const = 0;
|
||
15 years ago
|
|
||
14 years ago
|
void setAppID( const TQString &appID ) { mAppID = appID; }
|
||
|
TQString appID() const { return mAppID; }
|
||
15 years ago
|
|
||
14 years ago
|
void setPassword( const TQString &pass ) { mPassword = pass; }
|
||
|
TQString password() const { return mPassword; }
|
||
15 years ago
|
|
||
14 years ago
|
void setUsername( const TQString &uname ) { mUsername = uname; }
|
||
|
TQString username() const { return mUsername; }
|
||
15 years ago
|
|
||
|
void setURL( const KURL& url ) { mServerURL = url; }
|
||
|
KURL url() const { return mServerURL; }
|
||
|
|
||
|
void setDownloadCount( int nr ) { mDownloadCount = nr; }
|
||
|
int downloadCount() const { return mDownloadCount; }
|
||
|
|
||
|
static void dumpBlog( BlogPosting *blog );
|
||
|
|
||
|
|
||
|
enum blogFunctions {
|
||
|
bloggerGetUserInfo,
|
||
|
bloggerGetUsersBlogs,
|
||
|
bloggerGetRecentPosts,
|
||
|
bloggerNewPost,
|
||
|
bloggerEditPost,
|
||
|
bloggerDeletePost,
|
||
|
bloggerGetPost,
|
||
|
bloggerGetTemplate,
|
||
|
bloggerSetTemplate
|
||
|
};
|
||
|
|
||
14 years ago
|
virtual TQString getFunctionName( blogFunctions type ) = 0;
|
||
14 years ago
|
virtual TQValueList<TQVariant> defaultArgs( const TQString &id = TQString() );
|
||
15 years ago
|
|
||
12 years ago
|
virtual TDEIO::Job *createUserInfoJob() = 0;
|
||
|
virtual TDEIO::Job *createListFoldersJob() = 0;
|
||
|
virtual TDEIO::TransferJob *createListItemsJob( const KURL &url ) = 0;
|
||
|
virtual TDEIO::TransferJob *createDownloadJob( const KURL &url ) = 0;
|
||
|
virtual TDEIO::TransferJob *createUploadJob( const KURL &url, KBlog::BlogPosting *posting ) = 0;
|
||
|
virtual TDEIO::TransferJob *createUploadNewJob( KBlog::BlogPosting *posting ) = 0;
|
||
|
virtual TDEIO::Job *createRemoveJob( const KURL &url, const TQString &postid ) = 0;
|
||
|
|
||
|
virtual bool interpretUserInfoJob( TDEIO::Job *job ) = 0;
|
||
|
virtual void interpretListFoldersJob( TDEIO::Job *job ) = 0;
|
||
|
virtual bool interpretListItemsJob( TDEIO::Job *job ) = 0;
|
||
|
virtual bool interpretDownloadItemsJob( TDEIO::Job *job ) = 0;
|
||
15 years ago
|
|
||
|
static KCal::Journal *journalFromPosting( KBlog::BlogPosting *post );
|
||
|
static KBlog::BlogPosting *postingFromJournal( KCal::Journal *journal );
|
||
|
|
||
|
signals:
|
||
|
// TODO: Connect these
|
||
14 years ago
|
void userInfoRetrieved( const TQString &nickname, const TQString &userid, const TQString &email );
|
||
|
void folderInfoRetrieved( const TQString &id, const TQString &name );
|
||
15 years ago
|
|
||
|
void itemOnServer( const KURL &remoteURL );
|
||
14 years ago
|
void itemDownloaded( KCal::Incidence *j, const TQString &localID,
|
||
|
const KURL &remoteURL, const TQString &fingerprint,
|
||
|
const TQString &storageLocation );
|
||
15 years ago
|
|
||
|
|
||
|
protected:
|
||
|
|
||
|
KURL mServerURL;
|
||
14 years ago
|
TQString mPassword;
|
||
|
TQString mUsername;
|
||
|
TQString mAppID;
|
||
15 years ago
|
int mDownloadCount;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
#endif
|