[pim/korganizer] /: Restore the Hebrew Calendar Plugin
Allen Winter <[email protected]> Tue, 4 Aug 2026 13:52:58 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 07ac05bc717782e110974ebe2e3e8ebed1c187cc by Allen Winter.
Committed on 04/08/2026 at 13:52.
Pushed by winterz into branch 'master'.
Restore the Hebrew Calendar Plugin
restore from the KDE4 days
M +0 -1 .kde-ci.yml
M +0 -2 .krazy
M +4 -2 plugins/CMakeLists.txt
D +0 -391 plugins/hebrew/converter.cpp
D +0 -132 plugins/hebrew/converter.h
D +0 -70 plugins/hebrew/hebrew.cpp
D +0 -104 plugins/hebrew/hebrew.desktop
D +0 -96 plugins/hebrew/hebrew.json
D +0 -1208 plugins/hebrew/qcalendarsystem.cpp
D +0 -117 plugins/hebrew/qcalendarsystem_p.h
R +9 -6 plugins/hebrewcalendar/CMakeLists.txt [from: plugins/hebrew/CMakeLists.txt - 061% similarity]
R +2 -2 plugins/hebrewcalendar/README [from: plugins/hebrew/README - 075% similarity]
R +13 -5 plugins/hebrewcalendar/configdialog.cpp [from: plugins/hebrew/configdialog.cpp - 069% similarity]
R +0 -0 plugins/hebrewcalendar/configdialog.h [from: plugins/hebrew/configdialog.h - 100% similarity]
A +141 -0 plugins/hebrewcalendar/hebrew.cpp [License: GPL(v2.0+)]
A +62 -0 plugins/hebrewcalendar/hebrew.desktop
R +0 -0 plugins/hebrewcalendar/hebrew.h [from: plugins/hebrew/hebrew.h - 100% similarity]
A +64 -0 plugins/hebrewcalendar/hebrew.json
R +6 -2 plugins/hebrewcalendar/holiday.cpp [from: plugins/hebrew/holiday.cpp - 097% similarity]
R +4 -4 plugins/hebrewcalendar/holiday.h [from: plugins/hebrew/holiday.h - 088% similarity]
R +5 -1 plugins/hebrewcalendar/parsha.cpp [from: plugins/hebrew/parsha.cpp - 098% similarity]
R +0 -0 plugins/hebrewcalendar/parsha.h [from: plugins/hebrew/parsha.h - 100% similarity]
M +4 -0 src/org.kde.korganizer.appdata.xml
https://invent.kde.org/pim/korganizer/-/commit/07ac05bc717782e110974ebe2e3e8ebed1c187cc
diff --git a/.kde-ci.yml b/.kde-ci.yml
index cf713506c..44f1155ea 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -54,4 +54,3 @@ Options:
- src/views/collectionview/autotests
- src/kontactplugin/korganizer/autotests
- src/views/collectionview/reparentingmodel.cpp
- - plugins/hebrew
diff --git a/.krazy b/.krazy
index 224360d28..9fbf7bdae 100644
--- a/.krazy
+++ b/.krazy
@@ -3,5 +3,3 @@ EXTRA camelcase,defines,null,qenums,tipsandthis
PRIORITY all
STRICT all
-
-SKIP plugins/hebrew
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index cd1709b7f..763fb6918 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -3,8 +3,10 @@
add_definitions(-DTRANSLATION_DOMAIN=\"korganizer_calendarplugins\")
add_subdirectory(datenums)
-#the hebrew plugin depends on kdelibs4support
-#add_subdirectory(hebrew)
add_subdirectory(lunarphases)
add_subdirectory(picoftheday)
add_subdirectory(thisdayinhistory)
+
+if(${KF6Holidays_VERSION} VERSION_GREATER_EQUAL "6.29.0")
+ add_subdirectory(hebrewcalendar)
+endif()
diff --git a/plugins/hebrew/converter.cpp b/plugins/hebrew/converter.cpp
deleted file mode 100644
index 89aea45c6..000000000
--- a/plugins/hebrew/converter.cpp
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- This file is part of KOrganizer.
-
- SPDX-FileCopyrightText: 2003 Jonathan Singer <[email protected]>
- SPDX-FileCopyrightText: 2007 Loïc Corbasson <[email protected]>
- Calendar routines from Hebrew Calendar by Frank Yellin.
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "converter.h"
-
-HebrewDate::HebrewDate(const DateResult &d)
- : mYear(d.year)
- , mMonth(d.month)
- , mDay(d.day)
- , mDayOfWeek(d.day_of_week)
- , mHebrewMonthLength(d.hebrew_month_length)
- , mSecularMonthLength(d.secular_month_length)
- , mOnHebrewLeapYear(d.hebrew_leap_year_p)
- , mOnSecularLeapYear(d.secular_leap_year_p)
- , mKvia(d.kvia)
- , mHebrewDayNumber(d.hebrew_day_number)
-{
-}
-
-HebrewDate::~HebrewDate()
-{
-}
-
-HebrewDate HebrewDate::fromSecular(int year, int month, int day)
-{
- DateResult result;
- Converter::secularToHebrewConversion(year, month, day, &result);
- return HebrewDate(result);
-}
-
-HebrewDate HebrewDate::fromHebrew(int year, int month, int day)
-{
- DateResult result;
- Converter::hebrewToSecularConversion(year, month, day, &result);
- return HebrewDate(result);
-}
-
-int HebrewDate::year() const
-{
- return mYear;
-}
-
-int HebrewDate::month() const
-{
- return mMonth;
-}
-
-int HebrewDate::day() const
-{
- return mDay;
-}
-
-int HebrewDate::dayOfWeek() const
-{
- return mDayOfWeek;
-}
-
-int HebrewDate::hebrewMonthLength() const
-{
- return mHebrewMonthLength;
-}
-
-int HebrewDate::secularMonthLength() const
-{
- return mSecularMonthLength;
-}
-
-bool HebrewDate::isOnHebrewLeapYear() const
-{
- return mOnHebrewLeapYear;
-}
-
-bool HebrewDate::isOnSecularLeapYear() const
-{
- return mOnSecularLeapYear;
-}
-
-int HebrewDate::kvia() const
-{
- return mKvia;
-}
-
-int HebrewDate::hebrewDayNumber() const
-{
- return mHebrewDayNumber;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-long Converter::absolute_from_gregorian(int year, int month, int day)
-{
- int xyear, day_number;
-
- xyear = year - 1;
- day_number = day + 31 * (month - 1);
- if (month > 2) {
- day_number -= (23 + (4 * month)) / 10;
- if (gregorian_leap_year_p(year)) {
- day_number++;
- }
- }
- return day_number /* the day number within the current year */
- + 365L * xyear /* days in prior years */
- + (xyear / 4) /* Julian leap years */
- + (-(xyear / 100)) /* deduct century years */
- + (xyear / 400); /* add Gregorian leap years */
-}
-
-/* Given a Hebrew date, calculate the number of days since January 0, 0001,
- Gregorian */
-long Converter::absolute_from_hebrew(int year, int month, int day)
-{
- long sum = day + hebrew_elapsed_days(year) - 1373429L;
- int i;
-
- if (month < 7) {
- int months = hebrew_months_in_year(year);
- for (i = 7; i <= months; ++i) {
- sum += hebrew_month_length(year, i);
- }
- for (i = 1; i < month; ++i) {
- sum += hebrew_month_length(year, i);
- }
- } else {
- for (i = 7; i < month; ++i) {
- sum += hebrew_month_length(year, i);
- }
- }
- return sum;
-}
-
-/* Given an absolute date, calculate the gregorian date */
-void Converter::gregorian_from_absolute(long date, int *yearp, int *monthp, int *dayp)
-{
- int year, month, day;
-
- for (year = date / 366; date >= absolute_from_gregorian(year + 1, 1, 1); ++year) { }
-
- for (month = 1; (month <= 11) && (date >= absolute_from_gregorian(year, 1 + month, 1)); ++month) { }
-
- day = 1 + date - absolute_from_gregorian(year, month, 1);
- *yearp = year;
- *monthp = month;
- *dayp = day;
-}
-
-/* Given an absolute date, calculate the Hebrew date */
-void Converter::hebrew_from_absolute(long date, int *yearp, int *monthp, int *dayp)
-{
- int year, month, day, gyear, gmonth, gday, months;
-
- gregorian_from_absolute(date, &gyear, &gmonth, &gday);
- year = gyear + 3760;
- while (date >= absolute_from_hebrew(1 + year, 7, 1)) {
- year++;
- }
- months = hebrew_months_in_year(year);
- for (month = 7; date > absolute_from_hebrew(year, month, hebrew_month_length(year, month)); month = 1 + (month % months)) { }
- day = 1 + date - absolute_from_hebrew(year, month, 1);
- *yearp = year;
- *monthp = month;
- *dayp = day;
-}
-
-/* Number of months in a Hebrew year */
-int Converter::hebrew_months_in_year(int year)
-{
- if (hebrew_leap_year_p(year)) {
- return 13;
- } else {
- return 12;
- }
-}
-
-/* Number of days in a Hebrew month */
-int Converter::hebrew_month_length(int year, int month)
-{
- switch (month) {
- case Tishrei:
- case Shvat:
- case Nissan:
- case Sivan:
- case Ab:
- return 30;
-
- case Tevet:
- case Iyar:
- case Tamuz:
- case Elul:
- case AdarII:
- return 29;
-
- case Cheshvan:
- // 29 days, unless it's a long year.
- if ((hebrew_year_length(year) % 10) == 5) {
- return 30;
- } else {
- return 29;
- }
-
- case Kislev:
- // 30 days, unless it's a short year.
- if ((hebrew_year_length(year) % 10) == 3) {
- return 29;
- } else {
- return 30;
- }
-
- case Adar:
- // Adar (non-leap year) has 29 days. Adar I has 30 days.
- if (hebrew_leap_year_p(year)) {
- return 30;
- } else {
- return 29;
- }
-
- default:
- return 0;
- }
-}
-
-/* Number of days in a Julian or gregorian month */
-int Converter::secular_month_length(int year, int month /*, bool julianp */)
-{
- switch (month) {
- case January:
- case March:
- case May:
- case July:
- case August:
- case October:
- case December:
- return 31;
-
- case April:
- case June:
- case September:
- case November:
- return 30;
-
- case February:
- if (gregorian_leap_year_p(year)) {
- return 29;
- } else {
- return 28;
- }
-
- default:
- return 0;
- }
-}
-
-/* Is it a leap year in the gregorian calendar */
-bool Converter::gregorian_leap_year_p(int year)
-{
- if ((year % 4) != 0) {
- return 0;
- }
- if ((year % 400) == 0) {
- return 1;
- }
- if ((year % 100) == 0) {
- return 0;
- }
- return 1;
-}
-
-/* Is it a leap year in the Jewish Calendar */
-bool Converter::hebrew_leap_year_p(int year)
-{
- switch (year % 19) {
- case 0:
- case 3:
- case 6:
- case 8:
- case 11:
- case 14:
- case 17:
- return 1;
- default:
- return 0;
- }
-}
-
-/* Return the number of days from 1 Tishrei 0001 to the beginning of the given
- year. Since this routine gets called frequently with the same year arguments,
- we cache the most recent values. */
-#define MEMORY 5
-long Converter::hebrew_elapsed_days(int year)
-{
- static int saved_year[MEMORY] = {-1, -1, -1, -1, -1};
- static long saved_value[MEMORY];
- int i;
-
- for (i = 0; i < MEMORY; ++i) {
- if (year == saved_year[i]) {
- return saved_value[i];
- }
- }
- for (i = 0; i < MEMORY - 1; ++i) {
- saved_year[i] = saved_year[1 + i];
- saved_value[i] = saved_value[1 + i];
- }
- saved_year[MEMORY - 1] = year;
- saved_value[MEMORY - 1] = hebrew_elapsed_days2(year);
- return saved_value[MEMORY - 1];
-}
-
-/* Called by hebrew_elapsed_days to make the calculations if the result is not
- in the cache */
-long Converter::hebrew_elapsed_days2(int year)
-{
- long prev_year = year - 1;
- long months_elapsed = 235L * (prev_year / 19) + /* months in complete cycles so far */
- 12L * (prev_year % 19) + /* regular months in this cycle */
- (((prev_year % 19) * 7 + 1) / 19);
- /* leap months in this cycle */
- long parts_elapsed = 5604 + 13753 * months_elapsed;
- long day = 1 + 29 * months_elapsed + parts_elapsed / 25920;
- long parts = parts_elapsed % 25920;
- int weekday = day % 7;
- long alt_day = ((parts >= 19440) || (weekday == 2 && (parts >= 9924) && !hebrew_leap_year_p(year))
- || (weekday == 1 && (parts >= 16789) && hebrew_leap_year_p(prev_year)))
- ? day + 1
- : day;
-
- switch (alt_day % 7) {
- case 0:
- case 3:
- case 5:
- return 1 + alt_day;
- default:
- return alt_day;
- }
-}
-
-/* Number of days in the given Hebrew year */
-int Converter::hebrew_year_length(int year)
-{
- return hebrew_elapsed_days(1 + year) - hebrew_elapsed_days(year);
-}
-
-/* Fill in the DateResult structure based on the given secular date */
-void Converter::secularToHebrewConversion(int syear, int smonth, int sday, struct DateResult *result)
-{
- int hyear, hmonth, hday;
- long absolute;
-
- absolute = absolute_from_gregorian(syear, smonth, sday);
-
- hebrew_from_absolute(absolute, &hyear, &hmonth, &hday);
-
- result->year = hyear;
- result->month = hmonth;
- result->day = hday;
- finish_up(absolute, hyear, hmonth, syear, smonth, result);
-}
-
-/* Fill in the DateResult structure based on the given Hebrew date */
-void Converter::hebrewToSecularConversion(int hyear, int hmonth, int hday, struct DateResult *result)
-{
- int syear, smonth, sday;
- long absolute;
-
- absolute = absolute_from_hebrew(hyear, hmonth, hday);
- gregorian_from_absolute(absolute, &syear, &smonth, &sday);
- result->year = hyear;
- result->month = hmonth;
- result->day = hday;
- finish_up(absolute, hyear, hmonth, syear, smonth, result);
-}
-
-/* This is common code for filling up the DateResult structure */
-void Converter::finish_up(long absolute, int hyear, int hmonth, int syear, int smonth, struct DateResult *result)
-{
- result->hebrew_month_length = hebrew_month_length(hyear, hmonth);
- result->secular_month_length = secular_month_length(syear, smonth);
- result->hebrew_leap_year_p = hebrew_leap_year_p(hyear);
- result->secular_leap_year_p = gregorian_leap_year_p(syear);
- result->kvia = (hebrew_year_length(hyear) % 10) - 3;
- // absolute is -1 on 1/1/0001 Julian
- result->day_of_week = (7 + absolute) % 7;
- result->hebrew_day_number = absolute - absolute_from_hebrew(hyear, 7, 1) + 1;
-}
diff --git a/plugins/hebrew/converter.h b/plugins/hebrew/converter.h
deleted file mode 100644
index 647b6b904..000000000
--- a/plugins/hebrew/converter.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- This file is part of KOrganizer.
-
- SPDX-FileCopyrightText: 2003 Jonathan Singer <[email protected]>
- SPDX-FileCopyrightText: 2007 Loïc Corbasson <[email protected]>
- Calendar routines from Hebrew Calendar by Frank Yellin.
- SPDX-FileCopyrightText: 1994-2006 Danny Sadinoff <[email protected]>.
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-#pragma once
-
-// needed for [[nodiscard]]
-
-struct DateResult {
- int year;
- int month;
- int day;
- int day_of_week;
-
- int hebrew_month_length, secular_month_length;
- bool hebrew_leap_year_p, secular_leap_year_p;
- int kvia;
- int hebrew_day_number;
-};
-
-/**
- This class converts dates between the Hebrew and Gregorian (secular)
- calendars.
-
- @author Loïc Corbasson
- */
-class HebrewDate
-{
-public:
- explicit HebrewDate(const DateResult &);
- ~HebrewDate();
-
- static HebrewDate fromSecular(int year, int month, int day);
- static HebrewDate fromHebrew(int year, int month, int day);
-
- [[nodiscard]] int year() const;
- [[nodiscard]] int month() const;
- [[nodiscard]] int day() const;
- [[nodiscard]] int dayOfWeek() const;
-
- [[nodiscard]] int hebrewMonthLength() const;
- [[nodiscard]] int secularMonthLength() const;
- [[nodiscard]] bool isOnHebrewLeapYear() const;
- [[nodiscard]] bool isOnSecularLeapYear() const;
- [[nodiscard]] int kvia() const;
- [[nodiscard]] int hebrewDayNumber() const;
-
-private:
- int mYear, mMonth, mDay, mDayOfWeek;
- int mHebrewMonthLength, mSecularMonthLength;
- bool mOnHebrewLeapYear, mOnSecularLeapYear;
- int mKvia, mHebrewDayNumber;
-};
-
-/**
- This class is used internally to convert dates between the Hebrew and
- Gregorian (secular) calendars.
-
- Calendar routines from Hebrew Calendar by Frank Yellin.
-
- For more information, see “The Comprehensive Hebrew Calendar” by Arthur Spier
- and “Calendrical Calculations” by E. M. Reingold and Nachum Dershowitz,
- or the documentation of Remind by Roaring Penguin Software Inc.
-
- @author Jonathan Singer
-*/
-class Converter
-{
- friend class HebrewDate;
-
-public:
- enum HebrewMonths {
- Nissan = 1,
- Iyar,
- Sivan,
- Tamuz,
- Ab,
- Elul,
- Tishrei,
- Cheshvan,
- Kislev,
- Tevet,
- Shvat,
- Adar,
- AdarII,
- AdarI = 12,
- };
-
- enum SecularMonths {
- January = 1,
- February,
- March,
- April,
- May,
- June,
- July,
- August,
- September,
- October,
- November,
- December,
- };
-
-private:
- static bool hebrew_leap_year_p(int year);
- static bool gregorian_leap_year_p(int year);
-
- static long absolute_from_gregorian(int year, int month, int day);
- static long absolute_from_hebrew(int year, int month, int day);
-
- static void gregorian_from_absolute(long date, int *yearp, int *monthp, int *dayp);
- static void hebrew_from_absolute(long date, int *yearp, int *monthp, int *dayp);
-
- static int hebrew_months_in_year(int year);
- static int hebrew_month_length(int year, int month);
- static int secular_month_length(int year, int month);
-
- static long hebrew_elapsed_days(int year);
- static long hebrew_elapsed_days2(int year);
- static int hebrew_year_length(int year);
-
- static void finish_up(long absolute, int hyear, int hmonth, int syear, int smonth, struct DateResult *result);
-
- static void secularToHebrewConversion(int year, int month, int day, struct DateResult *result);
- static void hebrewToSecularConversion(int year, int month, int day, struct DateResult *result);
-};
diff --git a/plugins/hebrew/hebrew.cpp b/plugins/hebrew/hebrew.cpp
deleted file mode 100644
index aa5566f09..000000000
--- a/plugins/hebrew/hebrew.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- This file is part of KOrganizer.
-
- SPDX-FileCopyrightText: 2003 Jonathan Singer <[email protected]>
- SPDX-FileCopyrightText: 2007 Loïc Corbasson <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "hebrew.h"
-#include "configdialog.h"
-#include "converter.h"
-#include "holiday.h"
-
-#include <KCalendarSystem>
-#include <KConfig>
-#include <KConfigGroup>
-#include <KLocalizedString>
-#include <KPluginFactory>
-#include <QLocale>
-
-K_PLUGIN_CLASS_WITH_JSON(Hebrew, "hebrew.json")
-
-using namespace EventViews::CalendarDecoration;
-
-Hebrew::Hebrew(QObject *parent, const QVariantList &args)
- : Decoration(parent, args)
-{
- KConfig config(QStringLiteral("korganizerrc"), KConfig::NoGlobals);
-
- KConfigGroup group(&config, QStringLiteral("Hebrew Calendar Plugin"));
- areWeInIsrael = group.readEntry("UseIsraelSettings", QLocale::territoryToString(QLocale().territory()) == QLatin1StringView(".il"));
- showParsha = group.readEntry("ShowParsha", true);
- showChol = group.readEntry("ShowChol_HaMoed", true);
- showOmer = group.readEntry("ShowOmer", true);
-}
-
-void Hebrew::configure(QWidget *parent)
-{
- ConfigDialog dlg(parent);
- dlg.exec();
-}
-
-Element::List Hebrew::createDayElements(const QDate &date)
-{
- Element::List el;
- QString text;
- HebrewDate hd = HebrewDate::fromSecular(date.year(), date.month(), date.day());
-
- const QStringList holidays = Holiday::findHoliday(hd, areWeInIsrael, showParsha, showChol, showOmer);
-
- KCalendarSystem *cal = KCalendarSystem::create(KLocale::HebrewCalendar);
-
- text = cal->formatDate(date, KLocale::Day, KLocale::LongNumber) + u' ' + cal->monthName(date);
-
- for (const QString &holiday : holidays) {
- text += QLatin1StringView("<br/>\n") + holiday;
- }
-
- text = i18nc("Change the next two strings if emphasis is done differently in your language.", "<qt><p align=\"center\"><i>\n%1\n</i></p></qt>", text);
- el.append(new StoredElement(QStringLiteral("main element"), text));
- return el;
-}
-
-QString Hebrew::info() const
-{
- return i18n("This plugin provides the date in the Jewish calendar.");
-}
-
-#include "hebrew.moc"
diff --git a/plugins/hebrew/hebrew.desktop b/plugins/hebrew/hebrew.desktop
deleted file mode 100644
index 33ec62603..000000000
--- a/plugins/hebrew/hebrew.desktop
+++ /dev/null
@@ -1,104 +0,0 @@
-[Desktop Entry]
-X-KDE-Library=korg_hebrew
-Name=Jewish Calendar Plugin
-Name[af]=Joodse kalender inprop module
-Name[ar]=ملحق التّقويم اليهوديّ
-Name[bg]=Приставка за юдейски календар
-Name[br]=Lugent deiziadur yudev
-Name[bs]=Dodatak za Jevrejski Kalendar
-Name[ca]=Connector de calendari jueu
-Name[ca@valencia]=Connector de calendari jueu
-Name[cs]=Modul židovského kalendáře
-Name[da]=Jødisk kalender-plugin
-Name[de]=Modul für jüdischen Kalender
-Name[el]=Πρόσθετο εβραϊκού ημερολογίου
-Name[en_GB]=Jewish Calendar Plugin
-Name[eo]=Kromprogramo por Juda Kalendaro
-Name[es]=Complemento de calendario hebreo
-Name[et]=Juudi kalendri plugin
-Name[eu]=Egutegi juduaren plugina
-Name[fa]=وصله تقویم یهودی
-Name[fi]=Juutalaisen kalenterin laajennus
-Name[fr]=Module de prise en charge du calendrier juif
-Name[fy]=Joadske kalenderplugin
-Name[ga]=Breiseán Féilire Giúdaí
-Name[gl]=Complemento para o calendario xudeu
-Name[he]=תוסף לוח שנה עברי
-Name[hu]=Bővítőmodul a zsidó naptár kezeléséhez
-Name[ia]=Plug-in pro calendario judee
-Name[is]=Gyðinga dagatalsíforrit
-Name[it]=Estensione calendario ebraico
-Name[ka]=ებრაული კალენდრის დამატება
-Name[kk]=Яһуди күнтізбесінің плагині
-Name[km]=កម្មវិធីជំនួយប្រតិទិន Jewish
-Name[ko]=히브리 달력 플러그인
-Name[lt]=Žydų kalendoriaus įskiepis
-Name[lv]=Ebreju kalendāra spraudnis
-Name[mk]=Приклучок за еврејски календар
-Name[mr]=यहूदी दिनदर्शिका प्लगइन
-Name[ms]=PLugin Kalender Yahudi
-Name[nds]=Moduul för jöödschen Kalenner
-Name[ne]=यहूदी क्यालेन्डर प्लगइन
-Name[nl]=Joodse kalenderplug-in
-Name[pl]=Wtyczka kalendarza żydowskiego
-Name[pt_BR]=Plugin do calendário judaico
-Name[ru]=Еврейский календарь
-Name[sa]=यहूदी कैलेंडर प्लगइन
-Name[sk]=Modul Židovského kalendára
-Name[sl]=Vstavek za židovski koledar
-Name[sv]=Insticksprogram för judisk kalender
-Name[ta]=ஜூவிஷ் நாள்காட்டி சொருகுப்பொருள்
-Name[tg]=Тақвимоти яҳудӣ
-Name[tr]=Musevî Takvimi Eklentisi
-Name[ug]=ئىبرانى يىلنامە قىستۇرمىسى
-Name[uk]=Додаток єврейського календаря
-Name[wa]=Tchôke-divins calindrî djwif
-Name[zh_CN]=犹太历插件
-Name[zh_TW]=猶太行事曆外掛程式
-Comment=Shows all dates in KOrganizer also in the Jewish calendar system.
-Comment[ar]=يعرض كلّ التّواريخ في «منظّمك» بنظام التّقويم اليهوديّ.
-Comment[bg]=Показване на всички дати в KOrganizer също и във формат на юдейския календар.
-Comment[bs]=Prikazuje sve datume u KOrganizatoru kao i u Jevrejskom kalendaskom sistemu.
-Comment[ca]=Mostra totes les dates en el KOrganizer també en el sistema del calendari jueu.
-Comment[ca@valencia]=Mostra totes les dates en KOrganizer també en el sistema del calendari jueu.
-Comment[cs]=Zobrazení všech dat v KOrganizeru také v židovském kalendáři.
-Comment[da]=Viser alle datoer i KOrganizer - også i det jødiske kalendersystem.
-Comment[de]=Alle Daten in KOrganizer auch im jüdischen Kalendarium anzeigen.
-Comment[el]=Εμφανίζει στο KOrganizer όλες τις ημερομηνίες και στο εβραϊκό ημερολογιακό σύστημα.
-Comment[en_GB]=Shows all dates in KOrganizer also in the Jewish calendar system.
-Comment[eo]=Montras ĉiujn datojn ankaŭ en la juda kalendarsistemo.
-Comment[es]=Muestra todas las fechas de KOrganizer también en el sistema de calendario hebreo.
-Comment[et]=Näitab KOrganizeris kõiki kuupäevi ka juudi kalendri järgi.
-Comment[eu]=«KOrganizer»ren data guztiak erakusten ditu, baita egutegi sistema juduarena ere.
-Comment[fa]=همه تاریخهای KOrganizer، همچنین سیستم تقویم یهودی را نمایش میدهد.
-Comment[fi]=Näyttää kaikki päivät KOrganizerissa myös juutalaisen kalenterin mukaan.
-Comment[fr]=Affiche toutes les dates de KOrganizer selon le calendrier Juif.
-Comment[gl]=Amosa todas as datas en KOrganizer tamén no sistema de calendario xudeu.
-Comment[he]=הצגת כל התאריך ב־KOrganizer גם בלוח השנה העברי.
-Comment[hu]=A KOrganizer dátumait kiírja a hagyományos zsidó naptár szerint is.
-Comment[ia]=Monstra omne datas in KOrganizer anque in le systema de calendario judee.
-Comment[it]=Mostra tutte le date in KOrganizer anche secondo il calendario ebraico.
-Comment[ka]=KOrganizer-ში ყველა თარიღის ებრაულ კალენდარშიც ჩვენება.
-Comment[kk]=Яһуди күнтізбе күндерін KOrganizer-де көрсететін плагині.
-Comment[km]=បង្ហាញកាលបរិច្ឆេទទាំងអស់នៅក្នុង KOrganizer នៅក្នុងប្រព័ន្ធប្រតិទិន Jewish ផងដែរ ។
-Comment[ko]=KOrganizer의 모든 날짜를 히브리 달력의 날짜로도 표시합니다.
-Comment[lt]=Rodo visas dienas KOrganizer taip pat ir žydų kalendoriaus sistema.
-Comment[lv]=Parāda visus „KOrganizer“ datumus arī ebreju kalendāra sistēmā.
-Comment[mr]=के-ऑर्गनायझर मधील सर्व दिनांक यहूदी दिनदर्शिका पद्धतीने दर्शवितो
-Comment[nds]=Wiest all Daten vun KOrganizer ok in't jöödsche Kalennersysteem.
-Comment[nl]=Toont alle data in KOrganizer ook in het Joodse kalendersysteem.
-Comment[pl]=Pokazuje wszystkie daty w KOrganizerze również w kalendarzu żydowskim.
-Comment[pt_BR]=Mostra todas as datas no KOrganizer também no sistema de calendário judaico.
-Comment[ru]=Показывать все даты по еврейскому календарю.
-Comment[sa]=KOrganizer इत्यस्मिन् सर्वाणि तिथयः यहूदीपञ्चाङ्गव्यवस्थायां अपि दर्शयति ।
-Comment[sk]=Zobrazí všetky dátumy v KOorganizer tiež aj v židovskom kalendári.
-Comment[sl]=Pokaže vse datume v KOrganizerju tudi v židovskem koledarskem sistemu.
-Comment[sv]=Visar också alla datum i Korganizer enligt den judiska kalendern.
-Comment[tr]=K Organizatör’deki tüm tarihleri Musevî takviminde de gösterir
-Comment[uk]=Показує всі дати в korganizer також і в системі єврейського календаря.
-Comment[wa]=Mostere totes les dates dins KOrganizer come e sistinme di calindrî djwif.
-Comment[zh_CN]=在KOrganizer中同时以犹太历系统显示所有日期。
-Comment[zh_TW]=在 KOrganizer 也以猶太曆法顯示所有日期。
-Type=Service
-X-KDE-KOrganizer-HasSettings=true
-X-KDE-PluginInterfaceVersion=2
diff --git a/plugins/hebrew/hebrew.json b/plugins/hebrew/hebrew.json
deleted file mode 100644
index 2382127d2..000000000
--- a/plugins/hebrew/hebrew.json
+++ /dev/null
@@ -1,96 +0,0 @@
-{
- "KPlugin": {
- "Description": "Shows all dates in KOrganizer also in the Jewish calendar system.",
- "Description[ar]": "يعرض كلّ التّواريخ في «منظّمك» بنظام التّقويم اليهوديّ.",
- "Description[bg]": "Показва всички дати в KOrganizer също и в еврейската календарна система.",
- "Description[ca@valencia]": "Mostra totes les dates en KOrganizer també en el sistema del calendari jueu.",
- "Description[ca]": "Mostra totes les dates en el KOrganizer també en el sistema del calendari jueu.",
- "Description[cs]": "Zobrazení všech dat v KOrganizeru také v židovském kalendáři.",
- "Description[de]": "Alle Daten in KOrganizer auch im jüdischen Kalendarium anzeigen.",
- "Description[el]": "Εμφανίζει στο KOrganizer όλες τις ημερομηνίες και στο εβραϊκό ημερολογιακό σύστημα.",
- "Description[en_GB]": "Shows all dates in KOrganizer also in the Jewish calendar system.",
- "Description[eo]": "Montri ĉiujn datojn en KOrganizer ankaŭ en la Juda kalendarsistemo.",
- "Description[es]": "Muestra todas las fechas de KOrganizer también en el sistema de calendario hebreo.",
- "Description[eu]": "«KOrganizer»ren data guztiak erakusten ditu, baita egutegi sistema juduarena ere.",
- "Description[fi]": "Näyttää kaikki päivät KOrganizerissa myös juutalaisen kalenterin mukaan.",
- "Description[fr]": "Affiche toutes les dates dans KOrganizer, y compris dans le système du calendrier juif.",
- "Description[gl]": "Amosa todas as datas en KOrganizer tamén no sistema de calendario xudeu.",
- "Description[he]": "הצגת כל התאריך ב־KOrganizer גם בלוח השנה העברי.",
- "Description[hu]": "A KOrganizer dátumait megjeleníti a hagyományos zsidó naptár szerint is.",
- "Description[ia]": "Monstra omne datas in KOrganizer anque in le systema de calendario judee.",
- "Description[it]": "Mostra tutte le date in KOrganizer anche secondo il calendario ebraico.",
- "Description[ka]": "KOrganizer-ში ყველა თარიღის ებრაულ კალენდარშიც ჩვენება.",
- "Description[ko]": "KOrganizer의 모든 날짜를 히브리 달력의 날짜로도 표시합니다.",
- "Description[lv]": "Parāda visus „KOrganizer“ datumus arī ebreju kalendāra sistēmā.",
- "Description[nl]": "Toont alle data in KOrganizer ook in het Joodse kalendersysteem.",
- "Description[pl]": "Pokazuje wszystkie daty w KOrganizerze także w kalendarzu żydowskim.",
- "Description[pt_BR]": "Mostra todas as datas no KOrganizer também no sistema de calendário judaico.",
- "Description[ru]": "Показывать все даты по еврейскому календарю.",
- "Description[sa]": "KOrganizer इत्यस्मिन् सर्वाणि तिथयः यहूदीपञ्चाङ्गव्यवस्थायां अपि दर्शयति ।",
- "Description[sk]": "Zobrazí všetky dátumy v KOorganizer tiež aj v židovskom kalendári.",
- "Description[sl]": "Pokaže vse datume v KOrganizerju tudi v židovskem koledarskem sistemu.",
- "Description[sv]": "Visar också alla datum i Korganizer enligt den judiska kalendern.",
- "Description[tr]": "K Organizatör’deki tüm tarihleri Musevi takvim sisteminde de gösterir.",
- "Description[uk]": "Показує всі дати в korganizer також і в системі єврейського календаря.",
- "Description[zh_CN]": "在KOrganizer中同时以犹太历系统显示所有日期。",
- "Description[zh_TW]": "在 KOrganizer 也以猶太曆法顯示所有日期。",
- "Name": "Jewish Calendar Plugin",
- "Name[af]": "Joodse kalender inprop module",
- "Name[ar]": "ملحق التّقويم اليهوديّ",
- "Name[bg]": "Приставка за юдейски календар",
- "Name[br]": "Lugent deiziadur yudev",
- "Name[bs]": "Dodatak za Jevrejski Kalendar",
- "Name[ca@valencia]": "Connector de calendari jueu",
- "Name[ca]": "Connector de calendari jueu",
- "Name[cs]": "Modul židovského kalendáře",
- "Name[da]": "Jødisk kalender-plugin",
- "Name[de]": "Modul für jüdischen Kalender",
- "Name[el]": "Πρόσθετο εβραϊκού ημερολογίου",
- "Name[en_GB]": "Jewish Calendar Plugin",
- "Name[eo]": "Kromprogramo por Juda Kalendaro",
- "Name[es]": "Complemento de calendario hebreo",
- "Name[et]": "Juudi kalendri plugin",
- "Name[eu]": "Egutegi judutar plugin-a",
- "Name[fa]": "وصله تقویم یهودی",
- "Name[fi]": "Juutalainen kalenteri -liitännäinen",
- "Name[fr]": "Module de prise en charge du calendrier juif",
- "Name[fy]": "Joadske kalenderplugin",
- "Name[ga]": "Breiseán Féilire Giúdaí",
- "Name[gl]": "Complemento para o calendario xudeu",
- "Name[he]": "תוסף לוח שנה עברי",
- "Name[hu]": "Bővítőmodul a zsidó naptár kezeléséhez",
- "Name[ia]": "Plug-in pro calendario judee",
- "Name[is]": "Gyðinga dagatalsíforrit",
- "Name[it]": "Estensione calendario ebraico",
- "Name[ka]": "ებრაული კალენდრის დამატება",
- "Name[kk]": "Яһуди күнтізбесінің плагині",
- "Name[km]": "កម្មវិធីជំនួយប្រតិទិន Jewish",
- "Name[ko]": "히브리 달력 플러그인",
- "Name[lt]": "Žydų kalendoriaus įskiepis",
- "Name[lv]": "Ebreju kalendāra spraudnis",
- "Name[mk]": "Приклучок за еврејски календар",
- "Name[mr]": "यहूदी दिनदर्शिका प्लगइन",
- "Name[ms]": "PLugin Kalender Yahudi",
- "Name[nds]": "Moduul för jöödschen Kalenner",
- "Name[ne]": "यहूदी क्यालेन्डर प्लगइन",
- "Name[nl]": "Joodse kalenderplug-in",
- "Name[pl]": "Wtyczka kalendarza żydowskiego",
- "Name[pt_BR]": "Plugin do calendário judaico",
- "Name[ro]": "Modul calendar evreiesc",
- "Name[ru]": "Еврейский календарь",
- "Name[sa]": "यहूदी कैलेंडर प्लगइन",
- "Name[sk]": "Modul Židovského kalendára",
- "Name[sl]": "Vstavek za židovski koledar",
- "Name[sv]": "Insticksprogram för judisk kalender",
- "Name[ta]": "ஜூவிஷ் நாள்காட்டி செருகுநிரல்",
- "Name[tg]": "Тақвимоти яҳудӣ",
- "Name[tr]": "Musevi Takvimi Eklentisi",
- "Name[ug]": "ئىبرانى يىلنامە قىستۇرمىسى",
- "Name[uk]": "Додаток єврейського календаря",
- "Name[wa]": "Tchôke-divins calindrî djwif",
- "Name[zh_CN]": "犹太历插件",
- "Name[zh_TW]": "猶太行事曆外掛程式"
- },
- "X-KDE-KOrganizer-HasSettings": true,
- "X-KDE-PluginInterfaceVersion": 2
-}
diff --git a/plugins/hebrew/qcalendarsystem.cpp b/plugins/hebrew/qcalendarsystem.cpp
deleted file mode 100644
index 9b66aaa3f..000000000
--- a/plugins/hebrew/qcalendarsystem.cpp
+++ /dev/null
@@ -1,1208 +0,0 @@
-/*
- This file is part of the kholidays library.
-
- SPDX-FileCopyrightText: 2014 John Layt <[email protected]>
-
- SPDX-License-Identifier: LGPL-2.0-or-later
-*/
-
-#include "qcalendarsystem_p.h"
-
-#include <QDate>
-#include <QSharedData>
-
-class QCalendarSystemPrivate : public QSharedData
-{
-public:
- explicit QCalendarSystemPrivate(QCalendarSystem::CalendarSystem calendar);
-
- QCalendarSystem::CalendarSystem calendarSystem() const;
- qint64 epoch() const;
- qint64 earliestValidDate() const;
- int earliestValidYear() const;
- qint64 latestValidDate() const;
- int latestValidYear() const;
- int yearOffset() const;
- int maxMonthsInYear() const;
- int monthsInYear(int year) const;
- int maxDaysInYear() const;
- int daysInYear(int year) const;
- int maxDaysInMonth() const;
- int daysInMonth(int year, int month) const;
- bool hasYearZero() const;
- bool hasLeapMonths() const;
-
- int quarter(int month) const;
- bool isLeapYear(int year) const;
- void julianDayToDate(qint64 jd, int *year, int *month, int *day) const;
- qint64 julianDayFromDate(int year, int month, int day) const;
-
- bool isValidYear(int year) const;
- bool isValidMonth(int year, int month) const;
- int addYears(int y1, int years) const;
- int diffYears(int y1, int y2) const;
-
- QCalendarSystem::CalendarSystem m_calendarSystem;
-};
-
-static const char julianMonths[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-QCalendarSystemPrivate::QCalendarSystemPrivate(QCalendarSystem::CalendarSystem calendar)
- : QSharedData()
- , m_calendarSystem(calendar)
-{
-}
-
-QCalendarSystem::CalendarSystem QCalendarSystemPrivate::calendarSystem() const
-{
- if (m_calendarSystem == QCalendarSystem::DefaultCalendar) {
- return QCalendarSystem::GregorianCalendar;
- } else {
- return m_calendarSystem;
- }
-}
-
-qint64 QCalendarSystemPrivate::epoch() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- return 1721426; // 0001-01-01 Gregorian
- case QCalendarSystem::CopticCalendar:
- return 1825030; // 0001-01-01 == 0284-08-29 Gregorian
- case QCalendarSystem::EthiopicCalendar:
- return 1724221; // 0001-01-01 == 0008-08-29 Gregorian
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return -284655; // 0001-01-01 == -5492-08-29 Gregorian
- case QCalendarSystem::IndianNationalCalendar:
- return 1749994; // 0000-01-01 == 0078-03-22 Gregorian
- case QCalendarSystem::IslamicCivilCalendar:
- return 1948440; // 0001-01-01 == 0622-07-19 Gregorian
- case QCalendarSystem::ISO8601Calendar:
- return 1721060; // 0000-01-01 Gregorian
- case QCalendarSystem::JapaneseCalendar:
- return 1721426; // 0001-01-01 Gregorian
- case QCalendarSystem::JulianCalendar:
- return 1721424; // 0001-01-01 == Gregorian
- case QCalendarSystem::ROCCalendar:
- return 2419403; // 0001-01-01 == 1912-01-01 Gregorian
- case QCalendarSystem::ThaiCalendar:
- return 1522734; // 0000-01-01 == -0544-01-01 Gregorian
- default:
- return 0;
- }
-}
-
-qint64 QCalendarSystemPrivate::earliestValidDate() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- return -31738; // -4800-01-01 Gregorian
- case QCalendarSystem::CopticCalendar:
- return 1825030; // 0001-01-01 == 0284-08-29 Gregorian
- case QCalendarSystem::EthiopicCalendar:
- return 1724221; // 0001-01-01 == 0008-08-29 Gregorian
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return -284655; // 0001-01-01 == -5492-08-29 Gregorian
- case QCalendarSystem::IndianNationalCalendar:
- return 1749994; // 0000-01-01 == 0078-03-22 Gregorian
- case QCalendarSystem::IslamicCivilCalendar:
- return 1948440; // 0001-01-01 == 0622-07-19 Gregorian
- case QCalendarSystem::ISO8601Calendar:
- return 1721060; // 0000-01-01 Gregorian
- case QCalendarSystem::JapaneseCalendar:
- return -31738; // -4800-01-01 Gregorian
- case QCalendarSystem::JulianCalendar:
- return -31776; // -4800-01-01 Julian
- case QCalendarSystem::ROCCalendar:
- return 2419403; // 0001-01-01 == 1912-01-01 Gregorian
- case QCalendarSystem::ThaiCalendar:
- return 1522734; // 0000-01-01 == -0544-01-01 Gregorian
- default:
- return 0;
- }
-}
-
-int QCalendarSystemPrivate::earliestValidYear() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- case QCalendarSystem::JapaneseCalendar:
- case QCalendarSystem::JulianCalendar:
- return -4800;
- case QCalendarSystem::IndianNationalCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::ThaiCalendar:
- return 0;
- default:
- return 1;
- }
-}
-
-qint64 QCalendarSystemPrivate::latestValidDate() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- return 5373484; // 9999-12-31 Gregorian
- case QCalendarSystem::CopticCalendar:
- return 5477164; // 9999-13-05 == 10283-11-12 Gregorian
- case QCalendarSystem::EthiopicCalendar:
- return 5376721; // 9999-13-05 == 10008-11-10 Gregorian
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return 3367114; // 9999-13-05 == 4506-09-29 Gregorian
- case QCalendarSystem::IndianNationalCalendar:
- return 5402054; // 9999-12-30 == 10078-03-21 Gregorian
- case QCalendarSystem::IslamicCivilCalendar:
- return 5491751; // 9999-12-29 == 10323-10-21 Gregorian
- case QCalendarSystem::ISO8601Calendar:
- return 5373484; // 9999-12-31 Gregorian
- case QCalendarSystem::JapaneseCalendar:
- return 5373484; // 9999-12-31 Gregorian
- case QCalendarSystem::JulianCalendar:
- return 5373557; // 9999-12-31 == 10000-03-13 Gregorian
- case QCalendarSystem::ROCCalendar:
- return 6071462; // 9999-12-31 == 11910-12-31 Gregorian
- case QCalendarSystem::ThaiCalendar:
- return 5175158; // 9999-12-31 == 9456-12-31 Gregorian
- default:
- return 0;
- }
-}
-
-int QCalendarSystemPrivate::latestValidYear() const
-{
- switch (calendarSystem()) {
- default:
- return 9999;
- }
-}
-
-int QCalendarSystemPrivate::yearOffset() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::ROCCalendar:
- return 1911; // 0001-01-01 == 1912-01-01 Gregorian
- case QCalendarSystem::ThaiCalendar:
- return -543; // 0000-01-01 == -544-01-01 Gregorian
- default:
- return 0;
- }
-}
-
-int QCalendarSystemPrivate::maxMonthsInYear() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return 13;
- default:
- return 12;
- }
-}
-
-int QCalendarSystemPrivate::monthsInYear(int year) const
-{
- // year = year + yearOffset();
- Q_UNUSED(year)
-
- switch (calendarSystem()) {
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return 13;
- default:
- return 12;
- }
-}
-
-int QCalendarSystemPrivate::maxDaysInYear() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::IslamicCivilCalendar:
- return 355;
- default:
- return 366;
- }
-}
-
-int QCalendarSystemPrivate::daysInYear(int year) const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::IslamicCivilCalendar:
- return isLeapYear(year) ? 355 : 354;
- default:
- return isLeapYear(year) ? 366 : 365;
- }
-}
-
-int QCalendarSystemPrivate::maxDaysInMonth() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- case QCalendarSystem::IslamicCivilCalendar:
- return 30;
- default:
- return 31;
- }
-}
-
-int QCalendarSystemPrivate::daysInMonth(int year, int month) const
-{
- if (month < 1 || month > monthsInYear(year)) {
- return 0;
- }
-
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::JapaneseCalendar:
- case QCalendarSystem::ROCCalendar:
- case QCalendarSystem::ThaiCalendar:
- case QCalendarSystem::JulianCalendar:
- if (month == 2 && isLeapYear(year)) {
- return 29;
- } else {
- return julianMonths[month];
- }
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- if (month == 13) {
- return isLeapYear(year) ? 6 : 5;
- } else {
- return 30;
- }
- case QCalendarSystem::IndianNationalCalendar:
- if (month >= 7) {
- return 30;
- } else if (month >= 2) {
- return 31;
- } else if (isLeapYear(year)) {
- return 31;
- } else {
- return 30;
- }
- case QCalendarSystem::IslamicCivilCalendar:
- if (month == 12 && isLeapYear(year)) {
- return 30;
- } else if (month % 2 == 0) {
- return 29;
- } else {
- return 30;
- }
- default:
- return 0;
- }
-}
-
-bool QCalendarSystemPrivate::hasYearZero() const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::IndianNationalCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::ThaiCalendar:
- return true;
- default:
- return false;
- }
-}
-
-bool QCalendarSystemPrivate::hasLeapMonths() const
-{
- switch (calendarSystem()) {
- default:
- return false;
- }
-}
-
-int QCalendarSystemPrivate::quarter(int month) const
-{
- switch (calendarSystem()) {
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- if (month == 13) { // Consider the short epagomenal month as part of the 4th quarter
- return 4;
- }
- [[fallthrough]];
- default:
- return ((month - 1) / 3) + 1;
- }
-}
-
-bool QCalendarSystemPrivate::isLeapYear(int year) const
-{
- year = year + yearOffset();
-
- // Uses same rule as Gregorian and in same years as Gregorian to keep in sync
- // Can't use yearOffset() as this offset only applies for isLeapYear()
- if (calendarSystem() == QCalendarSystem::IndianNationalCalendar) {
- year = year + 78;
- }
-
- if (year < 1 && !hasYearZero()) {
- ++year;
- }
-
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- case QCalendarSystem::IndianNationalCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::JapaneseCalendar:
- case QCalendarSystem::ROCCalendar:
- case QCalendarSystem::ThaiCalendar:
- return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- return year % 4 == 3;
- case QCalendarSystem::JulianCalendar:
- return year % 4 == 0;
- case QCalendarSystem::IslamicCivilCalendar:
- return (((11 * year) + 14) % 30) < 11;
- default:
- return false;
- }
-}
-
-void QCalendarSystemPrivate::julianDayToDate(qint64 jd, int *year, int *month, int *day) const
-{
- int yy = 0, mm = 0, dd = 0;
-
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::JapaneseCalendar:
- case QCalendarSystem::ROCCalendar:
- case QCalendarSystem::ThaiCalendar: {
- // Formula from The Calendar FAQ by Claus Tondering
- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
- qint64 a = jd + 32044;
- qint64 b = ((4 * a) + 3) / 146097;
- qint64 c = a - ((146097 * b) / 4);
- qint64 d = ((4 * c) + 3) / 1461;
- qint64 e = c - ((1461 * d) / 4);
- qint64 m = ((5 * e) + 2) / 153;
- dd = e - (((153 * m) + 2) / 5) + 1;
- mm = m + 3 - (12 * (m / 10));
- yy = (100 * b) + d - 4800 + (m / 10);
- break;
- }
-
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar: {
- // Formula derived from first principles by John Layt
- qint64 s = jd - (epoch() - 365);
- qint64 l = s / 1461;
- yy = (l * 4) + qMin(static_cast<qint64>(3), (s % 1461) / 365);
- qint64 diy = s - (yy * 365) + (yy / 4);
- mm = (diy / 30) + 1;
- dd = (diy % 30) + 1;
- break;
- }
-
- case QCalendarSystem::IndianNationalCalendar: {
- // Formula from the "Explanatory Supplement to the Astronomical Almanac"
- // Revised Edition 2006 section 12.94 pp 605-606, US Naval Observatory
- // Originally from the "Report of the Calendar Reform Committee" 1955, Indian Government
- qint64 l = jd + 68518;
- qint64 n = (4 * l) / 146097;
- l = l - (146097 * n + 3) / 4;
- qint64 i = (4000 * (l + 1)) / 1461001;
- l = l - (1461 * i) / 4 + 1;
- qint64 j = ((l - 1) / 31) * (1 - l / 185) + (l / 185) * ((l - 156) / 30 + 5) - l / 366;
- dd = l - 31 * j + ((j + 2) / 8) * (j - 5);
- l = j / 11;
- mm = j + 2 - 12 * l;
- yy = 100 * (n - 49) + l + i - 78;
- break;
- }
-
- case QCalendarSystem::IslamicCivilCalendar: {
- // Formula from the "Explanatory Supplement to the Astronomical Almanac"
- // Revised Edition 2006 section ??? pp ???, US Naval Observatory
- // Derived from Fliegel & Van Flandern 1968
- qint64 l = jd - epoch() + 10632;
- qint64 n = (l - 1) / 10631;
- l = l - 10631 * n + 354;
- int j = ((10985 - l) / 5316) * ((50 * l) / 17719) + (l / 5670) * ((43 * l) / 15238);
- l = l - ((30 - j) / 15) * ((17719 * j) / 50) - (j / 16) * ((15238 * j) / 43) + 29;
- yy = (30 * n) + j - 30;
- mm = (24 * l) / 709;
- dd = l - ((709 * mm) / 24);
- break;
- }
-
- case QCalendarSystem::JulianCalendar: {
- // Formula from The Calendar FAQ by Claus Tondering
- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
- qint64 b = 0;
- qint64 c = jd + 32082;
- qint64 d = ((4 * c) + 3) / 1461;
- qint64 e = c - ((1461 * d) / 4);
- qint64 m = ((5 * e) + 2) / 153;
- dd = e - (((153 * m) + 2) / 5) + 1;
- mm = m + 3 - (12 * (m / 10));
- yy = (100 * b) + d - 4800 + (m / 10);
- break;
- }
-
- default:
- break;
- }
-
- if (!hasYearZero() && yy < 1) {
- yy -= 1;
- }
-
- yy = yy - yearOffset();
-
- if (year) {
- *year = yy;
- }
- if (month) {
- *month = mm;
- }
- if (day) {
- *day = dd;
- }
-}
-
-qint64 QCalendarSystemPrivate::julianDayFromDate(int year, int month, int day) const
-{
- qint64 jd = 0;
-
- year = year + yearOffset();
-
- if (year < 1 && !hasYearZero()) {
- year = year + 1;
- }
-
- switch (calendarSystem()) {
- case QCalendarSystem::GregorianCalendar:
- case QCalendarSystem::ISO8601Calendar:
- case QCalendarSystem::JapaneseCalendar:
- case QCalendarSystem::ROCCalendar:
- case QCalendarSystem::ThaiCalendar: {
- // Formula from The Calendar FAQ by Claus Tondering
- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
- int a = (14 - month) / 12;
- year = year + 4800 - a;
- int m = month + (12 * a) - 3;
- jd = day + (((153 * m) + 2) / 5) + (365 * year) + (year / 4) - (year / 100) + (year / 400) - 32045;
- break;
- }
-
- case QCalendarSystem::CopticCalendar:
- case QCalendarSystem::EthiopicCalendar:
- case QCalendarSystem::EthiopicAmeteAlemCalendar:
- // Formula derived from first principles by John Layt
- jd = epoch() - 1 + ((year - 1) * 365) + (year / 4) + ((month - 1) * 30) + day;
- break;
-
- case QCalendarSystem::IndianNationalCalendar:
- // Formula from the "Explanatory Supplement to the Astronomical Almanac"
- // Revised Edition 2006 section 12.94 pp 605-606, US Naval Observatory
- // Originally from the "Report of the Calendar Reform Committee" 1955, Indian Government
- jd = 365 * year + (year + 78 - 1 / month) / 4 + 31 * month - (month + 9) / 11 - (month / 7) * (month - 7)
- - (3 * ((year + 78 - 1 / month) / 100 + 1)) / 4 + day + 1749579;
- break;
-
- case QCalendarSystem::IslamicCivilCalendar:
- // Formula from the "Explanatory Supplement to the Astronomical Almanac"
- // Revised Edition 2006 section ??? pp ???, US Naval Observatory
- // Derived from Fliegel & Van Flandern 1968
- jd = (3 + (11 * year)) / 30 + 354 * year + 30 * month - (month - 1) / 2 + day + epoch() - 385;
- break;
-
- case QCalendarSystem::JulianCalendar: {
- // Formula from The Calendar FAQ by Claus Tondering
- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
- int a = (14 - month) / 12;
- year = year + 4800 - a;
- int m = month + (12 * a) - 3;
- jd = day + (((153 * m) + 2) / 5) + (365 * year) + (year / 4) - 32083;
- break;
- }
-
- default:
- break;
- }
-
- return jd;
-}
-
-// Some private utility rules
-
-bool QCalendarSystemPrivate::isValidYear(int year) const
-{
- return year >= earliestValidYear() && year <= latestValidYear() && (year == 0 ? hasYearZero() : true);
-}
-
-bool QCalendarSystemPrivate::isValidMonth(int year, int month) const
-{
- return isValidYear(year) && month >= 1 && month <= monthsInYear(year);
-}
-
-int QCalendarSystemPrivate::addYears(int y1, int years) const
-{
- int y2 = y1 + years;
-
- if (!hasYearZero()) {
- if (y1 > 0 && y2 <= 0) {
- --y2;
- } else if (y1 < 0 && y2 >= 0) {
- ++y2;
- }
- }
-
- return y2;
-}
-
-int QCalendarSystemPrivate::diffYears(int y1, int y2) const
-{
- int dy = y2 - y1;
-
- if (!hasYearZero()) {
- if (y2 > 0 && y1 < 0) {
- dy -= 1;
- } else if (y2 < 0 && y1 > 0) {
- dy += 1;
- }
- }
-
- return dy;
-}
-
-// QCalendarSystem public api
-
-QCalendarSystem::QCalendarSystem(QCalendarSystem::CalendarSystem calendar)
- : d(new QCalendarSystemPrivate(calendar))
-{
-}
-
-QCalendarSystem::~QCalendarSystem()
-{
-}
-
-QCalendarSystem &QCalendarSystem::operator=(const QCalendarSystem &other)
-{
- d = other.d;
- return *this;
-}
-
-QCalendarSystem::CalendarSystem QCalendarSystem::calendarSystem() const
-{
- return d->calendarSystem();
-}
-
-QDate QCalendarSystem::epoch() const
-{
- return QDate::fromJulianDay(d->epoch());
-}
-
-QDate QCalendarSystem::earliestValidDate() const
-{
- return QDate::fromJulianDay(d->earliestValidDate());
-}
-
-QDate QCalendarSystem::latestValidDate() const
-{
- return QDate::fromJulianDay(d->latestValidDate());
-}
-
-int QCalendarSystem::maximumMonthsInYear() const
-{
- return d->maxMonthsInYear();
-}
-
-int QCalendarSystem::maximumDaysInYear() const
-{
- return d->maxDaysInYear();
-}
-
-int QCalendarSystem::maximumDaysInMonth() const
-{
- return d->maxDaysInMonth();
-}
-
-bool QCalendarSystem::isValid(const QDate &date) const
-{
- return date.isValid() && date >= earliestValidDate() && date <= latestValidDate();
-}
-
-bool QCalendarSystem::isValid(int year, int month, int day) const
-{
- return d->isValidMonth(year, month) && day >= 1 && day <= d->daysInMonth(year, month);
-}
-
-bool QCalendarSystem::isValid(int year, int dayOfYear) const
-{
- return d->isValidYear(year) && dayOfYear > 0 && dayOfYear <= d->daysInYear(year);
-}
-
-QDate QCalendarSystem::date(int year, int month, int day) const
-{
- if (isValid(year, month, day)) {
- return QDate::fromJulianDay(d->julianDayFromDate(year, month, day));
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::date(int year, int dayOfYear) const
-{
- if (isValid(year, dayOfYear)) {
- return QDate::fromJulianDay(d->julianDayFromDate(year, 1, 1) + dayOfYear - 1);
- } else {
- return QDate();
- }
-}
-
-void QCalendarSystem::getDate(const QDate &date, int *year, int *month, int *day) const
-{
- int yy = 0;
- int mm = 0;
- int dd = 0;
-
- if (isValid(date)) {
- d->julianDayToDate(date.toJulianDay(), &yy, &mm, &dd);
- }
-
- if (year) {
- *year = yy;
- }
- if (month) {
- *month = mm;
- }
- if (day) {
- *day = dd;
- }
-}
-
-int QCalendarSystem::year(const QDate &date) const
-{
- int y = 0;
-
- if (isValid(date)) {
- d->julianDayToDate(date.toJulianDay(), &y, nullptr, nullptr);
- }
-
- return y;
-}
-
-int QCalendarSystem::month(const QDate &date) const
-{
- int m = 0;
-
- if (isValid(date)) {
- d->julianDayToDate(date.toJulianDay(), nullptr, &m, nullptr);
- }
-
- return m;
-}
-
-int QCalendarSystem::day(const QDate &date) const
-{
- int dd = 0;
-
- if (isValid(date)) {
- d->julianDayToDate(date.toJulianDay(), nullptr, nullptr, &dd);
- }
-
- return dd;
-}
-
-int QCalendarSystem::quarter(const QDate &date) const
-{
- if (isValid(date)) {
- int tmpMonth;
- d->julianDayToDate(date.toJulianDay(), nullptr, &tmpMonth, nullptr);
- return d->quarter(tmpMonth);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::quarter(int year, int month, int day) const
-{
- if (isValid(year, month, day)) {
- return d->quarter(month);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::dayOfYear(const QDate &date) const
-{
- if (isValid(date)) {
- return date.toJulianDay() - firstDayOfYear(date).toJulianDay() + 1;
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::dayOfYear(int year, int month, int day) const
-{
- return dayOfYear(date(year, month, day));
-}
-
-int QCalendarSystem::dayOfWeek(const QDate &date) const
-{
- // jd 0 = Monday = weekday 1. We've never skipped weekdays.
- if (isValid(date)) {
- if (date.toJulianDay() >= 0) {
- return (date.toJulianDay() % daysInWeek()) + 1;
- } else {
- return ((date.toJulianDay() + 1) % daysInWeek()) + daysInWeek();
- }
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::dayOfWeek(int year, int month, int day) const
-{
- return dayOfWeek(date(year, month, day));
-}
-
-// TODO These are ISO weeks, may need to localise
-int QCalendarSystem::weekNumber(const QDate &date, int *yearNum) const
-{
- if (isValid(date)) {
- int tmpYear, tmpMonth, tmpDay;
- d->julianDayToDate(date.toJulianDay(), &tmpYear, &tmpMonth, &tmpDay);
- return weekNumber(tmpYear, tmpMonth, tmpDay, yearNum);
- } else {
- return 0;
- }
-}
-
-/*
- \legalese
- Copyright (c) 1989 The Regents of the University of California.
- All rights reserved.
-
- Redistribution and use in source and binary forms are permitted
- provided that the above copyright notice and this paragraph are
- duplicated in all such forms and that any documentation,
- advertising materials, and other materials related to such
- distribution and use acknowledge that the software was developed
- by the University of California, Berkeley. The name of the
- University may not be used to endorse or promote products derived
- from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-*/
-// TODO These are ISO weeks, may need to localise
-// TODO Replace with cleanly licensed routine
-int QCalendarSystem::weekNumber(int year, int month, int day, int *yearNum) const
-{
- if (!isValid(year, month, day)) {
- if (yearNum) {
- *yearNum = 0;
- }
- return 0;
- }
-
- int yday = dayOfYear(year, month, day) - 1;
- int wday = dayOfWeek(year, month, day);
- if (wday == 7) {
- wday = 0;
- }
- int w;
-
- for (;;) {
- int len, bot, top;
-
- len = d->daysInYear(year);
- /*
- ** What yday (-3 ... 3) does
- ** the ISO year begin on?
- */
- bot = ((yday + 11 - wday) % 7) - 3;
- /*
- ** What yday does the NEXT
- ** ISO year begin on?
- */
- top = bot - (len % 7);
- if (top < -3) {
- top += 7;
- }
- top += len;
- if (yday >= top) {
- ++year;
- w = 1;
- break;
- }
- if (yday >= bot) {
- w = 1 + ((yday - bot) / 7);
- break;
- }
- --year;
- yday += d->daysInYear(year);
- }
-
- if (yearNum) {
- *yearNum = year;
- }
-
- return w;
-}
-
-int QCalendarSystem::monthsInYear(const QDate &date) const
-{
- if (isValid(date)) {
- return d->monthsInYear(year(date));
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::monthsInYear(int year) const
-{
- if (d->isValidYear(year)) {
- return d->monthsInYear(year);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::weeksInYear(const QDate &date) const
-{
- if (isValid(date)) {
- return weeksInYear(year(date));
- } else {
- return 0;
- }
-}
-
-// TODO This is ISO weeks, may need to localise
-int QCalendarSystem::weeksInYear(int year) const
-{
- if (d->isValidYear(year)) {
- int weekYear = year;
- int lastWeek = weekNumber(lastDayOfYear(year), &weekYear);
- if (lastWeek < 1 || weekYear != year) {
- lastWeek = weekNumber(addDays(lastDayOfYear(year), -7), &weekYear);
- }
- return lastWeek;
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::daysInYear(const QDate &date) const
-{
- if (isValid(date)) {
- return d->daysInYear(year(date));
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::daysInYear(int year) const
-{
- if (d->isValidYear(year)) {
- return d->daysInYear(year);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::daysInMonth(const QDate &date) const
-{
- if (isValid(date)) {
- int tmpYear, tmpMonth;
- d->julianDayToDate(date.toJulianDay(), &tmpYear, &tmpMonth, nullptr);
- return d->daysInMonth(tmpYear, tmpMonth);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::daysInMonth(int year, int month) const
-{
- if (d->isValidMonth(year, month)) {
- return d->daysInMonth(year, month);
- } else {
- return 0;
- }
-}
-
-int QCalendarSystem::daysInWeek() const
-{
- return 7;
-}
-
-bool QCalendarSystem::isLeapYear(const QDate &date) const
-{
- if (isValid(date)) {
- return d->isLeapYear(year(date));
- } else {
- return false;
- }
-}
-
-bool QCalendarSystem::isLeapYear(int year) const
-{
- if (d->isValidYear(year)) {
- return d->isLeapYear(year);
- } else {
- return false;
- }
-}
-
-QDate QCalendarSystem::addYears(const QDate &dt, int years) const
-{
- if (isValid(dt)) {
- int tmpYear, tmpMonth, tmpDay;
- d->julianDayToDate(dt.toJulianDay(), &tmpYear, &tmpMonth, &tmpDay);
- tmpYear = d->addYears(tmpYear, years);
- tmpMonth = qMin(tmpMonth, d->monthsInYear(tmpYear));
- return date(tmpYear, tmpMonth, qMin(tmpDay, d->daysInMonth(tmpYear, tmpMonth)));
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::addMonths(const QDate &dt, int months) const
-{
- if (isValid(dt)) {
- int tmpYear, tmpMonth, tmpDay;
- d->julianDayToDate(dt.toJulianDay(), &tmpYear, &tmpMonth, &tmpDay);
- while (months != 0) {
- if (months < 0) {
- if (tmpMonth + months >= 1) {
- tmpMonth += months;
- months = 0;
- } else {
- tmpYear = d->addYears(tmpYear, -1);
- months += d->monthsInYear(tmpYear);
- }
- } else {
- int miy = d->monthsInYear(tmpYear);
- if (tmpMonth + months <= miy) {
- tmpMonth += months;
- months = 0;
- } else {
- tmpYear = d->addYears(tmpYear, 1);
- months -= miy;
- }
- }
- }
- return date(tmpYear, tmpMonth, qMin(tmpDay, d->daysInMonth(tmpYear, tmpMonth)));
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::addDays(const QDate &date, int days) const
-{
- return date.addDays(days);
-}
-
-// Caters for Leap Months, but possibly not for Hebrew
-int QCalendarSystem::yearsDifference(const QDate &fromDate, const QDate &toDate) const
-{
- if (!isValid(fromDate) || !isValid(toDate) || toDate == fromDate) {
- return 0;
- }
-
- if (toDate < fromDate) {
- return -yearsDifference(toDate, fromDate);
- }
-
- int y1, m1, d1, y2, m2, d2;
- d->julianDayToDate(fromDate.toJulianDay(), &y1, &m1, &d1);
- d->julianDayToDate(toDate.toJulianDay(), &y2, &m2, &d2);
-
- if (y2 == y1) {
- return 0;
- }
-
- if (m2 > m1) {
- return d->diffYears(y1, y2);
- }
-
- if (m2 < m1) {
- return d->diffYears(y1, y2) - 1;
- }
-
- // m2 == m1
- // Allow for last day of month to last day of month and leap days
- // e.g. 2000-02-29 to 2001-02-28 is 1 year not 0 years
- if ((d2 >= d1) || (d1 == d->daysInMonth(y1, m1) && d2 == d->daysInMonth(y2, m2))) {
- return d->diffYears(y1, y2);
- } else {
- return d->diffYears(y1, y2) - 1;
- }
-}
-
-// Caters for Leap Months, but possibly not for Hebrew
-int QCalendarSystem::monthsDifference(const QDate &fromDate, const QDate &toDate) const
-{
- if (!isValid(fromDate) || !isValid(toDate) || toDate == fromDate) {
- return 0;
- }
-
- if (toDate < fromDate) {
- return -monthsDifference(toDate, fromDate);
- }
-
- int y1, m1, d1, y2, m2, d2, my;
- d->julianDayToDate(fromDate.toJulianDay(), &y1, &m1, &d1);
- d->julianDayToDate(toDate.toJulianDay(), &y2, &m2, &d2);
-
- // Calculate number of months in full years preceding y2
- if (y2 == y1) {
- my = 0;
- } else if (d->hasLeapMonths()) { /* cppcheck-suppress knownConditionTrueFalse */
- my = 0;
- for (int y = y1; y < y2; y = d->addYears(y, 1)) {
- my = my + monthsInYear(y);
- }
- } else {
- my = d->diffYears(y1, y2) * monthsInYear(y2);
- }
-
- // Allow for last day of month to last day of month and leap days
- // e.g. 2010-03-31 to 2010-04-30 is 1 month not 0 months
- // also 2000-02-29 to 2001-02-28 is 12 months not 11 months
- if ((d2 >= d1) || (d1 == d->daysInMonth(y1, m1) && d2 == d->daysInMonth(y2, m2))) {
- return my + m2 - m1;
- } else {
- return my + m2 - m1 - 1;
- }
-}
-
-qint64 QCalendarSystem::daysDifference(const QDate &fromDate, const QDate &toDate) const
-{
- if (isValid(fromDate) && isValid(toDate)) {
- return toDate.toJulianDay() - fromDate.toJulianDay();
- } else {
- return 0;
- }
-}
-
-// Caters for Leap Months, but possibly not for Hebrew
-void QCalendarSystem::dateDifference(const QDate &fromDate, const QDate &toDate, int *years, int *months, int *days, int *direction) const
-{
- int dy = 0;
- int dm = 0;
- int dd = 0;
- int dir = 1;
-
- if (isValid(fromDate) && isValid(toDate) && fromDate != toDate) {
- if (toDate < fromDate) {
- dateDifference(toDate, fromDate, &dy, &dm, &dd, nullptr);
- dir = -1;
- } else {
- int y1, m1, d1, y2, m2, d2;
- d->julianDayToDate(fromDate.toJulianDay(), &y1, &m1, &d1);
- d->julianDayToDate(toDate.toJulianDay(), &y2, &m2, &d2);
-
- dy = yearsDifference(fromDate, toDate);
-
- // Calculate months and days difference
- int miy0 = d->monthsInYear(d->addYears(y2, -1));
- if (d2 >= d1) {
- dm = (miy0 + m2 - m1) % miy0;
- dd = d2 - d1;
- } else { // d2 < d1
- // Allow for last day of month to last day of month and leap days
- // e.g. 2010-03-31 to 2010-04-30 is 1 month
- // 2000-02-29 to 2001-02-28 is 1 year
- // 2000-02-29 to 2001-03-01 is 1 year 1 day
- int dim0 = daysInMonth(addMonths(toDate, -1));
- int dim1 = d->daysInMonth(y1, m1);
- if (d1 == dim1 && d2 == d->daysInMonth(y2, m2)) {
- dm = (miy0 + m2 - m1) % miy0;
- dd = 0;
- } else if (month(addMonths(toDate, -1)) == m1 && dim0 < dim1) {
- // Special case where fromDate = leap day and toDate in month following but non-leap year
- // e.g. 2000-02-29 to 2001-03-01 needs to use 29 to calculate day number not 28
- dm = (miy0 + m2 - m1 - 1) % miy0;
- dd = (dim1 + d2 - d1) % dim1;
- } else {
- dm = (miy0 + m2 - m1 - 1) % miy0;
- dd = (dim0 + d2 - d1) % dim0;
- }
- }
- }
- }
-
- if (years) {
- *years = dy;
- }
- if (months) {
- *months = dm;
- }
- if (days) {
- *days = dd;
- }
- if (direction) {
- *direction = dir;
- }
-}
-
-QDate QCalendarSystem::firstDayOfYear(const QDate &dt) const
-{
- if (isValid(dt)) {
- return date(year(dt), 1, 1);
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::firstDayOfYear(int year) const
-{
- return date(year, 1, 1);
-}
-
-QDate QCalendarSystem::lastDayOfYear(const QDate &dt) const
-{
- if (isValid(dt)) {
- int y = year(dt);
- return date(y, d->daysInYear(y));
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::lastDayOfYear(int year) const
-{
- if (d->isValidYear(year)) {
- return date(year, d->daysInYear(year));
- } else {
- return QDate();
- }
-}
-
-QDate QCalendarSystem::firstDayOfMonth(const QDate &dt) const
-{
- int tmpYear, tmpMonth;
- getDate(dt, &tmpYear, &tmpMonth, nullptr);
- return date(tmpYear, tmpMonth, 1);
-}
-
-QDate QCalendarSystem::firstDayOfMonth(int year, int month) const
-{
- return date(year, month, 1);
-}
-
-QDate QCalendarSystem::lastDayOfMonth(const QDate &dt) const
-{
- int tmpYear, tmpMonth;
- getDate(dt, &tmpYear, &tmpMonth, nullptr);
- return date(tmpYear, tmpMonth, daysInMonth(tmpYear, tmpMonth));
-}
-
-QDate QCalendarSystem::lastDayOfMonth(int year, int month) const
-{
- return date(year, month, daysInMonth(year, month));
-}
diff --git a/plugins/hebrew/qcalendarsystem_p.h b/plugins/hebrew/qcalendarsystem_p.h
deleted file mode 100644
index faab54133..000000000
--- a/plugins/hebrew/qcalendarsystem_p.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- This file is part of the kholidays library.
-
- SPDX-FileCopyrightText: 2014 John Layt <[email protected]>
-
- SPDX-License-Identifier: LGPL-2.0-or-later
-*/
-
-#pragma once
-
-#include <QDate>
-#include <QSharedPointer>
-
-class QCalendarSystemPrivate;
-
-class QCalendarSystem
-{
-public:
- enum CalendarSystem {
- DefaultCalendar = 0,
- GregorianCalendar = 1,
- ChineseCalendar = 2,
- CopticCalendar = 3,
- EthiopicCalendar = 4,
- EthiopicAmeteAlemCalendar = 5,
- HebrewCalendar = 6,
- IndianNationalCalendar = 7,
- IslamicCalendar = 8,
- IslamicCivilCalendar = 9,
- ISO8601Calendar = 10,
- JapaneseCalendar = 11,
- JulianCalendar = 12,
- PersianCalendar = 13,
- ROCCalendar = 14,
- ThaiCalendar = 15,
- LastCalendar = ThaiCalendar,
- };
-
- explicit QCalendarSystem(QCalendarSystem::CalendarSystem calendar = QCalendarSystem::DefaultCalendar);
- ~QCalendarSystem();
-
- QCalendarSystem &operator=(const QCalendarSystem &other);
-
- QCalendarSystem::CalendarSystem calendarSystem() const;
-
- QDate epoch() const;
- QDate earliestValidDate() const;
- QDate latestValidDate() const;
- int maximumMonthsInYear() const;
- int maximumDaysInYear() const;
- int maximumDaysInMonth() const;
-
- bool isValid(const QDate &date) const;
- bool isValid(int year, int month, int day) const;
- bool isValid(int year, int dayOfYear) const;
-
- QDate date(int year, int month, int day) const;
- QDate date(int year, int dayOfYear) const;
-
- void getDate(const QDate &date, int *year, int *month, int *day) const;
-
- int year(const QDate &date) const;
- int month(const QDate &date) const;
- int day(const QDate &date) const;
-
- int quarter(const QDate &date) const;
- int quarter(int year, int month, int day) const;
-
- int dayOfYear(const QDate &date) const;
- int dayOfYear(int year, int month, int day) const;
-
- int dayOfWeek(const QDate &date) const;
- int dayOfWeek(int year, int month, int day) const;
-
- int weekNumber(const QDate &date, int *yearNum = nullptr) const;
- int weekNumber(int year, int month, int day, int *yearNum = nullptr) const;
-
- int monthsInYear(const QDate &date) const;
- int monthsInYear(int year) const;
-
- int weeksInYear(const QDate &date) const;
- int weeksInYear(int year) const;
-
- int daysInYear(const QDate &date) const;
- int daysInYear(int year) const;
-
- int daysInMonth(const QDate &date) const;
- int daysInMonth(int year, int month) const;
-
- int daysInWeek() const;
-
- bool isLeapYear(const QDate &date) const;
- bool isLeapYear(int year) const;
-
- QDate addYears(const QDate &date, int years) const;
- QDate addMonths(const QDate &date, int months) const;
- QDate addDays(const QDate &date, int days) const;
-
- int yearsDifference(const QDate &fromDate, const QDate &toDate) const;
- int monthsDifference(const QDate &fromDate, const QDate &toDate) const;
- qint64 daysDifference(const QDate &fromDate, const QDate &toDate) const;
-
- void dateDifference(const QDate &fromDate, const QDate &toDate, int *years, int *months, int *days, int *direction) const;
-
- QDate firstDayOfYear(const QDate &date) const;
- QDate firstDayOfYear(int year) const;
- QDate lastDayOfYear(const QDate &date) const;
- QDate lastDayOfYear(int year) const;
-
- QDate firstDayOfMonth(const QDate &date) const;
- QDate firstDayOfMonth(int year, int month) const;
- QDate lastDayOfMonth(const QDate &date) const;
- QDate lastDayOfMonth(int year, int month) const;
-
-private:
- QSharedDataPointer<QCalendarSystemPrivate> d;
-};
diff --git a/plugins/hebrew/CMakeLists.txt b/plugins/hebrewcalendar/CMakeLists.txt
similarity index 61%
rename from plugins/hebrew/CMakeLists.txt
rename to plugins/hebrewcalendar/CMakeLists.txt
index 7ce297725..35350d0e8 100644
--- a/plugins/hebrew/CMakeLists.txt
+++ b/plugins/hebrewcalendar/CMakeLists.txt
@@ -1,15 +1,19 @@
+# SPDX-FileCopyrightText: none
+# SPDX-License-Identifier: BSD-3-Clause
+
########### next target ###############
-find_package(KF6KDELibs4Support ${KF_MIN_VERSION} CONFIG REQUIRED) #for the korganizer hebrew plugin
add_library(hebrew MODULE)
target_sources(
hebrew
PRIVATE
- qcalendarsystem.cpp
configdialog.cpp
- converter.cpp
+ configdialog.h
hebrew.cpp
+ hebrew.h
holiday.cpp
+ holiday.h
parsha.cpp
+ parsha.h
)
ecm_qt_declare_logging_category(hebrew HEADER korganizer_hebrew_debug.h IDENTIFIER KORGANIZER_HEBREWPLUGIN_LOG CATEGORY_NAME org.kde.pim.korganizer_hebrew_plugin)
@@ -17,8 +21,7 @@ ecm_qt_declare_logging_category(hebrew HEADER korganizer_hebrew_debug.h IDENTIFI
target_link_libraries(
hebrew
KPim6::EventViews
- KF6::I18n
- KF6::KDELibs4Support
+ KF6::Holidays
)
-install(TARGETS hebrew DESTINATION ${KDE_INSTALL_PLUGINDIR}/korganizer)
+install(TARGETS hebrew DESTINATION ${KDE_INSTALL_PLUGINDIR}/pim6/korganizer)
diff --git a/plugins/hebrew/README b/plugins/hebrewcalendar/README
similarity index 75%
rename from plugins/hebrew/README
rename to plugins/hebrewcalendar/README
index 297df67fb..fece79960 100644
--- a/plugins/hebrew/README
+++ b/plugins/hebrewcalendar/README
@@ -4,8 +4,8 @@ Note that it only applies to modern (Gregorian) dates, as KDE/Qt does not
support Julian dates. See my KLuach application <http://www.leeta.net/kluach>
if you want to look up historical dates.
-TRANSLATORS! The weird-looking text strings are the names of Jewish months,
-holidays and whatnot. They aren't translateable (although European or Near
+TRANSLATORS! The weird-looking text strings are the names of Hebrew months,
+Jewish holidays and whatnot. They aren't translatable (although European or Near
Eastern languages may spell them differently) and should usually just be changed
into local characters with the same sound. "I" and "II" are Roman numerals.
diff --git a/plugins/hebrew/configdialog.cpp b/plugins/hebrewcalendar/configdialog.cpp
similarity index 69%
rename from plugins/hebrew/configdialog.cpp
rename to plugins/hebrewcalendar/configdialog.cpp
index 52c9a21ee..9af08c4e6 100644
--- a/plugins/hebrew/configdialog.cpp
+++ b/plugins/hebrewcalendar/configdialog.cpp
@@ -39,19 +39,27 @@ ConfigDialog::ConfigDialog(QWidget *parent)
topLayout->setContentsMargins(0, 0, 0, 0);
mIsraelBox = new QCheckBox(topFrame);
- mIsraelBox->setText(i18n("Use Israeli holidays"));
+ mIsraelBox->setText(i18nc("@option:check", "Use Israeli holidays"));
+ mIsraelBox->setToolTip(i18nc("@info:tooltip", "Include Israeli holidays"));
+ mIsraelBox->setWhatsThis(i18nc("@info:whatsthis", "Select this option to show Israeli holidays; including national, non-religious holidays."));
topLayout->addWidget(mIsraelBox);
mParshaBox = new QCheckBox(topFrame);
- mParshaBox->setText(i18n("Show weekly parsha"));
+ mParshaBox->setText(i18nc("@option:check", "Show weekly parsha"));
+ mParshaBox->setToolTip(i18nc("@info:tooltip", "Include weekly parsha days"));
+ mParshaBox->setWhatsThis(i18nc("@info:whatsthis", "Select this option to show weekly parsha days."));
topLayout->addWidget(mParshaBox);
mOmerBox = new QCheckBox(topFrame);
- mOmerBox->setText(i18n("Show day of Omer"));
+ mOmerBox->setText(i18nc("@option:check", "Show day of Omer"));
+ mOmerBox->setToolTip(i18nc("@info:tooltip", "Include days of the Omer"));
+ mOmerBox->setWhatsThis(i18nc("@info:whatsthis", "Select this option to show days of the Omer period."));
topLayout->addWidget(mOmerBox);
mCholBox = new QCheckBox(topFrame);
- mCholBox->setText(i18n("Show Chol HaMoed"));
+ mCholBox->setText(i18nc("@option:check", "Show Chol HaMoed"));
+ mCholBox->setToolTip(i18nc("@info:tooltip", "Include days of the Chol HaMoed"));
+ mCholBox->setWhatsThis(i18nc("@info:whatsthis", "Select this option to dhow days of the Chol HaMoed."));
topLayout->addWidget(mCholBox);
topLayout->addStretch(1);
connect(okButton, &QPushButton::clicked, this, &ConfigDialog::slotOk);
@@ -66,7 +74,7 @@ void ConfigDialog::load()
{
KConfig config(QStringLiteral("korganizerrc"));
- KConfigGroup group(&config, QStringLiteral("Hebrew Calendar Plugin"));
+ const KConfigGroup group(&config, QStringLiteral("Hebrew Calendar Plugin"));
mIsraelBox->setChecked(group.readEntry("UseIsraelSettings", QLocale::territoryToString(QLocale().territory()) == QLatin1StringView(".il")));
mParshaBox->setChecked(group.readEntry("ShowParsha", true));
mCholBox->setChecked(group.readEntry("ShowChol_HaMoed", true));
diff --git a/plugins/hebrew/configdialog.h b/plugins/hebrewcalendar/configdialog.h
similarity index 100%
rename from plugins/hebrew/configdialog.h
rename to plugins/hebrewcalendar/configdialog.h
diff --git a/plugins/hebrewcalendar/hebrew.cpp b/plugins/hebrewcalendar/hebrew.cpp
new file mode 100644
index 000000000..b131b30a8
--- /dev/null
+++ b/plugins/hebrewcalendar/hebrew.cpp
@@ -0,0 +1,141 @@
+/*
+ This file is part of KOrganizer.
+
+ SPDX-FileCopyrightText: 2003 Jonathan Singer <[email protected]>
+ SPDX-FileCopyrightText: 2007 Loïc Corbasson <[email protected]>
+
+ SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#include "hebrew.h"
+#include "configdialog.h"
+#include "holiday.h"
+
+#include <KConfig>
+#include <KConfigGroup>
+#include <KLocalizedString>
+#include <KPluginFactory>
+#include <QLocale>
+
+#include <KHolidays/HebrewConverter>
+
+K_PLUGIN_CLASS_WITH_JSON(Hebrew, "hebrew.json")
+
+using namespace EventViews::CalendarDecoration;
+
+Hebrew::Hebrew(QObject *parent, const QVariantList &args)
+ : Decoration(parent, args)
+{
+ KConfig config(QStringLiteral("korganizerrc"), KConfig::NoGlobals);
+
+ const KConfigGroup group(&config, QStringLiteral("Hebrew Calendar Plugin"));
+ areWeInIsrael = group.readEntry("UseIsraelSettings", QLocale::territoryToString(QLocale().territory()) == QLatin1StringView(".il"));
+ showParsha = group.readEntry("ShowParsha", true);
+ showChol = group.readEntry("ShowChol_HaMoed", true);
+ showOmer = group.readEntry("ShowOmer", true);
+}
+
+void Hebrew::configure(QWidget *parent)
+{
+ ConfigDialog dlg(parent);
+ dlg.exec();
+}
+
+static bool isLeapYear(int year)
+{
+ return ((((7 * year) + 1) % 19) < 7);
+}
+
+static int monthNumberToMonthIndex(int year, int month)
+{
+ if (isLeapYear(year)) {
+ if (month == 6) {
+ return 13; // Adar I
+ } else if (month == 7) {
+ return 14; // Adar II
+ } else if (month > 7) {
+ return month - 1; // Because of Adar II
+ }
+ }
+
+ return month;
+}
+
+static QString monthName(int month, int year)
+{
+ // month and year are in the hebrew calendar
+ // month number is according to the Biblical reckoning
+ // See https://en.wikipedia.org/wiki/Hebrew_calendar
+
+ // Convert Biblical to Civil month numbering
+ if (month == 12) {
+ month = 6;
+ } else {
+ if (month <= 6) {
+ month += 6;
+ } else {
+ month -= 6;
+ }
+ }
+
+ // We must map month number to month index (to account for leap years)
+ const int monthIndex = monthNumberToMonthIndex(year, month);
+
+ // Civil
+ switch (monthIndex) {
+ case 1:
+ return i18nc("Hebrew month 1 - KLocale::LongName", "Tishrey");
+ case 2:
+ return i18nc("Hebrew month 2 - KLocale::LongName", "Heshvan");
+ case 3:
+ return i18nc("Hebrew month 3 - KLocale::LongName", "Kislev");
+ case 4:
+ return i18nc("Hebrew month 4 - KLocale::LongName", "Tevet");
+ case 5:
+ return i18nc("Hebrew month 5 - KLocale::LongName", "Shvat");
+ case 6:
+ return i18nc("Hebrew month 6 - KLocale::LongName", "Adar");
+ case 7:
+ return i18nc("Hebrew month 7 - KLocale::LongName", "Nisan");
+ case 8:
+ return i18nc("Hebrew month 8 - KLocale::LongName", "Iyar");
+ case 9:
+ return i18nc("Hebrew month 9 - KLocale::LongName", "Sivan");
+ case 10:
+ return i18nc("Hebrew month 10 - KLocale::LongName", "Tamuz");
+ case 11:
+ return i18nc("Hebrew month 11 - KLocale::LongName", "Av");
+ case 12:
+ return i18nc("Hebrew month 12 - KLocale::LongName", "Elul");
+ case 13:
+ return i18nc("Hebrew month 13 - KLocale::LongName", "Adar I");
+ case 14:
+ return i18nc("Hebrew month 14 - KLocale::LongName", "Adar II");
+ default:
+ return QString();
+ }
+}
+
+Element::List Hebrew::createDayElements(const QDate &date)
+{
+ Element::List el;
+ QString text;
+ const KHolidays::HebrewDate hd = KHolidays::HebrewDate::fromSecular(date.year(), date.month(), date.day());
+ const QStringList holidays = Holiday::findHoliday(hd, areWeInIsrael, showParsha, showChol, showOmer);
+ text = i18nc("1. day of the month 2. hebrew month", "%1 %2", hd.day(), monthName(hd.month(), hd.year()));
+
+ for (const QString &holiday : holidays) {
+ text += QLatin1StringView("<br/>\n") + holiday;
+ }
+
+ text = i18nc("Change the next two strings if emphasis is done differently in your language.", "<qt><p align=\"center\"><i>\n%1\n</i></p></qt>", text);
+ el.append(new StoredElement(QStringLiteral("main element"), text));
+ return el;
+}
+
+QString Hebrew::info() const
+{
+ return i18n("This plugin provides the date in the Jewish calendar.");
+}
+
+#include "hebrew.moc"
diff --git a/plugins/hebrewcalendar/hebrew.desktop b/plugins/hebrewcalendar/hebrew.desktop
new file mode 100644
index 000000000..18f20e497
--- /dev/null
+++ b/plugins/hebrewcalendar/hebrew.desktop
@@ -0,0 +1,62 @@
+[Desktop Entry]
+X-KDE-Library=korg_hebrew
+Name=Jewish Calendar
+Name[af]=Joodse kalender inprop module
+Name[ar]=ملحق التّقويم اليهوديّ
+Name[bg]=Приставка за юдейски календар
+Name[br]=Lugent deiziadur yudev
+Name[bs]=Dodatak za Jevrejski Kalendar
+Name[ca]=Connector de calendari jueu
+Name[ca@valencia]=Connector de calendari jueu
+Name[cs]=Modul židovského kalendáře
+Name[da]=Jødisk kalender-plugin
+Name[de]=Modul für jüdischen Kalender
+Name[el]=Πρόσθετο εβραϊκού ημερολογίου
+Name[en_GB]=Jewish Calendar
+Name[eo]=Kromprogramo por Juda Kalendaro
+Name[es]=Complemento de calendario hebreo
+Name[et]=Juudi kalendri plugin
+Name[eu]=Egutegi juduaren plugina
+Name[fa]=وصله تقویم یهودی
+Name[fi]=Juutalaisen kalenterin laajennus
+Name[fr]=Module de prise en charge du calendrier juif
+Name[fy]=Joadske kalenderplugin
+Name[ga]=Breiseán Féilire Giúdaí
+Name[gl]=Complemento para o calendario xudeu
+Name[he]=תוסף לוח שנה עברי
+Name[hu]=Bővítőmodul a zsidó naptár kezeléséhez
+Name[ia]=Plug-in pro calendario judee
+Name[is]=Gyðinga dagatalsíforrit
+Name[it]=Estensione calendario ebraico
+Name[ka]=ებრაული კალენდრის დამატება
+Name[kk]=Яһуди күнтізбесінің плагині
+Name[km]=កម្មវិធីជំនួយប្រតិទិន Jewish
+Name[ko]=히브리 달력 플러그인
+Name[lt]=Žydų kalendoriaus įskiepis
+Name[lv]=Ebreju kalendāra spraudnis
+Name[mk]=Приклучок за еврејски календар
+Name[mr]=यहूदी दिनदर्शिका प्लगइन
+Name[ms]=PLugin Kalender Yahudi
+Name[nds]=Moduul för jöödschen Kalenner
+Name[ne]=यहूदी क्यालेन्डर प्लगइन
+Name[nl]=Joodse kalenderplug-in
+Name[pl]=Wtyczka kalendarza żydowskiego
+Name[pt_BR]=Plugin do calendário judaico
+Name[ru]=Еврейский календарь
+Name[sa]=यहूदी कैलेंडर प्लगइन
+Name[sk]=Modul Židovského kalendára
+Name[sl]=Vstavek za židovski koledar
+Name[sv]=Insticksprogram för judisk kalender
+Name[ta]=ஜூவிஷ் நாள்காட்டி சொருகுப்பொருள்
+Name[tg]=Тақвимоти яҳудӣ
+Name[tr]=Musevî Takvimi Eklentisi
+Name[ug]=ئىبرانى يىلنامە قىستۇرمىسى
+Name[uk]=Додаток єврейського календаря
+Name[wa]=Tchôke-divins calindrî djwif
+Name[zh_CN]=犹太历插件
+Name[zh_TW]=猶太行事曆外掛程式
+Comment=Shows dates and Jewish holidays in the Hebrew calendar system.
+Comment[en_GB]=Shows dates and Jewish holidays in the Hebrew calendar system.
+Type=Service
+X-KDE-KOrganizer-HasSettings=true
+X-KDE-PluginInterfaceVersion=2
diff --git a/plugins/hebrew/hebrew.h b/plugins/hebrewcalendar/hebrew.h
similarity index 100%
rename from plugins/hebrew/hebrew.h
rename to plugins/hebrewcalendar/hebrew.h
diff --git a/plugins/hebrewcalendar/hebrew.json b/plugins/hebrewcalendar/hebrew.json
new file mode 100644
index 000000000..edb58f7f3
--- /dev/null
+++ b/plugins/hebrewcalendar/hebrew.json
@@ -0,0 +1,64 @@
+{
+ "KPlugin": {
+ "Description": "Shows dates and Jewish holidays in the Hebrew calendar system.",
+ "Description[en_GB]": "Shows dates and Jewish holidays in the Hebrew calendar system.",
+ "Name": "Jewish Calendar",
+ "Name[af]": "Joodse kalender inprop module",
+ "Name[ar]": "ملحق التّقويم اليهوديّ",
+ "Name[bg]": "Приставка за юдейски календар",
+ "Name[br]": "Lugent deiziadur yudev",
+ "Name[bs]": "Dodatak za Jevrejski Kalendar",
+ "Name[ca@valencia]": "Connector de calendari jueu",
+ "Name[ca]": "Connector de calendari jueu",
+ "Name[cs]": "Modul židovského kalendáře",
+ "Name[da]": "Jødisk kalender-plugin",
+ "Name[de]": "Modul für jüdischen Kalender",
+ "Name[el]": "Πρόσθετο εβραϊκού ημερολογίου",
+ "Name[en_GB]": "Jewish Calendar",
+ "Name[eo]": "Kromprogramo por Juda Kalendaro",
+ "Name[es]": "Complemento de calendario hebreo",
+ "Name[et]": "Juudi kalendri plugin",
+ "Name[eu]": "Egutegi judutar plugin-a",
+ "Name[fa]": "وصله تقویم یهودی",
+ "Name[fi]": "Juutalainen kalenteri -liitännäinen",
+ "Name[fr]": "Module de prise en charge du calendrier juif",
+ "Name[fy]": "Joadske kalenderplugin",
+ "Name[ga]": "Breiseán Féilire Giúdaí",
+ "Name[gl]": "Complemento para o calendario xudeu",
+ "Name[he]": "תוסף לוח שנה עברי",
+ "Name[hu]": "Bővítőmodul a zsidó naptár kezeléséhez",
+ "Name[ia]": "Plug-in pro calendario judee",
+ "Name[is]": "Gyðinga dagatalsíforrit",
+ "Name[it]": "Estensione calendario ebraico",
+ "Name[ka]": "ებრაული კალენდრის დამატება",
+ "Name[kk]": "Яһуди күнтізбесінің плагині",
+ "Name[km]": "កម្មវិធីជំនួយប្រតិទិន Jewish",
+ "Name[ko]": "히브리 달력 플러그인",
+ "Name[lt]": "Žydų kalendoriaus įskiepis",
+ "Name[lv]": "Ebreju kalendāra spraudnis",
+ "Name[mk]": "Приклучок за еврејски календар",
+ "Name[mr]": "यहूदी दिनदर्शिका प्लगइन",
+ "Name[ms]": "PLugin Kalender Yahudi",
+ "Name[nds]": "Moduul för jöödschen Kalenner",
+ "Name[ne]": "यहूदी क्यालेन्डर प्लगइन",
+ "Name[nl]": "Joodse kalenderplug-in",
+ "Name[pl]": "Wtyczka kalendarza żydowskiego",
+ "Name[pt_BR]": "Plugin do calendário judaico",
+ "Name[ro]": "Modul calendar evreiesc",
+ "Name[ru]": "Еврейский календарь",
+ "Name[sa]": "यहूदी कैलेंडर प्लगइन",
+ "Name[sk]": "Modul Židovského kalendára",
+ "Name[sl]": "Vstavek za židovski koledar",
+ "Name[sv]": "Insticksprogram för judisk kalender",
+ "Name[ta]": "ஜூவிஷ் நாள்காட்டி செருகுநிரல்",
+ "Name[tg]": "Тақвимоти яҳудӣ",
+ "Name[tr]": "Musevi Takvimi Eklentisi",
+ "Name[ug]": "ئىبرانى يىلنامە قىستۇرمىسى",
+ "Name[uk]": "Додаток єврейського календаря",
+ "Name[wa]": "Tchôke-divins calindrî djwif",
+ "Name[zh_CN]": "犹太历插件",
+ "Name[zh_TW]": "猶太行事曆外掛程式"
+ },
+ "X-KDE-KOrganizer-HasSettings": true,
+ "X-KDE-PluginInterfaceVersion": 2
+}
diff --git a/plugins/hebrew/holiday.cpp b/plugins/hebrewcalendar/holiday.cpp
similarity index 97%
rename from plugins/hebrew/holiday.cpp
rename to plugins/hebrewcalendar/holiday.cpp
index 47392fee0..95d965fb4 100644
--- a/plugins/hebrew/holiday.cpp
+++ b/plugins/hebrewcalendar/holiday.cpp
@@ -18,7 +18,9 @@
#include <KLocalizedString>
-QStringList Holiday::findHoliday(const HebrewDate &hd, bool useIsraelSettings, bool showParsha, bool showChol, bool showOmer)
+// NOLINTBEGIN(bugprone-switch-missing-default-case)
+
+QStringList Holiday::findHoliday(const KHolidays::HebrewDate &hd, bool useIsraelSettings, bool showParsha, bool showChol, bool showOmer)
{
return findHoliday(hd.month(),
hd.day(),
@@ -56,7 +58,7 @@ QStringList Holiday::findHoliday(int month,
};
QStringList holidays;
- bool isAShabbat = (weekday == Saturday);
+ const bool isAShabbat = (weekday == Saturday);
// Treat Adar in a non-leap year as if it were Adar II.
if ((month == Adar) && !isLeapYear) {
@@ -482,3 +484,5 @@ QString Holiday::sfirah(int day)
// 2nd instead of 2, etc.
return buffer;
}
+
+// NOLINTEND(bugprone-switch-missing-default-case)
diff --git a/plugins/hebrew/holiday.h b/plugins/hebrewcalendar/holiday.h
similarity index 88%
rename from plugins/hebrew/holiday.h
rename to plugins/hebrewcalendar/holiday.h
index 06060d2af..04ca4b175 100644
--- a/plugins/hebrew/holiday.h
+++ b/plugins/hebrewcalendar/holiday.h
@@ -15,7 +15,7 @@
#pragma once
-#include "converter.h"
+#include <KHolidays/HebrewConverter>
#include <QStringList>
@@ -36,7 +36,7 @@ public:
whether we will use the settings corresponding to Israel or to the
diaspora.
*/
- static QStringList findHoliday(const HebrewDate &hd, bool useIsraelSettings, bool showParsha, bool showChol, bool showOmer);
+ static QStringList findHoliday(const KHolidays::HebrewDate &hd, bool useIsraelSettings, bool showParsha, bool showChol, bool showOmer);
private:
/**
@@ -66,9 +66,9 @@ private:
int day,
int weekday,
int kvia,
- bool leap_year_p,
+ bool isLeapYear,
bool useIsraelSettings,
- int day_number,
+ int dayNumber,
int year,
bool showParsha,
bool showChol,
diff --git a/plugins/hebrew/parsha.cpp b/plugins/hebrewcalendar/parsha.cpp
similarity index 98%
rename from plugins/hebrew/parsha.cpp
rename to plugins/hebrewcalendar/parsha.cpp
index 2202e3625..5f637a6cb 100644
--- a/plugins/hebrew/parsha.cpp
+++ b/plugins/hebrewcalendar/parsha.cpp
@@ -131,7 +131,7 @@ QString Parsha::findParshaName(int dayNumber, int kvia, bool isLeapYear, bool us
};
/* Make the calculations */
- int week = dayNumber / 7; // week of the year
+ const int week = dayNumber / 7; // week of the year
const quint8 *array = nullptr;
int index;
@@ -166,6 +166,8 @@ QString Parsha::findParshaName(int dayNumber, int kvia, bool isLeapYear, bool us
array = ThuLong;
}
break;
+ default:
+ break;
}
} else { /* leap year */
switch (dayNumber % 7) {
@@ -195,6 +197,8 @@ QString Parsha::findParshaName(int dayNumber, int kvia, bool isLeapYear, bool us
array = ThuLongLeap;
}
break;
+ default:
+ break;
}
}
QString buffer;
diff --git a/plugins/hebrew/parsha.h b/plugins/hebrewcalendar/parsha.h
similarity index 100%
rename from plugins/hebrew/parsha.h
rename to plugins/hebrewcalendar/parsha.h
diff --git a/src/org.kde.korganizer.appdata.xml b/src/org.kde.korganizer.appdata.xml
index c2a4fb49e..2480fc090 100644
--- a/src/org.kde.korganizer.appdata.xml
+++ b/src/org.kde.korganizer.appdata.xml
@@ -571,6 +571,10 @@
<li xml:lang="tr">Kontak özet: Tutarlı tarih dizisi biçimleri</li>
<li xml:lang="uk">Резюме Kontact: сумісні формати рядків дат</li>
</ul>
+ <p>Plugins</p>
+ <ul>
+ <li>The Jewish calendar plugin is restored (gone since KDE4). This plugin shows dates and Jewish holidays in the Hebrew calendar system</li>
+ </ul>
</description>
</release>
<release version="6.8.0" type="snapshot">