Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Unmaintained
KDE Pim
Commits
bd4a7275
Commit
bd4a7275
authored
Jul 07, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.kde.org:kdepim
parents
bb986445
76c6aaef
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
229 additions
and
45 deletions
+229
-45
blogilo/src/addeditblog.cpp
blogilo/src/addeditblog.cpp
+20
-28
blogilo/src/addeditblog.h
blogilo/src/addeditblog.h
+2
-1
blogilo/src/backend.cpp
blogilo/src/backend.cpp
+14
-8
blogilo/src/backend.h
blogilo/src/backend.h
+2
-0
blogilo/src/bilboblog.cpp
blogilo/src/bilboblog.cpp
+19
-5
blogilo/src/bilboblog.h
blogilo/src/bilboblog.h
+3
-1
blogilo/src/dbman.cpp
blogilo/src/dbman.cpp
+162
-2
blogilo/src/dbman.h
blogilo/src/dbman.h
+7
-0
No files found.
blogilo/src/addeditblog.cpp
View file @
bd4a7275
...
...
@@ -27,11 +27,11 @@
#include "bilboblog.h"
#include "dbman.h"
#include <kblog/gdata.h>
#include <kblog/blogger1.h>
#include <kblog/metaweblog.h>
#include <kblog/movabletype.h>
#include <kblog/wordpressbuggy.h>
#include <kblog/blogger.h>
#include <kurl.h>
#include <kmessagebox.h>
#include <kdebug.h>
...
...
@@ -290,17 +290,15 @@ void AddEditBlog::fetchBlogId()
}
case
4
:
{
KBlog
::
GData
*
blog
=
new
KBlog
::
GData
(
d
->
ui
.
txtUrl
->
text
()
,
this
);
KBlog
::
Blogger
*
blog
=
new
KBlog
::
Blogger
(
KUrl
(
d
->
ui
.
txtUrl
->
text
()
)
,
this
);
d
->
mBlog
=
blog
;
blog
->
setUsername
(
d
->
ui
.
txtUser
->
text
()
);
blog
->
setPassword
(
d
->
ui
.
txtPass
->
text
()
);
connect
(
blog
,
SIGNAL
(
fetchedProfileId
(
QString
)),
this
,
SLOT
(
fetchedProfileId
(
QString
))
);
blog
->
fetchProfileId
();
d
->
mFetchProfileIdTimer
=
new
QTimer
(
this
);
d
->
mFetchProfileIdTimer
->
setSingleShot
(
true
);
connect
(
d
->
mFetchProfileIdTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
handleFetchIDTimeout
())
);
d
->
mFetchProfileIdTimer
->
start
(
TIMEOUT
);
blog
->
setApiKey
(
QLatin1String
(
"500754804903-g6n1rfjjcmhct64p3qgj6ma3oo8l8s6a.apps.googleusercontent.com"
)
);
blog
->
setSecretKey
(
QLatin1String
(
"jzSzkrD7ert2z0v5VEq6CcSs"
)
);
connect
(
blog
,
SIGNAL
(
authenticated
(
QMap
<
QString
,
QString
>
)),
this
,
SLOT
(
bloggerAuthenticated
(
QMap
<
QString
,
QString
>
))
);
blog
->
authenticate
();
break
;
}
default:
...
...
@@ -440,24 +438,6 @@ void AddEditBlog::fetchedBlogId( const QList< QMap < QString , QString > > & lis
d
->
bBlog
->
setTitle
(
blogName
);
}
void
AddEditBlog
::
fetchedProfileId
(
const
QString
&
id
)
{
kDebug
();
Q_UNUSED
(
id
);
d
->
mFetchProfileIdTimer
->
deleteLater
();
d
->
mFetchProfileIdTimer
=
0
;
KBlog
::
GData
*
blog
=
static_cast
<
KBlog
::
GData
*>
(
d
->
mBlog
);
connect
(
blog
,
SIGNAL
(
listedBlogs
(
QList
<
QMap
<
QString
,
QString
>
>
)),
this
,
SLOT
(
fetchedBlogId
(
QList
<
QMap
<
QString
,
QString
>
>
))
);
connect
(
blog
,
SIGNAL
(
error
(
KBlog
::
Blog
::
ErrorType
,
QString
)),
this
,
SLOT
(
handleFetchError
(
KBlog
::
Blog
::
ErrorType
,
QString
))
);
d
->
mFetchBlogIdTimer
=
new
QTimer
(
this
);
d
->
mFetchBlogIdTimer
->
setSingleShot
(
true
);
connect
(
d
->
mFetchBlogIdTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
handleFetchIDTimeout
())
);
d
->
mFetchBlogIdTimer
->
start
(
TIMEOUT
);
blog
->
listBlogs
();
}
void
AddEditBlog
::
enableOkButton
(
const
QString
&
txt
)
{
const
bool
check
=
!
txt
.
isEmpty
();
...
...
@@ -549,7 +529,7 @@ void AddEditBlog::setSupportedFeatures( BilboBlog::ApiType api )
d
->
ui
.
featureTags
->
setText
(
yesText
);
d
->
ui
.
featureTags
->
setStyleSheet
(
yesStyle
);
break
;
case
BilboBlog
::
GDATA
_API
:
case
BilboBlog
::
BLOGGER
_API
:
d
->
ui
.
featureUploadMedia
->
setText
(
noText
);
d
->
ui
.
featureUploadMedia
->
setStyleSheet
(
noStyle
);
d
->
ui
.
featureCategories
->
setText
(
noText
);
...
...
@@ -634,3 +614,15 @@ void AddEditBlog::hideWaitWidget()
d
->
wait
=
0
;
}
void
AddEditBlog
::
bloggerAuthenticated
(
const
QMap
<
QString
,
QString
>
&
authData
)
{
d
->
bBlog
->
setAuthData
(
authData
);
KBlog
::
Blogger
*
blogger
=
qobject_cast
<
KBlog
::
Blogger
*>
(
d
->
mBlog
);
connect
(
blogger
,
SIGNAL
(
listedBlogs
(
QList
<
QMap
<
QString
,
QString
>
>
)),
this
,
SLOT
(
fetchedBlogId
(
QList
<
QMap
<
QString
,
QString
>
>
))
);
d
->
mFetchBlogIdTimer
=
new
QTimer
(
this
);
d
->
mFetchBlogIdTimer
->
setSingleShot
(
true
);
connect
(
d
->
mFetchBlogIdTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
handleFetchIDTimeout
())
);
d
->
mFetchBlogIdTimer
->
start
(
TIMEOUT
);
blogger
->
listBlogs
();
}
blogilo/src/addeditblog.h
View file @
bd4a7275
...
...
@@ -60,7 +60,6 @@ protected Q_SLOTS:
void
fetchBlogId
();
void
fetchedBlogId
(
const
QList
<
QMap
<
QString
,
QString
>
>&
list
);
void
fetchedProfileId
(
const
QString
&
);
void
handleFetchIDTimeout
();
void
handleFetchAPITimeout
();
...
...
@@ -72,6 +71,8 @@ protected Q_SLOTS:
void
gotHtml
(
KJob
*
);
void
gotXmlRpcTest
(
KJob
*
job
);
void
bloggerAuthenticated
(
const
QMap
<
QString
,
QString
>&
authData
);
Q_SIGNALS:
void
sigBlogAdded
(
const
BilboBlog
&
);
void
sigBlogEdited
(
const
BilboBlog
&
);
...
...
blogilo/src/backend.cpp
View file @
bd4a7275
...
...
@@ -31,11 +31,11 @@
#include <kurl.h>
#include <kblog/blogger1.h>
#include <kblog/gdata.h>
#include <kblog/metaweblog.h>
#include <kblog/movabletype.h>
#include <kblog/wordpressbuggy.h>
#include <kblog/blogmedia.h>
#include <kblog/blogger.h>
#include <kdebug.h>
#include <KDE/KLocale>
...
...
@@ -65,6 +65,12 @@ Backend::Backend( int blog_id, QObject* parent )
kDebug
()
<<
"with blog id: "
<<
blog_id
;
d
->
bBlog
=
DBMan
::
self
()
->
blog
(
blog_id
);
d
->
kBlog
=
d
->
bBlog
->
blogBackend
();
if
(
d
->
bBlog
->
api
()
==
BilboBlog
::
BLOGGER_API
)
{
KBlog
::
Blogger
*
blogger
=
qobject_cast
<
KBlog
::
Blogger
*>
(
d
->
kBlog
);
connect
(
blogger
,
SIGNAL
(
authenticated
(
QMap
<
QString
,
QString
>
)),
this
,
SLOT
(
bloggerAuthenticated
(
QMap
<
QString
,
QString
>
))
);
blogger
->
authenticate
(
DBMan
::
self
()
->
getAuthData
(
blog_id
)
);
}
connect
(
d
->
kBlog
,
SIGNAL
(
error
(
KBlog
::
Blog
::
ErrorType
,
QString
)),
this
,
SLOT
(
error
(
KBlog
::
Blog
::
ErrorType
,
QString
))
);
...
...
@@ -176,11 +182,6 @@ void Backend::postPublished( KBlog::BlogPost *post )
return
;
}
kDebug
()
<<
"isPrivate: "
<<
post
->
isPrivate
();
if
(
post
->
isPrivate
()
&&
d
->
bBlog
->
api
()
==
BilboBlog
::
GDATA_API
){
//GData do not support fetching drafts!
savePostInDbAndEmitResult
(
post
);
return
;
}
d
->
mSubmitPostStatusMap
[
post
]
=
post
->
status
();
connect
(
d
->
kBlog
,
SIGNAL
(
fetchedPost
(
KBlog
::
BlogPost
*
)),
this
,
SLOT
(
savePostInDbAndEmitResult
(
KBlog
::
BlogPost
*
))
);
...
...
@@ -193,8 +194,8 @@ void Backend::uploadMedia( BilboMedia * media )
QString
tmp
;
switch
(
d
->
bBlog
->
api
()
)
{
case
BilboBlog
::
BLOGGER1_API
:
case
BilboBlog
::
GDATA
_API
:
kDebug
()
<<
"The Blogger1 and
GData
API type doesn't support uploading Media files."
;
case
BilboBlog
::
BLOGGER
_API
:
kDebug
()
<<
"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."
);
kDebug
()
<<
"Emitting sigError..."
;
Q_EMIT
sigMediaError
(
tmp
,
media
);
...
...
@@ -482,3 +483,8 @@ KBlog::BlogPost* Backend::preparePost( KBlog::BlogPost* post )
return
post
;
//.toKBlogPost();
}
void
Backend
::
bloggerAuthenticated
(
const
QMap
<
QString
,
QString
>
&
authData
)
{
d
->
bBlog
->
setAuthData
(
authData
);
DBMan
::
self
()
->
saveAuthData
(
authData
,
d
->
bBlog
->
id
()
);
}
blogilo/src/backend.h
View file @
bd4a7275
...
...
@@ -116,6 +116,8 @@ protected Q_SLOTS:
*/
void
savePostInDbAndEmitResult
(
KBlog
::
BlogPost
*
post
);
void
bloggerAuthenticated
(
const
QMap
<
QString
,
QString
>&
authData
);
Q_SIGNALS:
/**
* emit when a categoriesListed() Done and Categories added to DB
...
...
blogilo/src/bilboblog.cpp
View file @
bd4a7275
...
...
@@ -23,8 +23,9 @@
*/
#include "bilboblog.h"
#include "dbman.h"
#include <kblog/wordpressbuggy.h>
#include <kblog/
gdata
.h>
#include <kblog/
blogger
.h>
#include <KDebug>
#include <QApplication>
...
...
@@ -50,6 +51,7 @@ public:
bool
mError
;
QHash
<
QString
,
bool
>
mSupportedFeatures
;
KBlog
::
Blog
*
kblog
;
QMap
<
QString
,
QString
>
mAuthData
;
};
BilboBlog
::
BilboBlog
(
QObject
*
parent
)
...
...
@@ -87,9 +89,6 @@ KBlog::Blog* BilboBlog::blogBackend()
case
BilboBlog
::
BLOGGER1_API
:
d
->
kblog
=
new
KBlog
::
Blogger1
(
url
(),
this
);
break
;
case
BilboBlog
::
GDATA_API
:
d
->
kblog
=
new
KBlog
::
GData
(
url
(),
this
);
break
;
case
BilboBlog
::
METAWEBLOG_API
:
d
->
kblog
=
new
KBlog
::
MetaWeblog
(
url
(),
this
);
break
;
...
...
@@ -99,6 +98,11 @@ KBlog::Blog* BilboBlog::blogBackend()
case
BilboBlog
::
WORDPRESSBUGGY_API
:
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"
)
);
break
;
}
d
->
kblog
->
setUserAgent
(
QLatin1String
(
APPNAME
),
QLatin1String
(
VERSION
)
);
d
->
kblog
->
setUsername
(
username
()
);
...
...
@@ -197,7 +201,7 @@ void BilboBlog::setApi( const ApiType api )
d
->
mSupportedFeatures
[
QLatin1String
(
"category"
)]
=
true
;
d
->
mSupportedFeatures
[
QLatin1String
(
"tag"
)]
=
true
;
break
;
case
GDATA
_API
:
case
BLOGGER
_API
:
d
->
mSupportedFeatures
[
QLatin1String
(
"uploadMedia"
)]
=
false
;
d
->
mSupportedFeatures
[
QLatin1String
(
"category"
)]
=
false
;
d
->
mSupportedFeatures
[
QLatin1String
(
"tag"
)]
=
true
;
...
...
@@ -268,3 +272,13 @@ bool BilboBlog::supportTag() const
return
d
->
mSupportedFeatures
[
QLatin1String
(
"tag"
)];
}
void
BilboBlog
::
setAuthData
(
const
QMap
<
QString
,
QString
>&
authData
)
{
d
->
mAuthData
=
authData
;
}
QMap
<
QString
,
QString
>
BilboBlog
::
authData
()
const
{
return
d
->
mAuthData
;
}
blogilo/src/bilboblog.h
View file @
bd4a7275
...
...
@@ -42,7 +42,7 @@ class BilboBlog : public QObject
Q_OBJECT
public:
enum
ApiType
{
BLOGGER1_API
=
0
,
METAWEBLOG_API
,
MOVABLETYPE_API
,
WORDPRESSBUGGY_API
,
GDATA
_API
BLOGGER1_API
=
0
,
METAWEBLOG_API
,
MOVABLETYPE_API
,
WORDPRESSBUGGY_API
,
BLOGGER
_API
};
explicit
BilboBlog
(
QObject
*
parent
=
0
);
...
...
@@ -67,6 +67,8 @@ public:
void
setPassword
(
const
QString
&
);
QString
title
()
const
;
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
;
...
...
blogilo/src/dbman.cpp
View file @
bd4a7275
...
...
@@ -40,6 +40,7 @@
#include <QFile>
#include <QSqlDatabase>
class
DBMan
::
Private
{
public:
...
...
@@ -53,6 +54,8 @@ public:
bool
useWallet
;
QMap
<
int
,
BilboBlog
*>
mBlogList
;
QSqlDatabase
db
;
static
const
int
DatabaseSchemaVersion
=
1
;
};
DBMan
::
DBMan
()
...
...
@@ -78,8 +81,15 @@ DBMan::DBMan()
kDebug
()
<<
"Cannot create database, SQL error: "
<<
d
->
db
.
lastError
().
text
()
<<
endl
;
exit
(
1
);
}
}
else
if
(
!
connectDB
()
)
}
else
if
(
!
connectDB
()
)
{
kDebug
()
<<
d
->
mLastErrorText
;
exit
(
1
);
}
if
(
!
updateDB
()
)
{
kDebug
()
<<
d
->
mLastErrorText
;
exit
(
1
);
}
reloadBlogList
();
}
...
...
@@ -245,6 +255,27 @@ bool DBMan::createDB()
d
->
mLastErrorText
=
q
.
lastError
().
text
();
}
///Auth data
if
(
!
q
.
exec
(
QLatin1String
(
"CREATE TABLE auth_data (blog_id INT, key TEXT NOT NULL, values TEXT NOT NULL, UNIQUE(blog_id,key))"
)
)
)
{
ret
=
false
;
d
->
mLastErrorText
=
q
.
lastError
().
text
();
}
if
(
!
q
.
exec
(
QLatin1String
(
"CREATE TABLE schema_version (version INT);"
)
)
)
{
ret
=
false
;
d
->
mLastErrorText
=
q
.
lastError
().
text
();
}
{
QSqlQuery
vq
;
vq
.
prepare
(
QLatin1String
(
"INSERT INTO schema_version (version) VALUES (?);"
)
);
vq
.
addBindValue
(
DBMan
::
Private
::
DatabaseSchemaVersion
);
if
(
!
vq
.
exec
()
)
{
ret
=
false
;
d
->
mLastErrorText
=
q
.
lastError
().
text
();
}
}
///delete related information on DB, On removing a post or a blog
q
.
exec
(
QLatin1String
(
"CREATE TRIGGER delete_post AFTER DELETE ON post\
BEGIN\
...
...
@@ -258,6 +289,7 @@ bool DBMan::createDB()
DELETE FROM file WHERE file.blog_id=OLD.id;\
DELETE FROM post WHERE post.blog_id=OLD.id;\
DELETE FROM comment WHERE comment.blog_id=OLD.id;\
DELETE FROM auth_data WHERE auth_data.blog_id=OLD.id;\
END"
)
);
q
.
exec
(
QLatin1String
(
"CREATE TRIGGER delete_temp_post AFTER DELETE ON temp_post \
BEGIN\
...
...
@@ -271,6 +303,73 @@ bool DBMan::createDB()
return
ret
;
}
bool
DBMan
::
updateDB
()
{
uint
dbVersion
=
0
;
/// Check whether schema_version exists
if
(
!
d
->
db
.
tables
(
QSql
::
Tables
).
contains
(
QLatin1String
(
"schema_version"
)
)
)
{
QSqlQuery
q
;
if
(
!
q
.
exec
(
QLatin1String
(
"CREATE TABLE schema_version (version INT);"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
if
(
!
q
.
exec
(
QLatin1String
(
"INSERT INTO schema_version (version) VALUES (0);"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
}
QSqlQuery
q
;
if
(
!
q
.
exec
(
QLatin1String
(
"SELECT version FROM schema_version;"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
q
.
next
();
dbVersion
=
q
.
value
(
0
).
toUInt
();
if
(
dbVersion
<
1
)
{
QSqlQuery
q
;
if
(
!
q
.
exec
(
QLatin1String
(
"CREATE TABLE auth_data (blog_id INT, key TEXT NOT NULL, value TEXT NOT NULL, UNIQUE(blog_id, key));"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
if
(
!
q
.
exec
(
QLatin1String
(
"DROP TRIGGER delete_blog"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
if
(
!
q
.
exec
(
QLatin1String
(
"CREATE TRIGGER delete_blog AFTER DELETE ON blog \
BEGIN\
DELETE FROM category WHERE category.blog_id=OLD.id;\
DELETE FROM file WHERE file.blog_id=OLD.id;\
DELETE FROM post WHERE post.blog_id=OLD.id;\
DELETE FROM comment WHERE comment.blog_id=OLD.id;\
DELETE FROM auth_data WHERE auth_data.blog_id=OLD.id;\
END"
)
)
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
dbVersion
=
1
;
}
/// Update schema_version table
{
QSqlQuery
q
;
q
.
prepare
(
QLatin1String
(
"UPDATE schema_version SET version = ?"
)
);
q
.
addBindValue
(
dbVersion
);
if
(
!
q
.
exec
()
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
return
false
;
}
}
return
true
;
}
int
DBMan
::
addBlog
(
const
BilboBlog
&
blog
)
{
QSqlQuery
q
;
...
...
@@ -343,7 +442,8 @@ bool DBMan::removeBlog( int blog_id )
{
BilboBlog
*
tmp
=
d
->
mBlogList
[
blog_id
];
if
(
d
->
useWallet
)
{
if
(
d
->
mWallet
&&
d
->
mWallet
->
removeEntry
(
tmp
->
url
().
url
()
+
QLatin1Char
(
'_'
)
+
tmp
->
username
()
)
==
0
)
if
(
d
->
mWallet
&&
d
->
mWallet
->
removeEntry
(
tmp
->
url
().
url
()
+
QLatin1Char
(
'_'
)
+
tmp
->
username
()
)
==
0
&&
d
->
mWallet
->
removeEntry
(
QString
::
number
(
blog_id
)
)
==
0
)
kDebug
()
<<
"Password removed to kde wallet"
;
}
QSqlQuery
q
;
...
...
@@ -848,6 +948,66 @@ bool DBMan::clearTempEntries()
return
res
;
}
QMap
<
QString
,
QString
>
DBMan
::
getAuthData
(
int
blog_id
)
{
kDebug
()
<<
blog_id
;
QSqlQuery
q
;
q
.
prepare
(
QLatin1String
(
"SELECT key, value FROM auth_data WHERE blog_id = ?"
)
);
q
.
addBindValue
(
blog_id
);
if
(
!
q
.
exec
()
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
kDebug
()
<<
q
.
lastError
().
text
();
return
QMap
<
QString
,
QString
>
();
}
QMap
<
QString
,
QString
>
result
;
while
(
q
.
next
()
)
{
result
[
q
.
value
(
0
).
toString
()
]
=
q
.
value
(
1
).
toString
();
}
kDebug
()
<<
blog_id
<<
result
;
return
result
;
}
bool
DBMan
::
saveAuthData
(
const
QMap
<
QString
,
QString
>
&
authData
,
int
blog_id
)
{
kDebug
()
<<
blog_id
;
QSqlQuery
q
;
q
.
prepare
(
QLatin1String
(
"INSERT OR REPLACE INTO auth_data (blog_id, key, value) VALUES (?, ?, ?)"
)
);
QMap
<
QString
,
QString
>::
ConstIterator
iter
,
end
=
authData
.
constEnd
();
QList
<
QVariant
>
ids
,
keys
,
values
;
for
(
iter
=
authData
.
constBegin
();
iter
!=
end
;
++
iter
)
{
ids
<<
blog_id
;
keys
<<
iter
.
key
();
values
<<
iter
.
value
();
}
q
.
addBindValue
(
ids
);
q
.
addBindValue
(
keys
);
q
.
addBindValue
(
values
);
const
bool
res
=
q
.
execBatch
();
if
(
!
res
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
kDebug
()
<<
q
.
lastError
().
text
();
}
return
res
;
}
bool
DBMan
::
clearAuthData
(
int
blog_id
)
{
kDebug
()
<<
blog_id
;
QSqlQuery
q
;
q
.
prepare
(
QLatin1String
(
"DELETE FROM auth_data WHERE blog_id = ?"
)
);
q
.
addBindValue
(
blog_id
);
const
bool
res
=
q
.
exec
();
if
(
!
res
)
{
d
->
mLastErrorText
=
q
.
lastError
().
text
();
kDebug
()
<<
q
.
lastError
().
text
();
}
return
res
;
}
BilboBlog
*
DBMan
::
blog
(
int
blog_id
)
{
return
blogList
().
value
(
blog_id
);
...
...
blogilo/src/dbman.h
View file @
bd4a7275
...
...
@@ -138,6 +138,12 @@ public:
bool
removeLocalEntry
(
int
local_id
);
bool
removeTempEntry
(
const
BilboPost
&
post
);
bool
clearTempEntries
();
///Auth Data:
QMap
<
QString
,
QString
>
getAuthData
(
int
blog_id
);
bool
saveAuthData
(
const
QMap
<
QString
,
QString
>&
authData
,
int
blog_id
);
bool
clearAuthData
(
int
blog_id
);
///END
private:
...
...
@@ -146,6 +152,7 @@ private:
QList
<
BilboBlog
*>
listBlogs
();
bool
createDB
();
bool
connectDB
();
bool
updateDB
();
void
reloadBlogList
();
static
DBMan
*
mSelf
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment