diff --git a/interfaces/feedstorage.h b/interfaces/feedstorage.h --- a/interfaces/feedstorage.h +++ b/interfaces/feedstorage.h @@ -49,14 +49,6 @@ /** returns the guids of all articles in this storage. */ virtual QStringList articles() const = 0; - /** Appends all articles from another storage. If there is already an article in this feed with the same guid, it is replaced by the article from the source - @param source the archive which articles should be appended - */ - virtual void add(FeedStorage *source) = 0; - - /** reads an article from another storage and adds it to this storage */ - virtual void copyArticle(const QString &guid, FeedStorage *source) = 0; - /** deletes all articles from the archive */ virtual void clear() = 0; diff --git a/interfaces/storage.h b/interfaces/storage.h --- a/interfaces/storage.h +++ b/interfaces/storage.h @@ -73,7 +73,7 @@ * Closes storage, freeing all allocated resources. Called from destructor, so you don't need to call it directly. * @return true on success. */ - virtual bool close() = 0; + virtual void close() = 0; /** * @return Article archive for feed at given url. @@ -99,11 +99,6 @@ virtual QStringList feeds() const = 0; - /** adds all feed storages from a source to this storage - existing articles are replaced - */ - virtual void add(Storage *source) = 0; - /** deletes all feed storages in this archive */ virtual void clear() = 0; }; diff --git a/plugins/mk4storage/feedstoragemk4impl.h b/plugins/mk4storage/feedstoragemk4impl.h --- a/plugins/mk4storage/feedstoragemk4impl.h +++ b/plugins/mk4storage/feedstoragemk4impl.h @@ -34,8 +34,6 @@ FeedStorageMK4Impl(const QString &url, StorageMK4Impl *main); ~FeedStorageMK4Impl(); - void add(FeedStorage *source) override; - void copyArticle(const QString &guid, FeedStorage *source) override; void clear() override; int unread() const override; diff --git a/plugins/mk4storage/feedstoragemk4impl.cpp b/plugins/mk4storage/feedstoragemk4impl.cpp --- a/plugins/mk4storage/feedstoragemk4impl.cpp +++ b/plugins/mk4storage/feedstoragemk4impl.cpp @@ -483,35 +483,6 @@ markDirty(); } -void FeedStorageMK4Impl::add(FeedStorage *source) -{ - QStringList articles = source->articles(); - for (QStringList::ConstIterator it = articles.constBegin(); it != articles.constEnd(); ++it) { - copyArticle(*it, source); - } - setUnread(source->unread()); - setLastFetch(source->lastFetch()); - setTotalCount(source->totalCount()); -} - -void FeedStorageMK4Impl::copyArticle(const QString &guid, FeedStorage *source) -{ - if (!contains(guid)) { - addEntry(guid); - } - setDescription(guid, source->description(guid)); - setGuidIsHash(guid, source->guidIsHash(guid)); - setGuidIsPermaLink(guid, source->guidIsPermaLink(guid)); - setHash(guid, source->hash(guid)); - setLink(guid, source->link(guid)); - setPubDate(guid, source->pubDate(guid)); - setStatus(guid, source->status(guid)); - setTitle(guid, source->title(guid)); - setAuthorName(guid, source->authorName(guid)); - setAuthorUri(guid, source->authorUri(guid)); - setAuthorEMail(guid, source->authorEMail(guid)); -} - void FeedStorageMK4Impl::setEnclosure(const QString &guid, const QString &url, const QString &type, int length) { int findidx = findArticle(guid); diff --git a/plugins/mk4storage/storagemk4impl.h b/plugins/mk4storage/storagemk4impl.h --- a/plugins/mk4storage/storagemk4impl.h +++ b/plugins/mk4storage/storagemk4impl.h @@ -78,7 +78,7 @@ * Closes storage, freeing all allocated resources. Called from destructor, so you don't need to call it directly. * @return true on success. */ - bool close() override; + void close() override; /** * @return Article archive for feed at given url. @@ -99,11 +99,6 @@ void storeFeedList(const QString &opmlStr) override; QString restoreFeedList() const override; - /** adds all feed storages from a source to this storage - existing articles are replaced - */ - void add(Storage *source) override; - /** deletes all feed storages in this archive */ void clear() override; diff --git a/plugins/mk4storage/storagemk4impl.cpp b/plugins/mk4storage/storagemk4impl.cpp --- a/plugins/mk4storage/storagemk4impl.cpp +++ b/plugins/mk4storage/storagemk4impl.cpp @@ -153,7 +153,7 @@ return d->autoCommit; } -bool Akregator::Backend::StorageMK4Impl::close() +void Akregator::Backend::StorageMK4Impl::close() { QMap::Iterator it; QMap::Iterator end(d->feeds.end()); @@ -171,8 +171,6 @@ d->feedListStorage->Commit(); delete d->feedListStorage; d->feedListStorage = 0; - - return true; } bool Akregator::Backend::StorageMK4Impl::commit() @@ -304,17 +302,6 @@ return list; } -void Akregator::Backend::StorageMK4Impl::add(Storage *source) -{ - QStringList feeds = source->feeds(); - QStringList::ConstIterator end(feeds.constEnd()); - - for (QStringList::ConstIterator it = feeds.constBegin(); it != end; ++it) { - FeedStorage *fa = archiveFor(*it); - fa->add(source->archiveFor(*it)); - } -} - void Akregator::Backend::StorageMK4Impl::clear() { QStringList feeds; diff --git a/src/dummystorage/feedstoragedummyimpl.h b/src/dummystorage/feedstoragedummyimpl.h --- a/src/dummystorage/feedstoragedummyimpl.h +++ b/src/dummystorage/feedstoragedummyimpl.h @@ -35,9 +35,6 @@ FeedStorageDummyImpl(const QString &url, StorageDummyImpl *main); ~FeedStorageDummyImpl() override; - void add(FeedStorage *source) override; - void copyArticle(const QString &guid, FeedStorage *source) override; - void clear() override; int unread() const override; void setUnread(int unread) override; diff --git a/src/dummystorage/feedstoragedummyimpl.cpp b/src/dummystorage/feedstoragedummyimpl.cpp --- a/src/dummystorage/feedstoragedummyimpl.cpp +++ b/src/dummystorage/feedstoragedummyimpl.cpp @@ -317,34 +317,6 @@ } } -void FeedStorageDummyImpl::add(FeedStorage *source) -{ - QStringList articles = source->articles(); - for (QStringList::ConstIterator it = articles.constBegin(); it != articles.constEnd(); ++it) { - copyArticle(*it, source); - } - setUnread(source->unread()); - setLastFetch(source->lastFetch()); - setTotalCount(source->totalCount()); -} - -void FeedStorageDummyImpl::copyArticle(const QString &guid, FeedStorage *source) -{ - if (!contains(guid)) { - addEntry(guid); - } - - setDescription(guid, source->description(guid)); - setContent(guid, source->content(guid)); - setGuidIsHash(guid, source->guidIsHash(guid)); - setGuidIsPermaLink(guid, source->guidIsPermaLink(guid)); - setHash(guid, source->hash(guid)); - setLink(guid, source->link(guid)); - setPubDate(guid, source->pubDate(guid)); - setStatus(guid, source->status(guid)); - setTitle(guid, source->title(guid)); -} - void FeedStorageDummyImpl::clear() { d->entries.clear(); diff --git a/src/dummystorage/storagedummyimpl.h b/src/dummystorage/storagedummyimpl.h --- a/src/dummystorage/storagedummyimpl.h +++ b/src/dummystorage/storagedummyimpl.h @@ -65,7 +65,7 @@ * Closes storage, freeing all allocated resources. Called from destructor, so you don't need to call it directly. * @return true on success. */ - bool close() override; + void close() override; /** * @return Article archive for feed at given url. @@ -84,11 +84,6 @@ void storeFeedList(const QString &opmlStr) override; QString restoreFeedList() const override; - /** adds all feed storages from a source to this storage - existing articles are replaced - */ - void add(Storage *source) override; - /** deletes all feed storages in this archive */ void clear() override; diff --git a/src/dummystorage/storagedummyimpl.cpp b/src/dummystorage/storagedummyimpl.cpp --- a/src/dummystorage/storagedummyimpl.cpp +++ b/src/dummystorage/storagedummyimpl.cpp @@ -63,6 +63,7 @@ StorageDummyImpl::~StorageDummyImpl() { + close(); delete d; d = nullptr; } @@ -81,13 +82,12 @@ return false; } -bool StorageDummyImpl::close() +void StorageDummyImpl::close() { for (QHash::ConstIterator it = d->feeds.constBegin(); it != d->feeds.constEnd(); ++it) { (*it).feedStorage->close(); delete(*it).feedStorage; } - return true; } bool StorageDummyImpl::commit() @@ -169,15 +169,6 @@ return d->feeds.keys(); } -void StorageDummyImpl::add(Storage *source) -{ - QStringList feeds = source->feeds(); - for (QStringList::ConstIterator it = feeds.constBegin(); it != feeds.constEnd(); ++it) { - FeedStorage *fa = archiveFor(*it); - fa->add(source->archiveFor(*it)); - } -} - void StorageDummyImpl::clear() { for (QHash::ConstIterator it = d->feeds.constBegin(); it != d->feeds.constEnd(); ++it) {