Commit 7198ddfa authored by Volker Krause's avatar Volker Krause
Browse files

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

parent 0d96f02a
Pipeline #214150 passed with stage
in 4 minutes and 26 seconds
......@@ -13,6 +13,7 @@
#include "utils.h"
#include <Akonadi/Item>
#include <Akonadi/TagCache>
#include "calendarsupport_debug.h"
#include <KConfig>
......@@ -268,18 +269,13 @@ void CalPrintPluginBase::setColorsByIncidenceCategory(QPainter &p, const KCalend
QColor CalPrintPluginBase::categoryColor(const QStringList &categories) const
{
if (categories.isEmpty()) {
return KCalPrefs::instance()->unsetCategoryColor();
}
// FIXME: Correctly treat events with multiple categories
const QString cat = categories.at(0);
QColor bgColor;
if (cat.isEmpty()) {
bgColor = KCalPrefs::instance()->unsetCategoryColor();
} else {
bgColor = KCalPrefs::instance()->categoryColor(cat);
if (!categories.isEmpty()) {
bgColor = Akonadi::TagCache::instance()->tagColor(categories.at(0));
}
return bgColor;
return bgColor.isValid() ? bgColor : KCalPrefs::instance()->unsetCategoryColor();
}
QColor CalPrintPluginBase::categoryBgColor(const KCalendarCore::Incidence::Ptr &incidence) const
......
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