Commit 88450880 authored by Laurent Montel's avatar Laurent Montel 😁

astyle-kdelibs

parent a1e0090f
This diff is collapsed.
......@@ -12,7 +12,6 @@
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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
......@@ -49,40 +48,40 @@ public:
* @param blog_id id of blog we will edit it, for adding a blog this should be "-1"
* @param parent Parent
*/
explicit AddEditBlog( int blog_id, QWidget *parent = 0, Qt::WindowFlags flags = 0 );
explicit AddEditBlog(int blog_id, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~AddEditBlog();
protected Q_SLOTS:
virtual void slotButtonClicked( int button );
virtual void slotButtonClicked(int button);
void enableAutoConfBtn();
void enableOkButton( const QString & );
void enableOkButton(const QString &);
void autoConfigure();
void fetchBlogId();
void fetchedBlogId( const QList<QMap<QString, QString> >& list );
void fetchedBlogId(const QList<QMap<QString, QString> > &list);
void handleFetchIDTimeout();
void handleFetchAPITimeout();
void handleFetchError( KBlog::Blog::ErrorType type, const QString& errorMsg );
void handleFetchError(KBlog::Blog::ErrorType type, const QString &errorMsg);
void slotReturnPressed();
void setSupportedFeatures( BilboBlog::ApiType api );
void slotComboApiChanged( int index );
void setSupportedFeatures(BilboBlog::ApiType api);
void slotComboApiChanged(int index);
void gotHtml( KJob * );
void gotXmlRpcTest( KJob *job );
void gotHtml(KJob *);
void gotXmlRpcTest(KJob *job);
void bloggerAuthenticated( const QMap<QString, QString>& authData );
void bloggerAuthenticated(const QMap<QString, QString> &authData);
Q_SIGNALS:
void sigBlogAdded( const BilboBlog& );
void sigBlogEdited( const BilboBlog& );
void sigBlogAdded(const BilboBlog &);
void sigBlogEdited(const BilboBlog &);
private:
void showWaitWidget( QString text );
void showWaitWidget(QString text);
void hideWaitWidget();
class Private;
Private * const d;
Private *const d;
};
#endif
This diff is collapsed.
......@@ -12,7 +12,6 @@
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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
......@@ -33,7 +32,6 @@
#include <QObject>
#include <QMap>
class BilboMedia;
/**
Engine of application.
......@@ -46,7 +44,7 @@ class Backend : public QObject
{
Q_OBJECT
public:
explicit Backend( int blog_id, QObject* parent = 0 );
explicit Backend(int blog_id, QObject *parent = 0);
~Backend();
......@@ -62,32 +60,32 @@ public:
* retrieve latest posts from server
* @param count number of post to retrieve.
*/
void getEntriesListFromServer( int count );
void getEntriesListFromServer(int count);
/**
* Use this to publish a post to server.
* @param post Post to publish.
*/
void publishPost( BilboPost *post );
void publishPost(BilboPost *post);
/**
* Upload a new Media object e.g. image to server.
* @param media Media Object to upload.
*/
void uploadMedia( BilboMedia *media );
void uploadMedia(BilboMedia *media);
/**
* Modify an existing post.
* Note: posiId must sets correctly.
* @param post post to modify.
*/
void modifyPost( BilboPost* post );
void modifyPost(BilboPost *post);
/**
* Remove an existing post from server
* @param post post to remove.
*/
void removePost( BilboPost *post );
void removePost(BilboPost *post);
// void setPostCategories( const QString postId, const QMap<QString, bool> &categoriesList );
......@@ -99,73 +97,73 @@ public:
* @param post a blog post with the ID identifying the blog post to fetch.
* @see sigPostFetched()
*/
void fetchPost( BilboPost *post );
void fetchPost(BilboPost *post);
protected Q_SLOTS:
void categoriesListed( const QList< QMap< QString, QString > > & categories );
void entriesListed( const QList< KBlog::BlogPost > &posts );
void postPublished( KBlog::BlogPost *post );
void mediaUploaded( KBlog::BlogMedia *media );
void error( KBlog::Blog::ErrorType type, const QString &errorMessage );
void slotMediaError( KBlog::Blog::ErrorType type, const QString &errorMessage, KBlog::BlogMedia *media );
void categoriesListed(const QList< QMap< QString, QString > > &categories);
void entriesListed(const QList< KBlog::BlogPost > &posts);
void postPublished(KBlog::BlogPost *post);
void mediaUploaded(KBlog::BlogMedia *media);
void error(KBlog::Blog::ErrorType type, const QString &errorMessage);
void slotMediaError(KBlog::Blog::ErrorType type, const QString &errorMessage, KBlog::BlogMedia *media);
// void postCategoriesSetted( const QString &postId );
void slotPostRemoved( KBlog::BlogPost *post );
void slotPostFetched( KBlog::BlogPost *post );
void slotPostRemoved(KBlog::BlogPost *post);
void slotPostFetched(KBlog::BlogPost *post);
/**
* This function is called after a post published fine, to insert it to DB and emit sigPostPublished.
*/
void savePostInDbAndEmitResult( KBlog::BlogPost *post );
void savePostInDbAndEmitResult(KBlog::BlogPost *post);
void bloggerAuthenticated( const QMap<QString,QString>& authData );
void bloggerAuthenticated(const QMap<QString, QString> &authData);
Q_SIGNALS:
/**
* emit when a categoriesListed() Done and Categories added to DB
* @param blog_id id of Blog owner of categories.
*/
void sigCategoryListFetched( int blog_id );
void sigCategoryListFetched(int blog_id);
/**
* emit when a entriesListed() Done and Entries added to DB
* @param blog_id id of Blog owner of Entries.
*/
void sigEntriesListFetched( int blog_id );
void sigEntriesListFetched(int blog_id);
/**
* This signal is emitted when a post published/modified and added/edited to Database.
* @param blog_id blog id.
* @param post The post has been saved.
*/
void sigPostPublished( int blog_id, BilboPost *post );
void sigPostPublished(int blog_id, BilboPost *post);
/**
* This signal is emitted when a media has been uploaded to the server.
* @param media Uploaded media Object.
*/
void sigMediaUploaded( BilboMedia *media );
void sigMediaUploaded(BilboMedia *media);
/**
* this signal is emitted when a post removed successfully.
*/
void sigPostRemoved( int blog_id, const BilboPost &post);
void sigPostRemoved(int blog_id, const BilboPost &post);
void sigPostFetched( BilboPost *post );
void sigPostFetched(BilboPost *post);
/**
* this signal emitted when an error occurred on current transaction.
* @param type type of error
* @param errorMessage error message.
*/
void sigError( const QString &errorMessage );
void sigError(const QString &errorMessage);
void sigMediaError( const QString &errorMessage, BilboMedia* media );
void sigMediaError(const QString &errorMessage, BilboMedia *media);
private:
KBlog::BlogPost* preparePost( KBlog::BlogPost* post );
QString errorTypeToString( KBlog::Blog::ErrorType type );
KBlog::BlogPost *preparePost(KBlog::BlogPost *post);
QString errorTypeToString(KBlog::Blog::ErrorType type);
class Private;
Private * const d;
Private *const d;
};
#endif
......@@ -12,7 +12,6 @@
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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
......@@ -29,12 +28,11 @@
#include <QApplication>
class BilboBlog::Private
{
public:
Private()
: kblog(0)
: kblog(0)
{}
KUrl mUrl;
QString mBlogUrl;
......@@ -53,15 +51,15 @@ public:
QMap<QString, QString> mAuthData;
};
BilboBlog::BilboBlog( QObject *parent )
: QObject( parent ), d(new Private)
BilboBlog::BilboBlog(QObject *parent)
: QObject(parent), d(new Private)
{
d->mError = false;
setApi(BLOGGER1_API);
}
BilboBlog::BilboBlog( const BilboBlog &blog)
: QObject( qApp ), d(new Private)
BilboBlog::BilboBlog(const BilboBlog &blog)
: QObject(qApp), d(new Private)
{
d->mUrl = blog.url();
d->mBlogUrl = blog.blogUrl();
......@@ -69,7 +67,7 @@ BilboBlog::BilboBlog( const BilboBlog &blog)
d->mUsername = blog.username();
d->mPassword = blog.password();
d->mTitle = blog.title();
setApi( blog.api() );
setApi(blog.api());
d->mId = blog.id();
d->mDir = blog.direction();
d->mLocalDirectory = blog.localDirectory();
......@@ -81,32 +79,32 @@ BilboBlog::~BilboBlog()
delete d;
}
KBlog::Blog* BilboBlog::blogBackend()
KBlog::Blog *BilboBlog::blogBackend()
{
if(!d->kblog){
switch ( api() ) {
if (!d->kblog) {
switch (api()) {
case BilboBlog::BLOGGER1_API:
d->kblog = new KBlog::Blogger1( url(), this );
d->kblog = new KBlog::Blogger1(url(), this);
break;
case BilboBlog::METAWEBLOG_API:
d->kblog = new KBlog::MetaWeblog( url(), this );
d->kblog = new KBlog::MetaWeblog(url(), this);
break;
case BilboBlog::MOVABLETYPE_API:
d->kblog = new KBlog::MovableType( url(), this );
d->kblog = new KBlog::MovableType(url(), this);
break;
case BilboBlog::WORDPRESSBUGGY_API:
d->kblog = new KBlog::WordpressBuggy( url(), this );
d->kblog = new KBlog::WordpressBuggy(url(), this);
break;
case BilboBlog::BLOGGER_API:
d->kblog = new KBlog::Blogger( url(), this );
qobject_cast<KBlog::Blogger*>(d->kblog)->setApiKey( QLatin1String("508396175529-icqp62q8t6st41gjv1du100fol6renq4.apps.googleusercontent.com") );
qobject_cast<KBlog::Blogger*>(d->kblog)->setSecretKey( QLatin1String("JFPDXYmGIuM601vhgVGv0Dlx") );
d->kblog = new KBlog::Blogger(url(), this);
qobject_cast<KBlog::Blogger *>(d->kblog)->setApiKey(QLatin1String("508396175529-icqp62q8t6st41gjv1du100fol6renq4.apps.googleusercontent.com"));
qobject_cast<KBlog::Blogger *>(d->kblog)->setSecretKey(QLatin1String("JFPDXYmGIuM601vhgVGv0Dlx"));
break;
}
d->kblog->setUserAgent( QLatin1String(APPNAME), QLatin1String(VERSION) );
d->kblog->setUsername( username() );
d->kblog->setPassword( password() );
d->kblog->setBlogId( blogid() );
d->kblog->setUserAgent(QLatin1String(APPNAME), QLatin1String(VERSION));
d->kblog->setUsername(username());
d->kblog->setPassword(password());
d->kblog->setBlogId(blogid());
}
return d->kblog;
}
......@@ -126,7 +124,7 @@ KUrl BilboBlog::url() const
return d->mUrl;
}
void BilboBlog::setUrl( const KUrl &url )
void BilboBlog::setUrl(const KUrl &url)
{
d->mUrl = url;
}
......@@ -136,7 +134,7 @@ QString BilboBlog::blogid() const
return d->mBlogid;
}
void BilboBlog::setBlogId( const QString &url )
void BilboBlog::setBlogId(const QString &url)
{
d->mBlogid = url;
}
......@@ -146,7 +144,7 @@ QString BilboBlog::username() const
return d->mUsername;
}
void BilboBlog::setUsername( const QString &username )
void BilboBlog::setUsername(const QString &username)
{
d->mUsername = username;
}
......@@ -156,7 +154,7 @@ QString BilboBlog::password() const
return d->mPassword;
}
void BilboBlog::setPassword( const QString &password )
void BilboBlog::setPassword(const QString &password)
{
d->mPassword = password;
}
......@@ -166,7 +164,7 @@ QString BilboBlog::title() const
return d->mTitle;
}
void BilboBlog::setTitle( const QString &title )
void BilboBlog::setTitle(const QString &title)
{
d->mTitle = title;
}
......@@ -176,40 +174,40 @@ BilboBlog::ApiType BilboBlog::api() const
return d->mApi;
}
void BilboBlog::setApi( const ApiType api )
void BilboBlog::setApi(const ApiType api)
{
d->mApi = api;
switch(api) {
case BLOGGER1_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
case METAWEBLOG_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
case MOVABLETYPE_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
case WORDPRESSBUGGY_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
case BLOGGER_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
default:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
switch (api) {
case BLOGGER1_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
case METAWEBLOG_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
case MOVABLETYPE_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
case WORDPRESSBUGGY_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = true;
d->mSupportedFeatures[QLatin1String("category")] = true;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
case BLOGGER_API:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = true;
break;
default:
d->mSupportedFeatures[QLatin1String("uploadMedia")] = false;
d->mSupportedFeatures[QLatin1String("category")] = false;
d->mSupportedFeatures[QLatin1String("tag")] = false;
break;
}
}
......@@ -218,7 +216,7 @@ int BilboBlog::id() const
return d->mId;
}
void BilboBlog::setId( const int id )
void BilboBlog::setId(const int id)
{
d->mId = id;
}
......@@ -228,7 +226,7 @@ Qt::LayoutDirection BilboBlog::direction() const
return d->mDir;
}
void BilboBlog::setDirection( const Qt::LayoutDirection dir )
void BilboBlog::setDirection(const Qt::LayoutDirection dir)
{
d->mDir = dir;
}
......@@ -238,17 +236,18 @@ QString BilboBlog::localDirectory() const
return d->mLocalDirectory;
}
void BilboBlog::setLocalDirectory( const QString &directory )
void BilboBlog::setLocalDirectory(const QString &directory)
{
d->mLocalDirectory = directory;
}
QString BilboBlog::blogUrl() const
{
if(d->mBlogUrl.isEmpty())
if (d->mBlogUrl.isEmpty()) {
return d->mUrl.prettyUrl();
else
} else {
return d->mBlogUrl;
}
}
void BilboBlog::setBlogUrl(const QString &blogUrl)
......@@ -271,7 +270,7 @@ bool BilboBlog::supportTag() const
return d->mSupportedFeatures[QLatin1String("tag")];
}
void BilboBlog::setAuthData( const QMap<QString, QString>& authData )
void BilboBlog::setAuthData(const QMap<QString, QString> &authData)
{
d->mAuthData = authData;
}
......
......@@ -12,7 +12,6 @@
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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
......@@ -45,8 +44,8 @@ public:
BLOGGER1_API = 0, METAWEBLOG_API, MOVABLETYPE_API, WORDPRESSBUGGY_API, BLOGGER_API
};
explicit BilboBlog( QObject *parent = 0 );
BilboBlog( const BilboBlog & );
explicit BilboBlog(QObject *parent = 0);
BilboBlog(const BilboBlog &);
~BilboBlog();
KBlog::Blog *blogBackend();
......@@ -58,27 +57,27 @@ public:
* @return url usable for xmlrpc!
*/
KUrl url() const;
void setUrl( const KUrl& );
void setUrl(const KUrl &);
QString blogid() const;
void setBlogId( const QString& );
void setBlogId(const QString &);
QString username() const;
void setUsername( const QString& );
void setUsername(const QString &);
QString password() const;
void setPassword( const QString& );
void setPassword(const QString &);
QString title() const;
void setTitle( const QString& );
void setAuthData( const QMap<QString, QString> &authData );
void setTitle(const QString &);
void setAuthData(const QMap<QString, QString> &authData);
QMap<QString, QString> authData() const;
// QString stylePath() const;
// void setStylePath( const QString& );
ApiType api() const;
void setApi( const ApiType );
void setApi(const ApiType);
int id() const;//id in DB
void setId( const int );
void setId(const int);
Qt::LayoutDirection direction() const;
void setDirection( const Qt::LayoutDirection );
void setDirection(const Qt::LayoutDirection);
QString localDirectory() const;
void setLocalDirectory( const QString& );
void setLocalDirectory(const QString &);
bool isError() const;
void setError(bool isError);
......@@ -98,7 +97,7 @@ public:
private:
class Private;
Private * const d;
Private *const d;
};
#endif
......@@ -12,7 +12,6 @@
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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
......@@ -49,8 +48,8 @@ public:
QString mName;
quint16 mChecksum;
};
BilboMedia::BilboMedia( QObject *parent )
: QObject( parent ), d(new Private)
BilboMedia::BilboMedia(QObject *parent)
: QObject(parent), d(new Private)
{
d->mChecksum = 0;
}
......@@ -65,8 +64,7 @@ int BilboMedia::blogId() const
return d->mBlogId;
}
void BilboMedia::setBlogId( const int blog_id )
void BilboMedia::setBlogId(const int blog_id)
{
d->mBlogId = blog_id;
}
......@@ -76,7 +74,7 @@ int BilboMedia::mediaId() const
return d->mMediaId;
}
void BilboMedia::setMediaId( const int media_id )
void BilboMedia::setMediaId(const int media_id)
{
d->mMediaId = media_id;
}
......@@ -86,7 +84,7 @@ bool BilboMedia::isUploaded() const
return d->mIsUploaded;
}
void BilboMedia::setUploaded( bool uploaded )
void BilboMedia::setUploaded(bool uploaded)
{
d->mIsUploaded = uploaded;
}
......@@ -96,7 +94,7 @@ KUrl BilboMedia::localUrl() const
return d->mLocalUrl;
}
void BilboMedia::setLocalUrl( const KUrl& url )
void BilboMedia::setLocalUrl(const KUrl &url)
{
d->mLocalUrl = url;
}
......@@ -106,7 +104,7 @@ KUrl BilboMedia::remoteUrl() const