diff --git a/CMakeLists.txt b/CMakeLists.txt index 661150b..fcf5e68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,104 +1,104 @@ cmake_minimum_required(VERSION 3.0) -set(PIM_VERSION "5.6.40") +set(PIM_VERSION "5.6.41") project(eventviews VERSION ${PIM_VERSION}) # ECM setup set(KF5_VERSION "5.37.0") option(RUN_UNINSTALL "test run uninstalled apps (experimental)" FALSE) set(ECM_VERSION ${KF5_VERSION}) # ECM setup if (RUN_UNINSTALL) set(ECM_VERSION "5.38.0") endif() find_package(ECM ${ECM_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(LIBRARY_NAMELINK) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) include(ECMCoverageOption) set(EVENTVIEW_LIB_VERSION ${PIM_VERSION}) set(CALENDARUTILS_LIB_VERSION "5.6.40") set(AKONADI_LIB_VERSION "5.6.40") set(QT_REQUIRED_VERSION "5.8.0") set(KCALENDARCORE_LIB_VERSION "5.6.40") set(AKONADICALENDAR_LIB_VERSION "5.6.40") set(KMIME_LIB_VERSION "5.6.40") set(LIBKDEPIM_LIB_VERSION "5.6.40") set(CALENDARSUPPORT_LIB_VERSION "5.6.40") find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets UiTools) find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5Codecs ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) set(KDIAGRAM_LIB_VERSION "1.4.0") find_package(KGantt ${KDIAGRAM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarCore ${KCALENDARCORE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarSupport ${CALENDARSUPPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiCalendar ${AKONADICALENDAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) ecm_setup_version(PROJECT VARIABLE_PREFIX EVENTVIEWS VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/eventviews_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfigVersion.cmake" SOVERSION 5 ) ########### Targets ########### add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII") add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) #add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) ########### CMake Config Files ########### set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5EventViews") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5EventViewsConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5EventViewsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5EventViewsTargets.cmake NAMESPACE KF5::) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eventviews_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) add_subdirectory(src) if (BUILD_TESTING) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test) add_subdirectory(tests) endif() install( FILES eventviews.renamecategories eventviews.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 860e369..f122526 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,241 +1,242 @@ # The following macros can be defined to alter behavior. # (if desired, use add_definitions() to define them) # # EVENTVIEWS_NODECOS - turns-off decoration plugins in views. # No idea why you would want to define this, perhaps to save # screen real estate? But there are a config options for that. add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII ) add_definitions(-DTRANSLATION_DOMAIN=\"libeventviews\") if(KDEPIM_BUILD_EXAMPLES) add_subdirectory(viewerapp) endif() option(EVENTVIEWS_NODECOS "Turn-off decoration plugins in views." FALSE) if(EVENTVIEWS_NODECOS) add_definitions(-DEVENTVIEWS_NODECOS) endif() ########### next target ############### set(eventviews_LIB_SRCS eventview_p.cpp eventview.cpp helper.cpp prefs.cpp # Agenda view specific code. agenda/agenda.cpp agenda/agendaitem.cpp agenda/agendaview.cpp agenda/alternatelabel.cpp agenda/calendardecoration.cpp agenda/decorationlabel.cpp agenda/timelabels.cpp agenda/timelabelszone.cpp agenda/timescaleconfigdialog.cpp agenda/viewcalendar.cpp journal/journalframe.cpp journal/journalview.cpp list/listview.cpp month/monthgraphicsitems.cpp month/monthitem.cpp month/monthscene.cpp month/monthview.cpp multiagenda/multiagendaview.cpp todo/tododelegates.cpp todo/todomodel.cpp todo/incidencetreemodel.cpp todo/todoviewquickaddline.cpp todo/todoviewquicksearch.cpp todo/todoviewsortfilterproxymodel.cpp todo/todoviewview.cpp todo/todoview.cpp timeline/timelineview.cpp timeline/timelineitem.cpp timeline/timelineview_p.cpp timespent/timespentview.cpp whatsnext/whatsnextview.cpp ) kconfig_add_kcfg_files(eventviews_LIB_SRCS prefs_base.kcfgc) ecm_qt_declare_logging_category(eventviews_LIB_SRCS HEADER calendarview_debug.h IDENTIFIER CALENDARVIEW_LOG CATEGORY_NAME org.kde.pim.calendarview) ki18n_wrap_ui(eventviews_LIB_SRCS agenda/timescaleedit_base.ui ) add_library(KF5EventViews ${eventviews_LIB_SRCS}) generate_export_header(KF5EventViews BASE_NAME eventviews) add_library(KF5::EventViews ALIAS KF5EventViews) target_link_libraries(KF5EventViews PUBLIC KF5::AkonadiCore KF5::CalendarSupport KF5::CalendarCore KF5::CalendarUtils KF5::AkonadiCalendar PRIVATE KF5::LibkdepimAkonadi KF5::Codecs KGantt KF5::AkonadiWidgets ) target_include_directories(KF5EventViews INTERFACE "$") target_include_directories(KF5EventViews PUBLIC "$") set_target_properties(KF5EventViews PROPERTIES VERSION ${EVENTVIEWS_VERSION_STRING} SOVERSION ${EVENTVIEWS_SOVERSION} EXPORT_NAME EventViews ) install(TARGETS KF5EventViews EXPORT KF5EventViewsTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) ecm_generate_headers(eventviews_CamelCase_HEADERS HEADER_NAMES + Helper Prefs EventView REQUIRED_HEADERS eventviews_CamelCase_HEADERS PREFIX EventViews ) ecm_generate_headers(eventviews_CamelCaseagenda_HEADERS HEADER_NAMES CalendarDecoration AgendaView ViewCalendar REQUIRED_HEADERS eventviews_agenda_HEADERS PREFIX EventViews RELATIVE agenda ) ecm_generate_headers(eventviews_CamelCasetodo_HEADERS HEADER_NAMES TodoView REQUIRED_HEADERS eventviews_todo_HEADERS PREFIX EventViews RELATIVE todo ) ecm_generate_headers(eventviews_CamelCasemonth_HEADERS HEADER_NAMES MonthView REQUIRED_HEADERS eventviews_month_HEADERS PREFIX EventViews RELATIVE month ) ecm_generate_headers(eventviews_CamelCaselist_HEADERS HEADER_NAMES ListView REQUIRED_HEADERS eventviews_list_HEADERS PREFIX EventViews RELATIVE list ) ecm_generate_headers(eventviews_CamelCasejournal_HEADERS HEADER_NAMES JournalView REQUIRED_HEADERS eventviews_journal_HEADERS PREFIX EventViews RELATIVE journal ) ecm_generate_headers(eventviews_CamelCasemultiagenda_HEADERS HEADER_NAMES MultiAgendaView ConfigDialogInterface REQUIRED_HEADERS eventviews_multiagenda_HEADERS PREFIX EventViews RELATIVE multiagenda ) ecm_generate_headers(eventviews_CamelCasetimeline_HEADERS HEADER_NAMES TimeLineView REQUIRED_HEADERS eventviews_timeline_HEADERS PREFIX EventViews RELATIVE timeline ) ecm_generate_headers(eventviews_CamelCasetimespent_HEADERS HEADER_NAMES TimeSpentView REQUIRED_HEADERS eventviews_timespent_HEADERS PREFIX EventViews RELATIVE timespent ) ecm_generate_headers(eventviews_CamelCasewhatsnext_HEADERS HEADER_NAMES WhatsNextView REQUIRED_HEADERS eventviews_whatsnext_HEADERS PREFIX EventViews RELATIVE whatsnext ) ecm_generate_pri_file(BASE_NAME EventViews LIB_NAME KF5EventViews DEPS "Mime AkonadiCalendar" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/EventViews ) install(FILES ${eventviews_CamelCase_HEADERS} ${eventviews_CamelCaseagenda_HEADERS} ${eventviews_CamelCasetodo_HEADERS} ${eventviews_CamelCasetimespent_HEADERS} ${eventviews_CamelCasewhatsnext_HEADERS} ${eventviews_CamelCasetimeline_HEADERS} ${eventviews_CamelCasemultiagenda_HEADERS} ${eventviews_CamelCasejournal_HEADERS} ${eventviews_CamelCaselist_HEADERS} ${eventviews_CamelCasemonth_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/EventViews COMPONENT Devel ) install(FILES ${eventviews_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/eventviews_export.h ${eventviews_CamelCase_HEADERS} ${eventviews_agenda_HEADERS} ${eventviews_todo_HEADERS} ${eventviews_timespent_HEADERS} ${eventviews_whatsnext_HEADERS} ${eventviews_timeline_HEADERS} ${eventviews_multiagenda_HEADERS} ${eventviews_journal_HEADERS} ${eventviews_list_HEADERS} ${eventviews_month_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/eventviews COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) install(FILES agenda/calendardecoration.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) diff --git a/src/helper.cpp b/src/helper.cpp index 36e86b0..f9520ac 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -1,64 +1,104 @@ /* Copyright (C) 2005 Reinhold Kainhofer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "helper.h" #include "prefs.h" #include #include +#include + #include #include QColor EventViews::getTextColor(const QColor &c) { double luminance = (c.red() * 0.299) + (c.green() * 0.587) + (c.blue() * 0.114); return (luminance > 128.0) ? QColor(0, 0, 0) : QColor(255, 255, 255); } +void EventViews::setResourceColor(const Akonadi::Collection &coll, const QColor &color, const PrefsPtr &preferences) +{ + if (!coll.isValid()) { + return; + } + + const QString id = QString::number(coll.id()); + if (coll.hasAttribute()) { + Akonadi::CollectionColorAttribute *colorAttr = coll.attribute(); + if (colorAttr && colorAttr->color().isValid() && (colorAttr->color() == color)) { + // It's the same color: we save an invalid color + preferences->setResourceColor(id, QColor()); + } + } + // in all other cases, we save the resourceColor + preferences->setResourceColor(id, color); +} + + QColor EventViews::resourceColor(const Akonadi::Collection &coll, const PrefsPtr &preferences) { if (!coll.isValid()) { return QColor(); } const QString id = QString::number(coll.id()); - return preferences->resourceColor(id); + QColor color = preferences->resourceColorKnown(id); + if (!color.isValid() && coll.hasAttribute()) { + Akonadi::CollectionColorAttribute *colorAttr = coll.attribute(); + if (colorAttr && colorAttr->color().isValid()) { + color = colorAttr->color(); + } else { + return preferences->resourceColor(id); + } + } + return color; } QColor EventViews::resourceColor(const Akonadi::Item &item, const PrefsPtr &preferences) { if (!item.isValid()) { return QColor(); } const QString id = QString::number(item.parentCollection().id()); - return preferences->resourceColor(id); + + QColor color = preferences->resourceColorKnown(id); + if (!color.isValid() && item.parentCollection().hasAttribute()) { + Akonadi::CollectionColorAttribute *colorAttr = item.parentCollection().attribute(); + if (colorAttr && colorAttr->color().isValid()) { + color = colorAttr->color(); + } else { + return preferences->resourceColor(id); + } + } + return color; } int EventViews::yearDiff(const QDate &start, const QDate &end) { return end.year() - start.year(); } QPixmap EventViews::cachedSmallIcon(const QString &name) { return QIcon::fromTheme(name).pixmap(16, 16); } diff --git a/src/helper.h b/src/helper.h index de8b6e0..d944fdc 100644 --- a/src/helper.h +++ b/src/helper.h @@ -1,81 +1,100 @@ /* Copyright (C) 2005 Reinhold Kainhofer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef EVENTVIEWS_HELPER_H #define EVENTVIEWS_HELPER_H +#include "eventviews_export.h" + + #include #include namespace Akonadi { class Collection; class Item; } class QPixmap; class QDate; // Provides static methods that are useful to all views. namespace EventViews { class Prefs; typedef QSharedPointer PrefsPtr; /** Returns a nice QColor for text, give the input color &c. */ QColor getTextColor(const QColor &c); /** This method returns the proper resource / subresource color for the view. + If a value is stored in the preferences, we use it, else we try to find a + CollectionColorAttribute in the collection. If everything else fails, a + random color can be set. + It is prefered to use this function instead of the + EventViews::Prefs::resourceColor function. @return The resource color for the incidence. If the incidence belongs to a subresource, the color for the subresource is returned (if set). @param calendar the calendar for which the resource color should be obtained @param incidence the incidence for which the color is needed (to determine which subresource needs to be used) */ -QColor resourceColor(const Akonadi::Item &incidence, +EVENTVIEWS_EXPORT QColor resourceColor(const Akonadi::Item &incidence, const PrefsPtr &preferences); -QColor resourceColor(const Akonadi::Collection &collection, +EVENTVIEWS_EXPORT QColor resourceColor(const Akonadi::Collection &collection, const PrefsPtr &preferences); +/** + This method sets the resource color in the preferences, only if it is + different from the CollectionColorAttribute. It is prefered to use this + instead of the EventViews::Prefs::setResourceColor function. + @param collection the collection for which the resource color should be stored + @param color the color to stored + @param preferences a pointer to the EventViews::Prefs to use +*/ +EVENTVIEWS_EXPORT void setResourceColor(const Akonadi::Collection &collection, + const QColor &color, const PrefsPtr &preferences); + /** Returns the number of years between the @p start QDate and the @p end QDate (i.e. the difference in the year number of both dates) */ int yearDiff(const QDate &start, const QDate &end); /** Equivalent to SmallIcon( name ), but uses QPixmapCache. KIconLoader already uses a cache, but it's 20x slower on my tests. @return A new pixmap if it isn't yet in cache, otherwise returns the cached one. */ QPixmap cachedSmallIcon(const QString &name); } #endif diff --git a/src/prefs.cpp b/src/prefs.cpp index 4cbf9d0..6ae7829 100644 --- a/src/prefs.cpp +++ b/src/prefs.cpp @@ -1,1103 +1,1110 @@ /* Copyright (c) 2001,2003 Cornelius Schumacher Copyright (C) 2003-2004 Reinhold Kainhofer Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net Author: Kevin Krammer, krake@kdab.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "prefs.h" #include "prefs_base.h" #include #include "calendarview_debug.h" #include +#include +#include + using namespace EventViews; QSet iconArrayToSet(const QByteArray &array) { QSet set; for (int i = 0; i < array.count(); ++i) { if (i >= EventViews::EventView::IconCount) { qCWarning(CALENDARVIEW_LOG) << "Icon array is too big: " << array.count(); return set; } if (array[i] != 0) { set.insert(static_cast(i)); } } return set; } QByteArray iconSetToArray(const QSet &set) { QByteArray array; for (int i = 0; i < EventViews::EventView::IconCount; ++i) { const bool contains = set.contains(static_cast(i)); array.append(contains ? 1 : 0); } return array; } QByteArray agendaViewIconDefaults() { QByteArray iconDefaults; iconDefaults[EventViews::EventView::CalendarCustomIcon] = 1; iconDefaults[EventViews::EventView::TaskIcon] = 1; iconDefaults[EventViews::EventView::JournalIcon] = 1; iconDefaults[EventViews::EventView::RecurringIcon] = 1; iconDefaults[EventViews::EventView::ReminderIcon] = 1; iconDefaults[EventViews::EventView::ReadOnlyIcon] = 1; iconDefaults[EventViews::EventView::ReplyIcon] = 0; return iconDefaults; } QByteArray monthViewIconDefaults() { QByteArray iconDefaults; iconDefaults[EventViews::EventView::CalendarCustomIcon] = 1; iconDefaults[EventViews::EventView::TaskIcon] = 1; iconDefaults[EventViews::EventView::JournalIcon] = 1; iconDefaults[EventViews::EventView::RecurringIcon] = 0; iconDefaults[EventViews::EventView::ReminderIcon] = 0; iconDefaults[EventViews::EventView::ReadOnlyIcon] = 1; iconDefaults[EventViews::EventView::ReplyIcon] = 0; return iconDefaults; } class BaseConfig : public PrefsBase { public: BaseConfig(); void setResourceColor(const QString &resource, const QColor &color); void setTimeScaleTimezones(const QStringList &timeZones); QStringList timeScaleTimezones() const; public: QHash mResourceColors; QColor mDefaultResourceColor; QFont mDefaultMonthViewFont; QFont mDefaultAgendaTimeLabelsFont; QStringList mTimeScaleTimeZones; QSet mAgendaViewIcons; QSet mMonthViewIcons; protected: void usrSetDefaults() override; void usrRead() override; bool usrSave() override; }; BaseConfig::BaseConfig() : PrefsBase() { mDefaultResourceColor = QColor(); //Default is a color invalid mDefaultAgendaTimeLabelsFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont); // make a large default time bar font, at least 16 points. mDefaultAgendaTimeLabelsFont.setPointSize( qMax(mDefaultAgendaTimeLabelsFont.pointSize() + 4, 16)); mDefaultMonthViewFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont); // make it a bit smaller mDefaultMonthViewFont.setPointSize( qMax(mDefaultMonthViewFont.pointSize() - 2, 6)); agendaTimeLabelsFontItem()->setDefaultValue(mDefaultAgendaTimeLabelsFont); agendaTimeLabelsFontItem()->setDefault(); monthViewFontItem()->setDefaultValue(mDefaultMonthViewFont); monthViewFontItem()->setDefault(); } void BaseConfig::setResourceColor(const QString &resource, const QColor &color) { mResourceColors.insert(resource, color); } void BaseConfig::setTimeScaleTimezones(const QStringList &list) { mTimeScaleTimeZones = list; } QStringList BaseConfig::timeScaleTimezones() const { return mTimeScaleTimeZones; } void BaseConfig::usrSetDefaults() { setAgendaTimeLabelsFont(mDefaultAgendaTimeLabelsFont); setMonthViewFont(mDefaultMonthViewFont); PrefsBase::usrSetDefaults(); } void BaseConfig::usrRead() { // Note that the [Category Colors] group was removed after 3.2 due to // an algorithm change. That's why we now use [Category Colors2] // Resource colors KConfigGroup rColorsConfig(config(), "Resources Colors"); const QStringList colorKeyList = rColorsConfig.keyList(); QStringList::ConstIterator it3; QStringList::ConstIterator end3(colorKeyList.end()); for (it3 = colorKeyList.begin(); it3 != end3; ++it3) { QColor color = rColorsConfig.readEntry(*it3, mDefaultResourceColor); //qCDebug(CALENDARVIEW_LOG) << "key:" << (*it3) << "value:" << color; setResourceColor(*it3, color); } #if 0 config()->setGroup("FreeBusy"); if (mRememberRetrievePw) { mRetrievePassword = KStringHandler::obscure(config()->readEntry("Retrieve Server Password")); } #endif KConfigGroup timeScaleConfig(config(), "Timescale"); setTimeScaleTimezones(timeScaleConfig.readEntry("Timescale Timezones", QStringList())); KConfigGroup monthViewConfig(config(), "Month View"); KConfigGroup agendaViewConfig(config(), "Agenda View"); const QByteArray agendaIconArray = agendaViewConfig.readEntry("agendaViewItemIcons", agendaViewIconDefaults()); const QByteArray monthIconArray = monthViewConfig.readEntry("monthViewItemIcons", monthViewIconDefaults()); mAgendaViewIcons = iconArrayToSet(agendaIconArray); mMonthViewIcons = iconArrayToSet(monthIconArray); KConfigSkeleton::usrRead(); } bool BaseConfig::usrSave() { KConfigGroup rColorsConfig(config(), "Resources Colors"); QHash::const_iterator i = mResourceColors.constBegin(); QHash::const_iterator end(mResourceColors.constEnd()); while (i != end) { rColorsConfig.writeEntry(i.key(), i.value()); ++i; } #if 0 if (mRememberRetrievePw) { config()->writeEntry("Retrieve Server Password", KStringHandler::obscure(mRetrievePassword)); } else { config()->deleteEntry("Retrieve Server Password"); } #endif KConfigGroup timeScaleConfig(config(), "Timescale"); timeScaleConfig.writeEntry("Timescale Timezones", timeScaleTimezones()); KConfigGroup monthViewConfig(config(), "Month View"); KConfigGroup agendaViewConfig(config(), "Agenda View"); const QByteArray agendaIconArray = iconSetToArray(mAgendaViewIcons); const QByteArray monthIconArray = iconSetToArray(mMonthViewIcons); agendaViewConfig.writeEntry("agendaViewItemIcons", agendaIconArray); monthViewConfig.writeEntry("monthViewItemIcons", monthIconArray); return KConfigSkeleton::usrSave(); } class Q_DECL_HIDDEN Prefs::Private { public: Private(Prefs *parent) : mAppConfig(nullptr), q(parent) {} Private(Prefs *parent, KCoreConfigSkeleton *appConfig) : mAppConfig(appConfig), q(parent) {} KConfigSkeletonItem *appConfigItem(const KConfigSkeletonItem *baseConfigItem) const; void setBool(KCoreConfigSkeleton::ItemBool *baseConfigItem, bool value); bool getBool(const KCoreConfigSkeleton::ItemBool *baseConfigItem) const; void setInt(KCoreConfigSkeleton::ItemInt *baseConfigItem, int value); int getInt(const KCoreConfigSkeleton::ItemInt *baseConfigItem) const; void setString(KCoreConfigSkeleton::ItemString *baseConfigItem, const QString &value); QString getString(const KCoreConfigSkeleton::ItemString *baseConfigItem) const; void setDateTime(KCoreConfigSkeleton::ItemDateTime *baseConfigItem, const QDateTime &value); QDateTime getDateTime(const KCoreConfigSkeleton::ItemDateTime *baseConfigItem) const; void setStringList(KCoreConfigSkeleton::ItemStringList *baseConfigItem, const QStringList &value); QStringList getStringList(const KCoreConfigSkeleton::ItemStringList *baseConfigItem) const; void setColor(KConfigSkeleton::ItemColor *baseConfigItem, const QColor &value); QColor getColor(const KConfigSkeleton::ItemColor *baseConfigItem) const; void setFont(KConfigSkeleton::ItemFont *baseConfigItem, const QFont &value); QFont getFont(const KConfigSkeleton::ItemFont *baseConfigItem) const; public: BaseConfig mBaseConfig; KCoreConfigSkeleton *mAppConfig; private: Prefs *q; }; KConfigSkeletonItem *Prefs::Private::appConfigItem( const KConfigSkeletonItem *baseConfigItem) const { Q_ASSERT(baseConfigItem); if (mAppConfig) { return mAppConfig->findItem(baseConfigItem->name()); } return nullptr; } void Prefs::Private::setBool(KCoreConfigSkeleton::ItemBool *baseConfigItem, bool value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemBool *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Bool"; } } else { baseConfigItem->setValue(value); } } bool Prefs::Private::getBool(const KCoreConfigSkeleton::ItemBool *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemBool *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Bool"; } return baseConfigItem->value(); } void Prefs::Private::setInt(KCoreConfigSkeleton::ItemInt *baseConfigItem, int value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemInt *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Int"; } } else { baseConfigItem->setValue(value); } } int Prefs::Private::getInt(const KCoreConfigSkeleton::ItemInt *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemInt *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Int"; } return baseConfigItem->value(); } void Prefs::Private::setString(KCoreConfigSkeleton::ItemString *baseConfigItem, const QString &value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemString *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type String"; } } else { baseConfigItem->setValue(value); } } QString Prefs::Private::getString(const KCoreConfigSkeleton::ItemString *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemString *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type String"; } return baseConfigItem->value(); } void Prefs::Private::setDateTime(KCoreConfigSkeleton::ItemDateTime *baseConfigItem, const QDateTime &value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemDateTime *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type DateTime"; } } else { baseConfigItem->setValue(value); } } QDateTime Prefs::Private::getDateTime( const KCoreConfigSkeleton::ItemDateTime *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemDateTime *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type DateTime"; } return baseConfigItem->value(); } void Prefs::Private::setStringList(KCoreConfigSkeleton::ItemStringList *baseConfigItem, const QStringList &value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemStringList *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type StringList"; } } else { baseConfigItem->setValue(value); } } QStringList Prefs::Private::getStringList( const KCoreConfigSkeleton::ItemStringList *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KCoreConfigSkeleton::ItemStringList *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type StringList"; } return baseConfigItem->value(); } void Prefs::Private::setColor(KConfigSkeleton::ItemColor *baseConfigItem, const QColor &value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KConfigSkeleton::ItemColor *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Color"; } } else { baseConfigItem->setValue(value); } } QColor Prefs::Private::getColor(const KConfigSkeleton::ItemColor *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KConfigSkeleton::ItemColor *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Color"; } return baseConfigItem->value(); } void Prefs::Private::setFont(KConfigSkeleton::ItemFont *baseConfigItem, const QFont &value) { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KConfigSkeleton::ItemFont *item = dynamic_cast(appItem); if (item) { item->setValue(value); } else { qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Font"; } } else { baseConfigItem->setValue(value); } } QFont Prefs::Private::getFont(const KConfigSkeleton::ItemFont *baseConfigItem) const { KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem); if (appItem) { KConfigSkeleton::ItemFont *item = dynamic_cast(appItem); if (item) { return item->value(); } qCCritical(CALENDARVIEW_LOG) << "Application config item" << appItem->name() << "is not of type Font"; } return baseConfigItem->value(); } Prefs::Prefs() : d(new Private(this)) { + // necessary to use CollectionColorAttribute in the EventViews::resourceColor and EventViews::setResourceColor + Akonadi::AttributeFactory::registerAttribute(); } Prefs::Prefs(KCoreConfigSkeleton *appConfig) : d(new Private(this, appConfig)) { + // necessary to use CollectionColorAttribute in the EventViews::resourceColor and EventViews::setResourceColor + Akonadi::AttributeFactory::registerAttribute(); } Prefs::~Prefs() { delete d; } void Prefs::readConfig() { d->mBaseConfig.load(); if (d->mAppConfig) { d->mAppConfig->load(); } } void Prefs::writeConfig() { d->mBaseConfig.save(); if (d->mAppConfig) { d->mAppConfig->save(); } } void Prefs::setMarcusBainsShowSeconds(bool showSeconds) { d->setBool(d->mBaseConfig.marcusBainsShowSecondsItem(), showSeconds); } bool Prefs::marcusBainsShowSeconds() const { return d->getBool(d->mBaseConfig.marcusBainsShowSecondsItem()); } void Prefs::setAgendaMarcusBainsLineLineColor(const QColor &color) { d->setColor(d->mBaseConfig.agendaMarcusBainsLineLineColorItem(), color); } QColor Prefs::agendaMarcusBainsLineLineColor() const { return d->getColor(d->mBaseConfig.agendaMarcusBainsLineLineColorItem()); } void Prefs::setMarcusBainsEnabled(bool enabled) { d->setBool(d->mBaseConfig.marcusBainsEnabledItem(), enabled); } bool Prefs::marcusBainsEnabled() const { return d->getBool(d->mBaseConfig.marcusBainsEnabledItem()); } void Prefs::setAgendaMarcusBainsLineFont(const QFont &font) { d->setFont(d->mBaseConfig.agendaMarcusBainsLineFontItem(), font); } QFont Prefs::agendaMarcusBainsLineFont() const { return d->getFont(d->mBaseConfig.agendaMarcusBainsLineFontItem()); } void Prefs::setHourSize(int size) { d->setInt(d->mBaseConfig.hourSizeItem(), size); } int Prefs::hourSize() const { return d->getInt(d->mBaseConfig.hourSizeItem()); } void Prefs::setDayBegins(const QDateTime &dateTime) { d->setDateTime(d->mBaseConfig.dayBeginsItem(), dateTime); } QDateTime Prefs::dayBegins() const { return d->getDateTime(d->mBaseConfig.dayBeginsItem()); } void Prefs::setWorkingHoursStart(const QDateTime &dateTime) { d->setDateTime(d->mBaseConfig.workingHoursStartItem(), dateTime); } QDateTime Prefs::workingHoursStart() const { return d->getDateTime(d->mBaseConfig.workingHoursStartItem()); } void Prefs::setWorkingHoursEnd(const QDateTime &dateTime) { d->setDateTime(d->mBaseConfig.workingHoursEndItem(), dateTime); } QDateTime Prefs::workingHoursEnd() const { return d->getDateTime(d->mBaseConfig.workingHoursEndItem()); } void Prefs::setSelectionStartsEditor(bool startEditor) { d->setBool(d->mBaseConfig.selectionStartsEditorItem(), startEditor); } bool Prefs::selectionStartsEditor() const { return d->getBool(d->mBaseConfig.selectionStartsEditorItem()); } void Prefs::setAgendaGridWorkHoursBackgroundColor(const QColor &color) { d->setColor(d->mBaseConfig.agendaGridWorkHoursBackgroundColorItem(), color); } QColor Prefs::agendaGridWorkHoursBackgroundColor() const { return d->getColor(d->mBaseConfig.agendaGridWorkHoursBackgroundColorItem()); } void Prefs::setAgendaGridHighlightColor(const QColor &color) { d->setColor(d->mBaseConfig.agendaGridHighlightColorItem(), color); } QColor Prefs::agendaGridHighlightColor() const { return d->getColor(d->mBaseConfig.agendaGridHighlightColorItem()); } void Prefs::setAgendaGridBackgroundColor(const QColor &color) { d->setColor(d->mBaseConfig.agendaGridBackgroundColorItem(), color); } QColor Prefs::agendaGridBackgroundColor() const { return d->getColor(d->mBaseConfig.agendaGridBackgroundColorItem()); } void Prefs::setEnableAgendaItemIcons(bool enable) { d->setBool(d->mBaseConfig.enableAgendaItemIconsItem(), enable); } bool Prefs::enableAgendaItemIcons() const { return d->getBool(d->mBaseConfig.enableAgendaItemIconsItem()); } void Prefs::setTodosUseCategoryColors(bool useColors) { d->setBool(d->mBaseConfig.todosUseCategoryColorsItem(), useColors); } bool Prefs::todosUseCategoryColors() const { return d->getBool(d->mBaseConfig.todosUseCategoryColorsItem()); } void Prefs::setAgendaHolidaysBackgroundColor(const QColor &color) const { d->setColor(d->mBaseConfig.agendaHolidaysBackgroundColorItem(), color); } QColor Prefs::agendaHolidaysBackgroundColor() const { return d->getColor(d->mBaseConfig.agendaHolidaysBackgroundColorItem()); } void Prefs::setAgendaViewColors(int colors) { d->setInt(d->mBaseConfig.agendaViewColorsItem(), colors); } int Prefs::agendaViewColors() const { return d->getInt(d->mBaseConfig.agendaViewColorsItem()); } void Prefs::setAgendaViewFont(const QFont &font) { d->setFont(d->mBaseConfig.agendaViewFontItem(), font); } QFont Prefs::agendaViewFont() const { return d->getFont(d->mBaseConfig.agendaViewFontItem()); } void Prefs::setMonthViewFont(const QFont &font) { d->setFont(d->mBaseConfig.monthViewFontItem(), font); } QFont Prefs::monthViewFont() const { return d->getFont(d->mBaseConfig.monthViewFontItem()); } QColor Prefs::monthGridBackgroundColor() const { return d->getColor(d->mBaseConfig.monthGridBackgroundColorItem()); } void Prefs::setMonthGridBackgroundColor(const QColor &color) { d->setColor(d->mBaseConfig.monthGridBackgroundColorItem(), color); } QColor Prefs::monthGridWorkHoursBackgroundColor() const { return d->getColor(d->mBaseConfig.monthGridWorkHoursBackgroundColorItem()); } void Prefs::monthGridWorkHoursBackgroundColor(const QColor &color) { d->setColor(d->mBaseConfig.monthGridWorkHoursBackgroundColorItem(), color); } int Prefs::monthViewColors() const { return d->getInt(d->mBaseConfig.monthViewColorsItem()); } void Prefs::setMonthViewColors(int colors) const { d->setInt(d->mBaseConfig.monthViewColorsItem(), colors); } void Prefs::setEnableMonthItemIcons(bool enable) { d->setBool(d->mBaseConfig.enableMonthItemIconsItem(), enable); } bool Prefs::enableMonthItemIcons() const { return d->getBool(d->mBaseConfig.enableMonthItemIconsItem()); } bool Prefs::showTimeInMonthView() const { return d->getBool(d->mBaseConfig.showTimeInMonthViewItem()); } void Prefs::setShowTimeInMonthView(bool show) { d->setBool(d->mBaseConfig.showTimeInMonthViewItem(), show); } bool Prefs::showTodosMonthView() const { return d->getBool(d->mBaseConfig.showTodosMonthViewItem()); } void Prefs::setShowTodosMonthView(bool enable) { d->setBool(d->mBaseConfig.showTodosMonthViewItem(), enable); } bool Prefs::showJournalsMonthView() const { return d->getBool(d->mBaseConfig.showJournalsMonthViewItem()); } void Prefs::setShowJournalsMonthView(bool enable) { d->setBool(d->mBaseConfig.showJournalsMonthViewItem(), enable); } bool Prefs::fullViewMonth() const { return d->getBool(d->mBaseConfig.fullViewMonthItem()); } void Prefs::setFullViewMonth(bool fullView) { d->setBool(d->mBaseConfig.fullViewMonthItem(), fullView); } bool Prefs::sortCompletedTodosSeparately() const { return d->getBool(d->mBaseConfig.sortCompletedTodosSeparatelyItem()); } void Prefs::setSortCompletedTodosSeparately(bool enable) { d->setBool(d->mBaseConfig.sortCompletedTodosSeparatelyItem(), enable); } void Prefs::setEnableToolTips(bool enable) { d->setBool(d->mBaseConfig.enableToolTipsItem(), enable); } bool Prefs::enableToolTips() const { return d->getBool(d->mBaseConfig.enableToolTipsItem()); } void Prefs::setShowTodosAgendaView(bool show) { d->setBool(d->mBaseConfig.showTodosAgendaViewItem(), show); } bool Prefs::showTodosAgendaView() const { return d->getBool(d->mBaseConfig.showTodosAgendaViewItem()); } void Prefs::setAgendaTimeLabelsFont(const QFont &font) { d->setFont(d->mBaseConfig.agendaTimeLabelsFontItem(), font); } QFont Prefs::agendaTimeLabelsFont() const { return d->getFont(d->mBaseConfig.agendaTimeLabelsFontItem()); } KDateTime::Spec Prefs::timeSpec() const { return KSystemTimeZones::local(); } QTimeZone Prefs::timeZone() const { return QTimeZone::systemTimeZone(); } bool Prefs::colorAgendaBusyDays() const { return d->getBool(d->mBaseConfig.colorBusyDaysEnabledItem()); } bool Prefs::colorMonthBusyDays() const { return d->getBool(d->mBaseConfig.colorMonthBusyDaysEnabledItem()); } QColor Prefs::viewBgBusyColor() const { return d->getColor(d->mBaseConfig.viewBgBusyColorItem()); } void Prefs::setViewBgBusyColor(const QColor &color) { d->mBaseConfig.mViewBgBusyColor = color; } QColor Prefs::holidayColor() const { return d->getColor(d->mBaseConfig.holidayColorItem()); } void Prefs::setHolidayColor(const QColor &color) { d->mBaseConfig.mHolidayColor = color; } QColor Prefs::agendaViewBackgroundColor() const { return d->getColor(d->mBaseConfig.agendaBgColorItem()); } void Prefs::setAgendaViewBackgroundColor(const QColor &color) { d->mBaseConfig.mAgendaBgColor = color; } QColor Prefs::workingHoursColor() const { return d->getColor(d->mBaseConfig.workingHoursColorItem()); } void Prefs::setWorkingHoursColor(const QColor &color) { d->mBaseConfig.mWorkingHoursColor = color; } QColor Prefs::todoDueTodayColor() const { return d->getColor(d->mBaseConfig.todoDueTodayColorItem()); } void Prefs::setTodoDueTodayColor(const QColor &color) { d->mBaseConfig.mTodoDueTodayColor = color; } QColor Prefs::todoOverdueColor() const { return d->getColor(d->mBaseConfig.todoOverdueColorItem()); } void Prefs::setTodoOverdueColor(const QColor &color) { d->mBaseConfig.mTodoOverdueColor = color; } void Prefs::setColorAgendaBusyDays(bool enable) { d->mBaseConfig.mColorBusyDaysEnabled = enable; } void Prefs::setColorMonthBusyDays(bool enable) { d->mBaseConfig.mColorMonthBusyDaysEnabled = enable; } void Prefs::setResourceColor(const QString &cal, const QColor &color) { d->mBaseConfig.setResourceColor(cal, color); } #define USE_RANDOM void Prefs::createNewColor(QColor &defColor, int seed) { #ifdef USE_RANDOM Q_UNUSED(seed); QColor col = QColor(qrand() % 256, qrand() % 256, qrand() % 256); defColor = col; #else int h, s, v; defColor.getHsv(&h, &s, &v); h = (seed % 12) * 30; s -= s * static_cast(((seed / 12) % 2) * 0.5); defColor.setHsv(h, s, v); #endif } QColor Prefs::resourceColorKnown(const QString &cal) const { QColor color; if (!cal.isEmpty() && d->mBaseConfig.mResourceColors.contains(cal)) { color = d->mBaseConfig.mResourceColors.value(cal); } return color; } QColor Prefs::resourceColor(const QString &cal) { if (cal.isEmpty()) { return d->mBaseConfig.mDefaultResourceColor; } QColor color = resourceColorKnown(cal); // assign default color if enabled if (!color.isValid() && d->getBool(d->mBaseConfig.assignDefaultResourceColorsItem())) { QColor defColor(0x37, 0x7A, 0xBC); const int seed = d->getInt(d->mBaseConfig.defaultResourceColorSeedItem()); const QStringList colors = d->getStringList(d->mBaseConfig.defaultResourceColorsItem()); if (seed > 0 && seed - 1 < (int)colors.size()) { defColor = QColor(colors[seed - 1]); } else { createNewColor(defColor, seed); } d->setInt(d->mBaseConfig.defaultResourceColorSeedItem(), (seed + 1)); d->mBaseConfig.setResourceColor(cal, defColor); color = d->mBaseConfig.mResourceColors[cal]; } if (color.isValid()) { return color; } else { return d->mBaseConfig.mDefaultResourceColor; } } QStringList Prefs::timeScaleTimezones() const { return d->mBaseConfig.timeScaleTimezones(); } void Prefs::setTimeScaleTimezones(const QStringList &list) { d->mBaseConfig.setTimeScaleTimezones(list); } KConfigSkeleton::ItemFont *Prefs::fontItem(const QString &name) const { KConfigSkeletonItem *item = d->mAppConfig ? d->mAppConfig->findItem(name) : nullptr; if (!item) { item = d->mBaseConfig.findItem(name); } return dynamic_cast(item); } QStringList Prefs::selectedPlugins() const { return d->mBaseConfig.mSelectedPlugins; } QStringList Prefs::decorationsAtAgendaViewTop() const { return d->mBaseConfig.decorationsAtAgendaViewTop(); } QStringList Prefs::decorationsAtAgendaViewBottom() const { return d->mBaseConfig.decorationsAtAgendaViewBottom(); } void Prefs::setSelectedPlugins(const QStringList &plugins) { d->mBaseConfig.setSelectedPlugins(plugins); } void Prefs::setDecorationsAtAgendaViewTop(const QStringList &decorations) { d->mBaseConfig.setDecorationsAtAgendaViewTop(decorations); } void Prefs::setDecorationsAtAgendaViewBottom(const QStringList &decorations) { d->mBaseConfig.setDecorationsAtAgendaViewBottom(decorations); } QSet Prefs::agendaViewIcons() const { return d->mBaseConfig.mAgendaViewIcons; } void Prefs::setAgendaViewIcons(const QSet &icons) { d->mBaseConfig.mAgendaViewIcons = icons; } QSet Prefs::monthViewIcons() const { return d->mBaseConfig.mMonthViewIcons; } void Prefs::setMonthViewIcons(const QSet &icons) { d->mBaseConfig.mMonthViewIcons = icons; } void Prefs::setFlatListTodo(bool enable) { d->mBaseConfig.mFlatListTodo = enable; } bool Prefs::flatListTodo() const { return d->mBaseConfig.mFlatListTodo; } void Prefs::setFullViewTodo(bool enable) { d->mBaseConfig.mFullViewTodo = enable; } bool Prefs::fullViewTodo() const { return d->mBaseConfig.mFullViewTodo; } bool Prefs::enableTodoQuickSearch() const { return d->mBaseConfig.mEnableTodoQuickSearch; } void Prefs::setEnableTodoQuickSearch(bool enable) { d->mBaseConfig.mEnableTodoQuickSearch = enable; } bool Prefs::enableQuickTodo() const { return d->mBaseConfig.mEnableQuickTodo; } void Prefs::setEnableQuickTodo(bool enable) { d->mBaseConfig.mEnableQuickTodo = enable; } bool Prefs::highlightTodos() const { return d->mBaseConfig.mHighlightTodos; } void Prefs::setHighlightTodos(bool highlight) { d->mBaseConfig.mHighlightTodos = highlight; } KConfig *Prefs::config() const { return d->mAppConfig ? d->mAppConfig->config() : d->mBaseConfig.config(); }