Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KOrganizer
Commits
ec272346
Commit
ec272346
authored
Jul 31, 2022
by
Volker Krause
Browse files
Port from KCalPrefs::categoryColor to Akonadi::TagCache::tagColor
parent
fe88be2b
Pipeline
#214151
passed with stage
in 3 minutes and 49 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/kocorehelper.cpp
View file @
ec272346
...
...
@@ -10,22 +10,18 @@
#include
<CalendarSupport/KCalPrefs>
#include
<Akonadi/TagCache>
#include
<KLocalizedString>
QColor
KOCoreHelper
::
categoryColor
(
const
QStringList
&
categories
)
{
if
(
categories
.
isEmpty
())
{
return
CalendarSupport
::
KCalPrefs
::
instance
()
->
unsetCategoryColor
();
}
// FIXME: Correctly treat events with multiple categories
const
QString
cat
=
categories
.
first
();
QColor
bgColor
;
if
(
cat
.
isEmpty
())
{
bgColor
=
CalendarSupport
::
KCalPrefs
::
instance
()
->
unsetCategoryColor
();
}
else
{
bgColor
=
CalendarSupport
::
KCalPrefs
::
instance
()
->
categoryColor
(
cat
);
if
(
!
categories
.
isEmpty
())
{
bgColor
=
Akonadi
::
TagCache
::
instance
()
->
tagColor
(
categories
.
at
(
0
));
}
return
bgColor
;
return
bgColor
.
isValid
()
?
bgColor
:
CalendarSupport
::
KCalPrefs
::
instance
()
->
unsetCategoryColor
()
;
}
QString
KOCoreHelper
::
holidayString
(
const
QDate
&
dt
)
...
...
src/prefs/koprefsdialogcolorsandfonts.cpp
View file @
ec272346
...
...
@@ -11,6 +11,7 @@
#include
"koprefs.h"
#include
<Akonadi/CollectionComboBox>
#include
<Akonadi/EntityTreeModel>
#include
<Akonadi/TagCache>
#include
<Akonadi/TagSelectionComboBox>
#include
<CalendarSupport/KCalPrefs>
#include
<KColorButton>
...
...
@@ -184,7 +185,7 @@ void KOPrefsDialogColorsAndFonts::usrWriteConfig()
{
QHash
<
QString
,
QColor
>::
const_iterator
i
=
mCategoryDict
.
constBegin
();
while
(
i
!=
mCategoryDict
.
constEnd
())
{
CalendarSupport
::
KCalPrefs
::
instance
()
->
set
Category
Color
(
i
.
key
(),
i
.
value
());
Akonadi
::
TagCache
::
instance
()
->
set
Tag
Color
(
i
.
key
(),
i
.
value
());
++
i
;
}
...
...
@@ -231,8 +232,7 @@ void KOPrefsDialogColorsAndFonts::updateCategoryColor()
const
QString
cat
=
mCategoryCombo
->
currentText
();
QColor
color
=
mCategoryDict
.
value
(
cat
);
if
(
!
color
.
isValid
())
{
// TODO get this from the tag
color
=
CalendarSupport
::
KCalPrefs
::
instance
()
->
categoryColor
(
cat
);
color
=
Akonadi
::
TagCache
::
instance
()
->
tagColor
(
cat
);
}
if
(
color
.
isValid
())
{
mCategoryButton
->
setColor
(
color
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment