20 #include <tdeglobal.h>
21 #include <tdeconfig.h>
22 #include <kstandarddirs.h>
23 #include <ksimpleconfig.h>
24 #include <kcalendarsystem.h>
25 #include <kcalendarsystemfactory.h>
27 #include "configdialog.h"
29 #include "converter.h"
34 class HebrewFactory:
public CalendarDecorationFactory
43 K_EXPORT_COMPONENT_FACTORY( libkorg_hebrew, HebrewFactory )
46 TQString Hebrew::shortText(
const TQDate & date)
49 TDEConfig config(
"korganizerrc",
true,
false);
51 config.setGroup(
"Calendar/Hebrew Calendar Plugin");
53 config.readBoolEntry(
"Israel",
54 (TDEGlobal::locale()->country() ==
".il"));
55 Holiday::ParshaP = config.readBoolEntry(
"Parsha",
true);
56 Holiday::CholP = config.readBoolEntry(
"Chol_HaMoed",
true);
57 Holiday::OmerP = config.readBoolEntry(
"Omer",
true);
61 int month = date.month();
62 int year = date.year();
65 struct DateResult result;
67 Converter::SecularToHebrewConversion(year, month, day,
69 int hebrew_day = result.day;
70 int hebrew_month = result.month;
71 int hebrew_year = result.year;
72 int hebrew_day_of_week = result.day_of_week;
73 bool hebrew_leap_year_p = result.hebrew_leap_year_p;
74 int hebrew_kvia = result.kvia;
75 int hebrew_day_number = result.hebrew_day_number;
77 TQStringList holidays =
78 Holiday::FindHoliday(hebrew_month, hebrew_day,
79 hebrew_day_of_week + 1, hebrew_kvia,
80 hebrew_leap_year_p, IsraelP,
81 hebrew_day_number, hebrew_year);
83 KCalendarSystem *cal = KCalendarSystemFactory::create(
"hebrew");
84 label_text = TQString(
"%1 %2").arg(cal->dayString(date,
false))
85 .arg(cal->monthName(date));
89 int count = holidays.count();
91 for (
int h = 0; h <= count; ++h)
93 label_text +=
"\n" + holidays[h];
100 TQString Hebrew::info()
103 i18n(
"This plugin provides the date in the Jewish calendar.");
106 void Hebrew::configure(TQWidget * parent)
This class provides the interface for a date dependent decoration.