remove unnecessary code

This commit is contained in:
Giorgos Tsiapaliwkas 2012-02-12 15:51:55 +02:00
parent 22cf25386a
commit 399bd464db
2 changed files with 17 additions and 113 deletions

View File

@ -21,86 +21,39 @@
#include "kdebug.h"
#include "kconfiggroup.h"
#include <KCalendarSystem>
#include <QtCore/QDateTime>
#include <KDateTime>
//FIXME fix all the create static methods
KCalendarSystem *CalendarSystem::create(const QString &calendarType, const KLocale *locale)
{
return create(calendarSystem(calendarType), locale);
}
KCalendarSystem *CalendarSystem::create(const QString &calendarType, KSharedConfig::Ptr config,
const KLocale *locale)
{
return create(calendarSystem(calendarType), config, locale);
}
QString CalendarSystem::calendarLabel(const QString &calendarType)
{
return m_calendarSystem->calendarLabel(calendarType);
}
KCalendarSystem *CalendarSystem::create(Locale::CalendarSystem calendarSystem, const KLocale *locale)
{
return create(calendarSystem, KSharedConfig::Ptr(), locale);
}
KCalendarSystem *CalendarSystem::create(Locale::CalendarSystem calendarSystem,
KSharedConfig::Ptr config,
const KLocale *locale)
{
switch (calendarSystem) {
case Locale::QDateCalendar:
return new KCalendarSystemQDate(config, locale);
case Locale::CopticCalendar:
return new KCalendarSystemCoptic(config, locale);
case Locale::EthiopianCalendar:
return new KCalendarSystemEthiopian(config, locale);
case Locale::GregorianCalendar:
return new KCalendarSystemGregorian(config, locale);
case Locale::HebrewCalendar:
return new KCalendarSystemHebrew(config, locale);
case Locale::IndianNationalCalendar:
return new KCalendarSystemIndianNational(config, locale);
case Locale::IslamicCivilCalendar:
return new KCalendarSystemIslamicCivil(config, locale);
case Locale::JalaliCalendar:
return new KCalendarSystemJalali(config, locale);
case Locale::JapaneseCalendar:
return new KCalendarSystemJapanese(config, locale);
case Locale::JulianCalendar:
return new KCalendarSystemJulian(config, locale);
case Locale::MinguoCalendar:
return new KCalendarSystemMinguo(config, locale);
case Locale::ThaiCalendar:
return new KCalendarSystemThai(config, locale);
default:
return new KCalendarSystemQDate(config, locale);
}
}
QList<Locale::CalendarSystem> CalendarSystem::calendarSystemsList()
{
QList<Locale::CalendarSystem> list;
foreach(KLocale::CalendarSystem calendarSystem, m_calendarSystem->calendarSystemList()) {
foreach(KLocale::CalendarSystem calendarSystem, KCalendarSystem::calendarSystemsList()) {
list.append((Locale::CalendarSystem)calendarSystem);
}
return list;
}
QString CalendarSystem::calendarLabel(Locale::CalendarSystem calendarSystem, const Locale *locale)
QString CalendarSystem::calendarLabel(Locale::CalendarSystem calendarSystem, const KLocale *locale)
{
return m_calendarSystem->calendarLabel((KLocale::CalendarSystem)calendarSystem, (KLocale)locale);
return KCalendarSystem::calendarLabel((KLocale::CalendarSystem)calendarSystem, locale);
}
QString CalendarSystem::calendarType(Locale::CalendarSystem calendarSystem)
{
return KCalendarSystem::calendarType((KLocale::CalendarSystem)calendarSystem);
}
Locale::CalendarSystem CalendarSystem::calendarSystem(const QString &calendarType )
{
return (Locale::CalendarSystem)m_calendarSystem->calendarSystem(calendarType);
return (Locale::CalendarSystem)KCalendarSystem::calendarSystem(calendarType);
}
// NOT VIRTUAL - If override needed use shared-d
@ -112,7 +65,7 @@ Locale::CalendarSystem CalendarSystem::calendarSystem() const
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::calendarLabel() const
{
return CalendarSystem::calendarLabel(calendarSystem());
return m_calendarSystem->calendarLabel();
}
// Dummy version using Gregorian as an example
@ -183,7 +136,7 @@ bool CalendarSystem::setDate(QDate &date, QString eraName, int yearInEra, int mo
// NOT VIRTUAL - If override needed use shared-d
bool CalendarSystem::setDateIsoWeek(QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const
{
m_calendarSystem->setDateIsoWeek(date, year, isoWeekNumber, dayOfIsoWeek);
return m_calendarSystem->setDateIsoWeek(date, year, isoWeekNumber, dayOfIsoWeek);
}
// NOT VIRTUAL - If override needed use shared-d

View File

@ -21,7 +21,6 @@
#ifndef CALENDARSYSTEM_H
#define CALENDARSYSTEM_H
#include <kcalendarsystem.h>
#include "locale.h" // needed for enums
#include "kglobal.h"
@ -75,31 +74,11 @@ public:
NarrowDayName /**< Narrow name format, e.g. "F". @since 4.7 */
};
//KDE5 add default value to calendarSystem
/**
*
* Creates a KCalendarSystem object for the required Calendar System
*
* @param calendarSystem the Calendar System to create, defaults to QDate compatible
* @param locale locale to use for translations. The global locale is used if null.
* @return a KCalendarSystem object
*/
Q_INVOKABLE static KCalendarSystem *create(Locale::CalendarSystem calendarSystem,
const KLocale *locale = 0);
/**
*
* Creates a KCalendarSystem object for the required Calendar System
*
* @param calendarSystem the Calendar System to create
* @param config a configuration file with a 'KCalendarSystem %calendarType' group detailing
* locale-related preferences (such as era options). The global config is used
if null.
* @param locale locale to use for translations. The global locale is used if null.
* @return a KCalendarSystem object
*/
Q_INVOKABLE static KCalendarSystem *create(Locale::CalendarSystem calendarSystem, KSharedConfig::Ptr config,
const KLocale *locale = 0);
* Returns the list of currently supported Calendar Systems
* @return list of Calendar Systems
*/
static QList<Locale::CalendarSystem> calendarSystemsList();
/**
*
@ -135,28 +114,6 @@ public:
*/
Q_INVOKABLE static QString calendarType(Locale::CalendarSystem calendarSystem);
/**
* Constructor of abstract calendar class. This will be called by derived classes.
*
* @param locale locale to use for translations. The global locale is used if null.
*/
explicit KCalendarSystem(const KLocale *locale = 0);
/**
* Constructor of abstract calendar class. This will be called by derived classes.
*
* @param config a configuration file with a 'KCalendarSystem %calendarName' group detailing
* locale-related preferences (such as era options). The global config is used
if null.
* @param locale locale to use for translations. The global locale is used if null.
*/
explicit KCalendarSystem(const KSharedConfig::Ptr config, const KLocale *locale = 0);
/**
* Destructor.
*/
virtual ~KCalendarSystem();
/**
*
* Returns the Calendar System type of the KCalendarSystem object
@ -1260,9 +1217,6 @@ protected:
if null.
* @param locale locale to use for translations. The global locale is used if null.
*/
KCalendarSystem(KCalendarSystemPrivate &dd,
const KSharedConfig::Ptr config = KSharedConfig::Ptr(),
const KLocale *locale = 0);
private:
//FIXME When it comes the time to create wrappers for the above
@ -1293,10 +1247,7 @@ private:
KCalendarEra era(const QDate &eraDate) const;
KCalendarEra era(const QString &eraName, int yearInEra) const;
//Q_DISABLE_COPY(KCalendarSystem)
KCalendarSystem *m_calendarSystem;
//FIXME What is Q_DECLARE_PRIVATE
//Q_DECLARE_PRIVATE(KCalendarSystem)
};
#endif