Commit e76451d2 authored by Laurent Montel's avatar Laurent Montel 😁

We use namespace directly

parent 1300d7c0
......@@ -39,37 +39,39 @@
using namespace Akregator;
Akregator::ArticleDeleteJob::ArticleDeleteJob(QObject *parent) : KJob(parent), m_feedList(Kernel::self()->feedList())
ArticleDeleteJob::ArticleDeleteJob(QObject *parent)
: KJob(parent),
m_feedList(Kernel::self()->feedList())
{
Q_ASSERT(m_feedList);
}
void Akregator::ArticleDeleteJob::appendArticleIds(const QList<Akregator::ArticleId> &ids)
void ArticleDeleteJob::appendArticleIds(const QList<ArticleId> &ids)
{
m_ids += ids;
}
void Akregator::ArticleDeleteJob::appendArticleId(const Akregator::ArticleId &id)
void ArticleDeleteJob::appendArticleId(const ArticleId &id)
{
m_ids += id;
}
void Akregator::ArticleDeleteJob::start()
void ArticleDeleteJob::start()
{
QTimer::singleShot(20, this, &ArticleDeleteJob::doStart);
}
void Akregator::ArticleDeleteJob::doStart()
void ArticleDeleteJob::doStart()
{
if (!m_feedList) {
qCWarning(AKREGATOR_LOG) << "Feedlist object was deleted, items not deleted";
emitResult();
return;
}
std::vector<Akregator::Feed *> feeds;
std::vector<Feed *> feeds;
Q_FOREACH (const Akregator::ArticleId &id, m_ids) {
Akregator::Article article = m_feedList->findArticle(id.feedUrl, id.guid);
Q_FOREACH (const ArticleId &id, m_ids) {
Article article = m_feedList->findArticle(id.feedUrl, id.guid);
if (article.isNull()) {
continue;
}
......@@ -81,34 +83,34 @@ void Akregator::ArticleDeleteJob::doStart()
article.setDeleted();
}
Q_FOREACH (Akregator::Feed *const i, feeds) {
Q_FOREACH (Feed *const i, feeds) {
i->setNotificationMode(true);
}
emitResult();
}
Akregator::ArticleModifyJob::ArticleModifyJob(QObject *parent) : KJob(parent), m_feedList(Kernel::self()->feedList())
ArticleModifyJob::ArticleModifyJob(QObject *parent) : KJob(parent), m_feedList(Kernel::self()->feedList())
{
Q_ASSERT(m_feedList);
}
void Akregator::ArticleModifyJob::setStatus(const ArticleId &id, int status)
void ArticleModifyJob::setStatus(const ArticleId &id, int status)
{
m_status[id] = status;
}
void Akregator::ArticleModifyJob::setKeep(const ArticleId &id, bool keep)
void ArticleModifyJob::setKeep(const ArticleId &id, bool keep)
{
m_keepFlags[id] = keep;
}
void Akregator::ArticleModifyJob::start()
void ArticleModifyJob::start()
{
QTimer::singleShot(20, this, &ArticleModifyJob::doStart);
}
void Akregator::ArticleModifyJob::doStart()
void ArticleModifyJob::doStart()
{
if (!m_feedList) {
......@@ -116,37 +118,37 @@ void Akregator::ArticleModifyJob::doStart()
emitResult();
return;
}
std::vector<Akregator::Feed *> feeds;
std::vector<Feed *> feeds;
for (auto it = m_keepFlags.cbegin(), end = m_keepFlags.cend(); it != end; ++it) {
const Akregator::ArticleId &id = it.key();
Akregator::Feed *feed = m_feedList->findByURL(id.feedUrl);
const ArticleId &id = it.key();
Feed *feed = m_feedList->findByURL(id.feedUrl);
if (!feed) {
continue;
}
feed->setNotificationMode(false);
feeds.push_back(feed);
Akregator::Article article = feed->findArticle(id.guid);
Article article = feed->findArticle(id.guid);
if (!article.isNull()) {
article.setKeep(it.value());
}
}
for (auto it = m_status.cbegin(), end = m_status.cend(); it != end; ++it) {
const Akregator::ArticleId &id = it.key();
Akregator::Feed *feed = m_feedList->findByURL(id.feedUrl);
const ArticleId &id = it.key();
Feed *feed = m_feedList->findByURL(id.feedUrl);
if (!feed) {
continue;
}
feed->setNotificationMode(false);
feeds.push_back(feed);
Akregator::Article article = feed->findArticle(id.guid);
Article article = feed->findArticle(id.guid);
if (!article.isNull()) {
article.setStatus(it.value());
}
}
Q_FOREACH (Akregator::Feed *const i, feeds) {
Q_FOREACH (Feed *const i, feeds) {
i->setNotificationMode(true);
}
emitResult();
......
......@@ -80,26 +80,26 @@ ArticleModel::Private::Private(const QVector<Article> &articles_, ArticleModel *
}
}
Akregator::ArticleModel::ArticleModel(const QVector<Article> &articles, QObject *parent) : QAbstractTableModel(parent), d(new Private(articles, this))
ArticleModel::ArticleModel(const QVector<Article> &articles, QObject *parent) : QAbstractTableModel(parent), d(new Private(articles, this))
{
}
Akregator::ArticleModel::~ArticleModel()
ArticleModel::~ArticleModel()
{
delete d;
}
int Akregator::ArticleModel::columnCount(const QModelIndex &parent) const
int ArticleModel::columnCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : ColumnCount;
}
int Akregator::ArticleModel::rowCount(const QModelIndex &parent) const
int ArticleModel::rowCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : d->articles.count();
}
QVariant Akregator::ArticleModel::headerData(int section, Qt::Orientation, int role) const
QVariant ArticleModel::headerData(int section, Qt::Orientation, int role) const
{
if (role != Qt::DisplayRole) {
return QVariant();
......@@ -123,13 +123,13 @@ QVariant Akregator::ArticleModel::headerData(int section, Qt::Orientation, int r
return QVariant();
}
QVariant Akregator::ArticleModel::data(const QModelIndex &index, int role) const
QVariant ArticleModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() < 0 || index.row() >= d->articles.count()) {
return QVariant();
}
const int row = index.row();
const Akregator::Article &article(d->articles[row]);
const Article &article(d->articles[row]);
if (article.isNull()) {
return QVariant();
......@@ -250,7 +250,7 @@ void ArticleModel::Private::articlesUpdated(const QVector<Article> &list)
Q_EMIT q->dataChanged(q->index(rmin, 0), q->index(rmax, ColumnCount - 1));
}
bool ArticleModel::rowMatches(int row, const QSharedPointer<const Akregator::Filters::AbstractMatcher> &matcher) const
bool ArticleModel::rowMatches(int row, const QSharedPointer<const Filters::AbstractMatcher> &matcher) const
{
Q_ASSERT(matcher);
return matcher->matches(article(row));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment