23 #include <KConfigSkeleton>
24 #include <KLocalizedString>
26 using namespace CalendarSupport;
31 l << i18nc(
"incidence category: appointment",
"Appointment" )
32 << i18nc(
"incidence category",
"Business" )
33 << i18nc(
"incidence category",
"Meeting" )
34 << i18nc(
"incidence category: phone call",
"Phone Call" )
35 << i18nc(
"incidence category",
"Education" )
36 << i18nc(
"incidence category: "
37 "official or unofficial observance of "
38 "religious/national/cultural/other significance, "
39 "often accompanied by celebrations or festivities",
"Holiday" )
40 << i18nc(
"incidence category: "
41 "a lengthy time away from work or school, a trip abroad, "
42 "or simply a pleasure trip away from home",
"Vacation" )
43 << i18nc(
"incidence category: "
44 "examples: anniversary of historical or personal event; "
45 "big date; remembrance, etc",
"Special Occasion" )
46 << i18nc(
"incidence category",
"Personal" )
47 << i18nc(
"incidence category: "
48 "typically associated with leaving home for business, "
49 "and not pleasure",
"Travel" )
50 << i18nc(
"incidence category",
"Miscellaneous" )
51 << i18nc(
"incidence category",
"Birthday" );
55 class CategoryConfig::Private
58 explicit Private( KCoreConfigSkeleton *cfg ) : config( cfg )
60 mDefaultCategoryColor = QColor( 151, 235, 121 );
63 QColor mDefaultCategoryColor;
64 KCoreConfigSkeleton *config;
70 QHash<QString,QColor> categoryColors;
71 KConfigGroup colorsConfig( d->config->config(),
"Category Colors2" );
73 Q_FOREACH (
const QString & category, cats ) {
74 const QColor color = colorsConfig.readEntry( category, d->mDefaultCategoryColor );
75 if ( color != d->mDefaultCategoryColor ) {
76 categoryColors.insert( category, color );
80 return categoryColors;
85 KConfigGroup colorsConfig( d->config->config(),
"Category Colors2" );
86 QHash<QString, QColor>::const_iterator i = colors.constBegin();
87 QHash<QString, QColor>::const_iterator end = colors.constEnd();
89 colorsConfig.writeEntry( i.key(), i.value() );
95 :
QObject( parent ), d( new Private( cfg ) )
106 d->config->writeConfig();
111 KConfigGroup group( d->config->config(),
"General" );
112 QStringList cats = group.readEntry(
"Custom Categories", QStringList() );
114 if ( cats.isEmpty() ) {
123 KConfigGroup group( d->config->config(),
"General" );
124 group.writeEntry(
"Custom Categories", categories );
129 #include "categoryconfig.moc"
void setColors(const QHash< QString, QColor > &colors)
QStringList customCategories() const
void setCustomCategories(const QStringList &categories)
static const QString categorySeparator
static QStringList categoryDefaults()
CALENDARSUPPORT_EXPORT QStringList categories(const KCalCore::Incidence::List &incidences)
QHash< QString, QColor > readColors() const
CategoryConfig(KCoreConfigSkeleton *cfg, QObject *parent=0)