/*
   SPDX-FileCopyrightText: 2024-2026 Laurent Montel <montel@kde.org>
   SPDX-FileCopyrightText: 2025-2026 Allen Winter <winter@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "whatsnewtranslations.h"

WhatsNewTranslations::WhatsNewTranslations() = default;

WhatsNewTranslations::~WhatsNewTranslations() = default;

// Use by newFeaturesMD5. changes in this list will trigger a "new stuff" notification
QList<KLazyLocalizedString> WhatsNewTranslations::lastNewFeatures() const
{
    const QList<KLazyLocalizedString> info{
        kli18n("A default To-do calendar can be specified to make creating new to-dos faster and easier with less chance of filing them into the wrong folder. "
               "Setting a default Event calendar has been supported for a long time.  See the Calendar Manager context menu \"Set as Default Todo Calendar\""),
        kli18n("Agenda view: optionally draw bolder/fatter horizontal grid lines every two hours. To enable this behaviour, check the \"Draw bold horizontal "
               "grid lines for the even hours\" option in the View->Agenda View tab"),
        kli18n("It is now possible to hide holidays that belong to specific categories, for example to hide religious holidays. See the Categories combobox in "
               "the Holidays section of the Time&Date->Regional tab"),
        kli18n("Month view: for the sake of consistency, holidays that land on a workday are no longer hidden"),
        kli18n("Month view: An option was added to allow hiding holidays. To enable this behavior, uncheck the \"Display holidays in the month view\" option "
               "in the Views->Month View tab"),
        kli18n("Month view: An option was added to allow using the custom holiday color as the date box background color if at least one holiday lands on "
               "that date. To enable this behavior, check the \"Use the Holiday background color when a holiday lands on the date\" option "
               "in the Views->Month View tab"),
        kli18n("Month view: An option was added to show start-time and end-times. Previously only showing the start-time was supported. To enable this "
               "option, check the \"Show the start-time and the end-time in month view items\" option in the View->Month View tab"),
        kli18n("Agenda view: underline today's column header date"),
        kli18n("Agenda view: optionally show the incidence locations inside the agenda items. To enable this behavior, check the \"Show incidence "
               "locations in agenda view items\" option in the View->Agenda View tab"),
        kli18n("Todo view: the mini todolist is no longer shown in the sidebar; the mini todolist can still be shown in all the other views if the "
               "Settings->Sidebar->Show Todo List option is enabled"),
        kli18n("Options for setting default access classifications (Public, Confidential or Private) when creating new Events, To-dos and "
               "Journals have been added.  Select your preferences in the \"General->Personal Default Access Classification\" comboboxes."),
        kli18n("Templates: tags (categories) can be added to incidence templates"),
    };

    return info;
}

QList<KLazyLocalizedString> WhatsNewTranslations::lastNewFeatures67() const
{
    const QList<KLazyLocalizedString> info{
        kli18n("Reminders are enabled by default for all new events and to-dos. To disable this behavior, uncheck the Enable reminders options in the settings "
               "Time&Date->Default Values tab"),
        kli18n("Month view: no longer display the month year header to save vertical space and remove redundancy"),
        kli18n("Month view: use a slightly different color for drawing the day headers for days outside of the currently selected month"),
        kli18n("Month view: the navigation controls on the lower right side are removed in favor of the improved application navigator bar"),
        kli18n("Month view: the background color for today's date cell can be changed. To configure the color,  set the \"Month view today background color\""
               " in the Colors and Fonts settings"),
        kli18n("Navigator bar: improved by adding week scrolling and showing/hiding the sidebar on a per-view basis"),
        kli18n("Navigator bar: added a button to scroll the view to the current date"),
        kli18n("Agenda view: events with short durations are displayed with their starting time in addition to their summary"),
        kli18n("Agenda view: optionally show the incidence descriptions inside the agenda items. To enable this behavior, check the \"Show incidence "
               "descriptions in agenda view items\" option in the View->Agenda View tab"),
        kli18n("Search: the search settings are saved/restored"),
    };

    return info;
}

QList<KLazyLocalizedString> WhatsNewTranslations::lastNewFeatures66() const
{
    const QList<KLazyLocalizedString> info{
        kli18n("Agenda view: added timelabels context menu to show/hide time labels for the system timezone on the right (or left) side as well"),
        kli18n("Incidence editor: detect and warn about creating incidences in the past"),
        kli18n("Incidence editor: add emoji support"),
    };

    return info;
}

QList<KLazyLocalizedString> WhatsNewTranslations::lastNewFeatures65() const
{
    const QList<KLazyLocalizedString> info{
        kli18n("Add What's New menu"),
        kli18n("The current view is remembered"),
        kli18n("Add a Date Picker dialog available on the Go menu"),
        kli18n("Agenda view: consolidated the \"Day\", \"Next X Days\", \"Work Schedule\", \"Week\" time ranges into the Agenda tool button"),
        kli18n("Agenda view: added timelabels context menu option to toggle a 24-hour (military style) clock"),
        kli18n("Agenda view: added context menu to create new Event or To-do"),
        kli18n("To-do view: added context menu options for toggling completion and reminders"),
        kli18n("To-do view: save/restore fullview setting"),
        kli18n("To-do view: save/restore flatview setting"),
        kli18n("Date navigator: added an option in the Configure->Views settings for hiding the week numbers"),
        kli18n("Date navigator: the \"Week numbers select a work week when in work week mode\" setting is true by default"),
        kli18n("Incidence editor: remember/restore the template manager geometry"),
        kli18n("Incidence editor: support drag-and-drop attachments"),
        kli18n("The export calendar dialog remembers its last export folder location"),
        kli18n("The import calendar dialog remembers its last import folder location"),
        kli18n("Get Hot New Stuff removed"),
        kli18n("Add calendar file: remote calendars are always read-only"),
        kli18n("Add calendar file: will not permit an empty file path"),
        kli18n("DAV configuration: dialog allows seeing the account password when editing"),
        kli18n("DAV configuration: wizard shows icons for the various providers"),
        kli18n("DAV configuration: wizard updated list of providers")};

    return info;
}

QList<TextAddonsWidgets::WhatsNewInfo> WhatsNewTranslations::createWhatsNewInfo() const
{
    QList<TextAddonsWidgets::WhatsNewInfo> listInfo;
    {
        // Version 6.5.0
        TextAddonsWidgets::WhatsNewInfo info65;
        info65.setVersion(QStringLiteral("6.5.0"));
        QStringList lst65;
        const auto newFeatureStrings65 = lastNewFeatures65();
        for (const KLazyLocalizedString &l : newFeatureStrings65) {
            lst65 += l.toString();
        }
        info65.setNewFeatures(lst65);
        info65.setChanges({i18n("Semantics are changed from a \"working schedule\" concept to a \"week schedule\" concept to accommodate non-working users"),
                           i18n("Initial \"New Event\" start times are consistent across all the views"),
                           i18n("Improved default event calendar handling")});
        info65.setBugFixings({
            i18n("Incidences with a long excluded dates list no longer create huge tooltips"),
            i18n("Fixed the organizer email address for incidences with attendees"),
            i18n("Agenda view: events without a duration are displayed as 30 long (rather than 15 minutes long)"),
        });
        listInfo.append(std::move(info65));

        // Version 6.6.0
        TextAddonsWidgets::WhatsNewInfo info66;
        info66.setVersion(QStringLiteral("6.6.0"));
        QStringList lst66;
        const auto newFeatureStrings66 = lastNewFeatures66();
        for (const KLazyLocalizedString &l : newFeatureStrings66) {
            lst66 += l.toString();
        }
        info66.setNewFeatures(lst66);
        // info66.setChanges({i18n()});
        info66.setBugFixings({i18n("Incidence editor: the tags are sorted alphabetically in the tags editor")});
        listInfo.append(std::move(info66));

        // Version 6.7.0
        TextAddonsWidgets::WhatsNewInfo info67;
        info67.setVersion(QStringLiteral("6.7.0"));
        QStringList lst67;
        const auto newFeatureStrings67 = lastNewFeatures67();
        for (const KLazyLocalizedString &l : newFeatureStrings67) {
            lst67 += l.toString();
        }
        info67.setNewFeatures(lst67);
        // info67.setChanges({i18n()});
        // info67.setBugFixings({i18n());
        listInfo.append(std::move(info67));

        // Version 6.8.0 (Current)
        TextAddonsWidgets::WhatsNewInfo info68;
        info68.setVersion(QStringLiteral("6.8.0"));
        QStringList lst68;
        const auto newFeatureStrings68 = lastNewFeatures();
        for (const KLazyLocalizedString &l : newFeatureStrings68) {
            lst68 += l.toString();
        }
        info68.setNewFeatures(lst68);
        info68.setChanges({
            i18n("CalDAV fix: calendars created in KOrganizer are created on the DAV server"),
            i18n("CalDAV fix: calendar name/color changes in KOrganizer are replicated on the DAV server"),
            i18n("CalDAV fix: handle creating/editing/deleting recurring event exceptions"),
        });
        info68.setBugFixings({
            i18n("Fixed reminder toggling from menus"),
            i18n("Agenda view: improved timelabel vertical alignment with grid"),
        });
        listInfo.append(std::move(info68));
    }

    return listInfo;
}
