From b363d2579af0a11b77e698aed2e1021c2233b644 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:50 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kresources/blogging/API_Blog.cpp | 121 ------ kresources/blogging/API_Blog.h | 163 -------- kresources/blogging/API_Blogger.cpp | 332 ---------------- kresources/blogging/API_Blogger.h | 57 --- kresources/blogging/Makefile.am | 29 -- kresources/blogging/blogging.desktop | 49 --- kresources/blogging/bloggingcalendaradaptor.cpp | 259 ------------- kresources/blogging/bloggingcalendaradaptor.h | 105 ----- kresources/blogging/bloggingglobals.cpp | 53 --- kresources/blogging/bloggingglobals.h | 50 --- kresources/blogging/kcal_resourceblogging.cpp | 97 ----- kresources/blogging/kcal_resourceblogging.h | 60 --- .../blogging/kcal_resourceblogging_plugin.cpp | 41 -- .../blogging/kcal_resourcebloggingconfig.cpp | 41 -- kresources/blogging/kcal_resourcebloggingconfig.h | 41 -- kresources/blogging/resourcebloggingsettings.ui | 330 ---------------- kresources/blogging/xmlrpcjob.cpp | 430 --------------------- kresources/blogging/xmlrpcjob.h | 124 ------ 18 files changed, 2382 deletions(-) delete mode 100644 kresources/blogging/API_Blog.cpp delete mode 100644 kresources/blogging/API_Blog.h delete mode 100644 kresources/blogging/API_Blogger.cpp delete mode 100644 kresources/blogging/API_Blogger.h delete mode 100644 kresources/blogging/Makefile.am delete mode 100644 kresources/blogging/blogging.desktop delete mode 100644 kresources/blogging/bloggingcalendaradaptor.cpp delete mode 100644 kresources/blogging/bloggingcalendaradaptor.h delete mode 100644 kresources/blogging/bloggingglobals.cpp delete mode 100644 kresources/blogging/bloggingglobals.h delete mode 100644 kresources/blogging/kcal_resourceblogging.cpp delete mode 100644 kresources/blogging/kcal_resourceblogging.h delete mode 100644 kresources/blogging/kcal_resourceblogging_plugin.cpp delete mode 100644 kresources/blogging/kcal_resourcebloggingconfig.cpp delete mode 100644 kresources/blogging/kcal_resourcebloggingconfig.h delete mode 100644 kresources/blogging/resourcebloggingsettings.ui delete mode 100644 kresources/blogging/xmlrpcjob.cpp delete mode 100644 kresources/blogging/xmlrpcjob.h (limited to 'kresources/blogging') diff --git a/kresources/blogging/API_Blog.cpp b/kresources/blogging/API_Blog.cpp deleted file mode 100644 index 981390fa1..000000000 --- a/kresources/blogging/API_Blog.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004-05 Reinhold Kainhofer * -* * -* 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. * -***************************************************************************/ -#include "API_Blog.h" -#include -#include - -using namespace KBlog; - -APIBlog::APIBlog( const KURL &url, TQObject *parent, const char *name ) : - TQObject( parent, name ), - mServerURL( url ), mAppID( TQString() ), mDownloadCount( 20 ) -{} - -APIBlog::~APIBlog() -{} - -void APIBlog::dumpBlog( BlogPosting *blog ) -{ - kdDebug() << "-----------------------------------" << endl; - kdDebug() << "Post " << blog->postID() << " by \"" << - blog->userID() << "\" on " << - blog->dateTime().toString() << endl; - kdDebug() << "Title: " << blog->title() << endl; - kdDebug() << blog->content() <setPostID( postID ); - deletePost( post ); - delete post; -}*/ - -TQValueList APIBlog::defaultArgs( const TQString &id ) -{ - TQValueList args; - args << TQVariant( mAppID ); - if ( !id.isNull() ) { - args << TQVariant( id ); - } - args << TQVariant( mUsername ) - << TQVariant( mPassword ); - return args; -} - - -KCal::Journal *APIBlog::journalFromPosting( KBlog::BlogPosting *blog ) -{ - if ( !blog ) return 0; - KCal::Journal *j = new KCal::Journal(); - TQDateTime dt = blog->dateTime(); - TQDateTime creationDt = blog->creationDateTime(); - TQDateTime modificationDt = blog->modificationDateTime(); -kdDebug() << "dt ="<title() << " is " - << blog->dateTime().toString()<setSummary( blog->title() ); - j->setDescription( blog->content() ); - j->setCategories( TQStringList( blog->category() ) ); - j->setOrganizer( blog->userID() ); - j->setCustomProperty( "KCalBloggerRes", "UserID", blog->userID() ); - j->setCustomProperty( "KCalBloggerRes", "BlogID", blog->blogID() ); - j->setCustomProperty( "KCalBloggerRes", "PostID", blog->postID() ); - - // TODO: Set the read-only flag in the resource! -// j->setReadOnly( readOnly() ); - - return j; -} - -KBlog::BlogPosting *APIBlog::postingFromJournal( KCal::Journal *journal ) -{ - KBlog::BlogPosting *item = new KBlog::BlogPosting(); - if ( journal && item ) { - item->setContent( journal->description() ); - item->setTitle( journal->summary() ); - item->setCategory( journal->categories().first() ); - item->setDateTime( journal->dtStart() ); - item->setModificationDateTime( journal->lastModified() ); - item->setCreationDateTime( journal->created() ); - item->setUserID( journal->customProperty( "KCalBloggerRes", "UserID" ) ); - item->setBlogID( journal->customProperty( "KCalBloggerRes", "BlogID" ) ); - item->setPostID( journal->customProperty( "KCalBloggerRes", "PostID" ) ); - } - return item; -} - - -#include "API_Blog.moc" diff --git a/kresources/blogging/API_Blog.h b/kresources/blogging/API_Blog.h deleted file mode 100644 index 9425bd5e6..000000000 --- a/kresources/blogging/API_Blog.h +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************** -* Copyright (C) 2004 by Reinhold Kainhofer * -* * -* 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 -#include -#include - -#include -#include -#include -#include - -/** -This is the main interface for blog backends -@author ian reinhart geiser, Reinhold Kainhofer -*/ - -namespace KBlog { - -class BlogPosting -{ -public: - BlogPosting() {} - virtual ~BlogPosting() {} - - TQString userID() const { return mUserID; } - void setUserID( const TQString &userID ) { mUserID = userID; } - - TQString blogID() const { return mBlogID; } - void setBlogID( const TQString &blogID ) { mBlogID = blogID; } - - TQString postID() const { return mPostID; } - void setPostID( const TQString &postID ) { assignPostID( postID ); mPostID = postID; } - - TQString title() const { return mTitle; } - void setTitle( const TQString &title ) { mTitle = title; } - - TQString content() const { return mContent; } - void setContent( const TQString &content ) { mContent = content; } - - TQString category() const { return mCategory; } - void setCategory( const TQString &category ) { mCategory = category; } - - TQString fingerprint() const { return mFingerprint; } - void setFingerprint( const TQString &fp ) { mFingerprint = fp; } - - TQDateTime dateTime() const { return mDateTime; } - void setDateTime( const TQDateTime &datetime ) { mDateTime = datetime; } - - TQDateTime creationDateTime() const { return mCreationDateTime; } - void setCreationDateTime( const TQDateTime &datetime ) { mCreationDateTime = datetime; } - - TQDateTime modificationDateTime() const { return mModificationDateTime; } - void setModificationDateTime( const TQDateTime &datetime ) { mModificationDateTime = datetime; } - - virtual void wasDeleted( bool ) {} - virtual void wasUploaded( bool ) {} - virtual void error( int /*code*/, const TQString &/*error*/ ) {} - -protected: - // Override this method to detect the new postID assigned when adding a new post - 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; -}; - - -class APIBlog : public TQObject -{ - Q_OBJECT - - public: - APIBlog( const KURL &server, TQObject *parent = 0L, const char *name = 0L ); - virtual ~APIBlog(); - virtual TQString interfaceName() const = 0; - - void setAppID( const TQString &appID ) { mAppID = appID; } - TQString appID() const { return mAppID; } - - void setPassword( const TQString &pass ) { mPassword = pass; } - TQString password() const { return mPassword; } - - void setUsername( const TQString &uname ) { mUsername = uname; } - TQString username() const { return mUsername; } - - 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 - }; - - virtual TQString getFunctionName( blogFunctions type ) = 0; - virtual TQValueList defaultArgs( const TQString &id = TQString() ); - - 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; - - static KCal::Journal *journalFromPosting( KBlog::BlogPosting *post ); - static KBlog::BlogPosting *postingFromJournal( KCal::Journal *journal ); - - signals: - // TODO: Connect these - void userInfoRetrieved( const TQString &nickname, const TQString &userid, const TQString &email ); - void folderInfoRetrieved( const TQString &id, const TQString &name ); - - void itemOnServer( const KURL &remoteURL ); - void itemDownloaded( KCal::Incidence *j, const TQString &localID, - const KURL &remoteURL, const TQString &fingerprint, - const TQString &storageLocation ); - - - protected: - - KURL mServerURL; - TQString mPassword; - TQString mUsername; - TQString mAppID; - int mDownloadCount; -}; - -} -#endif diff --git a/kresources/blogging/API_Blogger.cpp b/kresources/blogging/API_Blogger.cpp deleted file mode 100644 index 69a722e22..000000000 --- a/kresources/blogging/API_Blogger.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "API_Blogger.h" -#include "xmlrpcjob.h" -#include - -using namespace KBlog; - -TQString APIBlogger::getFunctionName( blogFunctions type ) -{ - switch ( type ) { - case bloggerGetUserInfo: return "blogger.getUserInfo"; - case bloggerGetUsersBlogs: return "blogger.getUsersBlogs"; - case bloggerGetRecentPosts: return "blogger.getRecentPosts"; - case bloggerNewPost: return "blogger.newPost"; - case bloggerEditPost: return "blogger.editPost"; - case bloggerDeletePost: return "blogger.deletePost"; - case bloggerGetPost: return "blogger.getPost"; - case bloggerGetTemplate: return "blogger.getTemplate"; - case bloggerSetTemplate: return "blogger.setTemplate"; - default: return TQString(); - } -} - - - - -TDEIO::Job *APIBlogger::createUserInfoJob() -{ - kdDebug() << "read user info..." << endl; - TQValueList args( defaultArgs() ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerGetUserInfo ), args, false ); -} - -TDEIO::Job *APIBlogger::createListFoldersJob() -{ - // TODO: Check if we're already authenticated. If not, do it! -// if ( isValid() ) { - kdDebug() << "Fetch List of Blogs..." << endl; - TQValueList args( defaultArgs() ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerGetUsersBlogs ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - -TDEIO::TransferJob *APIBlogger::createListItemsJob( const KURL &url ) -{ - // TODO: Check if we're already authenticated. If not, do it! -// if ( isValid() ) { - kdDebug() << "Fetch List of Posts..." << endl; - TQValueList args( defaultArgs( url.url() ) ); - args << TQVariant( mDownloadCount ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerGetRecentPosts ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - -TDEIO::TransferJob *APIBlogger::createDownloadJob( const KURL &url ) -{ -// if ( isValid() ){ - kdDebug() << "Fetch Posting with url " << url.url() << endl; - TQValueList args( defaultArgs( url.url() ) ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerGetPost ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - -TDEIO::TransferJob *APIBlogger::createUploadJob( const KURL &url, KBlog::BlogPosting *posting ) -{ - if ( !posting ) { - kdDebug() << "APIBlogger::createUploadJob: posting=0" << endl; - return 0; - } -// if ( isValid() ){ - kdDebug() << "Uploading Posting with url " << url.url() << endl; - TQValueList args( defaultArgs( posting->postID() ) ); - args << TQVariant( posting->content() ); - args << TQVariant( /*publish=*/true, 0 ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerEditPost ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - -TDEIO::TransferJob *APIBlogger::createUploadNewJob( KBlog::BlogPosting *posting ) -{ - if ( !posting ) { - kdDebug() << "APIBlogger::createUploadNewJob: posting=0" << endl; - return 0; - } -// if ( isValid() ){ - kdDebug() << "Creating new Posting with blogid " << posting->blogID() << " at url " << mServerURL << endl; - TQValueList args( defaultArgs( posting->blogID() ) ); - args << TQVariant( posting->content() ); - args << TQVariant( /*publish=*/true, 0 ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerNewPost ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - -TDEIO::Job *APIBlogger::createRemoveJob( const KURL &/*url*/, const TQString &postid ) -{ -kdDebug() << "APIBlogger::createRemoveJob: postid=" << postid << endl; -// if ( isValid() ){ - TQValueList args( defaultArgs( postid ) ); - args << TQVariant( /*publish=*/true, 0 ); - return TDEIO::xmlrpcCall( mServerURL, getFunctionName( bloggerDeletePost ), args, false ); -// } else { -// warningNotInitialized(); -// return 0; -// } -} - - - - -bool APIBlogger::interpretUserInfoJob( TDEIO::Job *job ) -{ - // TODO: Implement user authentication -// isValid = true; - TDEIO::XmlrpcJob *trfjob = dynamic_cast(job); - if ( job->error() || !trfjob ) { - // TODO: Error handling - return false; - } else if ( trfjob ) { - TQValueList message( trfjob->response() ); - - kdDebug () << "TOP: " << message[ 0 ].typeName() << endl; - const TQValueList posts = message; - TQValueList::ConstIterator it = posts.begin(); - TQValueList::ConstIterator end = posts.end(); - for ( ; it != end; ++it ) { - kdDebug () << "MIDDLE: " << ( *it ).typeName() << endl; - const TQMap postInfo = ( *it ).toMap(); - const TQString nickname = postInfo[ "nickname" ].toString(); - const TQString userid = postInfo[ "userid" ].toString(); - const TQString email = postInfo[ "email" ].toString(); - kdDebug() << "Post " << nickname << " " << userid << " " << email << endl; - // FIXME: How about a BlogUserInfo class??? - emit userInfoRetrieved( nickname, userid, email ); - } - return true; - } - return false; -} - -void APIBlogger::interpretListFoldersJob( TDEIO::Job *job ) -{ -kdDebug() << "APIBlogger::interpretListFoldersJob" << endl; - TDEIO::XmlrpcJob *trfjob = dynamic_cast(job); - if ( job->error() || !trfjob ) { - // TODO: Error handling - } else { -kdDebug() << "APIBlogger::interpretListFoldersJob, no error!" << endl; - TQValueList message( trfjob->response() ); - kdDebug () << "TOP: " << message[ 0 ].typeName() << endl; - - const TQValueList posts = message[ 0 ].toList(); - TQValueList::ConstIterator it = posts.begin(); - TQValueList::ConstIterator end = posts.end(); - for ( ; it != end; ++it ) { - kdDebug () << "MIDDLE: " << ( *it ).typeName() << endl; - const TQMap postInfo = ( *it ).toMap(); - - const TQString id( postInfo[ "blogid" ].toString() ); - const TQString name( postInfo[ "blogName" ].toString() ); - const TQString url( postInfo[ "url" ].toString() ); - - // Use the Blog ID instead of the URL. The ID already indicates the correct blog, and the - // URL for all calls will be the XML-RPC interface, anyway. - if ( !id.isEmpty() && !name.isEmpty() ) { - emit folderInfoRetrieved( id, name ); -kdDebug()<< "Emitting folderInfoRetrieved( id=" << id << ", name=" << name << "); " << endl; - } - } - } -} - -bool APIBlogger::interpretListItemsJob( TDEIO::Job *job ) -{ - return interpretDownloadItemsJob( job ); -} - -bool APIBlogger::interpretDownloadItemsJob( TDEIO::Job *job ) -{ - kdDebug(5800)<<"APIBlogger::interpretDownloadItemJob"<(job); - bool success = false; - if ( job->error() || !trfjob ) { - // TODO: Error handling - success = false; - } else { - //array of structs containing ISO.8601 dateCreated, String userid, String postid, String content; - // TODO: Time zone for the dateCreated! - TQValueList message( trfjob->response() ); - kdDebug () << "TOP: " << message[ 0 ].typeName() << endl; - - const TQValueList postReceived = message[ 0 ].toList(); - TQValueList::ConstIterator it = postReceived.begin(); - TQValueList::ConstIterator end = postReceived.end(); - success = true; - for ( ; it != end; ++it ) { - BlogPosting posting; - kdDebug () << "MIDDLE: " << ( *it ).typeName() << endl; - const TQMap postInfo = ( *it ).toMap(); - if ( readPostingFromMap( &posting, postInfo ) ) { - KCal::Journal *j = journalFromPosting( &posting ); -// dumpBlog( &posting ); - kdDebug() << "Emitting itemOnServer( posting.postID()="<uid(), KURL( posting.postID() ), - posting.fingerprint(), posting.postID() ); - } else { - kdDebug() << "readPostingFromMap failed! " << endl; - success = false; - // TODO: Error handling - } - } - } - return success; -} - - -bool APIBlogger::readPostingFromMap( BlogPosting *post, const TQMap &postInfo ) -{ - // FIXME: - if ( !post ) return false; - TQStringList mapkeys = postInfo.keys(); - kdDebug() << endl << "Keys: " << mapkeys.join(", ") << endl << endl; - - TQString fp( TQString() ); - - TQDateTime dt( postInfo[ "dateCreated" ].toDateTime() ); - if ( dt.isValid() && !dt.isNull() ) { - post->setCreationDateTime( dt ); - TQString fp = dt.toString( TQt::ISODate ); - } - dt = postInfo[ "postDate" ].toDateTime(); - if ( dt.isValid() && !dt.isNull() ) { - post->setDateTime( dt ); - fp = dt.toString( TQt::ISODate ); - } - dt = postInfo[ "lastModified" ].toDateTime(); - if ( dt.isValid() && !dt.isNull() ) { - post->setModificationDateTime( dt ); - fp = dt.toString( TQt::ISODate ); - } - post->setFingerprint( fp ); - - post->setUserID( postInfo[ "userid" ].toString() ); - post->setPostID( postInfo[ "postid" ].toString() ); - - TQString title( postInfo[ "title" ].toString() ); - TQString description( postInfo[ "description" ].toString() ); - TQString contents( postInfo[ "content" ].toString() ); - TQString category; - - // TODO: Extract title and cats from the old-style blogger api without extensions -/* - if ( (title.isEmpty() || description.isEmpty() ) && !contents.isEmpty() ) { - // we don't have both title and description, so use the content (ie. it's an - // old-style blogger api, not the extended drupal api. - - kdDebug() << "No title and description given, so it's an old-style " - "Blogger API without extensions" << endl; - TQString catTagOpen = mTemplate.categoryTagOpen(); - TQString catTagClose = mTemplate.categoryTagClose(); - TQString titleTagOpen = mTemplate.titleTagOpen(); - TQString titleTagClose = mTemplate.titleTagClose(); - - int catStart = contents.find( catTagOpen, 0, false ) + catTagOpen.length(); - int catEnd = contents.find( catTagClose, 0, false ); -kdDebug() << " catTagOpen = " << catTagOpen << ", catTagClose = " << catTagClose << ", start - end : " << catStart <<" - " << catEnd << endl; - if ( catEnd > catStart ) { - category = contents.mid( catStart, catEnd - catStart ); - kdDebug() << "Found a category \"" << category << "\"" << endl; - contents = contents.remove( catStart - catTagOpen.length(), - catEnd - catStart + catTagClose.length() + catTagOpen.length() ); - } - int titleStart = contents.find( titleTagOpen, 0, false ) + titleTagOpen.length(); - int titleEnd = contents.find( titleTagClose, 0, false ); -kdDebug() << " titleTagOpen = " << titleTagOpen << ", titleTagClose = " << titleTagClose << ", start - end : " << titleStart <<" - " << titleEnd << endl; - kdDebug() << "Title start and end: " << titleStart << ", " << titleEnd << endl; - if ( titleEnd > titleStart ) { - title = contents.mid( titleStart, titleEnd - titleStart ); - contents = contents.remove( titleStart - titleTagOpen.length(), - titleEnd - titleStart + titleTagClose.length() + titleTagOpen.length() ); - } - kdDebug() << endl << endl << endl << "After treatment of the special tags, we have a content of: "<< endl << contents << endl; - } -*/ - - post->setTitle( title ); - post->setContent( contents ); - if ( !category.isEmpty() ) - post->setCategory( category ); - return true; -} - - - diff --git a/kresources/blogging/API_Blogger.h b/kresources/blogging/API_Blogger.h deleted file mode 100644 index d7d5f43b9..000000000 --- a/kresources/blogging/API_Blogger.h +++ /dev/null @@ -1,57 +0,0 @@ - /* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef API_BLOGGER_H -#define API_BLOGGER_H - -#include "API_Blog.h" - -#include -#include -#include - -namespace KBlog { - -class APIBlogger : public APIBlog -{ - public: - APIBlogger( const KURL &server, TQObject *parent = 0L, const char *name = 0L ) : APIBlog( server, parent, name ) {} - TQString getFunctionName( blogFunctions type ); - TQString interfaceName() const { return "Blogger API 1.0"; } - - - TDEIO::Job *createUserInfoJob(); - TDEIO::Job *createListFoldersJob(); - TDEIO::TransferJob *createListItemsJob( const KURL &url ); - TDEIO::TransferJob *createDownloadJob( const KURL &url ); - TDEIO::TransferJob *createUploadJob( const KURL &url, KBlog::BlogPosting *posting ); - TDEIO::TransferJob *createUploadNewJob( KBlog::BlogPosting *posting ); - TDEIO::Job *createRemoveJob( const KURL &url, const TQString &postid ); - - bool interpretUserInfoJob( TDEIO::Job *job ); - void interpretListFoldersJob( TDEIO::Job *job ); - bool interpretListItemsJob( TDEIO::Job *job ); - bool interpretDownloadItemsJob( TDEIO::Job *job ); - protected: - bool readPostingFromMap( BlogPosting *post, const TQMap &postInfo ); -}; - -} -#endif diff --git a/kresources/blogging/Makefile.am b/kresources/blogging/Makefile.am deleted file mode 100644 index 508b0e752..000000000 --- a/kresources/blogging/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/kresources/lib -I../lib -I$(top_srcdir)/kresources/blogging/libkblog/ $(all_includes) - -lib_LTLIBRARIES = libkcal_blogging.la -kde_module_LTLIBRARIES = kcal_blogging.la - -libkcal_blogging_la_SOURCES = API_Blog.cpp API_Blogger.cpp xmlrpcjob.cpp \ - bloggingglobals.cpp \ - bloggingcalendaradaptor.cpp \ - kcal_resourceblogging.cpp kcal_resourcebloggingconfig.cpp -libkcal_blogging_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ - -version-info 1:0:0 -no-undefined -libkcal_blogging_la_LIBADD = \ - ../lib/libkgroupwarebase.la \ - $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la - - -kcal_blogging_la_SOURCES = kcal_resourceblogging_plugin.cpp -kcal_blogging_la_LDFLAGS = $(all_libraries) -module -no-undefined $(KDE_PLUGIN) -kcal_blogging_la_LIBADD = libkcal_blogging.la - -kcal_servicedir = $(kde_servicesdir)/kresources/kcal -kcal_service_DATA = blogging.desktop - -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kres_blogging.pot - -kcal_resourceblogging.lo: ../lib/kresources_groupwareprefs.h diff --git a/kresources/blogging/blogging.desktop b/kresources/blogging/blogging.desktop deleted file mode 100644 index 7714a362a..000000000 --- a/kresources/blogging/blogging.desktop +++ /dev/null @@ -1,49 +0,0 @@ -[Desktop Entry] -Name=Journals as Blogs on a Server -Name[af]=Joernale as Blogs op 'n bediener -Name[bg]=Дневници и блогове -Name[ca]=Diaris com a blocs en un servidor -Name[cs]=Deníky jako blogy na serveru -Name[da]=Journaler som www-blogger på en server -Name[de]=Journaleinträge als Blogs auf einem Server -Name[el]=Εφημερίδες ως Blogs σε έναν εξυπηρετητή -Name[es]=Diarios, como bitácoras en un servidor -Name[et]=Päevik veebipäevikuna serveris -Name[eu]=Egunkariak blog moduan zerbitzarian -Name[fa]=نشریه‌ها به عنوان وب‌نوشتها روی یک کارساز -Name[fi]=Päiväkirjat blogeina palvelimella -Name[fr]=Journaux (blogs) sur un serveur -Name[fy]=Journalen as blochs op in tsjinner -Name[gl]=Xornais como Bitácoras nun Servidor -Name[hu]=Naplók blogként tárolása a kiszolgálón -Name[is]=Dagbækur sem blogg á þjóni -Name[it]=Diari come blog su un server -Name[ja]=サーバ上のブログとしてのジャーナル -Name[kk]=Сервердегі күнделік блог ретінде -Name[km]=ទិនានុប្បវត្តិ​ជា​កំណត់ហេតុ​បណ្ដាញ​នៅ​លើ​ម៉ាស៊ីន​បម្រើ -Name[lt]=Dienynai kaip Blog'ai serveryje -Name[ms]=Jurnal sebagai Blog pada pelayan -Name[nb]=Dagbok som blogg på en tjener -Name[nds]=Daagbookindräag as Blog op en Server -Name[ne]=सर्भरमा बल्गका रुपका पत्रिका -Name[nl]=Journalen als blogs op een server -Name[nn]=Dagbøker som bloggar på ein tenar -Name[pl]=Dzienniki jako blogi na serwerze -Name[pt]=Diários como 'Blogs' num Servidor -Name[pt_BR]=Diários como Blogs em um Servidor -Name[ru]=Журналы (блоги) на сервере -Name[sk]=Žurnály ako blogy na serveri -Name[sl]=Dnevniki kot spletni dnevniki (blogi) na strežniku -Name[sr]=Дневници као блогови на серверу -Name[sr@Latn]=Dnevnici kao blogovi na serveru -Name[sv]=Journaler som webbloggar på en server -Name[ta]=சேவகனில் பேச்சுரைகள் பத்திரிககளாக உள்ளன -Name[tr]=Web Günlüğü gibi, bir Sunucuya yazar -Name[uk]=Журнали як веб-щоденники на сервері -Name[zh_CN]=日记作为服务器上的博客日志 -Name[zh_TW]=日誌做為伺服器上的部落格 -X-TDE-Library=kcal_blogging -Type=Service -ServiceTypes=KResources/Plugin -X-TDE-ResourceFamily=calendar -X-TDE-ResourceType=blogging diff --git a/kresources/blogging/bloggingcalendaradaptor.cpp b/kresources/blogging/bloggingcalendaradaptor.cpp deleted file mode 100644 index 2ed925a88..000000000 --- a/kresources/blogging/bloggingcalendaradaptor.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2005 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "bloggingcalendaradaptor.h" -#include "bloggingglobals.h" -#include -#include - -#include -#include -#include - -#include - -using namespace KCal; - -// That terribly long app key was generated at -// http://www.blogger.com/developers/api/1_docs/register.html -// for the "KDE-Pim libkcal blogging resource". -// TODO: -/*TQString BloggingCalendarAdaptor::mAppID = - TQString("20ffffffd7ffffffc5ffffffbdffffff87ffffffb72d39fffffffe5c4bfffff" - "fcfffffff80ffffffd4665cfffffff375ffffff88ffffff871a0cffffff8029"); -*/ - - -BloggingUploadItem::BloggingUploadItem( KBlog::APIBlog *api, CalendarAdaptor *adaptor, KCal::Incidence *incidence, KPIM::GroupwareUploadItem::UploadType type ) - : GroupwareUploadItem( type ), mPosting( 0 ), mAPI( 0 ) -{ - Journal* j = dynamic_cast( incidence ); - if ( api && j && adaptor ) { - mItemType = KPIM::FolderLister::Journal; - - setUrl( j->customProperty( adaptor->identifier(), "storagelocation" ) ); - setUid( j->uid() ); - - mPosting = api->postingFromJournal( j ); - mAPI = api; - } -} - -BloggingUploadItem::~BloggingUploadItem() -{ - delete mPosting; -} - -TDEIO::TransferJob *BloggingUploadItem::createUploadJob( KPIM::GroupwareDataAdaptor *adaptor, const KURL &baseurl ) -{ -kdDebug()<<"BloggingUploadItem::createUploadJob, adaptor="<setURL( baseurl ); - return mAPI->createUploadJob( url(), mPosting ); -} - -TDEIO::TransferJob *BloggingUploadItem::createUploadNewJob( KPIM::GroupwareDataAdaptor *adaptor, const KURL &baseurl ) -{ -kdDebug()<<"BloggingUploadItem::createUploadNewJob"<setURL( baseurl ); - return mAPI->createUploadNewJob( mPosting ); -} - - - - - - -BloggingCalendarAdaptor::BloggingCalendarAdaptor() : mAPI( 0 ), mAuthenticated( false ) -{ -} - - -KBlog::APIBlog *BloggingCalendarAdaptor::api() const -{ - return mAPI; -} - -void BloggingCalendarAdaptor::setAPI( KBlog::APIBlog *api ) -{ - delete mAPI; - mAPI = api; - mAuthenticated = false; - connect( api, TQT_SIGNAL( userInfoRetrieved( const TQString &, const TQString &, - const TQString & ) ), - TQT_SLOT( slotUserInfoRetrieved( const TQString &, const TQString &, - const TQString & ) ) ); - connect( api, TQT_SIGNAL( folderInfoRetrieved( const TQString &, const TQString & ) ), - TQT_SLOT( slotFolderInfoRetrieved( const TQString&, const TQString & ) ) ); - connect( api, TQT_SIGNAL( itemOnServer( const KURL & ) ), - TQT_SIGNAL( itemOnServer( const KURL & ) ) ); - connect( api, TQT_SIGNAL( itemDownloaded( KCal::Incidence *, const TQString &, - const KURL &, const TQString &, const TQString & ) ), - TQT_SLOT( calendarItemDownloaded( KCal::Incidence *, const TQString &, - const KURL &, const TQString &, const TQString & ) ) ); - -} - -KPIM::GroupwareUploadItem *BloggingCalendarAdaptor::newUploadItem( KCal::Incidence*it, - KPIM::GroupwareUploadItem::UploadType type ) -{ - return new BloggingUploadItem( mAPI, this, it, type ); -} - - - -void BloggingCalendarAdaptor::slotFolderInfoRetrieved( const TQString &id, const TQString &name ) -{ - emit folderInfoRetrieved( KURL(id), name, KPIM::FolderLister::Journal ); -} - -void BloggingCalendarAdaptor::slotUserInfoRetrieved( const TQString &/*nick*/, - const TQString &/*user*/, const TQString &/*email*/ ) -{ -kdDebug() << "BloggingCalendarAdaptor::slotUserInfoRetrieved"<setURL( url ); - } -} - -void BloggingCalendarAdaptor::setUser( const TQString &user ) -{ - CalendarAdaptor::setUser( user ); - if ( mAPI ) { - mAPI->setUsername( user ); - } -} - -void BloggingCalendarAdaptor::setPassword( const TQString &password ) -{ - CalendarAdaptor::setPassword( password ); - if ( mAPI ) { - mAPI->setPassword( password ); - } -} - -void BloggingCalendarAdaptor::setUserPassword( KURL & ) -{ - kdDebug(5800) << "BloggingCalendarAdaptor::setUserPassword" << endl; -} - - - -TDEIO::Job *BloggingCalendarAdaptor::createLoginJob( const KURL &url, - const TQString &user, - const TQString &password ) -{ - if ( mAPI ) { - mAPI->setURL( url ); - mAPI->setUsername( user ); - mAPI->setPassword( password ); - return mAPI->createUserInfoJob(); - } else return 0; -} - -TDEIO::Job *BloggingCalendarAdaptor::createListFoldersJob( const KURL &/*url*/ ) -{ - if ( mAPI ) { - return mAPI->createListFoldersJob(); - } else return 0; -} - -TDEIO::TransferJob *BloggingCalendarAdaptor::createListItemsJob( const KURL &url ) -{ - if ( mAPI ) { - return mAPI->createListItemsJob( url ); - } else return 0; -} - -TDEIO::TransferJob *BloggingCalendarAdaptor::createDownloadJob( const KURL &url, - KPIM::FolderLister::ContentType ctype ) -{ - if ( mAPI && (ctype & KPIM::FolderLister::Journal) ) { - return mAPI->createDownloadJob( url ); - } else return 0; -} - -TDEIO::Job *BloggingCalendarAdaptor::createRemoveJob( const KURL &url, - KPIM::GroupwareUploadItem *deleteItem ) -{ -kdDebug()<<"BloggingCalendarAdaptor::createRemoveJob( " << url.url() << ", ..)" << endl; - if ( mAPI && deleteItem ) { - return mAPI->createRemoveJob( url, deleteItem->url().url() ); - } else return 0; -} - - - - -bool BloggingCalendarAdaptor::interpretLoginJob( TDEIO::Job *job ) -{ -kdDebug()<<"BloggingCalendarAdaptor::interpretLoginJob"<interpretUserInfoJob( job ); -kdDebug() << "authenticated=" << mAuthenticated << endl; - return mAuthenticated; - } else return false; -} - - -void BloggingCalendarAdaptor::interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister * ) -{ -kdDebug() << "BloggingCalendarAdaptor::interpretListFoldersJob" << endl; - if ( mAPI && job ) { - mAPI->interpretListFoldersJob( job ); - } -} - - -bool BloggingCalendarAdaptor::interpretListItemsJob( TDEIO::Job *job, - const TQString &/*jobData*/ ) -{ - if ( mAPI ) { - return mAPI->interpretListItemsJob( job ); - } else { - return false; - } -} - - -bool BloggingCalendarAdaptor::interpretDownloadItemsJob( TDEIO::Job *job, - const TQString &/*jobData*/ ) -{ - if ( mAPI ) { - return mAPI->interpretDownloadItemsJob( job ); - } else { - return false; - } -} - -#include "bloggingcalendaradaptor.moc" diff --git a/kresources/blogging/bloggingcalendaradaptor.h b/kresources/blogging/bloggingcalendaradaptor.h deleted file mode 100644 index ee6d292aa..000000000 --- a/kresources/blogging/bloggingcalendaradaptor.h +++ /dev/null @@ -1,105 +0,0 @@ - /* - This file is part of tdepim. - - Copyright (C) 2004-05 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCAL_BLOGGINGCALENDARADAPTOR_H -#define KCAL_BLOGGINGCALENDARADAPTOR_H - -#include "calendaradaptor.h" -#include "groupwareuploadjob.h" -#include "API_Blog.h" -#include - -namespace TDEIO { -class Job; -} - -namespace KCal { - -class BloggingUploadItem : public KPIM::GroupwareUploadItem -{ - public: - BloggingUploadItem( KBlog::APIBlog *api, CalendarAdaptor *adaptor, KCal::Incidence *incidence, UploadType type ); - virtual ~BloggingUploadItem(); - virtual TDEIO::TransferJob *createUploadNewJob( - KPIM::GroupwareDataAdaptor *adaptor, const KURL &baseurl ); - virtual TDEIO::TransferJob *createUploadJob( - KPIM::GroupwareDataAdaptor *adaptor, const KURL &url ); - - protected: - BloggingUploadItem( UploadType type ) : KPIM::GroupwareUploadItem( type ) {} - KBlog::BlogPosting *mPosting; - KBlog::APIBlog *mAPI; -}; - -class BloggingCalendarAdaptor : public CalendarAdaptor -{ -Q_OBJECT - - public: - BloggingCalendarAdaptor(); - TQValueList supportedTypes() - { - TQValueList types; - types << KPIM::FolderLister::Journal; - return types; - } - - TQCString identifier() const { return "KCalResourceBlogging"; } - long flags() const { return GWResNeedsLogon; } - - void setBaseURL( const KURL &url ); - void setUser( const TQString &user ); - void setPassword( const TQString &password ); - // We don't want to set the username / pw for the URL! - void setUserPassword( KURL &url ); - - KBlog::APIBlog *api() const; - void setAPI( KBlog::APIBlog *api ); - - TDEIO::Job *createLoginJob( const KURL &url, const TQString &user, - const TQString &password ); - TDEIO::Job *createListFoldersJob( const KURL &url ); - TDEIO::TransferJob *createListItemsJob( const KURL &url ); - TDEIO::TransferJob *createDownloadJob( const KURL &url, - KPIM::FolderLister::ContentType ctype ); - TDEIO::Job *createRemoveJob( const KURL &url, KPIM::GroupwareUploadItem *deleteItem ); - - bool interpretLoginJob( TDEIO::Job *job ); - void interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister * ); - bool interpretListItemsJob( TDEIO::Job *job, const TQString &jobData ); - bool interpretDownloadItemsJob( TDEIO::Job *job, const TQString &jobData ); - - public slots: - void slotFolderInfoRetrieved( const TQString &id, const TQString &name ); - void slotUserInfoRetrieved( const TQString &nick, const TQString &user, - const TQString &email ); - - protected: - KPIM::GroupwareUploadItem *newUploadItem( KCal::Incidence*it, - KPIM::GroupwareUploadItem::UploadType type ); - - KBlog::APIBlog *mAPI; - bool mAuthenticated; - static TQString mAppID; -}; - -} - -#endif diff --git a/kresources/blogging/bloggingglobals.cpp b/kresources/blogging/bloggingglobals.cpp deleted file mode 100644 index 53743e9a6..000000000 --- a/kresources/blogging/bloggingglobals.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "bloggingglobals.h" - -TQString BloggingGlobals::mAppID = TQString("20ffffffd7ffffffc5ffffffbdffffff87ffffffb72d39fffffffe5c4bffffffcfffffff80ffffffd4665cfffffff375ffffff88ffffff871a0cffffff8029"); - -TQString BloggingGlobals::getFunctionName( blogFunctions type ) -{ - switch ( type ) { - case bloggerGetUserInfo: return "blogger.getUserInfo"; - case bloggerGetUsersBlogs: return "blogger.getUsersBlogs"; - case bloggerGetRecentPosts: return "blogger.getRecentPosts"; - case bloggerNewPost: return "blogger.newPost"; - case bloggerEditPost: return "blogger.editPost"; - case bloggerDeletePost: return "blogger.deletePost"; - case bloggerGetPost: return "blogger.getPost"; - case bloggerGetTemplate: return "blogger.getTemplate"; - case bloggerSetTemplate: return "blogger.setTemplate"; - default: return TQString(); - } -} - -TQValueList BloggingGlobals::defaultArgs( const TQString &user, const TQString &pw, const TQString &id ) -{ - TQValueList args; - args << TQVariant( mAppID ); - if ( !id.isNull() ) { - args << TQVariant( id ); - } - args << TQVariant( user ) - << TQVariant( pw ); - return args; -} - diff --git a/kresources/blogging/bloggingglobals.h b/kresources/blogging/bloggingglobals.h deleted file mode 100644 index 74eafdf75..000000000 --- a/kresources/blogging/bloggingglobals.h +++ /dev/null @@ -1,50 +0,0 @@ - /* - This file is part of tdepim. - - Copyright (c) 2005 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef BLOGGINGGLOBALS_H -#define BLOGGINGGLOBALS_H - -#include -#include -#include - -class BloggingGlobals -{ - public: - BloggingGlobals() {} - - enum blogFunctions { - bloggerGetUserInfo, - bloggerGetUsersBlogs, - bloggerGetRecentPosts, - bloggerNewPost, - bloggerEditPost, - bloggerDeletePost, - bloggerGetPost, - bloggerGetTemplate, - bloggerSetTemplate - }; - - static TQString getFunctionName( blogFunctions type ); - static TQValueList defaultArgs( const TQString &user, const TQString &pw, const TQString &id = TQString() ); - static TQString mAppID; -}; - -#endif diff --git a/kresources/blogging/kcal_resourceblogging.cpp b/kresources/blogging/kcal_resourceblogging.cpp deleted file mode 100644 index 14bb24ca3..000000000 --- a/kresources/blogging/kcal_resourceblogging.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer > - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "bloggingcalendaradaptor.h" -#include "API_Blogger.h" - -#include "kcal_resourceblogging.h" -#include - -using namespace KCal; - -KBlog::APIBlog *ResourceBlogging::mAPI = 0; - -ResourceBlogging::ResourceBlogging() - : ResourceGroupwareBase() -{ - init(); -} - -ResourceBlogging::ResourceBlogging( const TDEConfig *config ) - : ResourceGroupwareBase( config ) -{ - init(); - if ( config ) { - readConfig( config ); - } else { - setResourceName( i18n( "Blogs" ) ); - } -} - -void ResourceBlogging::init() -{ - setType( "ResourceBlogging" ); - setPrefs( createPrefs() ); - setFolderLister( new KPIM::FolderLister( KPIM::FolderLister::Calendar ) ); - BloggingCalendarAdaptor *ad = new BloggingCalendarAdaptor(); - setAdaptor( ad ); - ad->setAPI( new KBlog::APIBlogger( prefs()->url(), this ) ); - - ResourceGroupwareBase::init(); -} - -void ResourceBlogging::readConfig( const TDEConfig *config ) -{ - BloggingCalendarAdaptor *ad = dynamic_cast( adaptor() ); - ResourceGroupwareBase::readConfig( config ); - if ( ad && prefs() ) { - ad->setUser( prefs()->user() ); - ad->setPassword( prefs()->password() ); - ad->setBaseURL( prefs()->url() ); - } -// TQString url = config->readEntry( "URL" ); -// mUrl = KURL( url ); - -// mServerAPI = config->readNumEntry( "ServerAPI" ); -// mTemplate.setCategoryTagOpen( config->readEntry( "CategoryTagOpen", "" ) ); -// mTemplate.setCategoryTagClose( config->readEntry( "CategoryTagClose", "" ) ); -// mTemplate.setTitleTagOpen( config->readEntry( "TitleTagOpen", "" ) ); -// mTemplate.setTitleTagClose( config->readEntry( "TitleTagClose", "" ) ); - -} - -void ResourceBlogging::writeConfig( TDEConfig *config ) -{ - kdDebug(5800) << "ResourceBlogging::writeConfig()" << endl; - - ResourceCalendar::writeConfig( config ); - -// config->writeEntry( "URL", mUrl.url() ); -// config->writeEntry( "ServerAPI", mServerAPI ); -// config->writeEntry( "CategoryTagOpen", mTemplate.categoryTagOpen() ); -// config->writeEntry( "CategoryTagClose", mTemplate.categoryTagClose() ); -// config->writeEntry( "TitleTagOpen", mTemplate.titleTagOpen() ); -// config->writeEntry( "TitleTagClose", mTemplate.titleTagClose() ); - - ResourceGroupwareBase::writeConfig( config ); -} - - -#include "kcal_resourceblogging.moc" diff --git a/kresources/blogging/kcal_resourceblogging.h b/kresources/blogging/kcal_resourceblogging.h deleted file mode 100644 index 4e850d148..000000000 --- a/kresources/blogging/kcal_resourceblogging.h +++ /dev/null @@ -1,60 +0,0 @@ - /* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCAL_RESOURCEBLOGGING_H -#define KCAL_RESOURCEBLOGGING_H - -#include -#include - -namespace KBlog { -class APIBlog; -} - -namespace KCal { - -/** - This class provides a resource for accessing blogs on a blogging server as journals -*/ -class KDE_EXPORT ResourceBlogging : public ResourceGroupwareBase -{ - Q_OBJECT - - public: - ResourceBlogging(); - ResourceBlogging( const TDEConfig * ); - - void readConfig( const TDEConfig *config ); - void writeConfig( TDEConfig *config ); - - bool addEvent( Event* ) { return false; } - bool addTodo( Todo * ) { return false; } - bool deleteEvent( Event* ) { return false; } - bool deleteTodo( Todo * ) { return false; } - static KBlog::APIBlog *api() { return mAPI; } - - protected: - void init(); - static KBlog::APIBlog *mAPI; -}; - -} - -#endif diff --git a/kresources/blogging/kcal_resourceblogging_plugin.cpp b/kresources/blogging/kcal_resourceblogging_plugin.cpp deleted file mode 100644 index 4cc3dd8cb..000000000 --- a/kresources/blogging/kcal_resourceblogging_plugin.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Reinhold Kainhofer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kcal_resourceblogging.h" -#include "kcal_resourcebloggingconfig.h" - -#include -#include - -using namespace KCal; - -typedef KRES::PluginFactory< ResourceBlogging, ResourceBloggingConfig > BloggingFactory; -//K_EXPORT_COMPONENT_FACTORY( kcal_blogging, BloggingFactory ) - -extern "C" -{ - void *init_kcal_blogging() - { - TDEGlobal::locale()->insertCatalogue( "tdepimresources" ); - TDEGlobal::locale()->insertCatalogue( "kres_blogging" ); - return new BloggingFactory; - } -} diff --git a/kresources/blogging/kcal_resourcebloggingconfig.cpp b/kresources/blogging/kcal_resourcebloggingconfig.cpp deleted file mode 100644 index bd999ffe3..000000000 --- a/kresources/blogging/kcal_resourcebloggingconfig.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2005 Reinhold Kainhofer - - 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. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "kcal_resourcebloggingconfig.h" - -#include -#include - -using namespace KCal; - -ResourceBloggingConfig::ResourceBloggingConfig( TQWidget *parent, const char *name ) : ResourceGroupwareBaseConfig( parent, name ) -{ -} - -void ResourceBloggingConfig::saveSettings( KRES::Resource *resource ) -{ - if ( resource && !resource->readOnly() ) { - KMessageBox::information( this, i18n("Currently, the blogging resource is only read-only. You will not be able to add journals to this resource or upload any changes to the server."), i18n("Read-Only"), "AutoSetReadOnly"); - resource->setReadOnly( true ); - } - ResourceGroupwareBaseConfig::saveSettings( resource ); -} - -#include "kcal_resourcebloggingconfig.moc" diff --git a/kresources/blogging/kcal_resourcebloggingconfig.h b/kresources/blogging/kcal_resourcebloggingconfig.h deleted file mode 100644 index b7584167c..000000000 --- a/kresources/blogging/kcal_resourcebloggingconfig.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2005 Reinhold Kainhofer - - 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. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -#ifndef KCAL_RESOURCEBLOGGINGCONFIG_H -#define KCAL_RESOURCEBLOGGINGCONFIG_H - -#include -#include - -namespace KCal { - -class KDE_EXPORT ResourceBloggingConfig : public ResourceGroupwareBaseConfig -{ - Q_OBJECT - - public: - ResourceBloggingConfig( TQWidget *parent = 0, const char *name = 0 ); - - public slots: - virtual void saveSettings( KRES::Resource *resource ); -}; - -} - -#endif diff --git a/kresources/blogging/resourcebloggingsettings.ui b/kresources/blogging/resourcebloggingsettings.ui deleted file mode 100644 index 7d7e02279..000000000 --- a/kresources/blogging/resourcebloggingsettings.ui +++ /dev/null @@ -1,330 +0,0 @@ - -ResourceBloggingSettings -Ian Reinhart Geiser <geiseri@kde.org> - - - ResourceBloggingSettings - - - - 0 - 0 - 363 - 289 - - - - - unnamed - - - - layout12 - - - - unnamed - - - - textLabel1_4 - - - false - - - - 4 - 5 - 0 - 0 - - - - Service: - - - - - - Custom - - - - - Blogger.com - - - - mServiceType - - - false - - - - - - - groupBox2 - - - Server Settings - - - - unnamed - - - - textLabel1 - - - - 4 - 5 - 0 - 0 - - - - URL: - - - - - textLabel9 - - - Username: - - - - - mUser - - - - - textLabel10 - - - Password: - - - - - mURL - - - http://www.kdedevelopers.com/xmlrpc.php - - - true - - - - - mPassword - - - Password - - - - - textLabel4_2 - - - - 4 - 5 - 0 - 0 - - - - Server API: - - - - - - Blogger API - - - - - Drupal API - - - - - metaWeblog API - - - - - Moveable Type API - - - - mServerAPI - - - true - - - - - - - groupBox3 - - - Templates - - - - unnamed - - - - mCloseTitle - - - - 1 - 0 - 0 - 0 - - - - </TITLE> - - - - - textLabel7_2 - - - Title tags: - - - - - mOpenTitle - - - - 1 - 0 - 0 - 0 - - - - <TITLE> - - - - - mOpenCategory - - - - 1 - 0 - 0 - 0 - - - - 2 - - - <CATEGORY> - - - - - textLabel8_2 - - - - 4 - 1 - 0 - 0 - - - - Category tags: - - - - - mCloseCategory - - - - 1 - 0 - 0 - 0 - - - - </CATEGORY> - - - - - - - spacer4_2 - - - Vertical - - - Expanding - - - - 20 - 84 - - - - - - - - - mServiceType - mURL - mUser - mPassword - mServerAPI - mOpenTitle - mCloseTitle - mOpenCategory - mCloseCategory - - - - kcombobox.h - klineedit.h - kurlrequester.h - klineedit.h - kpushbutton.h - klineedit.h - kcombobox.h - klineedit.h - klineedit.h - klineedit.h - klineedit.h - - diff --git a/kresources/blogging/xmlrpcjob.cpp b/kresources/blogging/xmlrpcjob.cpp deleted file mode 100644 index f2e516308..000000000 --- a/kresources/blogging/xmlrpcjob.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2004 Reinhold Kainhofer - - Based on the davjob: - Copyright (C) 2002 Jan-Pascal van Best - XML-RPC specific parts taken from the xmlrpciface: - Copyright (C) 2003 - 2004 by Frerich Raabe - Tobias Koenig - - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "xmlrpcjob.h" - -#include -#include - -#include -#include -#include -#include -#include - - -#define KIO_ARGS TQByteArray packedArgs; \ - TQDataStream stream( packedArgs, IO_WriteOnly ); stream - -using namespace TDEIO; - -namespace TDEIO { - class XMLRPCResult - { - friend class XmlrpcJob; - public: - XMLRPCResult() {} - bool success() const { return m_success; } - int errorCode() const { return m_errorCode; } - TQString errorString() const { return m_errorString; } - TQValueList data() const { return m_data; } - private: - bool m_success; - int m_errorCode; - TQString m_errorString; - TQValueList m_data; - }; -} - -class XmlrpcJob::XmlrpcJobPrivate -{ -public: -// TQByteArray savedStaticData; -}; - - -XmlrpcJob::XmlrpcJob( const KURL& url, const TQString& method, - const TQValueList ¶ms, bool showProgressInfo) - : TransferJob( url, TDEIO::CMD_SPECIAL, TQByteArray(), TQByteArray(), - showProgressInfo ) -{ - d = new XmlrpcJobPrivate; - // We couldn't set the args when calling the parent constructor, - // so do it now. - TQDataStream stream( m_packedArgs, IO_WriteOnly ); - stream << (int)1 << url; -kdDebug()<<"XMLrpcJob::url="<savedStaticData = staticData.copy(); - } - addMetaData( "UserAgent", "KDE XML-RPC TransferJob" ); - addMetaData( "content-type", "Content-Type: text/xml; charset=utf-8" ); - addMetaData( "ConnectTimeout", "50" ); -} - -XmlrpcJob::~XmlrpcJob() -{ - delete d; - d = 0; -} - -TQString XmlrpcJob::markupCall( const TQString &cmd, - const TQValueList &args ) -{ -kdDebug()<<"XmlrpcJob::markupCall, cmd="<\r\n\r\n"; - - markup += "" + cmd + "\r\n"; - - if ( !args.isEmpty() ) - { - markup += "\r\n"; - TQValueList::ConstIterator it = args.begin(); - TQValueList::ConstIterator end = args.end(); - for ( ; it != end; ++it ) - markup += "\r\n" + marshal( *it ) + "\r\n"; - markup += "\r\n"; - } - - markup += "\r\n"; - - return markup; -} - - - - - -void XmlrpcJob::slotData( const TQByteArray& data ) -{ -kdDebug()<<"XmlrpcJob::slotData()"<> s_cmd; - istream >> s_url; - istream >> s_method; - // PROPFIND - if ( (s_cmd == 7) && (s_method == (int)TDEIO::HTTP_POST) ) { - m_packedArgs.truncate(0); - TQDataStream stream( m_packedArgs, IO_WriteOnly ); - stream << (int)7 << m_redirectionURL << (int)TDEIO::HTTP_POST; - } - } else */ - - kdDebug() << "\033[35;40mResult: " << m_str_response << "\033[0;0m" << endl; - TQDomDocument doc; - TQString errMsg; - int errLine, errCol; - if ( doc.setContent( m_str_response, false, &errMsg, &errLine, &errCol ) ) { - if ( isMessageResponse( doc ) ) { - m_response = parseMessageResponse( doc ).data(); - m_responseType = XMLRPCMessageResponse; - } else if ( isFaultResponse( doc ) ) { - // TODO: Set the error of the job - m_response.clear(); - m_response << TQVariant( parseFaultResponse( doc ).errorString() ); - m_responseType = XMLRPCFaultResponse; - } else { - // TODO: Set the error of the job - m_response.clear(); - m_response << TQVariant( i18n( "Unknown type of XML markup received. " - "Markup: \n %1" ).arg( m_str_response ) ); - m_responseType = XMLRPCUnknownResponse; - } - - } else { - // TODO: if we can't parse the XML response, set the correct error message! -// emit fault( -1, i18n( "Received invalid XML markup: %1 at %2:%3" ) -// .arg( errMsg ).arg( errLine ).arg( errCol ), m_id ); - } - - TransferJob::slotFinished(); -// TODO: Redirect: if( d ) staticData = d->savedStaticData.copy(); -// Need to send XMLRPC request to this host too -} - - - - - -bool XmlrpcJob::isMessageResponse( const TQDomDocument &doc ) -{ - return doc.documentElement().firstChild().toElement() - .tagName().lower() == "params"; -} - -XMLRPCResult XmlrpcJob::parseMessageResponse( const TQDomDocument &doc ) -{ - XMLRPCResult response; - response.m_success = true; - - TQDomNode paramNode = doc.documentElement().firstChild().firstChild(); - while ( !paramNode.isNull() ) { - response.m_data << demarshal( paramNode.firstChild().toElement() ); - paramNode = paramNode.nextSibling(); - } - - return response; -} - - - - - -bool XmlrpcJob::isFaultResponse( const TQDomDocument &doc ) -{ - return doc.documentElement().firstChild().toElement() - .tagName().lower() == "fault"; -} - -XMLRPCResult XmlrpcJob::parseFaultResponse( const TQDomDocument &doc ) -{ - XMLRPCResult response; - response.m_success = false; - - TQDomNode errorNode = doc.documentElement().firstChild().firstChild(); - const TQVariant errorVariant = demarshal( errorNode.toElement() ); - response.m_errorCode = errorVariant.toMap() [ "faultCode" ].toInt(); - response.m_errorString = errorVariant.toMap() [ "faultString" ].toString(); - - return response; -} - - - - - -TQString XmlrpcJob::marshal( const TQVariant &arg ) -{ - switch ( arg.type() ) - { - case TQVariant::String: - case TQVariant::CString: - return "" + arg.toString() + "\r\n"; - case TQVariant::Int: - return "" + TQString::number( arg.toInt() ) + - "\r\n"; - case TQVariant::Double: - return "" + TQString::number( arg.toDouble() ) + - "\r\n"; - case TQVariant::Bool: - { - TQString markup = ""; - markup += arg.toBool() ? "1" : "0"; - markup += "\r\n"; - return markup; - } - case TQVariant::ByteArray: - return "" + KCodecs::base64Encode( arg.toByteArray() ) + - "\r\n"; - case TQVariant::DateTime: - return "" + - arg.toDateTime().toString( TQt::ISODate ) + - "\r\n"; - case TQVariant::List: - { - TQString markup = "\r\n"; - const TQValueList args = arg.toList(); - TQValueList::ConstIterator it = args.begin(); - TQValueList::ConstIterator end = args.end(); - for ( ; it != end; ++it ) - markup += marshal( *it ); - markup += "\r\n"; - return markup; - } - case TQVariant::Map: - { - TQString markup = "\r\n"; - TQMap map = arg.toMap(); - TQMap::ConstIterator it = map.begin(); - TQMap::ConstIterator end = map.end(); - for ( ; it != end; ++it ) - { - markup += "\r\n"; - markup += "" + it.key() + "\r\n"; - markup += marshal( it.data() ); - markup += "\r\n"; - } - markup += "\r\n"; - return markup; - } - default: - kdWarning() << "Failed to marshal unknown variant type: " - << arg.type() << endl; - }; - return TQString(); -} - -TQVariant XmlrpcJob::demarshal( const TQDomElement &elem ) -{ - Q_ASSERT( elem.tagName().lower() == "value" ); - - if ( !elem.hasChildNodes() ) { - // it doesn't have child nodes, so no explicit type name was given, - // i.e. here comes the value instead of - // here comes the value - // Assume in that case: - // Actually, the element will still have a child node, so this will not help here. - // The dirty hack is at the end of this method. -kdDebug()<<"XmlrpcJob::demarshal: No child nodes, assume type=string. Text: "<= 0 ) { - // It's in the format 20041120T...., so adjust it to correct - // ISO 8601 Format 2004-11-20T..., else TQDateTime::fromString won't work: - text = text.insert( 6, '-' ); - text = text.insert( 4, '-' ); - } - return TQVariant( TQDateTime::fromString( text, TQt::ISODate ) ); - - } else if ( typeName == "array" ) { - - TQValueList values; - TQDomNode valueNode = typeElement.firstChild().firstChild(); - while ( !valueNode.isNull() ) { - values << demarshal( valueNode.toElement() ); - valueNode = valueNode.nextSibling(); - } - return TQVariant( values ); - - } else if ( typeName == "struct" ) { - - TQMap map; - TQDomNode memberNode = typeElement.firstChild(); - while ( !memberNode.isNull() ) { - const TQString key = memberNode.toElement().elementsByTagName( "name" ).item( 0 ).toElement().text(); - const TQVariant data = demarshal( memberNode.toElement().elementsByTagName( "value" ).item( 0 ).toElement() ); - map[ key ] = data; - memberNode = memberNode.nextSibling(); - } - return TQVariant( map ); - - } else { - - kdWarning() << "Cannot demarshal unknown type " << typeName << ", text= " << typeElement.text() << endl; - // FIXME: This is just a workaround, for the issue mentioned at the beginning of this method. - return TQVariant( elem.text() ); - } - - return TQVariant(); -} - - - - - -/* Convenience methods */ - -XmlrpcJob* TDEIO::xmlrpcCall( const KURL& url, const TQString &method, const TQValueList ¶ms, bool showProgressInfo ) -{ - if ( url.isEmpty() ) { - kdWarning() << "Cannot execute call to " << method << ": empty server URL" << endl; - return 0; - } - XmlrpcJob *job = new XmlrpcJob( url, method, params, showProgressInfo ); -// job->addMetaData( "xmlrpcDepth", depth ); - - return job; -} - -XmlrpcJob* TDEIO::xmlrpcCall( const KURL& url, const TQString &method, - const TQVariant &arg, bool showProgressInfo ) -{ - TQValueList args; - args << arg; - return TDEIO::xmlrpcCall( url, method, args, showProgressInfo ); -} - -XmlrpcJob* TDEIO::xmlrpcCall( const KURL& url, const TQString &method, - const TQStringList &arg, bool showProgressInfo ) -{ - TQValueList args; - TQStringList::ConstIterator it = arg.begin(); - TQStringList::ConstIterator end = arg.end(); - for ( ; it != end; ++it ) - args << TQVariant( *it ); - return TDEIO::xmlrpcCall( url, method, args, showProgressInfo ); -} - -template -XmlrpcJob* TDEIO::xmlrpcCall( const KURL& url, const TQString &method, - const TQValueList&arg, bool showProgressInfo ) -{ - TQValueList args; - - typename TQValueList::ConstIterator it = arg.begin(); - typename TQValueList::ConstIterator end = arg.end(); - for ( ; it != end; ++it ) - args << TQVariant( *it ); - return TDEIO::xmlrpcCall( url, method, args, showProgressInfo ); -} - -#include "xmlrpcjob.moc" diff --git a/kresources/blogging/xmlrpcjob.h b/kresources/blogging/xmlrpcjob.h deleted file mode 100644 index 1efe79e1d..000000000 --- a/kresources/blogging/xmlrpcjob.h +++ /dev/null @@ -1,124 +0,0 @@ -// -*- c++ -*- -/* This file is part of the KDE libraries - Copyright (C) 2004 Reinhold Kainhofer - Based on the davjob: - Copyright (C) 2002 Jan-Pascal van Best - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef __kio_xmlrpcjob_h__ -#define __kio_xmlrpcjob_h__ - -#include - -#include -#include -#include - -#include -#include - -namespace TDEIO { - - class XMLRPCResult; - -/** - * The transfer job pumps data into and/or out of a Slave. - * Data is sent to the slave on request of the slave ( dataReq ). - * If data coming from the slave can not be handled, the - * reading of data from the slave should be suspended. - * @see TDEIO::xmlrpcCall() - * @since 3.4 - */ -class XmlrpcJob : public TransferJob { -Q_OBJECT - - - public: - /** Indicates the response type of the call - */ - enum XMLRPCResponseType { - XMLRPCMessageResponse, - XMLRPCFaultResponse, - XMLRPCUnknownResponse - }; - /** - * Use TDEIO::xmlrpcPropFind(), TDEIO::xmlrpcPropPatch() and - * TDEIO::xmlrpcSearch() to create a new XmlrpcJob. - */ - XmlrpcJob( const KURL& url, const TQString& method, - const TQValueList ¶ms, bool showProgressInfo ); - virtual ~XmlrpcJob(); - /** - * Returns the response as a TQDomDocument. - * @return the response document - */ - TQValueList &response() { return m_response; } - /** - * Returns the type of the response. - * @return the type of the response - */ - XMLRPCResponseType responseType() const { return m_responseType; } - - static TQString markupCall( const TQString &cmd, - const TQValueList &args ); - protected slots: - virtual void slotFinished(); - virtual void slotData( const TQByteArray &data); - - protected: - static TQString marshal( const TQVariant &arg ); - static TQVariant demarshal( const TQDomElement &e ); - - static bool isMessageResponse( const TQDomDocument &doc ); - static bool isFaultResponse( const TQDomDocument &doc ); - - static XMLRPCResult parseMessageResponse( const TQDomDocument &doc ); - static XMLRPCResult parseFaultResponse( const TQDomDocument &doc ); - - - private: - class XmlrpcJobPrivate; - XmlrpcJobPrivate *d; - TQString m_str_response; - TQValueList m_response; - XMLRPCResponseType m_responseType; -}; - -/** - * Creates a XmlrpcJob that calls a @p method of the API at the given @p url. - * - * @param url the URL of the XML-RPC Interface of the server - * @param method the name of the method to call - * @param params the arguments (as TQValueList) for the method call. - * @param showProgressInfo true to show progress information - * @return the new XmlrpcJob - */ -XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method, - const TQValueList ¶ms, - bool showProgressInfo = true ); - -XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method, - const TQVariant &arg, bool showProgressInfo = true ); -XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method, - const TQStringList &arg, bool showProgressInfo = true ); -template -XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method, - const TQValueList&arg,bool showProgressInfo = true ); -} - -#endif -- cgit v1.2.1