[PATCH 09/23] kcalendarsystem: Remove deprecated functions sceduled for removal

Jon Severinsson jon at severinsson.net
Fri Oct 12 15:13:44 UTC 2012


---
 kdecore/date/kcalendarsystem.cpp |  107 --------------------------------------
 kdecore/date/kcalendarsystem.h   |   99 ++---------------------------------
 kdecore/tests/kcalendartest.cpp  |   87 -------------------------------
 kdecore/tests/kdatetimetest.cpp  |    2 +-
 kdeui/widgets/kdatepicker.cpp    |    5 --
 kdeui/widgets/kdatepicker.h      |    9 ----
 kdeui/widgets/kdatetable.cpp     |    5 --
 kdeui/widgets/kdatetable.h       |    9 ----
 kdeui/widgets/kdatewidget.cpp    |    5 --
 kdeui/widgets/kdatewidget.h      |    9 ----
 10 filer ändrade, 4 tillägg(+), 333 borttagningar(-)

diff --git a/kdecore/date/kcalendarsystem.cpp b/kdecore/date/kcalendarsystem.cpp
index 11fd86c..afc2a18 100644
--- a/kdecore/date/kcalendarsystem.cpp
+++ b/kdecore/date/kcalendarsystem.cpp
@@ -44,46 +44,6 @@
 #include "kcalendarsystemqdate_p.h"
 #include "kcalendarsystemthai_p.h"
 
-KCalendarSystem *KCalendarSystem::create(const QString &calendarType, const KLocale *locale)
-{
-    return create(calendarSystem(calendarType), locale);
-}
-
-KCalendarSystem *KCalendarSystem::create(const QString &calendarType, KSharedConfig::Ptr config,
-                                         const KLocale *locale)
-{
-    return create(calendarSystem(calendarType), config, locale);
-}
-
-QStringList KCalendarSystem::calendarSystems()
-{
-    QStringList lst;
-
-    lst.append(QLatin1String("coptic"));
-    lst.append(QLatin1String("ethiopian"));
-    lst.append(QLatin1String("gregorian"));
-    lst.append(QLatin1String("gregorian-proleptic"));
-    lst.append(QLatin1String("hebrew"));
-    lst.append(QLatin1String("hijri"));
-    lst.append(QLatin1String("indian-national"));
-    lst.append(QLatin1String("jalali"));
-    lst.append(QLatin1String("japanese"));
-    lst.append(QLatin1String("julian"));
-    lst.append(QLatin1String("minguo"));
-    lst.append(QLatin1String("thai"));
-
-    return lst;
-}
-
-QString KCalendarSystem::calendarLabel(const QString &calendarType)
-{
-    if (calendarSystemsList().contains(calendarSystem(calendarType))) {
-        return KCalendarSystem::calendarLabel(KCalendarSystem::calendarSystem(calendarType));
-    } else {
-        return ki18nc("@item Calendar system", "Invalid Calendar Type").toString(KLocale::global());
-    }
-}
-
 KCalendarSystem *KCalendarSystem::create(KLocale::CalendarSystem calendarSystem, const KLocale *locale)
 {
     return create(calendarSystem, KSharedConfig::Ptr(), locale);
@@ -175,73 +135,6 @@ QString KCalendarSystem::calendarLabel(KLocale::CalendarSystem calendarSystem, c
     return ki18nc("@item Calendar system", "Invalid Calendar Type").toString(locale);
 }
 
-KLocale::CalendarSystem KCalendarSystem::calendarSystemForCalendarType(const QString &calendarType )
-{
-    return calendarSystem( calendarType );
-}
-
-KLocale::CalendarSystem KCalendarSystem::calendarSystem(const QString &calendarType )
-{
-    if (calendarType == QLatin1String("coptic")) {
-        return KLocale::CopticCalendar;
-    } else if (calendarType == QLatin1String("ethiopian")) {
-        return KLocale::EthiopianCalendar;
-    } else if (calendarType == QLatin1String("gregorian")) {
-        return KLocale::QDateCalendar;
-    } else if (calendarType == QLatin1String("gregorian-proleptic")) {
-        return KLocale::GregorianCalendar;
-    } else if (calendarType == QLatin1String("hebrew")) {
-        return KLocale::HebrewCalendar;
-    } else if (calendarType == QLatin1String("hijri")) {
-        return KLocale::IslamicCivilCalendar;
-    } else if (calendarType == QLatin1String("indian-national")) {
-        return KLocale::IndianNationalCalendar;
-    } else if (calendarType == QLatin1String("jalali")) {
-        return KLocale::JalaliCalendar;
-    } else if (calendarType == QLatin1String("japanese")) {
-        return KLocale::JapaneseCalendar;
-    } else if (calendarType == QLatin1String("julian")) {
-        return KLocale::JulianCalendar;
-    } else if (calendarType == QLatin1String("minguo")) {
-        return KLocale::MinguoCalendar;
-    } else if (calendarType == QLatin1String("thai")) {
-        return KLocale::ThaiCalendar;
-    } else {
-        return KLocale::QDateCalendar;
-    }
-}
-
-QString KCalendarSystem::calendarType(KLocale::CalendarSystem calendarSystem)
-{
-    if (calendarSystem == KLocale::QDateCalendar) {
-        return QLatin1String("gregorian");
-    } else if (calendarSystem == KLocale::CopticCalendar) {
-        return QLatin1String("coptic");
-    } else if (calendarSystem == KLocale::EthiopianCalendar) {
-        return QLatin1String("ethiopian");
-    } else if (calendarSystem == KLocale::GregorianCalendar) {
-        return QLatin1String("gregorian-proleptic");
-    } else if (calendarSystem == KLocale::HebrewCalendar) {
-        return QLatin1String("hebrew");
-    } else if (calendarSystem == KLocale::IndianNationalCalendar) {
-        return QLatin1String("indian-national");
-    } else if (calendarSystem == KLocale::IslamicCivilCalendar) {
-        return QLatin1String("hijri");
-    } else if (calendarSystem == KLocale::JalaliCalendar) {
-        return QLatin1String("jalali");
-    } else if (calendarSystem == KLocale::JapaneseCalendar) {
-        return QLatin1String("japanese");
-    } else if (calendarSystem == KLocale::JulianCalendar) {
-        return QLatin1String("julian");
-    } else if (calendarSystem == KLocale::MinguoCalendar) {
-        return QLatin1String("minguo");
-    } else if (calendarSystem == KLocale::ThaiCalendar) {
-        return QLatin1String("thai");
-    } else {
-        return QLatin1String("gregorian");
-    }
-}
-
 // Shared d pointer base class definitions
 
 KCalendarSystemPrivate::KCalendarSystemPrivate(KCalendarSystem *q_ptr)
diff --git a/kdecore/date/kcalendarsystem.h b/kdecore/date/kcalendarsystem.h
index 42cefd4..45f10a1 100644
--- a/kdecore/date/kcalendarsystem.h
+++ b/kdecore/date/kcalendarsystem.h
@@ -68,39 +68,6 @@ public:
         NarrowDayName                /**< Narrow name format, e.g. "F". @since 4.7 */
     };
 
-    //KDE5 remove
-    /**
-     * @deprecated use create(KLocale::CalendarSystem, KLocale) instead
-     *
-     * Creates specific calendar type
-     *
-     * @param calType string identification of the specific calendar type
-     * to be constructed
-     * @param locale locale to use for translations. The global locale is used if null.
-     * @return a KCalendarSystem object
-     */
-    KDECORE_DEPRECATED static KCalendarSystem *create(const QString & calType = QLatin1String("gregorian"),
-                                                  const KLocale * locale = 0);
-
-    //KDE5 remove
-    /**
-     * @deprecated use create(KLocale::CalendarSystem, KSharedConfig, KLocale) instead
-     *
-     * @since 4.5
-     *
-     * Creates specific calendar type
-     *
-     * @param calType string identification of the specific calendar type to be constructed
-     * @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
-     */
-    KDECORE_DEPRECATED static KCalendarSystem *create(const QString & calType, KSharedConfig::Ptr config,
-                                                  const KLocale * locale = 0);
-
-    //KDE5 add default value to calendarSystem
     /**
      * @since 4.6
      *
@@ -111,7 +78,7 @@ public:
      * @return a KCalendarSystem object
      */
     static KCalendarSystem *create(KLocale::CalendarSystem calendarSystem,
-                                   const KLocale *locale = 0);
+                                   const KLocale *locale);
 
     /**
      * @since 4.6
@@ -125,19 +92,10 @@ public:
      * @param locale locale to use for translations. The global locale is used if null.
      * @return a KCalendarSystem object
      */
-    static KCalendarSystem *create(KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config,
+    static KCalendarSystem *create(KLocale::CalendarSystem calendarSystem = KLocale::QDateCalendar,
+                                   KSharedConfig::Ptr config = KSharedConfig::Ptr(),
                                    const KLocale *locale = 0);
 
-    //KDE5 remove
-    /**
-     * @deprecated use calendarSystemsList() instead
-     *
-     * Gets a list of names of supported calendar systems.
-     *
-     * @return list of names
-     */
-    KDECORE_DEPRECATED static QStringList calendarSystems();
-
     /**
      * @since 4.6
      *
@@ -147,20 +105,6 @@ public:
      */
     static QList<KLocale::CalendarSystem> calendarSystemsList();
 
-    //KDE5 remove
-    /**
-     * @deprecated use calendarLabel( KLocale::CalendarSystem ) instead
-     *
-     * Returns a typographically correct and translated label to display for
-     * the calendar system type.  Use with calendarSystems() to neatly
-     * format labels to display on combo widget of available calendar systems.
-     *
-     * @param calendarType the specific calendar type to return the label for
-     *
-     * @return label for calendar
-     */
-    KDECORE_DEPRECATED static QString calendarLabel(const QString &calendarType);
-
     /**
      * @since 4.6
      *
@@ -175,43 +119,6 @@ public:
      */
     static QString calendarLabel(KLocale::CalendarSystem calendarSystem, const KLocale *locale = KLocale::global());
 
-    //KDE5 Remove
-    /**
-     * @deprecated use calendarSystem(const QString &calendarType) instead
-     * @since 4.6
-     *
-     * Returns the Calendar System enum value for a given Calendar Type,
-     * e.g. KLocale::QDateCalendar for "gregorian"
-     *
-     * @param calendarType the calendar type to convert
-     * @return calendar system for calendar type
-     */
-    KDECORE_DEPRECATED static KLocale::CalendarSystem calendarSystemForCalendarType(const QString &calendarType);
-
-    //KDE5 Remove
-    /**
-     * @since 4.7
-     *
-     * Returns the Calendar System enum value for a given Calendar Type,
-     * e.g. KLocale::QDateCalendar for "gregorian"
-     *
-     * @param calendarType the calendar type to convert
-     * @return calendar system for calendar type
-     */
-    static KLocale::CalendarSystem calendarSystem(const QString &calendarType);
-
-    //KDE5 remove
-    /**
-     * @since 4.7
-     *
-     * Returns the deprecated Calendar Type for a given Calendar System enum value,
-     * e.g. "gregorian" for KLocale::QDateCalendar
-     *
-     * @param calendarSystem the calendar system to convert
-     * @return calendar type for calendar system
-     */
-    static QString calendarType(KLocale::CalendarSystem calendarSystem);
-
     /**
      * Destructor.
      */
diff --git a/kdecore/tests/kcalendartest.cpp b/kdecore/tests/kcalendartest.cpp
index 397166a..051e8cc 100644
--- a/kdecore/tests/kcalendartest.cpp
+++ b/kdecore/tests/kcalendartest.cpp
@@ -36,62 +36,6 @@ QTEST_KDEMAIN_CORE_WITH_COMPONENTNAME(KCalendarTest, "kdecalendarsystems" /*so t
 void KCalendarTest::testTypes()
 {
     const KCalendarSystem *calendar;
-    calendar = KCalendarSystem::create("coptic");
-    QCOMPARE(calendar->calendarType(), QString("coptic"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::CopticCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("ethiopian");
-    QCOMPARE(calendar->calendarType(), QString("ethiopian"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::EthiopianCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("gregorian");
-    QCOMPARE(calendar->calendarType(), QString("gregorian"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::QDateCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("gregorian-proleptic");
-    QCOMPARE(calendar->calendarType(), QString("gregorian-proleptic"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::GregorianCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("hebrew");
-    QCOMPARE(calendar->calendarType(), QString("hebrew"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::HebrewCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("hijri");
-    QCOMPARE(calendar->calendarType(), QString("hijri"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::IslamicCivilCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("indian-national");
-    QCOMPARE(calendar->calendarType(), QString("indian-national"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::IndianNationalCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("jalali");
-    QCOMPARE(calendar->calendarType(), QString("jalali"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::JalaliCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("japanese");
-    QCOMPARE(calendar->calendarType(), QString("japanese"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::JapaneseCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("julian");
-    QCOMPARE(calendar->calendarType(), QString("julian"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::JulianCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("minguo");
-    QCOMPARE(calendar->calendarType(), QString("minguo"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::MinguoCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("thai");
-    QCOMPARE(calendar->calendarType(), QString("thai"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::ThaiCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create("invalid");
-    QCOMPARE(calendar->calendarType(), QString("gregorian"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::QDateCalendar);
-    delete calendar;
-    calendar = KCalendarSystem::create(QString());
-    QCOMPARE(calendar->calendarType(), QString("gregorian"));
-    QCOMPARE(calendar->calendarSystem(), KLocale::QDateCalendar);
-    delete calendar;
 
     calendar = KCalendarSystem::create(KLocale::QDateCalendar);
     QCOMPARE(calendar->calendarType(), QString("gregorian"));
@@ -142,21 +86,6 @@ void KCalendarTest::testTypes()
     QCOMPARE(calendar->calendarSystem(), KLocale::ThaiCalendar);
     delete calendar;
 
-    QStringList lst = KCalendarSystem::calendarSystems();
-    QCOMPARE(lst.count(), 12);
-    QVERIFY(lst.contains("coptic"));
-    QVERIFY(lst.contains("ethiopian"));
-    QVERIFY(lst.contains("gregorian"));
-    QVERIFY(lst.contains("gregorian-proleptic"));
-    QVERIFY(lst.contains("hebrew"));
-    QVERIFY(lst.contains("hijri"));
-    QVERIFY(lst.contains("indian-national"));
-    QVERIFY(lst.contains("jalali"));
-    QVERIFY(lst.contains("japanese"));
-    QVERIFY(lst.contains("julian"));
-    QVERIFY(lst.contains("minguo"));
-    QVERIFY(lst.contains("thai"));
-
     QList<KLocale::CalendarSystem> list = KCalendarSystem::calendarSystemsList();
     QCOMPARE(list.count(), 12);
     QVERIFY(list.contains(KLocale::QDateCalendar));
@@ -172,19 +101,6 @@ void KCalendarTest::testTypes()
     QVERIFY(list.contains(KLocale::MinguoCalendar));
     QVERIFY(list.contains(KLocale::ThaiCalendar));
 
-    QCOMPARE(KCalendarSystem::calendarLabel("coptic"),              QString("Coptic"));
-    QCOMPARE(KCalendarSystem::calendarLabel("ethiopian"),           QString("Ethiopian"));
-    QCOMPARE(KCalendarSystem::calendarLabel("gregorian"),           QString("Gregorian"));
-    QCOMPARE(KCalendarSystem::calendarLabel("gregorian-proleptic"), QString("Gregorian (Proleptic)"));
-    QCOMPARE(KCalendarSystem::calendarLabel("hebrew"),              QString("Hebrew"));
-    QCOMPARE(KCalendarSystem::calendarLabel("hijri"),               QString("Islamic / Hijri (Civil)"));
-    QCOMPARE(KCalendarSystem::calendarLabel("indian-national"),     QString("Indian National"));
-    QCOMPARE(KCalendarSystem::calendarLabel("jalali"),              QString("Jalali"));
-    QCOMPARE(KCalendarSystem::calendarLabel("japanese"),            QString("Japanese"));
-    QCOMPARE(KCalendarSystem::calendarLabel("julian"),              QString("Julian"));
-    QCOMPARE(KCalendarSystem::calendarLabel("minguo"),              QString("Taiwanese"));
-    QCOMPARE(KCalendarSystem::calendarLabel("thai"),                QString("Thai"));
-
     QCOMPARE(KCalendarSystem::calendarLabel(KLocale::QDateCalendar),          QString("Gregorian"));
     QCOMPARE(KCalendarSystem::calendarLabel(KLocale::CopticCalendar),         QString("Coptic"));
     QCOMPARE(KCalendarSystem::calendarLabel(KLocale::EthiopianCalendar),      QString("Ethiopian"));
@@ -1934,12 +1850,9 @@ void KCalendarTest::testCalendarSystemType(const KCalendarSystem *calendar,
                                            KLocale::CalendarSystem system,
                                            const QString &type, const QString &label)
 {
-    QCOMPARE(calendar->calendarType(system),         type);
-    QCOMPARE(calendar->calendarSystem(type),         system);
     QCOMPARE(calendar->calendarType(),               type);
     QCOMPARE(calendar->calendarSystem(),             system);
     QCOMPARE(calendar->calendarLabel(),              label);
-    QCOMPARE(KCalendarSystem::calendarLabel(type),   label);
     QCOMPARE(KCalendarSystem::calendarLabel(system), label);
 }
 
diff --git a/kdecore/tests/kdatetimetest.cpp b/kdecore/tests/kdatetimetest.cpp
index 5d6577b..7114d12 100644
--- a/kdecore/tests/kdatetimetest.cpp
+++ b/kdecore/tests/kdatetimetest.cpp
@@ -3628,7 +3628,7 @@ void KDateTimeTest::strings_qttextdate()
 
 void KDateTimeTest::strings_format()
 {
-    KCalendarSystem* calendar = KCalendarSystem::create(QString("gregorian"), KLocale::global());
+    KCalendarSystem* calendar = KCalendarSystem::create(KLocale::GregorianCalendar, KLocale::global());
     KTimeZone london = KSystemTimeZones::zone("Europe/London");
     KTimeZone paris  = KSystemTimeZones::zone("Europe/Paris");
     KTimeZone berlin = KSystemTimeZones::zone("Europe/Berlin");
diff --git a/kdeui/widgets/kdatepicker.cpp b/kdeui/widgets/kdatepicker.cpp
index f029f34..e0a8362 100644
--- a/kdeui/widgets/kdatepicker.cpp
+++ b/kdeui/widgets/kdatepicker.cpp
@@ -401,11 +401,6 @@ bool KDatePicker::setCalendar( KCalendarSystem *calendar )
     return  d->table->setCalendar( calendar );
 }
 
-bool KDatePicker::setCalendar( const QString &calendarType )
-{
-    return  d->table->setCalendar( calendarType );
-}
-
 bool KDatePicker::setCalendarSystem( KLocale::CalendarSystem calendarSystem )
 {
     return  d->table->setCalendarSystem( calendarSystem );
diff --git a/kdeui/widgets/kdatepicker.h b/kdeui/widgets/kdatepicker.h
index fd96964..2f51776 100644
--- a/kdeui/widgets/kdatepicker.h
+++ b/kdeui/widgets/kdatepicker.h
@@ -113,15 +113,6 @@ public:
     bool setCalendar( KCalendarSystem *calendar = 0 );
 
     /**
-     * Changes the calendar system to use.  Will always use global locale.
-     *
-     * @param calendarType the calendar system type to use
-     *
-     * @return @c true if the calendar system was successfully set, @c false otherwise
-     */
-    bool setCalendar( const QString &calendarType );
-
-    /**
      * @since 4.6
      *
      * Changes the calendar system to use.  Will always use global locale.
diff --git a/kdeui/widgets/kdatetable.cpp b/kdeui/widgets/kdatetable.cpp
index c07efad..d60f3d5 100644
--- a/kdeui/widgets/kdatetable.cpp
+++ b/kdeui/widgets/kdatetable.cpp
@@ -797,11 +797,6 @@ bool KDateTable::setCalendar( KCalendarSystem *newCalendar )
     return setDate( oldDate );
 }
 
-bool KDateTable::setCalendar( const QString &newCalendarType )
-{
-    return setCalendarSystem( KCalendarSystem::calendarSystem( newCalendarType ) );
-}
-
 bool KDateTable::setCalendarSystem( KLocale::CalendarSystem newCalendarSystem )
 {
     d->m_date.setCalendarSystem( newCalendarSystem );
diff --git a/kdeui/widgets/kdatetable.h b/kdeui/widgets/kdatetable.h
index 733185d..66a8997 100644
--- a/kdeui/widgets/kdatetable.h
+++ b/kdeui/widgets/kdatetable.h
@@ -201,15 +201,6 @@ public:
     bool setCalendar( KCalendarSystem *calendar = 0 );
 
     /**
-     * Changes the calendar system to use.  Will always use global locale.
-     * 
-     * @param calendarType the calendar system type to use
-     * 
-     * @return @c true if the calendar system was successfully set, @c false otherwise
-     */
-    bool setCalendar( const QString &calendarType );
-
-    /**
      * @since 4.6
      *
      * Changes the calendar system to use.  Will always use global locale.
diff --git a/kdeui/widgets/kdatewidget.cpp b/kdeui/widgets/kdatewidget.cpp
index 5aca3bb..dc132ee 100644
--- a/kdeui/widgets/kdatewidget.cpp
+++ b/kdeui/widgets/kdatewidget.cpp
@@ -170,11 +170,6 @@ bool KDateWidget::setCalendar( KCalendarSystem *newCalendar )
     return setDate( oldDate );
 }
 
-bool KDateWidget::setCalendar( const QString &newCalendarType )
-{
-    return setCalendarSystem( KCalendarSystem::calendarSystem( newCalendarType ) );
-}
-
 bool KDateWidget::setCalendarSystem( KLocale::CalendarSystem newCalendarSystem )
 {
     d->m_date.setCalendarSystem( newCalendarSystem );
diff --git a/kdeui/widgets/kdatewidget.h b/kdeui/widgets/kdatewidget.h
index 715a713..e955338 100644
--- a/kdeui/widgets/kdatewidget.h
+++ b/kdeui/widgets/kdatewidget.h
@@ -93,15 +93,6 @@ public:
     bool setCalendar( KCalendarSystem *calendar = 0 );
 
     /**
-     * Changes the calendar system to use.  Will always use global locale.
-     * 
-     * @param calendarType the calendar system type to use
-     * 
-     * @return @c true if the calendar system was successfully set, @c false otherwise
-     */
-    bool setCalendar( const QString &calendarType );
-
-    /**
      * @since 4.6
      *
      * Changes the calendar system to use.  Will always use global locale.
-- 
1.7.10.4



More information about the Kde-frameworks-devel mailing list