From 029237d1f67f7433ae523dc0ef33bc9f53ea53b3 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Tue, 23 Jun 2026 10:35:06 +0900
Subject: Replace custom define USE_LIBICAL_3_0 with official
 ICAL_CHECK_VERSION check

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 libkcal/ConfigureChecks.cmake |  4 ----
 libkcal/icalformatimpl.cpp    | 12 ++++++------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/libkcal/ConfigureChecks.cmake b/libkcal/ConfigureChecks.cmake
index de6fca5b..4c27fa15 100644
--- a/libkcal/ConfigureChecks.cmake
+++ b/libkcal/ConfigureChecks.cmake
@@ -12,10 +12,6 @@
 # libical
 pkg_search_module( LIBICAL libical )
 if( LIBICAL_FOUND )
-  # check for libical >= 3.0
-  if( NOT (LIBICAL_VERSION VERSION_LESS "3.0") )
-    add_definitions(-DUSE_LIBICAL_3_0)
-  endif( )
 else( )
   tde_message_fatal( "libical are required, but not found on your system" )
 endif()
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index ad1c70cf..2e686900 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -1919,7 +1919,7 @@ icaltimetype ICalFormatImpl::writeICalDate(const TQDate &date)
   t.second = 0;
 
   t.is_date = 1;
-#ifndef USE_LIBICAL_3_0
+#if !ICAL_CHECK_VERSION(3,0,0)
 	t.is_utc = 0;
 #endif
   t.zone = 0;
@@ -1941,7 +1941,7 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
 
   t.is_date = 0;
   t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
-#ifndef USE_LIBICAL_3_0
+#if !ICAL_CHECK_VERSION(3,0,0)
 	t.is_utc = 0;
 #endif
 
@@ -1958,7 +1958,7 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
       t.zone = tz;
       t = icaltime_convert_to_zone( t, utc );
     } else {
-#ifndef USE_LIBICAL_3_0
+#if !ICAL_CHECK_VERSION(3,0,0)
 			t.is_utc = 1;
 #endif
       t.zone = utc;
@@ -1972,7 +1972,7 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
 TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz )
 {
 //   kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl;
-#ifdef USE_LIBICAL_3_0
+#if ICAL_CHECK_VERSION(3,0,0)
   bool time_is_utc = icaltime_is_utc(t);
 #else
   bool time_is_utc = t.is_utc;
@@ -1993,13 +1993,13 @@ TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, i
 		}
 		else {
 		    if (tz && tz != icaltimezone_get_utc_timezone()) {
-#ifndef USE_LIBICAL_3_0
+#if !ICAL_CHECK_VERSION(3,0,0)
 						t.is_utc = 0;
 #endif
 						t.zone = tz;
 				}
 				else {
-#ifndef USE_LIBICAL_3_0
+#if !ICAL_CHECK_VERSION(3,0,0)
 						t.is_utc = 1;
 #endif
 						t.zone = icaltimezone_get_utc_timezone();
-- 
cgit v1.2.3

