2 commits - cmake/modules conversion/timezoneconverter.cpp tests/timezonetest.cpp tests/timezonetest.h

Christian Mollekopf mollekopf at kolabsys.com
Sat Oct 5 00:28:02 CEST 2013


 cmake/modules/FindLibcalendaring.cmake |    3 +++
 conversion/timezoneconverter.cpp       |    7 +++++++
 tests/timezonetest.cpp                 |   14 ++++++++++++++
 tests/timezonetest.h                   |    2 ++
 4 files changed, 26 insertions(+)

New commits:
commit e1c392ed879519c4fb407ea67d0f433b6d0fa5be
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Sat Oct 5 00:27:01 2013 +0200

    Compile again with libcalendaring. We need to export the version number in libcalendaring.

diff --git a/cmake/modules/FindLibcalendaring.cmake b/cmake/modules/FindLibcalendaring.cmake
index 4b5dfd5..baa72e2 100644
--- a/cmake/modules/FindLibcalendaring.cmake
+++ b/cmake/modules/FindLibcalendaring.cmake
@@ -15,6 +15,9 @@ find_path(CALENDARING_INCLUDE_DIRS NAMES calendaring/kdatetime.h)
 set( Libcalendaring_INCLUDE_DIRS "${CALENDARING_INCLUDE_DIRS}/calendaring" )
 
 set( Libcalendaring_LIBRARIES ${CALENDARING_KDECORE} ${CALENDARING_KCALCORE} ${CALENDARING_KMIME} ${CALENDARING_KIMAP} ${CALENDARING_KABC} ${CALENDARING_NOTES} ${CALENDARING_KCALUTILS} ${CALENDARING_KPIMUTILS})
+set(KdepimLibs_VERSION_MAJOR 4)
+set(KdepimLibs_VERSION_MINOR 10)
+set(KdepimLibs_VERSION_PATCH 0)
 
 find_package_handle_standard_args(Libcalendaring  DEFAULT_MSG
                                   CALENDARING_KDECORE CALENDARING_KCALCORE CALENDARING_KMIME CALENDARING_KIMAP CALENDARING_KABC CALENDARING_NOTES CALENDARING_KCALUTILS CALENDARING_KPIMUTILS CALENDARING_INCLUDE_DIRS)


commit 3dc95bd7b371577e319d0aae8a233c2f9d69ac7c
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Sat Oct 5 00:25:37 2013 +0200

    Recognize all kinds of legacy timezones.

diff --git a/conversion/timezoneconverter.cpp b/conversion/timezoneconverter.cpp
index acd81d1..4736b68 100644
--- a/conversion/timezoneconverter.cpp
+++ b/conversion/timezoneconverter.cpp
@@ -39,6 +39,13 @@ QString TimezoneConverter::normalizeTimezone(const QString& tz)
     if (guessedTimezone.isEmpty()) {
         guessedTimezone = fromGMTOffsetTimezone(tz);
     }
+    if (guessedTimezone.isEmpty()) {
+        //slower but also finds outdated zones
+        timezone = KSystemTimeZones::readZone(tz);
+        if (timezone.isValid()) {
+            return tz;
+        }
+    }
     Debug() << "Guessed timezone and found: " << guessedTimezone;
     return guessedTimezone;
 }
diff --git a/tests/timezonetest.cpp b/tests/timezonetest.cpp
index 35aae7c..92f09ce 100644
--- a/tests/timezonetest.cpp
+++ b/tests/timezonetest.cpp
@@ -152,6 +152,20 @@ void TimezoneTest::testKolabObjectReader()
     QVERIFY( *(realIncidence.data()) ==  *(convertedIncidence.data()) );
 }
 
+void TimezoneTest::testFindLegacyTimezone()
+{
+    const QString normalized = TimezoneConverter::normalizeTimezone("US/Pacific");
+    kDebug() << normalized;
+    QVERIFY(!normalized.isEmpty());
+}
+
+void TimezoneTest::testTimezoneDaemonAvailable()
+{
+    //With KDE it should be available and with libcalendaring it should return true
+    QVERIFY(KSystemTimeZones::isTimeZoneDaemonAvailable());
+}
+
+
 QTEST_MAIN( TimezoneTest )
 
 #include "timezonetest.moc"
diff --git a/tests/timezonetest.h b/tests/timezonetest.h
index efaaddc..ed2f33f 100644
--- a/tests/timezonetest.h
+++ b/tests/timezonetest.h
@@ -33,6 +33,8 @@ private slots:
     void testFromHardcodedList();
     void testKolabObjectWriter();
     void testKolabObjectReader();
+    void testFindLegacyTimezone();
+    void testTimezoneDaemonAvailable();
 };
 
 #endif // TIMEZONETEST_H




More information about the commits mailing list