Branch 'libkolab-0.4' - 2 commits - cmake/modules conversion/timezoneconverter.cpp tests/timezonetest.cpp tests/timezonetest.h
Christian Mollekopf
mollekopf at kolabsys.com
Sat Oct 5 00:27:16 CEST 2013
cmake/modules/FindLibcalendaring.cmake | 3 +++
conversion/timezoneconverter.cpp | 7 +++++++
tests/timezonetest.cpp | 15 +++++++++++++++
tests/timezonetest.h | 2 ++
4 files changed, 27 insertions(+)
New commits:
commit 45d7e2a141b9357ba7e1d64548a8dede226fb35a
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 225d5babc1cd7f02676d42456a97737a00128269
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 1e903f9..300c6a6 100644
--- a/tests/timezonetest.cpp
+++ b/tests/timezonetest.cpp
@@ -28,6 +28,7 @@
#include <kdebug.h>
#include <kcalcore/event.h>
#include <kcalcore/icalformat.h>
+#include <ksystemtimezone.h>
// void icuFoo()
// {
@@ -145,6 +146,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 7d76969..1500105 100644
--- a/tests/timezonetest.h
+++ b/tests/timezonetest.h
@@ -28,6 +28,8 @@ private slots:
void testFromHardcodedList();
void testKolabObjectWriter();
void testKolabObjectReader();
+ void testFindLegacyTimezone();
+ void testTimezoneDaemonAvailable();
};
#endif // TIMEZONETEST_H
More information about the commits
mailing list