Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KBlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
KBlog
Commits
f0cd287b
Commit
f0cd287b
authored
Apr 15, 2020
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GIT_SILENT: Use QT_NO_KEYWORDS. It will be the default in qt6
parent
dfece3a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
92 deletions
+93
-92
CMakeLists.txt
CMakeLists.txt
+1
-0
src/blogger1.cpp
src/blogger1.cpp
+17
-17
src/gdata.cpp
src/gdata.cpp
+44
-44
src/metaweblog.cpp
src/metaweblog.cpp
+6
-6
src/movabletype.cpp
src/movabletype.cpp
+15
-15
src/wordpressbuggy.cpp
src/wordpressbuggy.cpp
+10
-10
No files found.
CMakeLists.txt
View file @
f0cd287b
...
...
@@ -43,6 +43,7 @@ find_package(KF5XmlRpcClient ${XMLRPCCLIENT_LIB_VERSION} CONFIG REQUIRED)
add_definitions
(
-DTRANSLATION_DOMAIN=\"libkblog5\"
)
add_definitions
(
-DQT_NO_FOREACH
)
add_definitions
(
-DQT_NO_KEYWORDS
)
if
(
EXISTS
"
${
CMAKE_SOURCE_DIR
}
/.git"
)
add_definitions
(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00
)
add_definitions
(
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054500
)
...
...
src/blogger1.cpp
View file @
f0cd287b
...
...
@@ -239,7 +239,7 @@ void Blogger1Private::slotFetchUserInfo(const QList<QVariant> &result, const QVa
if
(
result
[
0
].
type
()
!=
QVariant
::
Map
)
{
qCritical
()
<<
"Could not fetch user's info out of the result from the server,"
<<
"not a map."
;
emit
q
->
error
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
error
(
Blogger1
::
ParsingError
,
i18n
(
"Could not fetch user's info out of the result "
"from the server, not a map."
));
return
;
...
...
@@ -252,7 +252,7 @@ void Blogger1Private::slotFetchUserInfo(const QList<QVariant> &result, const QVa
userInfo
[
QStringLiteral
(
"lastname"
)]
=
resultMap
[
QStringLiteral
(
"lastname"
)].
toString
();
userInfo
[
QStringLiteral
(
"firstname"
)]
=
resultMap
[
QStringLiteral
(
"firstname"
)].
toString
();
emit
q
->
fetchedUserInfo
(
userInfo
);
Q_EMIT
q
->
fetchedUserInfo
(
userInfo
);
}
void
Blogger1Private
::
slotListBlogs
(
const
QList
<
QVariant
>
&
result
,
const
QVariant
&
id
)
...
...
@@ -266,7 +266,7 @@ void Blogger1Private::slotListBlogs(const QList<QVariant> &result, const QVarian
if
(
result
[
0
].
type
()
!=
QVariant
::
List
)
{
qCritical
()
<<
"Could not fetch blogs out of the result from the server,"
<<
"not a list."
;
emit
q
->
error
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
error
(
Blogger1
::
ParsingError
,
i18n
(
"Could not fetch blogs out of the result "
"from the server, not a list."
));
return
;
...
...
@@ -286,7 +286,7 @@ void Blogger1Private::slotListBlogs(const QList<QVariant> &result, const QVarian
<<
", Name ="
<<
blogInfo
[
QStringLiteral
(
"title"
)];
blogsList
<<
blogInfo
;
}
emit
q
->
listedBlogs
(
blogsList
);
Q_EMIT
q
->
listedBlogs
(
blogsList
);
}
void
Blogger1Private
::
slotListRecentPosts
(
const
QList
<
QVariant
>
&
result
,
const
QVariant
&
id
)
...
...
@@ -303,7 +303,7 @@ void Blogger1Private::slotListRecentPosts(const QList<QVariant> &result, const Q
if
(
result
[
0
].
type
()
!=
QVariant
::
List
)
{
qCritical
()
<<
"Could not fetch list of posts out of the"
<<
"result from the server, not a list."
;
emit
q
->
error
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
error
(
Blogger1
::
ParsingError
,
i18n
(
"Could not fetch list of posts out of the result "
"from the server, not a list."
));
return
;
...
...
@@ -323,14 +323,14 @@ void Blogger1Private::slotListRecentPosts(const QList<QVariant> &result, const Q
fetchedPostList
.
append
(
post
);
}
else
{
qCritical
()
<<
"readPostFromMap failed!"
;
emit
q
->
error
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read post."
));
Q_EMIT
q
->
error
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read post."
));
}
if
(
--
count
==
0
)
{
break
;
}
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listRecentPostsFinished()"
;
emit
q
->
listedRecentPosts
(
fetchedPostList
);
Q_EMIT
q
->
listedRecentPosts
(
fetchedPostList
);
}
void
Blogger1Private
::
slotFetchPost
(
const
QList
<
QVariant
>
&
result
,
const
QVariant
&
id
)
...
...
@@ -349,12 +349,12 @@ void Blogger1Private::slotFetchPost(const QList<QVariant> &result, const QVarian
readPostFromMap
(
post
,
result
[
0
].
toMap
()))
{
qCDebug
(
KBLOG_LOG
)
<<
"Emitting fetchedPost()"
;
post
->
setStatus
(
KBlog
::
BlogPost
::
Fetched
);
emit
q
->
fetchedPost
(
post
);
Q_EMIT
q
->
fetchedPost
(
post
);
}
else
{
qCritical
()
<<
"Could not fetch post out of the result from the server."
;
post
->
setError
(
i18n
(
"Could not fetch post out of the result from the server."
));
post
->
setStatus
(
BlogPost
::
Error
);
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not fetch post out of the result from the server."
),
post
);
}
}
...
...
@@ -373,7 +373,7 @@ void Blogger1Private::slotCreatePost(const QList<QVariant> &result, const QVaria
if
(
result
[
0
].
type
()
!=
QVariant
::
String
&&
result
[
0
].
type
()
!=
QVariant
::
Int
)
{
qCritical
()
<<
"Could not read the postId, not a string or an integer."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the postId, not a string or an integer."
),
post
);
return
;
...
...
@@ -389,7 +389,7 @@ void Blogger1Private::slotCreatePost(const QList<QVariant> &result, const QVaria
qCDebug
(
KBLOG_LOG
)
<<
"emitting createdPost()"
<<
"for title:
\"
"
<<
post
->
title
()
<<
"
\"
server id: "
<<
serverID
;
emit
q
->
createdPost
(
post
);
Q_EMIT
q
->
createdPost
(
post
);
}
void
Blogger1Private
::
slotModifyPost
(
const
QList
<
QVariant
>
&
result
,
const
QVariant
&
id
)
...
...
@@ -406,7 +406,7 @@ void Blogger1Private::slotModifyPost(const QList<QVariant> &result, const QVaria
if
(
result
[
0
].
type
()
!=
QVariant
::
Bool
&&
result
[
0
].
type
()
!=
QVariant
::
Int
)
{
qCritical
()
<<
"Could not read the result, not a boolean."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the result, not a boolean."
),
post
);
return
;
...
...
@@ -414,7 +414,7 @@ void Blogger1Private::slotModifyPost(const QList<QVariant> &result, const QVaria
post
->
setStatus
(
KBlog
::
BlogPost
::
Modified
);
qCDebug
(
KBLOG_LOG
)
<<
"emitting modifiedPost() for title:
\"
"
<<
post
->
title
()
<<
"
\"
"
;
emit
q
->
modifiedPost
(
post
);
Q_EMIT
q
->
modifiedPost
(
post
);
}
void
Blogger1Private
::
slotRemovePost
(
const
QList
<
QVariant
>
&
result
,
const
QVariant
&
id
)
...
...
@@ -431,14 +431,14 @@ void Blogger1Private::slotRemovePost(const QList<QVariant> &result, const QVaria
if
(
result
[
0
].
type
()
!=
QVariant
::
Bool
&&
result
[
0
].
type
()
!=
QVariant
::
Int
)
{
qCritical
()
<<
"Could not read the result, not a boolean."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the result, not a boolean."
),
post
);
return
;
}
post
->
setStatus
(
KBlog
::
BlogPost
::
Removed
);
qCDebug
(
KBLOG_LOG
)
<<
"emitting removedPost()"
;
emit
q
->
removedPost
(
post
);
Q_EMIT
q
->
removedPost
(
post
);
}
void
Blogger1Private
::
slotError
(
int
number
,
...
...
@@ -451,9 +451,9 @@ void Blogger1Private::slotError(int number,
BlogPost
*
post
=
mCallMap
[
id
.
toInt
()
];
if
(
post
)
{
emit
q
->
errorPost
(
Blogger1
::
XmlRpc
,
errorString
,
post
);
Q_EMIT
q
->
errorPost
(
Blogger1
::
XmlRpc
,
errorString
,
post
);
}
else
{
emit
q
->
error
(
Blogger1
::
XmlRpc
,
errorString
);
Q_EMIT
q
->
error
(
Blogger1
::
XmlRpc
,
errorString
);
}
}
...
...
src/gdata.cpp
View file @
f0cd287b
...
...
@@ -212,7 +212,7 @@ void GData::modifyPost(KBlog::BlogPost *post)
if
(
!
d
->
authenticate
())
{
qCritical
()
<<
"Authentication failed."
;
emit
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
Q_EMIT
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
return
;
}
...
...
@@ -276,7 +276,7 @@ void GData::createPost(KBlog::BlogPost *post)
if
(
!
d
->
authenticate
())
{
qCritical
()
<<
"Authentication failed."
;
emit
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
Q_EMIT
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
return
;
}
...
...
@@ -336,7 +336,7 @@ void GData::removePost(KBlog::BlogPost *post)
if
(
!
d
->
authenticate
())
{
qCritical
()
<<
"Authentication failed."
;
emit
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
Q_EMIT
errorPost
(
Atom
,
i18n
(
"Authentication failed."
),
post
);
return
;
}
...
...
@@ -381,7 +381,7 @@ void GData::createComment(KBlog::BlogPost *post, KBlog::BlogComment *comment)
Q_D
(
GData
);
if
(
!
d
->
authenticate
())
{
qCritical
()
<<
"Authentication failed."
;
emit
errorComment
(
Atom
,
i18n
(
"Authentication failed."
),
post
,
comment
);
Q_EMIT
errorComment
(
Atom
,
i18n
(
"Authentication failed."
),
post
,
comment
);
return
;
}
QString
atomMarkup
=
QStringLiteral
(
"<entry xmlns='http://www.w3.org/2005/Atom'>"
);
...
...
@@ -437,7 +437,7 @@ void GData::removeComment(KBlog::BlogPost *post, KBlog::BlogComment *comment)
if
(
!
d
->
authenticate
())
{
qCritical
()
<<
"Authentication failed."
;
emit
errorComment
(
Atom
,
i18n
(
"Authentication failed."
),
post
,
comment
);
Q_EMIT
errorComment
(
Atom
,
i18n
(
"Authentication failed."
),
post
,
comment
);
return
;
}
...
...
@@ -524,17 +524,17 @@ void GDataPrivate::slotFetchProfileId(KJob *job)
if
(
pid
.
indexIn
(
data
)
!=
-
1
)
{
q
->
setProfileId
(
pid
.
cap
(
1
));
qCDebug
(
KBLOG_LOG
)
<<
"QRegExp bid( 'http://www.blogger.com/profile/(
\\
d+)' matches"
<<
pid
.
cap
(
1
);
emit
q
->
fetchedProfileId
(
pid
.
cap
(
1
));
Q_EMIT
q
->
fetchedProfileId
(
pid
.
cap
(
1
));
}
else
{
qCritical
()
<<
"QRegExp bid( 'http://www.blogger.com/profile/(
\\
d+)' "
<<
" could not regexp the Profile ID"
;
emit
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the Profile ID."
));
emit
q
->
fetchedProfileId
(
QString
());
Q_EMIT
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the Profile ID."
));
Q_EMIT
q
->
fetchedProfileId
(
QString
());
}
}
else
{
qCritical
()
<<
"Job Error: "
<<
job
->
errorString
();
emit
q
->
error
(
GData
::
Other
,
job
->
errorString
());
emit
q
->
fetchedProfileId
(
QString
());
Q_EMIT
q
->
error
(
GData
::
Other
,
job
->
errorString
());
Q_EMIT
q
->
fetchedProfileId
(
QString
());
}
}
...
...
@@ -549,7 +549,7 @@ void GDataPrivate::slotListBlogs(Syndication::Loader *loader,
return
;
}
if
(
status
!=
Syndication
::
Success
)
{
emit
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get blogs."
));
Q_EMIT
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get blogs."
));
return
;
}
...
...
@@ -571,11 +571,11 @@ void GDataPrivate::slotListBlogs(Syndication::Loader *loader,
}
else
{
qCritical
()
<<
"QRegExp rx( 'blog-(
\\
d+)' does not match anything in:"
<<
(
*
it
)
->
id
();
emit
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the blog id path."
));
Q_EMIT
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the blog id path."
));
}
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedBlogs(); "
;
emit
q
->
listedBlogs
(
blogsList
);
Q_EMIT
q
->
listedBlogs
(
blogsList
);
}
void
GDataPrivate
::
slotListComments
(
Syndication
::
Loader
*
loader
,
...
...
@@ -592,7 +592,7 @@ void GDataPrivate::slotListComments(Syndication::Loader *loader,
mListCommentsMap
.
remove
(
loader
);
if
(
status
!=
Syndication
::
Success
)
{
emit
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not get comments."
),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not get comments."
),
post
);
return
;
}
...
...
@@ -606,7 +606,7 @@ void GDataPrivate::slotListComments(Syndication::Loader *loader,
QRegExp
rx
(
QStringLiteral
(
"post-(
\\
d+)"
));
if
(
rx
.
indexIn
((
*
it
)
->
id
())
==
-
1
)
{
qCritical
()
<<
"QRegExp rx( 'post-(
\\
d+)' does not match"
<<
rx
.
cap
(
1
);
emit
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the comment id path."
));
Q_EMIT
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the comment id path."
));
}
else
{
comment
.
setCommentId
(
rx
.
cap
(
1
));
}
...
...
@@ -619,7 +619,7 @@ void GDataPrivate::slotListComments(Syndication::Loader *loader,
commentList
.
append
(
comment
);
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedComments()"
;
emit
q
->
listedComments
(
post
,
commentList
);
Q_EMIT
q
->
listedComments
(
post
,
commentList
);
}
void
GDataPrivate
::
slotListAllComments
(
Syndication
::
Loader
*
loader
,
...
...
@@ -634,7 +634,7 @@ void GDataPrivate::slotListAllComments(Syndication::Loader *loader,
}
if
(
status
!=
Syndication
::
Success
)
{
emit
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get comments."
));
Q_EMIT
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get comments."
));
return
;
}
...
...
@@ -648,7 +648,7 @@ void GDataPrivate::slotListAllComments(Syndication::Loader *loader,
QRegExp
rx
(
QStringLiteral
(
"post-(
\\
d+)"
));
if
(
rx
.
indexIn
((
*
it
)
->
id
())
==
-
1
)
{
qCritical
()
<<
"QRegExp rx( 'post-(
\\
d+)' does not match"
<<
rx
.
cap
(
1
);
emit
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the comment id path."
));
Q_EMIT
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the comment id path."
));
}
else
{
comment
.
setCommentId
(
rx
.
cap
(
1
));
}
...
...
@@ -662,7 +662,7 @@ void GDataPrivate::slotListAllComments(Syndication::Loader *loader,
commentList
.
append
(
comment
);
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedAllComments()"
;
emit
q
->
listedAllComments
(
commentList
);
Q_EMIT
q
->
listedAllComments
(
commentList
);
}
void
GDataPrivate
::
slotListRecentPosts
(
Syndication
::
Loader
*
loader
,
...
...
@@ -677,7 +677,7 @@ void GDataPrivate::slotListRecentPosts(Syndication::Loader *loader,
}
if
(
status
!=
Syndication
::
Success
)
{
emit
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get posts."
));
Q_EMIT
q
->
error
(
GData
::
Atom
,
i18n
(
"Could not get posts."
));
return
;
}
int
number
=
0
;
...
...
@@ -697,7 +697,7 @@ void GDataPrivate::slotListRecentPosts(Syndication::Loader *loader,
QRegExp
rx
(
QStringLiteral
(
"post-(
\\
d+)"
));
if
(
rx
.
indexIn
((
*
it
)
->
id
())
==
-
1
)
{
qCritical
()
<<
"QRegExp rx( 'post-(
\\
d+)' does not match"
<<
rx
.
cap
(
1
);
emit
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the post id path."
));
Q_EMIT
q
->
error
(
GData
::
Other
,
i18n
(
"Could not regexp the post id path."
));
}
else
{
post
.
setPostId
(
rx
.
cap
(
1
));
}
...
...
@@ -727,7 +727,7 @@ void GDataPrivate::slotListRecentPosts(Syndication::Loader *loader,
}
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedRecentPosts()"
;
emit
q
->
listedRecentPosts
(
postList
);
Q_EMIT
q
->
listedRecentPosts
(
postList
);
}
void
GDataPrivate
::
slotFetchPost
(
Syndication
::
Loader
*
loader
,
...
...
@@ -748,7 +748,7 @@ void GDataPrivate::slotFetchPost(Syndication::Loader *loader,
post
->
postId
();
if
(
status
!=
Syndication
::
Success
)
{
emit
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not get posts."
),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not get posts."
),
post
);
return
;
}
...
...
@@ -770,14 +770,14 @@ void GDataPrivate::slotFetchPost(Syndication::Loader *loader,
post
->
setModificationDateTime
(
QDateTime
::
fromSecsSinceEpoch
((
*
it
)
->
dateUpdated
()).
toLocalTime
());
qCDebug
(
KBLOG_LOG
)
<<
"Emitting fetchedPost( postId="
<<
postId
<<
");"
;
success
=
true
;
emit
q
->
fetchedPost
(
post
);
Q_EMIT
q
->
fetchedPost
(
post
);
break
;
}
}
if
(
!
success
)
{
qCritical
()
<<
"QRegExp rx( 'post-(
\\
d+)' does not match"
<<
mFetchPostMap
[
loader
]
->
postId
()
<<
"."
;
emit
q
->
errorPost
(
GData
::
Other
,
i18n
(
"Could not regexp the blog id path."
),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Other
,
i18n
(
"Could not regexp the blog id path."
),
post
);
}
}
...
...
@@ -798,14 +798,14 @@ void GDataPrivate::slotCreatePost(KJob *job)
if
(
job
->
error
()
!=
0
)
{
qCritical
()
<<
"slotCreatePost error:"
<<
job
->
errorString
();
emit
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
return
;
}
QRegExp
rxId
(
QStringLiteral
(
"post-(
\\
d+)"
));
//FIXME check and do better handling, esp the creation date time
if
(
rxId
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the id out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the id out of the result."
),
post
);
return
;
}
...
...
@@ -814,7 +814,7 @@ void GDataPrivate::slotCreatePost(KJob *job)
QRegExp
rxPub
(
QStringLiteral
(
"<published>(.+)</published>"
));
if
(
rxPub
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the published time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the published time out of the result."
),
post
);
return
;
}
...
...
@@ -823,7 +823,7 @@ void GDataPrivate::slotCreatePost(KJob *job)
QRegExp
rxUp
(
QStringLiteral
(
"<updated>(.+)</updated>"
));
if
(
rxUp
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the update time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the update time out of the result."
),
post
);
return
;
}
...
...
@@ -834,7 +834,7 @@ void GDataPrivate::slotCreatePost(KJob *job)
post
->
setModificationDateTime
(
QDateTime
::
fromString
(
rxUp
.
cap
(
1
)));
post
->
setStatus
(
BlogPost
::
Created
);
qCDebug
(
KBLOG_LOG
)
<<
"Emitting createdPost()"
;
emit
q
->
createdPost
(
post
);
Q_EMIT
q
->
createdPost
(
post
);
}
void
GDataPrivate
::
slotModifyPost
(
KJob
*
job
)
...
...
@@ -852,14 +852,14 @@ void GDataPrivate::slotModifyPost(KJob *job)
Q_Q
(
GData
);
if
(
job
->
error
()
!=
0
)
{
qCritical
()
<<
"slotModifyPost error:"
<<
job
->
errorString
();
emit
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
return
;
}
QRegExp
rxId
(
QStringLiteral
(
"post-(
\\
d+)"
));
//FIXME check and do better handling, esp creation date time
if
(
rxId
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the id out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the id out of the result."
),
post
);
return
;
}
...
...
@@ -868,7 +868,7 @@ void GDataPrivate::slotModifyPost(KJob *job)
QRegExp
rxPub
(
QStringLiteral
(
"<published>(.+)</published>"
));
if
(
rxPub
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the published time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the published time out of the result."
),
post
);
return
;
}
...
...
@@ -877,7 +877,7 @@ void GDataPrivate::slotModifyPost(KJob *job)
QRegExp
rxUp
(
QStringLiteral
(
"<updated>(.+)</updated>"
));
if
(
rxUp
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the update time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the update time out of the result."
),
post
);
return
;
}
...
...
@@ -886,7 +886,7 @@ void GDataPrivate::slotModifyPost(KJob *job)
post
->
setCreationDateTime
(
QDateTime
::
fromString
(
rxPub
.
cap
(
1
)));
post
->
setModificationDateTime
(
QDateTime
::
fromString
(
rxUp
.
cap
(
1
)));
post
->
setStatus
(
BlogPost
::
Modified
);
emit
q
->
modifiedPost
(
post
);
Q_EMIT
q
->
modifiedPost
(
post
);
}
void
GDataPrivate
::
slotRemovePost
(
KJob
*
job
)
...
...
@@ -904,13 +904,13 @@ void GDataPrivate::slotRemovePost(KJob *job)
Q_Q
(
GData
);
if
(
job
->
error
()
!=
0
)
{
qCritical
()
<<
"slotRemovePost error:"
<<
job
->
errorString
();
emit
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
job
->
errorString
(),
post
);
return
;
}
post
->
setStatus
(
BlogPost
::
Removed
);
qCDebug
(
KBLOG_LOG
)
<<
"Emitting removedPost()"
;
emit
q
->
removedPost
(
post
);
Q_EMIT
q
->
removedPost
(
post
);
}
void
GDataPrivate
::
slotCreateComment
(
KJob
*
job
)
...
...
@@ -932,7 +932,7 @@ void GDataPrivate::slotCreateComment(KJob *job)
if
(
job
->
error
()
!=
0
)
{
qCritical
()
<<
"slotCreateComment error:"
<<
job
->
errorString
();
emit
q
->
errorComment
(
GData
::
Atom
,
job
->
errorString
(),
post
,
comment
);
Q_EMIT
q
->
errorComment
(
GData
::
Atom
,
job
->
errorString
(),
post
,
comment
);
return
;
}
...
...
@@ -940,7 +940,7 @@ void GDataPrivate::slotCreateComment(KJob *job)
QRegExp
rxId
(
QStringLiteral
(
"post-(
\\
d+)"
));
if
(
rxId
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the id out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the id out of the result."
),
post
);
return
;
}
...
...
@@ -949,7 +949,7 @@ void GDataPrivate::slotCreateComment(KJob *job)
QRegExp
rxPub
(
QStringLiteral
(
"<published>(.+)</published>"
));
if
(
rxPub
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the published time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the published time out of the result."
),
post
);
return
;
}
...
...
@@ -958,7 +958,7 @@ void GDataPrivate::slotCreateComment(KJob *job)
QRegExp
rxUp
(
QStringLiteral
(
"<updated>(.+)</updated>"
));
if
(
rxUp
.
indexIn
(
data
)
==
-
1
)
{
qCritical
()
<<
"Could not regexp the update time out of the result:"
<<
data
;
emit
q
->
errorPost
(
GData
::
Atom
,
Q_EMIT
q
->
errorPost
(
GData
::
Atom
,
i18n
(
"Could not regexp the update time out of the result."
),
post
);
return
;
}
...
...
@@ -968,7 +968,7 @@ void GDataPrivate::slotCreateComment(KJob *job)
comment
->
setModificationDateTime
(
QDateTime
::
fromString
(
rxUp
.
cap
(
1
)));
comment
->
setStatus
(
BlogComment
::
Created
);
qCDebug
(
KBLOG_LOG
)
<<
"Emitting createdComment()"
;
emit
q
->
createdComment
(
post
,
comment
);
Q_EMIT
q
->
createdComment
(
post
,
comment
);
}
void
GDataPrivate
::
slotRemoveComment
(
KJob
*
job
)
...
...
@@ -989,13 +989,13 @@ void GDataPrivate::slotRemoveComment(KJob *job)
if
(
job
->
error
()
!=
0
)
{
qCritical
()
<<
"slotRemoveComment error:"
<<
job
->
errorString
();
emit
q
->
errorComment
(
GData
::
Atom
,
job
->
errorString
(),
post
,
comment
);
Q_EMIT
q
->
errorComment
(
GData
::
Atom
,
job
->
errorString
(),
post
,
comment
);
return
;
}
comment
->
setStatus
(
BlogComment
::
Created
);
qCDebug
(
KBLOG_LOG
)
<<
"Emitting removedComment()"
;
emit
q
->
removedComment
(
post
,
comment
);
Q_EMIT
q
->
removedComment
(
post
,
comment
);
}
#include "moc_gdata.cpp"
src/metaweblog.cpp
View file @
f0cd287b
...
...
@@ -76,7 +76,7 @@ void MetaWeblog::createMedia(KBlog::BlogMedia *media)
Q_D
(
MetaWeblog
);
if
(
!
media
)
{
qCritical
()
<<
"MetaWeblog::createMedia: media is a null pointer"
;
emit
error
(
Other
,
i18n
(
"Media is a null pointer."
));
Q_EMIT
error
(
Other
,
i18n
(
"Media is a null pointer."
));
return
;
}
unsigned
int
i
=
d
->
mCallMediaCounter
++
;
...
...
@@ -183,7 +183,7 @@ void MetaWeblogPrivate::slotListCategories(const QList<QVariant> &result,
// include fix for not metaweblog standard compatible apis with
// array of structs instead of struct of structs, e.g. wordpress
qCritical
()
<<
"Could not list categories out of the result from the server."
;
emit
q
->
error
(
MetaWeblog
::
ParsingError
,
Q_EMIT
q
->
error
(
MetaWeblog
::
ParsingError
,
i18n
(
"Could not list categories out of the result "
"from the server."
));
}
else
{
...
...
@@ -203,7 +203,7 @@ void MetaWeblogPrivate::slotListCategories(const QList<QVariant> &result,
mCategoriesList
.
append
(
category
);
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedCategories"
;
emit
q
->
listedCategories
(
mCategoriesList
);
Q_EMIT
q
->
listedCategories
(
mCategoriesList
);
}
}
if
(
result
[
0
].
type
()
==
QVariant
::
List
)
{
...
...
@@ -225,7 +225,7 @@ void MetaWeblogPrivate::slotListCategories(const QList<QVariant> &result,
mCategoriesList
.
append
(
category
);
}
qCDebug
(
KBLOG_LOG
)
<<
"Emitting listedCategories()"
;
emit
q
->
listedCategories
(
mCategoriesList
);
Q_EMIT
q
->
listedCategories
(
mCategoriesList
);
}
saveCategories
();
}
...
...
@@ -242,7 +242,7 @@ void MetaWeblogPrivate::slotCreateMedia(const QList<QVariant> &result,
qCDebug
(
KBLOG_LOG
)
<<
"TOP:"
<<
result
[
0
].
typeName
();
if
(
result
[
0
].
type
()
!=
8
)
{
qCritical
()
<<
"Could not read the result, not a map."
;
emit
q
->
errorMedia
(
MetaWeblog
::
ParsingError
,
Q_EMIT
q
->
errorMedia
(
MetaWeblog
::
ParsingError
,
i18n
(
"Could not read the result, not a map."
),
media
);
return
;
...
...
@@ -255,7 +255,7 @@ void MetaWeblogPrivate::slotCreateMedia(const QList<QVariant> &result,
media
->
setUrl
(
QUrl
(
url
));
media
->
setStatus
(
BlogMedia
::
Created
);
qCDebug
(
KBLOG_LOG
)
<<
"Emitting createdMedia( url="
<<
url
<<
");"
;
emit
q
->
createdMedia
(
media
);
Q_EMIT
q
->
createdMedia
(
media
);
}
}
...
...
src/movabletype.cpp
View file @
f0cd287b
...
...
@@ -237,7 +237,7 @@ void MovableTypePrivate::slotCreatePost(const QList<QVariant> &result, const QVa
if
(
result
[
0
].
type
()
!=
QVariant
::
String
&&
result
[
0
].
type
()
!=
QVariant
::
Int
)
{
qCritical
()
<<
"Could not read the postId, not a string or an integer."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the postId, not a string or an integer."
),
post
);
return
;
...
...
@@ -258,7 +258,7 @@ void MovableTypePrivate::slotCreatePost(const QList<QVariant> &result, const QVa
<<
"for title:
\"
"
<<
post
->
title
()
<<
"
\"
server id: "
<<
serverID
;
post
->
setStatus
(
KBlog
::
BlogPost
::
Created
);
emit
q
->
createdPost
(
post
);
Q_EMIT
q
->
createdPost
(
post
);
}
}
...
...
@@ -279,7 +279,7 @@ void MovableTypePrivate::slotFetchPost(const QList<QVariant> &result, const QVar
qCritical
()
<<
"Could not fetch post out of the result from the server."
;
post
->
setError
(
i18n
(
"Could not fetch post out of the result from the server."
));
post
->
setStatus
(
BlogPost
::
Error
);
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not fetch post out of the result from the server."
),
post
);
}
if
(
post
->
categories
().
isEmpty
())
{
...
...
@@ -294,7 +294,7 @@ void MovableTypePrivate::slotFetchPost(const QList<QVariant> &result, const QVar
}
else
{
qCDebug
(
KBLOG_LOG
)
<<
"Emitting fetchedPost()"
;
post
->
setStatus
(
KBlog
::
BlogPost
::
Fetched
);
emit
q
->
fetchedPost
(
post
);
Q_EMIT
q
->
fetchedPost
(
post
);
}
}
...
...
@@ -312,7 +312,7 @@ void MovableTypePrivate::slotModifyPost(const QList<QVariant> &result, const QVa
if
(
result
[
0
].
type
()
!=
QVariant
::
Bool
&&
result
[
0
].
type
()
!=
QVariant
::
Int
)
{
qCritical
()
<<
"Could not read the result, not a boolean."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the result, not a boolean."
),
post
);
return
;
...
...
@@ -320,7 +320,7 @@ void MovableTypePrivate::slotModifyPost(const QList<QVariant> &result, const QVa
if
(
mSilentCreationList
.
contains
(
post
))
{
post
->
setStatus
(
KBlog
::
BlogPost
::
Created
);
mSilentCreationList
.
removeOne
(
post
);
emit
q
->
createdPost
(
post
);
Q_EMIT
q
->
createdPost
(
post
);
}
else
{
if
(
!
post
->
categories
().
isEmpty
())
{
setPostCategories
(
post
,
false
);
...
...
@@ -376,12 +376,12 @@ void MovableTypePrivate::slotGetPostCategories(const QList<QVariant> &result, co
mCallMap
.
remove
(
i
);
if
(
result
[
0
].
type
()
!=
QVariant
::
List
)
{
qCritical
()
<<
"Could not read the result, not a list. Category fetching failed! We will still
emit
fetched post now."
;
emit
q
->
errorPost
(
Blogger1
::
ParsingError
,
qCritical
()
<<
"Could not read the result, not a list. Category fetching failed! We will still
Q_EMIT
fetched post now."
;
Q_EMIT
q
->
errorPost
(
Blogger1
::
ParsingError
,
i18n
(
"Could not read the result - is not a list. Category fetching failed."
),
post
);
post
->
setStatus
(
KBlog
::
BlogPost
::
Fetched
);
emit
q
->
fetchedPost
(
post
);
Q_EMIT
q
->
fetchedPost
(
post
);
}
else
{
QList
<
QVariant
>
categoryList
=
result
[
0
].
toList
();
QList
<
QString
>
newCatList
;
...
...
@@ -394,7 +394,7 @@ void MovableTypePrivate::slotGetPostCategories(const QList<QVariant> &result, co
qCDebug
(
KBLOG_LOG
)
<<
"categories list: "
<<
newCatList
;
post
->
setCategories
(
newCatList
);
post
->
setStatus
(
KBlog
::
BlogPost
::
Fetched
);
emit
q
->
fetchedPost
(
post
);
Q_EMIT
q
->
fetchedPost
(
post
);
}
}
...
...
@@ -411,7 +411,7 @@ void MovableTypePrivate::slotSetPostCategories(const QList<QVariant> &result, co
if
(
result
[
0
].
type
()
!=
QVariant
::
Bool
)
{
qCritical
()
<<
"Could not read the result, not a boolean. Category setting failed! We will still publish if