• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • date
kcalendarsystemqdate.cpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es>
3 Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org>
4 Copyright 2007, 2010 John Layt <john@layt.net>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22// Derived QDate kde calendar class
23
24#include "kcalendarsystemqdate_p.h"
25#include "kcalendarsystemprivate_p.h"
26#include "kcalendarera_p.h"
27
28#include "kdebug.h"
29#include "klocale.h"
30#include "kglobal.h"
31#include "kconfiggroup.h"
32
33#include <QtCore/QDate>
34#include <QtCore/QCharRef>
35
36class KCalendarSystemQDatePrivate : public KCalendarSystemPrivate
37{
38public:
39 explicit KCalendarSystemQDatePrivate(KCalendarSystemQDate *q);
40
41 virtual ~KCalendarSystemQDatePrivate();
42
43 // Virtual methods each calendar system must re-implement
44 virtual KLocale::CalendarSystem calendarSystem() const;
45 virtual void loadDefaultEraList();
46 virtual int monthsInYear(int year) const;
47 virtual int daysInMonth(int year, int month) const;
48 virtual int daysInYear(int year) const;
49 virtual int daysInWeek() const;
50 virtual bool isLeapYear(int year) const;
51 virtual bool hasLeapMonths() const;
52 virtual bool hasYearZero() const;
53 virtual int maxDaysInWeek() const;
54 virtual int maxMonthsInYear() const;
55 virtual int earliestValidYear() const;
56 virtual int latestValidYear() const;
57 virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
58 virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
59
60 bool m_useCommonEra;
61};
62
63// Shared d pointer implementations
64
65KCalendarSystemQDatePrivate::KCalendarSystemQDatePrivate(KCalendarSystemQDate *q)
66 : KCalendarSystemPrivate(q),
67 m_useCommonEra(false)
68
69{
70}
71
72KCalendarSystemQDatePrivate::~KCalendarSystemQDatePrivate()
73{
74}
75
76KLocale::CalendarSystem KCalendarSystemQDatePrivate::calendarSystem() const
77{
78 return KLocale::QDateCalendar;
79}
80
81void KCalendarSystemQDatePrivate::loadDefaultEraList()
82{
83 QString name, shortName, format;
84
85 KConfigGroup lcg(config(), QString::fromLatin1("Locale"));
86 KConfigGroup cg = lcg.group(QString::fromLatin1("KCalendarSystem %1").arg(q->calendarType(q->calendarSystem())));
87 m_useCommonEra = cg.readEntry("UseCommonEra", false);
88
89 if (m_useCommonEra) {
90 name = i18nc("Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era");
91 shortName = i18nc("Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE");
92 } else {
93 name = i18nc("Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ");
94 shortName = i18nc("Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC");
95 }
96 format = i18nc("(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC");
97 addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), name, shortName, format);
98
99 if (m_useCommonEra) {
100 name = i18nc("Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era");
101 shortName = i18nc("Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE");
102 } else {
103 name = i18nc("Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini");
104 shortName = i18nc("Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD");
105 }
106 format = i18nc("(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC");
107 addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format);
108}
109
110int KCalendarSystemQDatePrivate::monthsInYear(int year) const
111{
112 Q_UNUSED(year)
113 return 12;
114}
115
116int KCalendarSystemQDatePrivate::daysInMonth(int year, int month) const
117{
118 QDate tempDate(year, month, 1);
119 return tempDate.daysInMonth();
120}
121
122int KCalendarSystemQDatePrivate::daysInYear(int year) const
123{
124 QDate tempDate(year, 1, 1);
125 return tempDate.daysInYear();
126}
127
128int KCalendarSystemQDatePrivate::daysInWeek() const
129{
130 return 7;
131}
132
133bool KCalendarSystemQDatePrivate::isLeapYear(int year) const
134{
135 return QDate::isLeapYear(year);
136}
137
138bool KCalendarSystemQDatePrivate::hasLeapMonths() const
139{
140 return false;
141}
142
143bool KCalendarSystemQDatePrivate::hasYearZero() const
144{
145 return false;
146}
147
148int KCalendarSystemQDatePrivate::maxDaysInWeek() const
149{
150 return 7;
151}
152
153int KCalendarSystemQDatePrivate::maxMonthsInYear() const
154{
155 return 12;
156}
157
158int KCalendarSystemQDatePrivate::earliestValidYear() const
159{
160 return -4712;
161}
162
163int KCalendarSystemQDatePrivate::latestValidYear() const
164{
165 return 9999;
166}
167
168QString KCalendarSystemQDatePrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const
169{
170 Q_UNUSED(year);
171
172 if (format == KLocale::NarrowName) {
173 switch (month) {
174 case 1:
175 return ki18nc("Gregorian month 1 - KLocale::NarrowName", "J").toString(locale());
176 case 2:
177 return ki18nc("Gregorian month 2 - KLocale::NarrowName", "F").toString(locale());
178 case 3:
179 return ki18nc("Gregorian month 3 - KLocale::NarrowName", "M").toString(locale());
180 case 4:
181 return ki18nc("Gregorian month 4 - KLocale::NarrowName", "A").toString(locale());
182 case 5:
183 return ki18nc("Gregorian month 5 - KLocale::NarrowName", "M").toString(locale());
184 case 6:
185 return ki18nc("Gregorian month 6 - KLocale::NarrowName", "J").toString(locale());
186 case 7:
187 return ki18nc("Gregorian month 7 - KLocale::NarrowName", "J").toString(locale());
188 case 8:
189 return ki18nc("Gregorian month 8 - KLocale::NarrowName", "A").toString(locale());
190 case 9:
191 return ki18nc("Gregorian month 9 - KLocale::NarrowName", "S").toString(locale());
192 case 10:
193 return ki18nc("Gregorian month 10 - KLocale::NarrowName", "O").toString(locale());
194 case 11:
195 return ki18nc("Gregorian month 11 - KLocale::NarrowName", "N").toString(locale());
196 case 12:
197 return ki18nc("Gregorian month 12 - KLocale::NarrowName", "D").toString(locale());
198 default:
199 return QString();
200 }
201 }
202
203 if (format == KLocale::ShortName && possessive) {
204 switch (month) {
205 case 1:
206 return ki18nc("Gregorian month 1 - KLocale::ShortName Possessive", "of Jan").toString(locale());
207 case 2:
208 return ki18nc("Gregorian month 2 - KLocale::ShortName Possessive", "of Feb").toString(locale());
209 case 3:
210 return ki18nc("Gregorian month 3 - KLocale::ShortName Possessive", "of Mar").toString(locale());
211 case 4:
212 return ki18nc("Gregorian month 4 - KLocale::ShortName Possessive", "of Apr").toString(locale());
213 case 5:
214 return ki18nc("Gregorian month 5 - KLocale::ShortName Possessive", "of May").toString(locale());
215 case 6:
216 return ki18nc("Gregorian month 6 - KLocale::ShortName Possessive", "of Jun").toString(locale());
217 case 7:
218 return ki18nc("Gregorian month 7 - KLocale::ShortName Possessive", "of Jul").toString(locale());
219 case 8:
220 return ki18nc("Gregorian month 8 - KLocale::ShortName Possessive", "of Aug").toString(locale());
221 case 9:
222 return ki18nc("Gregorian month 9 - KLocale::ShortName Possessive", "of Sep").toString(locale());
223 case 10:
224 return ki18nc("Gregorian month 10 - KLocale::ShortName Possessive", "of Oct").toString(locale());
225 case 11:
226 return ki18nc("Gregorian month 11 - KLocale::ShortName Possessive", "of Nov").toString(locale());
227 case 12:
228 return ki18nc("Gregorian month 12 - KLocale::ShortName Possessive", "of Dec").toString(locale());
229 default:
230 return QString();
231 }
232 }
233
234 if (format == KLocale::ShortName && !possessive) {
235 switch (month) {
236 case 1:
237 return ki18nc("Gregorian month 1 - KLocale::ShortName", "Jan").toString(locale());
238 case 2:
239 return ki18nc("Gregorian month 2 - KLocale::ShortName", "Feb").toString(locale());
240 case 3:
241 return ki18nc("Gregorian month 3 - KLocale::ShortName", "Mar").toString(locale());
242 case 4:
243 return ki18nc("Gregorian month 4 - KLocale::ShortName", "Apr").toString(locale());
244 case 5:
245 return ki18nc("Gregorian month 5 - KLocale::ShortName", "May").toString(locale());
246 case 6:
247 return ki18nc("Gregorian month 6 - KLocale::ShortName", "Jun").toString(locale());
248 case 7:
249 return ki18nc("Gregorian month 7 - KLocale::ShortName", "Jul").toString(locale());
250 case 8:
251 return ki18nc("Gregorian month 8 - KLocale::ShortName", "Aug").toString(locale());
252 case 9:
253 return ki18nc("Gregorian month 9 - KLocale::ShortName", "Sep").toString(locale());
254 case 10:
255 return ki18nc("Gregorian month 10 - KLocale::ShortName", "Oct").toString(locale());
256 case 11:
257 return ki18nc("Gregorian month 11 - KLocale::ShortName", "Nov").toString(locale());
258 case 12:
259 return ki18nc("Gregorian month 12 - KLocale::ShortName", "Dec").toString(locale());
260 default:
261 return QString();
262 }
263 }
264
265 if (format == KLocale::LongName && possessive) {
266 switch (month) {
267 case 1:
268 return ki18nc("Gregorian month 1 - KLocale::LongName Possessive", "of January").toString(locale());
269 case 2:
270 return ki18nc("Gregorian month 2 - KLocale::LongName Possessive", "of February").toString(locale());
271 case 3:
272 return ki18nc("Gregorian month 3 - KLocale::LongName Possessive", "of March").toString(locale());
273 case 4:
274 return ki18nc("Gregorian month 4 - KLocale::LongName Possessive", "of April").toString(locale());
275 case 5:
276 return ki18nc("Gregorian month 5 - KLocale::LongName Possessive", "of May").toString(locale());
277 case 6:
278 return ki18nc("Gregorian month 6 - KLocale::LongName Possessive", "of June").toString(locale());
279 case 7:
280 return ki18nc("Gregorian month 7 - KLocale::LongName Possessive", "of July").toString(locale());
281 case 8:
282 return ki18nc("Gregorian month 8 - KLocale::LongName Possessive", "of August").toString(locale());
283 case 9:
284 return ki18nc("Gregorian month 9 - KLocale::LongName Possessive", "of September").toString(locale());
285 case 10:
286 return ki18nc("Gregorian month 10 - KLocale::LongName Possessive", "of October").toString(locale());
287 case 11:
288 return ki18nc("Gregorian month 11 - KLocale::LongName Possessive", "of November").toString(locale());
289 case 12:
290 return ki18nc("Gregorian month 12 - KLocale::LongName Possessive", "of December").toString(locale());
291 default:
292 return QString();
293 }
294 }
295
296 // Default to LongName
297 switch (month) {
298 case 1:
299 return ki18nc("Gregorian month 1 - KLocale::LongName", "January").toString(locale());
300 case 2:
301 return ki18nc("Gregorian month 2 - KLocale::LongName", "February").toString(locale());
302 case 3:
303 return ki18nc("Gregorian month 3 - KLocale::LongName", "March").toString(locale());
304 case 4:
305 return ki18nc("Gregorian month 4 - KLocale::LongName", "April").toString(locale());
306 case 5:
307 return ki18nc("Gregorian month 5 - KLocale::LongName", "May").toString(locale());
308 case 6:
309 return ki18nc("Gregorian month 6 - KLocale::LongName", "June").toString(locale());
310 case 7:
311 return ki18nc("Gregorian month 7 - KLocale::LongName", "July").toString(locale());
312 case 8:
313 return ki18nc("Gregorian month 8 - KLocale::LongName", "August").toString(locale());
314 case 9:
315 return ki18nc("Gregorian month 9 - KLocale::LongName", "September").toString(locale());
316 case 10:
317 return ki18nc("Gregorian month 10 - KLocale::LongName", "October").toString(locale());
318 case 11:
319 return ki18nc("Gregorian month 11 - KLocale::LongName", "November").toString(locale());
320 case 12:
321 return ki18nc("Gregorian month 12 - KLocale::LongName", "December").toString(locale());
322 default:
323 return QString();
324 }
325}
326
327QString KCalendarSystemQDatePrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
328{
329 if (format == KLocale::NarrowName) {
330 switch (weekDay) {
331 case 1:
332 return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
333 case 2:
334 return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
335 case 3:
336 return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
337 case 4:
338 return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
339 case 5:
340 return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
341 case 6:
342 return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
343 case 7:
344 return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
345 default:
346 return QString();
347 }
348 }
349
350 if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
351 switch (weekDay) {
352 case 1:
353 return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
354 case 2:
355 return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
356 case 3:
357 return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
358 case 4:
359 return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
360 case 5:
361 return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
362 case 6:
363 return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
364 case 7:
365 return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
366 default: return QString();
367 }
368 }
369
370 switch (weekDay) {
371 case 1:
372 return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale());
373 case 2:
374 return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
375 case 3:
376 return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
377 case 4:
378 return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
379 case 5:
380 return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale());
381 case 6:
382 return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
383 case 7:
384 return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
385 default:
386 return QString();
387 }
388}
389
390
391KCalendarSystemQDate::KCalendarSystemQDate(const KLocale *locale)
392 : KCalendarSystem(*new KCalendarSystemQDatePrivate(this), KSharedConfig::Ptr(), locale)
393{
394 d_ptr->loadConfig(calendarType());
395}
396
397KCalendarSystemQDate::KCalendarSystemQDate(const KSharedConfig::Ptr config, const KLocale *locale)
398 : KCalendarSystem(*new KCalendarSystemQDatePrivate(this), config, locale)
399{
400 d_ptr->loadConfig(calendarType());
401}
402
403KCalendarSystemQDate::KCalendarSystemQDate(KCalendarSystemQDatePrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale)
404 : KCalendarSystem(dd, config, locale)
405{
406 d_ptr->loadConfig(calendarType());
407}
408
409KCalendarSystemQDate::~KCalendarSystemQDate()
410{
411}
412
413QString KCalendarSystemQDate::calendarType() const
414{
415 return QLatin1String("gregorian");
416}
417
418QDate KCalendarSystemQDate::epoch() const
419{
420 // 1 Jan 1 AD in Julian
421 return QDate::fromJulianDay(1721424);
422}
423
424QDate KCalendarSystemQDate::earliestValidDate() const
425{
426 // 1 Jan 4712 BC, no year zero, cant be 4713BC due to error in QDate that day 0 is not valid
427 // and we really need the first in each year to be valid for the date maths
428 return QDate::fromJulianDay(366);
429}
430
431QDate KCalendarSystemQDate::latestValidDate() const
432{
433 // Set to last day of year 9999 until confirm date formats & widets support > 9999
434 // In Gregorian this is 9999-12-31, which is is jd 5373484
435 // Can't call setDate( 9999, 12, 31 ) as it creates circular reference!
436 return QDate::fromJulianDay(5373484);
437}
438
439bool KCalendarSystemQDate::isValid(int year, int month, int day) const
440{
441 // Limit to max year 9999 for now, QDate allows to be greater
442 if (year <= 9999) {
443 return QDate::isValid(year, month, day);
444 }
445
446 return false;
447}
448
449bool KCalendarSystemQDate::isValid(const QDate &date) const
450{
451 return KCalendarSystem::isValid(date);
452}
453
454int KCalendarSystemQDate::year(const QDate &date) const
455{
456 return date.year();
457}
458
459int KCalendarSystemQDate::month(const QDate &date) const
460{
461 return date.month();
462}
463
464int KCalendarSystemQDate::day(const QDate &date) const
465{
466 return date.day();
467}
468
469int KCalendarSystemQDate::daysInYear(const QDate &date) const
470{
471 return date.daysInYear();
472}
473
474int KCalendarSystemQDate::daysInMonth(const QDate &date) const
475{
476 return date.daysInMonth();
477}
478
479int KCalendarSystemQDate::dayOfYear(const QDate &date) const
480{
481 return date.dayOfYear();
482}
483
484int KCalendarSystemQDate::dayOfWeek(const QDate &date) const
485{
486 return date.dayOfWeek();
487}
488
489bool KCalendarSystemQDate::isLeapYear(int year) const
490{
491 return QDate::isLeapYear(year);
492}
493
494bool KCalendarSystemQDate::isLeapYear(const QDate &date) const
495{
496 return QDate::isLeapYear(date.year());
497}
498
499QString KCalendarSystemQDate::monthName(int month, int year, MonthNameFormat format) const
500{
501 return KCalendarSystem::monthName(month, year, format);
502}
503
504QString KCalendarSystemQDate::monthName(const QDate &date, MonthNameFormat format) const
505{
506 return KCalendarSystem::monthName(date, format);
507}
508
509QString KCalendarSystemQDate::weekDayName(int weekDay, WeekDayNameFormat format) const
510{
511 return KCalendarSystem::weekDayName(weekDay, format);
512}
513
514QString KCalendarSystemQDate::weekDayName(const QDate &date, WeekDayNameFormat format) const
515{
516 return KCalendarSystem::weekDayName(date, format);
517}
518
519int KCalendarSystemQDate::weekDayOfPray() const
520{
521 return 7; // sunday
522}
523
524bool KCalendarSystemQDate::isLunar() const
525{
526 return false;
527}
528
529bool KCalendarSystemQDate::isLunisolar() const
530{
531 return false;
532}
533
534bool KCalendarSystemQDate::isSolar() const
535{
536 return true;
537}
538
539bool KCalendarSystemQDate::isProleptic() const
540{
541 return false;
542}
543
544bool KCalendarSystemQDate::julianDayToDate(int jd, int &year, int &month, int &day) const
545{
546 QDate date = QDate::fromJulianDay(jd);
547
548 date.getDate(&year, &month, &day);
549
550 return date.isValid();
551}
552
553bool KCalendarSystemQDate::dateToJulianDay(int year, int month, int day, int &jd) const
554{
555 QDate date;
556
557 date.setDate(year, month, day);
558 jd = date.toJulianDay();
559
560 return date.isValid();
561}
KCalendarSystemPrivate
Definition: kcalendarsystemprivate_p.h:32
KCalendarSystemPrivate::latestValidYear
virtual int latestValidYear() const
Definition: kcalendarsystem.cpp:380
KCalendarSystemPrivate::monthName
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive=false) const
Definition: kcalendarsystem.cpp:387
KCalendarSystemPrivate::isLeapYear
virtual bool isLeapYear(int year) const
Definition: kcalendarsystem.cpp:322
KCalendarSystemPrivate::calendarSystem
virtual KLocale::CalendarSystem calendarSystem() const
Definition: kcalendarsystem.cpp:261
KCalendarSystemPrivate::q
const KCalendarSystem * q
Definition: kcalendarsystemprivate_p.h:104
KCalendarSystemPrivate::daysInYear
virtual int daysInYear(int year) const
Definition: kcalendarsystem.cpp:304
KCalendarSystemPrivate::weekDayName
virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
Definition: kcalendarsystem.cpp:398
KCalendarSystemPrivate::earliestValidYear
virtual int earliestValidYear() const
Definition: kcalendarsystem.cpp:371
KCalendarSystemPrivate::loadDefaultEraList
virtual void loadDefaultEraList()
Definition: kcalendarsystem.cpp:269
KCalendarSystemPrivate::hasYearZero
virtual bool hasYearZero() const
Definition: kcalendarsystem.cpp:348
KCalendarSystemPrivate::daysInMonth
virtual int daysInMonth(int year, int month) const
Definition: kcalendarsystem.cpp:285
KCalendarSystemPrivate::hasLeapMonths
virtual bool hasLeapMonths() const
Definition: kcalendarsystem.cpp:341
KCalendarSystemPrivate::monthsInYear
virtual int monthsInYear(int year) const
Definition: kcalendarsystem.cpp:277
KCalendarSystemPrivate::maxDaysInWeek
virtual int maxDaysInWeek() const
Definition: kcalendarsystem.cpp:355
KCalendarSystemPrivate::daysInWeek
virtual int daysInWeek() const
Definition: kcalendarsystem.cpp:315
KCalendarSystemPrivate::maxMonthsInYear
virtual int maxMonthsInYear() const
Definition: kcalendarsystem.cpp:362
KCalendarSystemQDate
Definition: kcalendarsystemqdate_p.h:42
KCalendarSystemQDate::isLeapYear
virtual bool isLeapYear(int year) const
Returns whether a given year is a leap year.
Definition: kcalendarsystemqdate.cpp:489
KCalendarSystemQDate::isLunisolar
virtual bool isLunisolar() const
Returns whether the calendar is lunisolar based.
Definition: kcalendarsystemqdate.cpp:529
KCalendarSystemQDate::earliestValidDate
virtual QDate earliestValidDate() const
Returns the earliest date valid in this calendar system implementation.
Definition: kcalendarsystemqdate.cpp:424
KCalendarSystemQDate::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const
Gets specific calendar type week day name.
Definition: kcalendarsystemqdate.cpp:509
KCalendarSystemQDate::isLunar
virtual bool isLunar() const
Returns whether the calendar is lunar based.
Definition: kcalendarsystemqdate.cpp:524
KCalendarSystemQDate::latestValidDate
virtual QDate latestValidDate() const
Returns the latest date valid in this calendar system implementation.
Definition: kcalendarsystemqdate.cpp:431
KCalendarSystemQDate::calendarType
virtual QString calendarType() const
Definition: kcalendarsystemqdate.cpp:413
KCalendarSystemQDate::dayOfWeek
virtual int dayOfWeek(const QDate &date) const
Returns the weekday number for the given date.
Definition: kcalendarsystemqdate.cpp:484
KCalendarSystemQDate::day
virtual int day(const QDate &date) const
Returns the day portion of a given date in the current calendar system.
Definition: kcalendarsystemqdate.cpp:464
KCalendarSystemQDate::month
virtual int month(const QDate &date) const
Returns the month portion of a given date in the current calendar system.
Definition: kcalendarsystemqdate.cpp:459
KCalendarSystemQDate::daysInYear
virtual int daysInYear(const QDate &date) const
Returns the number of days in the given year.
Definition: kcalendarsystemqdate.cpp:469
KCalendarSystemQDate::daysInMonth
virtual int daysInMonth(const QDate &date) const
Returns the number of days in the given month.
Definition: kcalendarsystemqdate.cpp:474
KCalendarSystemQDate::~KCalendarSystemQDate
virtual ~KCalendarSystemQDate()
Definition: kcalendarsystemqdate.cpp:409
KCalendarSystemQDate::epoch
virtual QDate epoch() const
Returns a QDate holding the epoch of the calendar system.
Definition: kcalendarsystemqdate.cpp:418
KCalendarSystemQDate::dateToJulianDay
virtual bool dateToJulianDay(int year, int month, int day, int &jd) const
Internal method to convert YMD values for this calendar system into a Julian Day number.
Definition: kcalendarsystemqdate.cpp:553
KCalendarSystemQDate::isProleptic
virtual bool isProleptic() const
Returns whether the calendar system is proleptic, i.e.
Definition: kcalendarsystemqdate.cpp:539
KCalendarSystemQDate::isSolar
virtual bool isSolar() const
Returns whether the calendar is solar based.
Definition: kcalendarsystemqdate.cpp:534
KCalendarSystemQDate::weekDayOfPray
virtual int weekDayOfPray() const
Definition: kcalendarsystemqdate.cpp:519
KCalendarSystemQDate::isValid
virtual bool isValid(int year, int month, int day) const
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystemqdate.cpp:439
KCalendarSystemQDate::year
virtual int year(const QDate &date) const
Returns the year portion of a given date in the current calendar system.
Definition: kcalendarsystemqdate.cpp:454
KCalendarSystemQDate::monthName
virtual QString monthName(int month, int year, MonthNameFormat format=LongName) const
Gets specific calendar type month name for a given month number If an invalid month is specified,...
Definition: kcalendarsystemqdate.cpp:499
KCalendarSystemQDate::julianDayToDate
virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const
Internal method to convert a Julian Day number into the YMD values for this calendar system.
Definition: kcalendarsystemqdate.cpp:544
KCalendarSystemQDate::dayOfYear
virtual int dayOfYear(const QDate &date) const
Returns the day number of year for the given date.
Definition: kcalendarsystemqdate.cpp:479
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Definition: kcalendarsystem.h:41
KCalendarSystem::KCalendarSystemQDate
friend class KCalendarSystemQDate
Definition: kcalendarsystem.h:1675
KCalendarSystem::monthName
virtual QString monthName(int month, int year, MonthNameFormat format=LongName) const =0
Gets specific calendar type month name for a given month number If an invalid month is specified,...
Definition: kcalendarsystem.cpp:1842
KCalendarSystem::MonthNameFormat
MonthNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:55
KCalendarSystem::WeekDayNameFormat
WeekDayNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:66
KCalendarSystem::isValid
virtual bool isValid(int year, int month, int day) const =0
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystem.cpp:1133
KCalendarSystem::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const =0
Gets specific calendar type week day name.
Definition: kcalendarsystem.cpp:1881
KConfigBase::group
KConfigGroup group(const QByteArray &group)
Returns an object for the named subgroup.
Definition: kconfigbase.cpp:44
KConfigGroup
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:54
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:248
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:70
KLocale::CalendarSystem
CalendarSystem
Definition: klocale.h:780
KLocale::QDateCalendar
@ QDateCalendar
KDE Default, hybrid of Gregorian and Julian as used by QDate.
Definition: klocale.h:781
KLocale::DateTimeComponentFormat
DateTimeComponentFormat
Definition: klocale.h:908
KLocale::LongName
@ LongName
Long text format, e.g.
Definition: klocale.h:915
KLocale::ShortName
@ ShortName
Short text format, e.g.
Definition: klocale.h:914
KLocale::NarrowName
@ NarrowName
Narrow text format, may not be unique, e.g.
Definition: klocale.h:913
KLocale::ShortNumber
@ ShortNumber
Number at its natural width, e.g.
Definition: klocale.h:910
KLocalizedString::toString
QString toString() const
Finalizes the translation, creates QString with placeholders substituted.
Definition: klocalizedstring.cpp:192
KSharedConfig
KConfig variant using shared memory.
Definition: ksharedconfig.h:41
KSharedPtr< KSharedConfig >
QString
kcalendarera_p.h
kcalendarsystemprivate_p.h
kcalendarsystemqdate_p.h
kconfiggroup.h
kdebug.h
kglobal.h
klocale.h
ki18nc
KLocalizedString ki18nc(const char *ctxt, const char *msg)
Creates localized string from a given message, with added context.
Definition: klocalizedstring.cpp:929
i18nc
QString i18nc(const char *ctxt, const char *text)
Returns a localized version of a string and a context.
Definition: klocalizedstring.h:797
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal