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
KDE Pim
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
Unmaintained
KDE Pim
Commits
cd0abb80
Commit
cd0abb80
authored
Dec 12, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port to qcdebug
parent
9250bd69
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
270 additions
and
219 deletions
+270
-219
blogilo/src/CMakeLists.txt
blogilo/src/CMakeLists.txt
+1
-0
blogilo/src/addeditblog.cpp
blogilo/src/addeditblog.cpp
+23
-23
blogilo/src/backend.cpp
blogilo/src/backend.cpp
+37
-37
blogilo/src/bilbomedia.cpp
blogilo/src/bilbomedia.cpp
+2
-2
blogilo/src/bilbopost.cpp
blogilo/src/bilbopost.cpp
+2
-2
blogilo/src/blogger.cpp
blogilo/src/blogger.cpp
+4
-4
blogilo/src/blogilo_debug.cpp
blogilo/src/blogilo_debug.cpp
+23
-0
blogilo/src/blogilo_debug.h
blogilo/src/blogilo_debug.h
+27
-0
blogilo/src/blogsettings.cpp
blogilo/src/blogsettings.cpp
+1
-1
blogilo/src/composer/bilbobrowser.cpp
blogilo/src/composer/bilbobrowser.cpp
+2
-2
blogilo/src/composer/blogilocomposereditor.cpp
blogilo/src/composer/blogilocomposereditor.cpp
+3
-3
blogilo/src/composer/htmleditor.cpp
blogilo/src/composer/htmleditor.cpp
+4
-4
blogilo/src/composer/stylegetter.cpp
blogilo/src/composer/stylegetter.cpp
+12
-12
blogilo/src/configuredialog.cpp
blogilo/src/configuredialog.cpp
+2
-2
blogilo/src/dbman.cpp
blogilo/src/dbman.cpp
+75
-75
blogilo/src/entriescountdialog.cpp
blogilo/src/entriescountdialog.cpp
+1
-1
blogilo/src/global.cpp
blogilo/src/global.cpp
+3
-3
blogilo/src/mainwindow.cpp
blogilo/src/mainwindow.cpp
+16
-16
blogilo/src/postentry.cpp
blogilo/src/postentry.cpp
+11
-11
blogilo/src/sendtoblogdialog.cpp
blogilo/src/sendtoblogdialog.cpp
+1
-1
blogilo/src/syncuploader.cpp
blogilo/src/syncuploader.cpp
+2
-2
blogilo/src/toolbox.cpp
blogilo/src/toolbox.cpp
+10
-10
blogilo/src/uploadmediadialog.cpp
blogilo/src/uploadmediadialog.cpp
+2
-2
blogilo/src/waitwidget.cpp
blogilo/src/waitwidget.cpp
+6
-6
No files found.
blogilo/src/CMakeLists.txt
View file @
cd0abb80
...
...
@@ -6,6 +6,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
${
LibKGAPI2_INCLUDE_DIR
}
)
set
(
blogilo_SRCS
blogilo_debug.cpp
main.cpp
mainwindow.cpp
toolbox.cpp
...
...
blogilo/src/addeditblog.cpp
View file @
cd0abb80
...
...
@@ -32,7 +32,7 @@
#include <kblog/wordpressbuggy.h>
#include "blogger.h"
#include <kmessagebox.h>
#include
<qdebug.h>
#include
"blogilo_debug.h"
#include <kio/jobclasses.h>
#include <kio/job.h>
#include <KLocalizedString>
...
...
@@ -69,7 +69,7 @@ public:
AddEditBlog
::
AddEditBlog
(
int
blog_id
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
KDialog
(
parent
,
flags
),
d
(
new
Private
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
d
->
mainW
=
new
QTabWidget
(
this
);
d
->
ui
.
setupUi
(
d
->
mainW
);
setMainWidget
(
d
->
mainW
);
...
...
@@ -131,9 +131,9 @@ void AddEditBlog::enableAutoConfBtn()
void
AddEditBlog
::
autoConfigure
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
if
(
d
->
ui
.
txtUrl
->
text
().
isEmpty
()
||
d
->
ui
.
txtUser
->
text
().
isEmpty
()
||
d
->
ui
.
txtPass
->
text
().
isEmpty
())
{
q
Debug
(
)
<<
"Username, Password or Url doesn't set!"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Username, Password or Url doesn't set!"
;
KMessageBox
::
sorry
(
this
,
i18n
(
"You have to set the username, password and URL of your blog or website."
),
i18n
(
"Incomplete fields"
));
return
;
...
...
@@ -171,7 +171,7 @@ void AddEditBlog::autoConfigure()
hideWaitWidget
();
return
;
}
q
Debug
(
)
<<
"Trying to guess API type by Homepage contents"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Trying to guess API type by Homepage contents"
;
KIO
::
StoredTransferJob
*
httpGetJob
=
KIO
::
storedGet
(
d
->
ui
.
txtUrl
->
text
()
,
KIO
::
NoReload
,
KIO
::
HideProgressInfo
);
connect
(
httpGetJob
,
&
KIO
::
StoredTransferJob
::
result
,
this
,
&
AddEditBlog
::
gotHtml
);
d
->
mFetchAPITimer
=
new
QTimer
(
this
);
...
...
@@ -186,7 +186,7 @@ void AddEditBlog::gotHtml(KJob *job)
return
;
}
if
(
job
->
error
())
{
q
Debug
(
)
<<
"Auto configuration failed! Error: "
<<
job
->
errorString
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Auto configuration failed! Error: "
<<
job
->
errorString
();
hideWaitWidget
();
KMessageBox
::
sorry
(
this
,
i18n
(
"Auto configuration failed. You have to set Blog API on Advanced tab manually."
));
return
;
...
...
@@ -196,7 +196,7 @@ void AddEditBlog::gotHtml(KJob *job)
QRegExp
rxGData
(
QStringLiteral
(
"content='blogger' name='generator'"
));
if
(
rxGData
.
indexIn
(
httpData
)
!=
-
1
)
{
q
Debug
(
)
<<
"content='blogger' name='generator' matched"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"content='blogger' name='generator' matched"
;
d
->
mFetchAPITimer
->
deleteLater
();
d
->
ui
.
comboApi
->
setCurrentIndex
(
4
);
QRegExp
rxBlogId
(
QStringLiteral
(
"BlogID=(
\\
d+)"
));
...
...
@@ -207,7 +207,7 @@ void AddEditBlog::gotHtml(KJob *job)
QRegExp
rxLiveJournal
(
QStringLiteral
(
"rel=
\"
openid.server
\"
href=
\"
http://www.livejournal.com/openid/server.bml
\"
"
));
if
(
rxLiveJournal
.
indexIn
(
httpData
)
!=
-
1
)
{
q
Debug
(
)
<<
" rel=
\"
openid.server
\"
href=
\"
http://www.livejournal.com/openid/server.bml
\"
matched"
;
q
CDebug
(
BLOGILO_LOG
)
<<
" rel=
\"
openid.server
\"
href=
\"
http://www.livejournal.com/openid/server.bml
\"
matched"
;
d
->
mFetchAPITimer
->
deleteLater
();
d
->
ui
.
comboApi
->
setCurrentIndex
(
0
);
d
->
ui
.
txtUrl
->
setText
(
QLatin1String
(
"http://www.liverjournal.com/interface/blogger/"
));
...
...
@@ -219,7 +219,7 @@ void AddEditBlog::gotHtml(KJob *job)
QString
textUrl
;
QRegExp
rxWordpress
(
QStringLiteral
(
"name=
\"
generator
\"
content=
\"
WordPress"
));
if
(
rxWordpress
.
indexIn
(
httpData
)
!=
-
1
)
{
q
Debug
(
)
<<
"name=
\"
generator
\"
content=
\"
WordPress matched"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"name=
\"
generator
\"
content=
\"
WordPress matched"
;
d
->
mFetchAPITimer
->
deleteLater
();
d
->
ui
.
comboApi
->
setCurrentIndex
(
3
);
...
...
@@ -245,13 +245,13 @@ void AddEditBlog::gotHtml(KJob *job)
void
AddEditBlog
::
gotXmlRpcTest
(
KJob
*
job
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
d
->
mFetchAPITimer
->
deleteLater
();
if
(
!
job
)
{
return
;
}
if
(
job
->
error
())
{
q
Debug
(
)
<<
"Auto configuration failed! Error: "
<<
job
->
errorString
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Auto configuration failed! Error: "
<<
job
->
errorString
();
hideWaitWidget
();
KMessageBox
::
sorry
(
this
,
i18n
(
"Auto configuration failed. You have to set Blog API on Advanced tab manually."
));
return
;
...
...
@@ -299,7 +299,7 @@ void AddEditBlog::fetchBlogId()
break
;
}
default:
q
Debug
(
)
<<
"Unknown API"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Unknown API"
;
return
;
}
...
...
@@ -311,7 +311,7 @@ void AddEditBlog::fetchBlogId()
void
AddEditBlog
::
handleFetchIDTimeout
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
if
(
d
->
mFetchBlogIdTimer
)
{
d
->
mFetchBlogIdTimer
->
stop
();
}
...
...
@@ -328,7 +328,7 @@ void AddEditBlog::handleFetchIDTimeout()
void
AddEditBlog
::
handleFetchAPITimeout
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
d
->
mFetchAPITimer
->
deleteLater
();
d
->
mFetchAPITimer
=
0
;
hideWaitWidget
();
...
...
@@ -341,7 +341,7 @@ void AddEditBlog::handleFetchAPITimeout()
void
AddEditBlog
::
handleFetchError
(
KBlog
::
Blog
::
ErrorType
type
,
const
QString
&
errorMsg
)
{
q
Debug
(
)
<<
" ErrorType: "
<<
type
;
q
CDebug
(
BLOGILO_LOG
)
<<
" ErrorType: "
<<
type
;
d
->
ui
.
txtId
->
setEnabled
(
true
);
d
->
ui
.
txtId
->
setText
(
QString
());
hideWaitWidget
();
...
...
@@ -358,7 +358,7 @@ void AddEditBlog::fetchedBlogId(const QList< QMap < QString , QString > > &list)
QString
blogId
,
blogName
,
blogUrl
,
apiUrl
;
const
int
listCount
(
list
.
count
());
if
(
listCount
>
1
)
{
q
Debug
(
)
<<
"User has more than ONE blog!"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"User has more than ONE blog!"
;
KDialog
*
blogsDialog
=
new
KDialog
(
this
);
QTableWidget
*
blogsList
=
new
QTableWidget
(
blogsDialog
);
blogsList
->
setSelectionBehavior
(
QAbstractItemView
::
SelectRows
);
...
...
@@ -373,7 +373,7 @@ void AddEditBlog::fetchedBlogId(const QList< QMap < QString , QString > > &list)
blogsList
->
setColumnHidden
(
2
,
true
);
blogsList
->
setColumnHidden
(
3
,
true
);
for
(;
it
!=
endIt
;
++
it
)
{
q
Debug
(
)
<<
it
->
value
(
QLatin1String
(
"title"
));
q
CDebug
(
BLOGILO_LOG
)
<<
it
->
value
(
QLatin1String
(
"title"
));
blogsList
->
insertRow
(
i
);
blogsList
->
setCellWidget
(
i
,
0
,
new
QLabel
(
it
->
value
(
QLatin1String
(
"title"
))));
blogsList
->
setCellWidget
(
i
,
1
,
new
QLabel
(
it
->
value
(
QLatin1String
(
"url"
))));
...
...
@@ -460,7 +460,7 @@ void AddEditBlog::slotReturnPressed()
AddEditBlog
::~
AddEditBlog
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
delete
d
;
}
...
...
@@ -548,7 +548,7 @@ void AddEditBlog::slotComboApiChanged(int index)
void
AddEditBlog
::
slotButtonClicked
(
int
button
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
if
(
button
==
KDialog
::
Ok
)
{
if
(
d
->
bBlog
->
blogid
().
isEmpty
()
&&
d
->
ui
.
txtId
->
text
().
isEmpty
())
{
KMessageBox
::
sorry
(
this
,
i18n
(
"Blog ID has not yet been retrieved.
\n
"
...
...
@@ -572,17 +572,17 @@ void AddEditBlog::slotButtonClicked(int button)
int
blog_id
=
DBMan
::
self
()
->
addBlog
(
*
d
->
bBlog
);
d
->
bBlog
->
setId
(
blog_id
);
if
(
blog_id
!=
-
1
)
{
q
Debug
(
)
<<
"Emitting sigBlogAdded() ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigBlogAdded() ..."
;
Q_EMIT
sigBlogAdded
(
*
d
->
bBlog
);
}
else
{
q
Debug
(
)
<<
"Cannot add blog"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Cannot add blog"
;
}
}
else
{
if
(
DBMan
::
self
()
->
editBlog
(
*
d
->
bBlog
))
{
q
Debug
(
)
<<
"Emitting sigBlogEdited() ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigBlogEdited() ..."
;
Q_EMIT
sigBlogEdited
(
*
d
->
bBlog
);
}
else
{
q
Debug
(
)
<<
"Cannot edit blog with id "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Cannot edit blog with id "
<<
d
->
bBlog
->
id
();
}
}
accept
();
...
...
blogilo/src/backend.cpp
View file @
cd0abb80
...
...
@@ -34,7 +34,7 @@
#include <kblog/wordpressbuggy.h>
#include <kblog/blogmedia.h>
#include "blogger.h"
#include
<qdebug.h>
#include
"blogilo_debug.h"
#include <KLocalizedString>
#include <kio/netaccess.h>
...
...
@@ -60,7 +60,7 @@ public:
Backend
::
Backend
(
int
blog_id
,
QObject
*
parent
)
:
QObject
(
parent
),
d
(
new
Private
)
{
q
Debug
(
)
<<
"with blog id: "
<<
blog_id
;
q
CDebug
(
BLOGILO_LOG
)
<<
"with blog id: "
<<
blog_id
;
d
->
bBlog
=
DBMan
::
self
()
->
blog
(
blog_id
);
d
->
kBlog
=
d
->
bBlog
->
blogBackend
();
if
(
d
->
bBlog
->
api
()
==
BilboBlog
::
BLOGGER_API
)
{
...
...
@@ -80,13 +80,13 @@ Backend::Backend(int blog_id, QObject *parent)
Backend
::~
Backend
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
delete
d
;
}
void
Backend
::
getCategoryListFromServer
()
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
if
(
d
->
bBlog
->
api
()
==
BilboBlog
::
METAWEBLOG_API
||
d
->
bBlog
->
api
()
==
BilboBlog
::
MOVABLETYPE_API
||
d
->
bBlog
->
api
()
==
BilboBlog
::
WORDPRESSBUGGY_API
)
{
...
...
@@ -100,7 +100,7 @@ void Backend::getCategoryListFromServer()
void
Backend
::
categoriesListed
(
const
QList
<
QMap
<
QString
,
QString
>
>
&
categories
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
DBMan
::
self
()
->
clearCategories
(
d
->
bBlog
->
id
());
const
int
categoriesCount
(
categories
.
count
());
...
...
@@ -120,20 +120,20 @@ void Backend::categoriesListed(const QList< QMap < QString , QString > > &catego
DBMan
::
self
()
->
addCategory
(
name
,
description
,
htmlUrl
,
rssUrl
,
categoryId
,
parentId
,
d
->
bBlog
->
id
());
}
q
Debug
(
)
<<
"Emitting sigCategoryListFetched..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigCategoryListFetched..."
;
Q_EMIT
sigCategoryListFetched
(
d
->
bBlog
->
id
());
}
void
Backend
::
getEntriesListFromServer
(
int
count
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
connect
(
d
->
kBlog
,
&
KBlog
::
Blog
::
listedRecentPosts
,
this
,
&
Backend
::
entriesListed
);
d
->
kBlog
->
listRecentPosts
(
count
);
}
void
Backend
::
entriesListed
(
const
QList
<
KBlog
::
BlogPost
>
&
posts
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
// DBMan::self()->clearPosts( d->bBlog->id() );
const
int
postCount
(
posts
.
count
());
...
...
@@ -145,13 +145,13 @@ void Backend::entriesListed(const QList< KBlog::BlogPost > &posts)
}
DBMan
::
self
()
->
addPost
(
tempPost
,
d
->
bBlog
->
id
());
}
q
Debug
(
)
<<
"Emitting sigEntriesListFetched ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigEntriesListFetched ..."
;
Q_EMIT
sigEntriesListFetched
(
d
->
bBlog
->
id
());
}
void
Backend
::
publishPost
(
BilboPost
*
post
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
// BilboPost tmpPost = post;
if
(
Settings
::
addPoweredBy
())
{
QString
poweredStr
=
QLatin1String
(
"<p>=-=-=-=-=<br/>"
...
...
@@ -165,15 +165,15 @@ void Backend::publishPost(BilboPost *post)
void
Backend
::
postPublished
(
KBlog
::
BlogPost
*
post
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
if
(
post
->
status
()
==
KBlog
::
BlogPost
::
Error
)
{
q
Debug
(
)
<<
"Publishing/Modifying Failed"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Publishing/Modifying Failed"
;
const
QString
tmp
(
i18n
(
"Publishing/Modifying post failed: %1"
,
post
->
error
()));
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigError
(
tmp
);
return
;
}
q
Debug
(
)
<<
"isPrivate: "
<<
post
->
isPrivate
();
q
CDebug
(
BLOGILO_LOG
)
<<
"isPrivate: "
<<
post
->
isPrivate
();
d
->
mSubmitPostStatusMap
[
post
]
=
post
->
status
();
connect
(
d
->
kBlog
,
&
KBlog
::
Blog
::
fetchedPost
,
this
,
&
Backend
::
savePostInDbAndEmitResult
);
d
->
kBlog
->
fetchPost
(
post
);
...
...
@@ -181,14 +181,14 @@ void Backend::postPublished(KBlog::BlogPost *post)
void
Backend
::
uploadMedia
(
BilboMedia
*
media
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
QString
tmp
;
switch
(
d
->
bBlog
->
api
())
{
case
BilboBlog
::
BLOGGER1_API
:
case
BilboBlog
::
BLOGGER_API
:
q
Debug
(
)
<<
"The Blogger1 and Blogspot API type doesn't support uploading Media files."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"The Blogger1 and Blogspot API type doesn't support uploading Media files."
;
tmp
=
i18n
(
"Uploading media failed: Your Blog API does not support uploading media objects."
);
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigMediaError
(
tmp
,
media
);
return
;
case
BilboBlog
::
METAWEBLOG_API
:
...
...
@@ -204,14 +204,14 @@ void Backend::uploadMedia(BilboMedia *media)
if
(
!
KIO
::
NetAccess
::
synchronousRun
(
job
,
0
,
&
data
))
{
qCritical
()
<<
"Job error: "
<<
job
->
errorString
();
tmp
=
i18n
(
"Uploading media failed: Cannot read the media file, please check if it exists. Path: %1"
,
media
->
localUrl
().
toDisplayString
());
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigMediaError
(
tmp
,
media
);
}
if
(
data
.
count
()
==
0
)
{
qCritical
()
<<
"Cannot read the media file, please check if it exists."
;
tmp
=
i18n
(
"Uploading media failed: Cannot read the media file, please check if it exists. Path: %1"
,
media
->
localUrl
().
toDisplayString
());
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigMediaError
(
tmp
,
media
);
delete
m
;
return
;
...
...
@@ -226,7 +226,7 @@ void Backend::uploadMedia(BilboMedia *media)
qCritical
()
<<
"Media file checksum is zero"
;
tmp
=
i18n
(
"Uploading media failed: Media file checksum is zero, please check file path. Path: %1"
,
media
->
localUrl
().
toDisplayString
());
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigMediaError
(
tmp
,
media
);
delete
m
;
return
;
...
...
@@ -235,7 +235,7 @@ void Backend::uploadMedia(BilboMedia *media)
if
(
!
MWBlog
)
{
qCritical
()
<<
"MWBlog is NULL: casting has not worked, this should NEVER happen, has the gui allowed using GDATA?"
;
tmp
=
i18n
(
"INTERNAL ERROR: MWBlog is NULL: casting has not worked, this should NEVER happen."
);
q
Debug
(
)
<<
"Emitting sigError..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError..."
;
Q_EMIT
sigError
(
tmp
);
delete
m
;
return
;
...
...
@@ -253,7 +253,7 @@ void Backend::uploadMedia(BilboMedia *media)
void
Backend
::
mediaUploaded
(
KBlog
::
BlogMedia
*
media
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
()
<<
"Media: "
<<
media
->
url
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
()
<<
"Media: "
<<
media
->
url
();
if
(
!
media
)
{
qCritical
()
<<
"ERROR! Media returned from KBlog is NULL!"
;
return
;
...
...
@@ -268,7 +268,7 @@ void Backend::mediaUploaded(KBlog::BlogMedia *media)
if
(
media
->
status
()
==
KBlog
::
BlogMedia
::
Error
)
{
qCritical
()
<<
"Upload error! with this message: "
<<
media
->
error
();
const
QString
tmp
(
i18n
(
"Uploading media failed: %1"
,
media
->
error
()));
q
Debug
(
)
<<
"Emitting sigMediaError ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigMediaError ..."
;
Q_EMIT
sigMediaError
(
tmp
,
m
);
return
;
}
...
...
@@ -278,19 +278,19 @@ void Backend::mediaUploaded(KBlog::BlogMedia *media)
" Checksum of received file: "
<<
newChecksum
<<
"Error: "
<<
media
->
error
()
<<
endl
;
const
QString
tmp
(
i18n
(
"Uploading media failed: Checksum error. Returned error: %1"
,
media
->
error
()));
q
Debug
(
)
<<
"Emitting sigMediaError ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigMediaError ..."
;
Q_EMIT
sigMediaError
(
tmp
,
m
);
return
;
}
m
->
setRemoteUrl
(
QUrl
(
media
->
url
().
url
()).
toString
());
m
->
setUploaded
(
true
);
q
Debug
(
)
<<
"Emitting sigMediaUploaded..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigMediaUploaded..."
;
Q_EMIT
sigMediaUploaded
(
m
);
}
void
Backend
::
modifyPost
(
BilboPost
*
post
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
// BilboPost tmpPost = post;
preparePost
(
post
);
connect
(
d
->
kBlog
,
&
KBlog
::
Blog
::
modifiedPost
,
this
,
&
Backend
::
postPublished
);
...
...
@@ -299,7 +299,7 @@ void Backend::modifyPost(BilboPost *post)
void
Backend
::
removePost
(
BilboPost
*
post
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
// KBlog::BlogPost *bp = post.toKBlogPost();
connect
(
d
->
kBlog
,
&
KBlog
::
Blog
::
removedPost
,
this
,
&
Backend
::
slotPostRemoved
);
...
...
@@ -309,11 +309,11 @@ void Backend::removePost(BilboPost *post)
void
Backend
::
slotPostRemoved
(
KBlog
::
BlogPost
*
post
)
{
if
(
!
post
)
{
q
Debug
(
)
<<
"post returned from server is NULL"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"post returned from server is NULL"
;
return
;
}
if
(
!
DBMan
::
self
()
->
removePost
(
d
->
bBlog
->
id
(),
post
->
postId
()))
{
q
Debug
(
)
<<
"cannot remove post from database, error: "
<<
DBMan
::
self
()
->
lastErrorText
();
q
CDebug
(
BLOGILO_LOG
)
<<
"cannot remove post from database, error: "
<<
DBMan
::
self
()
->
lastErrorText
();
}
emit
sigPostRemoved
(
d
->
bBlog
->
id
(),
BilboPost
(
*
post
));
}
...
...
@@ -333,22 +333,22 @@ void Backend::slotPostFetched(KBlog::BlogPost *post)
void
Backend
::
error
(
KBlog
::
Blog
::
ErrorType
type
,
const
QString
&
errorMessage
)
{
q
Debug
(
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
q
CDebug
(
BLOGILO_LOG
)
<<
"Blog Id: "
<<
d
->
bBlog
->
id
();
QString
errType
=
errorTypeToString
(
type
);
errType
+=
errorMessage
;
q
Debug
(
)
<<
errType
;
q
Debug
(
)
<<
"Emitting sigError"
;
q
CDebug
(
BLOGILO_LOG
)
<<
errType
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigError"
;
Q_EMIT
sigError
(
errType
);
}
void
Backend
::
slotMediaError
(
KBlog
::
Blog
::
ErrorType
type
,
const
QString
&
errorMessage
,
KBlog
::
BlogMedia
*
media
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
QString
errType
=
errorTypeToString
(
type
);
errType
+=
errorMessage
;
q
Debug
(
)
<<
errType
;
q
Debug
(
)
<<
"Emitting sigMediaError ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
errType
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigMediaError ..."
;
emit
sigMediaError
(
errorMessage
,
d
->
mPublishMediaMap
[
media
]);
d
->
mPublishMediaMap
.
remove
(
media
);
}
...
...
@@ -385,7 +385,7 @@ void Backend::savePostInDbAndEmitResult(KBlog::BlogPost *post)
Q_EMIT
sigError
(
i18n
(
"post is NULL"
));
return
;
}
q
Debug
(
)
<<
"isPrivate: "
<<
post
->
isPrivate
();
q
CDebug
(
BLOGILO_LOG
)
<<
"isPrivate: "
<<
post
->
isPrivate
();
BilboPost
*
pp
=
new
BilboPost
(
*
post
);
int
post_id
;
if
(
d
->
mSubmitPostStatusMap
[
post
]
==
KBlog
::
BlogPost
::
Modified
)
{
...
...
@@ -397,7 +397,7 @@ void Backend::savePostInDbAndEmitResult(KBlog::BlogPost *post)
if
(
post_id
!=
-
1
)
{
pp
->
setPrivate
(
post
->
isPrivate
());
pp
->
setId
(
post_id
);
q
Debug
(
)
<<
"Emitting sigPostPublished ..."
;
q
CDebug
(
BLOGILO_LOG
)
<<
"Emitting sigPostPublished ..."
;
Q_EMIT
sigPostPublished
(
d
->
bBlog
->
id
(),
pp
);
}
// TODO crashes stylegetter on GData. Somehow the post gets deleted before
...
...
blogilo/src/bilbomedia.cpp
View file @
cd0abb80
...
...
@@ -23,7 +23,7 @@
#include "bilbomedia.h"
#include
<qdebug.h>
#include
"blogilo_debug.h"
#include <QIcon>
#include <QPixmap>
#include <QUrl>
...
...
@@ -141,7 +141,7 @@ QIcon BilboMedia::icon() const
if
(
!
iconPic
.
isNull
())
{
return
QIcon
(
iconPic
);
}
else
{
q
Debug
(
)
<<
"iconPic is Null"
;
q
CDebug
(
BLOGILO_LOG
)
<<
"iconPic is Null"
;
}
}
...
...
blogilo/src/bilbopost.cpp
View file @
cd0abb80
...
...
@@ -23,7 +23,7 @@
#include "bilbopost.h"
#include <kdatetime.h>
#include
<qdebug.h>
#include
"blogilo_debug.h"
#include <QStringList>
class
BilboPostPrivate
...
...
@@ -150,7 +150,7 @@ void BilboPost::setCategoryList(const QList< Category > &list)
void
BilboPost
::
setProperties
(
const
BilboPost
&
postProp
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
this
->
setCreationDateTime
(
postProp
.
creationDateTime
());
this
->
setModificationDateTime
(
postProp
.
modificationDateTime
());
this
->
setLink
(
postProp
.
link
());
...
...
blogilo/src/blogger.cpp
View file @
cd0abb80
...
...
@@ -22,7 +22,7 @@
#include <kblog/blogpost.h>
#include <kblog/blogcomment.h>
#include
<QDebug>
#include
"blogilo_debug.h"
#include <KLocalizedString>
#include <KGAPI/Blogger/Blog>
...
...
@@ -232,12 +232,12 @@ bool BloggerPrivate::handleError(KGAPI2::Job *job)
Blogger
::
Blogger
(
const
QUrl
&
server
,
QObject
*
parent
)
:
Blog
(
server
,
*
new
BloggerPrivate
(
this
),
parent
)
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
}
Blogger
::~
Blogger
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
}
QString
Blogger
::
interfaceName
()
const
...
...
@@ -262,7 +262,7 @@ void Blogger::authenticate(const QMap<QString, QString> &authData)
Q_D
(
Blogger
);
KGAPI2
::
AccountPtr
account
;
q
Debug
(
)
<<
authData
;
q
CDebug
(
BLOGILO_LOG
)
<<
authData
;
if
(
!
authData
.
isEmpty
())
{
QList
<
QUrl
>
scopes
;
scopes
<<
KGAPI2
::
Account
::
bloggerScopeUrl
();
...
...
blogilo/src/blogilo_debug.cpp
0 → 100644
View file @
cd0abb80
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
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 "blogilo_debug.h"
Q_LOGGING_CATEGORY
(
BLOGILO_LOG
,
"log_blogilo"
)
blogilo/src/blogilo_debug.h
0 → 100644
View file @
cd0abb80
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
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 BLOGILO_DEBUG_H
#define BLOGILO_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY
(
BLOGILO_LOG
)
#endif
blogilo/src/blogsettings.cpp
View file @
cd0abb80
...
...
@@ -25,7 +25,7 @@
#include "addeditblog.h"
#include "dbman.h"
#include
<qdebug.h>
#include
"blogilo_debug.h"
#include <KMessageBox>
#include <QIcon>
#include <KLocalizedString>
...
...
blogilo/src/composer/bilbobrowser.cpp
View file @
cd0abb80
...
...
@@ -30,7 +30,7 @@
#include <kmessagebox.h>
#include <kseparator.h>
#include <QPushButton>
#include
<QDebug>
#include
"blogilo_debug.h"
#include "stylegetter.h"
#include "global.h"
...
...
@@ -58,7 +58,7 @@ BilboBrowser::BilboBrowser(QWidget *parent)
BilboBrowser
::~
BilboBrowser
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
}
void
BilboBrowser
::
createUi
(
QWidget
*
parent
)
...
...
blogilo/src/composer/blogilocomposereditor.cpp
View file @
cd0abb80
...
...
@@ -23,7 +23,7 @@
#include "bilbomedia.h"
#include "global.h"
#include
<QDebug>
#include
"blogilo_debug.h"
#include <QAction>
#include <KLocalizedString>
...
...
@@ -109,12 +109,12 @@ void BlogiloComposerEditor::setReadOnly(bool _readOnly)
QList
<
BilboMedia
*
>
BlogiloComposerEditor
::
getLocalImages
()
{
q
Debug
(
);
q
CDebug
(
BLOGILO_LOG
);
QList
<
BilboMedia
*
>
list
;
QWebElementCollection
images
=
view
()
->
page
()
->
mainFrame
()
->
findAllElements
(
QLatin1String
(
"img"
));
Q_FOREACH
(
const
QWebElement
&
elm
,
images
)
{
if
(
elm
.
attribute
(
QLatin1String
(
"src"
)).
startsWith
(
QLatin1String
(
"file://"
)))
{
// q
Debug(
)<<elm.toOuterXml();
// q
CDebug(BLOGILO_LOG
)<<elm.toOuterXml();
BilboMedia
*
media
=
new
BilboMedia
(
this
);
QUrl
mediaUrl
(
elm
.
attribute
(
QLatin1String
(
"src"
)));
media
->
setLocalUrl
(
mediaUrl
);
...
...
blogilo/src/composer/htmleditor.cpp
View file @
cd0abb80
...
...
@@ -31,7 +31,7 @@
#include <QAction>
#include <klocalizedstring.h>
#include
<QDebug>
#include
"blogilo_debug.h"
#include <QMenu>
class
HtmlEditorPrivate
...
...
@@ -54,9 +54,9 @@ HtmlEditor::HtmlEditor() : QObject()
HtmlEditor
::~
HtmlEditor
()
{