22 #include "holidayparserdriverplanold_p.h"
24 #include <QStringList>
27 #include <KCalendarSystem>
30 #include "holiday_p.h"
35 KHOLIDAYS_EXPORT
char *parse_holidays(
const char *,
int year,
short force );
37 char *parse_holidays(
const char *,
int year,
short force );
48 KHOLIDAYS_EXPORT
extern struct holiday holidays[366];
50 extern struct holiday holidays[366];
54 using namespace KHolidays;
68 kDebug() << errorMessage;
81 for ( m_parseYear = m_parseStartYear; m_parseYear <= m_parseEndYear; ++m_parseYear ) {
84 m_parseCalendar->setDate( parseYearStart, m_parseYear, 1, 1 );
87 parse_holidays( QFile::encodeName( m_filePath ), m_parseYear - 1900, 1 );
90 for (
int i = 0; i < 366; ++i ) {
91 struct holiday *hd = &::holidays[i];
92 thisDate = parseYearStart.addDays( i );
94 if ( thisDate >= m_requestStart && thisDate <= m_requestEnd ) {
98 holiday.d->mObservedDate = thisDate;
99 holiday.d->mText = QString::fromUtf8( hd->string );
100 holiday.d->mShortText = holiday.d->mText;
101 if ( hd->color == 2 || hd->color == 9 ) {
102 holiday.d->mDayType = Holiday::NonWorkday;
104 holiday.d->mDayType = Holiday::Workday;
106 m_resultList.append( holiday );
119 m_fileCountryCode.clear();
120 m_fileLanguageCode.clear();
122 m_fileDescription.clear();
124 QFileInfo file( m_filePath );
125 if ( file.exists() ) {
126 QStringList metadata = file.fileName().split(
'_' );
127 if ( metadata[0] ==
"holiday" && metadata.count() > 2 ) {
128 m_fileCountryCode = metadata[1].toUpper();
129 QStringList language = metadata[2].split(
'-' );
130 m_fileLanguageCode = language[0];
131 if ( language.count() > 1 ) {
132 m_fileLanguageCode.append(
'_' ).append( language[1].toUpper() );
134 if ( metadata.count() > 3 ) {
135 m_fileName = metadata[3];