Commit 340af1a9 authored by Volker Krause's avatar Volker Krause
Browse files

Port from KCalPrefs::categoryColor to Akonadi::TagCache::tagColor

parent 17c0b0ee
Pipeline #214148 passed with stage
in 9 minutes and 27 seconds
......@@ -14,6 +14,8 @@
#include <CalendarSupport/KCalPrefs>
#include <CalendarSupport/Utils>
#include <Akonadi/TagCache>
#include <KContacts/VCardDrag>
#include <KCalUtils/ICalDrag>
......@@ -1127,14 +1129,14 @@ void AgendaItem::drawRoundedRect(QPainter *p,
QColor AgendaItem::getCategoryColor() const
{
const QStringList &categories = mIncidence->categories();
if (categories.isEmpty() || !CalendarSupport::KCalPrefs::instance()->hasCategoryColor(categories.first())) {
if (categories.isEmpty() || !Akonadi::TagCache::instance()->tagColor(categories.first()).isValid()) {
const auto colorPreference = mEventView->preferences()->agendaViewColors();
if (colorPreference == PrefsBase::CategoryOnly || !mResourceColor.isValid()) {
return CalendarSupport::KCalPrefs::instance()->unsetCategoryColor();
}
return mResourceColor;
}
return CalendarSupport::KCalPrefs::instance()->categoryColor(categories.first());
return Akonadi::TagCache::instance()->tagColor(categories.first());
}
QColor AgendaItem::getFrameColor(const QColor &resourceColor, const QColor &categoryColor) const
......
......@@ -14,6 +14,7 @@
#include <Akonadi/CalendarUtils>
#include <Akonadi/IncidenceChanger>
#include <Akonadi/TagCache>
#include <CalendarSupport/KCalPrefs>
#include <CalendarSupport/Utils>
......@@ -564,14 +565,14 @@ QColor IncidenceMonthItem::catColor() const
const auto &prefs = monthScene()->monthView()->preferences();
const auto &categories = mIncidence->categories();
if (categories.isEmpty() || !CalendarSupport::KCalPrefs::instance()->hasCategoryColor(categories.first())) {
if (categories.isEmpty() || !Akonadi::TagCache::instance()->tagColor(categories.first()).isValid()) {
const auto &colorPreference = prefs->monthViewColors();
if (colorPreference == PrefsBase::CategoryOnly) {
return CalendarSupport::KCalPrefs::instance()->unsetCategoryColor();
}
return EventViews::resourceColor(akonadiItem(), prefs);
}
return CalendarSupport::KCalPrefs::instance()->categoryColor(categories.first());
return Akonadi::TagCache::instance()->tagColor(categories.first());
}
QColor IncidenceMonthItem::bgColor() const
......
......@@ -7,7 +7,6 @@
#include "todomodel.h"
#include <CalendarSupport/KCalPrefs>
#include <CalendarSupport/Utils>
#include <KCalUtils/IncidenceFormatter>
#include <KCalendarCore/Attachment>
......@@ -17,6 +16,7 @@
#include <Akonadi/CalendarUtils>
#include <Akonadi/IncidenceTreeModel>
#include <Akonadi/TagCache>
#include <KCalUtils/DndFactory>
#include <KCalUtils/ICalDrag>
......@@ -276,7 +276,7 @@ QVariant TodoModel::data(const QModelIndex &index, int role) const
return QVariant(QIcon::fromTheme(QStringLiteral("task-recurring")));
}
const QStringList categories = todo->categories();
return categories.isEmpty() ? QVariant() : QVariant(CalendarSupport::KCalPrefs::instance()->categoryColor(categories.first()));
return categories.isEmpty() ? QVariant() : QVariant(Akonadi::TagCache::instance()->tagColor(categories.first()));
} else if (role == Qt::DecorationRole) {
return {};
}
......
Supports Markdown
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