Add a reset() function to reset the service to default settings

This commit is contained in:
Luca Beltrame 2015-02-14 14:45:29 +01:00
parent 1b9c0adaa8
commit aaf8adf560
2 changed files with 25 additions and 6 deletions

View file

@ -377,6 +377,11 @@ QStringList DanbooruService::postTags() const
return m_tags;
}
void DanbooruService::reset()
{
m_currentPage = 1;
m_tags = QStringList();
}
// Slots
@ -435,7 +440,7 @@ void DanbooruService::processPostList(KJob *job)
QPixmap pix;
qDebug() << "About to donwload images";
// qDebug() << "About to donwload images";
if (m_cache && m_cache->findPixmap(post->thumbnailUrl().url(), &pix)) {
@ -565,11 +570,18 @@ void DanbooruService::setMaximumAllowedRating(DanbooruPost::Rating rating)
void DanbooruService::setUserName(const QString& username)
{
if (username.isEmpty()) {
return;
}
m_username = username;
}
void DanbooruService::setPassword(const QString& password)
{
if(password.isEmpty()) {
return;
}
m_password = password;
}
@ -587,7 +599,7 @@ void DanbooruService::setImageCache(KImageCache* cache)
void DanbooruService::setMaxPosts(int number) {
m_maxPosts = number ? number < 100: 100;
m_maxPosts = number < 100 ? number : 100;
}

View file

@ -198,10 +198,21 @@ public:
**/
int maxPosts() const;
/**
* @brief Fetches the next page of posts.
*
* @return void
*/
Q_INVOKABLE void nextPostPage();
/**
* @return A QStringList containing the currently-selected tags
*/
QStringList postTags() const;
void reset();
/**
* @brief Set blacklisted tags.
*
@ -230,9 +241,6 @@ public:
**/
void setMaximumAllowedRating(DanbooruPost::Rating rating);
/**
* @brief Set the board URL to connect to.
*
@ -241,7 +249,6 @@ public:
*/
void setBoardUrl(const QUrl& url);
/**
* @brief Set an image cache to use.
*