summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-06-26 11:02:49 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-06-26 11:02:49 (GMT)
commitdb6eb28e9626dd78156b9c6fc17bc0c65ff2f6ca (patch)
tree3a6daf4a5ab5052a24ec18f404b028233c0ae8ba
parent76178c821932ada88863877e9652056a84cb1018 (diff)
downloadlibcalendaring-db6eb28e9626dd78156b9c6fc17bc0c65ff2f6ca.tar.gz
and kmime builds as well
-rw-r--r--kmime/cmake/CMakeLists.txt3
-rw-r--r--kmime/cmake/modules/CMakeLists.txt8
-rw-r--r--kmime/cmake/modules/CheckTimezone.cmake35
-rw-r--r--kmime/cmake/modules/FindGpgme.cmake412
-rw-r--r--kmime/cmake/modules/FindLdap.cmake46
-rw-r--r--kmime/cmake/modules/FindLibical.cmake95
-rw-r--r--kmime/cmake/modules/FindQGpgme.cmake46
-rw-r--r--kmime/kmime_content.cpp4
-rw-r--r--kmime/kmime_header_parsing.cpp8
-rw-r--r--kmime/kmime_headerfactory.cpp8
-rw-r--r--kmime/kmime_message.cpp2
-rw-r--r--kmime/kmime_newsarticle.h8
-rw-r--r--kmime/kmime_util.cpp14
13 files changed, 667 insertions, 22 deletions
diff --git a/kmime/cmake/CMakeLists.txt b/kmime/cmake/CMakeLists.txt
new file mode 100644
index 0000000..38a9971
--- /dev/null
+++ b/kmime/cmake/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+add_subdirectory(modules)
+
diff --git a/kmime/cmake/modules/CMakeLists.txt b/kmime/cmake/modules/CMakeLists.txt
new file mode 100644
index 0000000..e0152e6
--- /dev/null
+++ b/kmime/cmake/modules/CMakeLists.txt
@@ -0,0 +1,8 @@
+# install the cmake files
+
+file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake")
+
+set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules )
+
+install( FILES ${cmakeFiles} DESTINATION ${module_install_dir} )
+
diff --git a/kmime/cmake/modules/CheckTimezone.cmake b/kmime/cmake/modules/CheckTimezone.cmake
new file mode 100644
index 0000000..88d3104
--- /dev/null
+++ b/kmime/cmake/modules/CheckTimezone.cmake
@@ -0,0 +1,35 @@
+# Discover the type of the timezone variable,
+# set HAVE_TIMEZONE if found for config.h
+
+INCLUDE (CheckCXXSourceCompiles)
+
+CHECK_CXX_SOURCE_COMPILES("
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <unistd.h>
+int main() { timezone = 1; return 0;}
+"
+ HAVE_TIMEZONE)
+
+IF (NOT HAVE_TIMEZONE)
+ # Then it's probably this variant, just to be sure
+ CHECK_CXX_SOURCE_COMPILES("
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <unistd.h>
+int main() { const char *p = timezone(0,0); return 0;}
+"
+ HAVE_BSD_TIMEZONE)
+endif()
+
+CHECK_CXX_SOURCE_COMPILES("
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <unistd.h>
+int main() { struct tm tm; tm.tm_gmtoff=1; return 0; }
+"
+ HAVE_TM_GMTOFF)
+
diff --git a/kmime/cmake/modules/FindGpgme.cmake b/kmime/cmake/modules/FindGpgme.cmake
new file mode 100644
index 0000000..872c045
--- /dev/null
+++ b/kmime/cmake/modules/FindGpgme.cmake
@@ -0,0 +1,412 @@
+# - Try to find the gpgme library
+#
+# Algorithm:
+# - Windows:
+# On Windows, there's three gpgme variants: gpgme{,-glib,-qt}.
+# - The variant used determines the event loop integration possible:
+# - gpgme: no event loop integration possible, only synchronous operations supported
+# - gpgme-glib: glib event loop integration possible, only asynchronous operations supported
+# - gpgme-qt: qt event loop integration possible, only asynchronous operations supported
+# - GPGME_{VANILLA,GLIB,QT}_{FOUND,LIBRARIES} will be set for each of the above
+# - GPGME_INCLUDES is the same for all of the above
+# - GPGME_FOUND is set if any of the above was found
+# - *nix:
+# There's also three variants: gpgme{,-pthread,-pth}.
+# - The variant used determines the multithreaded use possible:
+# - gpgme: no multithreading support available
+# - gpgme-pthread: multithreading available using POSIX threads
+# - gpgme-pth: multithreading available using GNU PTH (cooperative multithreading)
+# - GPGME_{VANILLA,PTH,PTHREAD}_{FOUND,LIBRARIES} will be set for each of the above
+# - GPGME_INCLUDES is the same for all of the above
+# - GPGME_FOUND is set if any of the above was found
+#
+# GPGME_LIBRARY_DIR - the directory where the libraries are located
+
+#
+# THIS IS ALMOST A 1:1 COPY OF FindAssuan.cmake in kdepim.
+# Any changes here likely apply there, too.
+#
+
+# do away with crappy condition repetition on else/endfoo
+set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS_gpgme_saved ${CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS} )
+set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
+
+#if this is built-in, please replace, if it isn't, export into a MacroToBool.cmake of it's own
+macro( macro_bool_to_bool FOUND_VAR )
+ foreach( _current_VAR ${ARGN} )
+ if ( ${FOUND_VAR} )
+ set( ${_current_VAR} TRUE )
+ else()
+ set( ${_current_VAR} FALSE )
+ endif()
+ endforeach()
+endmacro()
+
+#HACK: local copy...
+MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
+ FOREACH (_current_VAR ${ARGN})
+ IF(${FOUND_VAR})
+ SET(${_current_VAR} 1)
+ ELSE(${FOUND_VAR})
+ SET(${_current_VAR} 0)
+ ENDIF(${FOUND_VAR})
+ ENDFOREACH(_current_VAR)
+ENDMACRO(MACRO_BOOL_TO_01)
+
+
+if ( WIN32 )
+
+ # On Windows, we don't have a gpgme-config script, so we need to
+ # look for the stuff ourselves:
+
+ # in cmake, AND and OR have the same precedence, there's no
+ # subexpressions, and expressions are evaluated short-circuit'ed
+ # IOW: CMake if() suxx.
+ # Starting with CMake 2.6.3 you can group if expressions with (), but we
+ # don't require 2.6.3 but 2.6.2, we can't use it. Alex
+ set( _seem_to_have_cached_gpgme false )
+ if ( GPGME_INCLUDES )
+ if ( GPGME_VANILLA_LIBRARIES OR GPGME_QT_LIBRARIES OR GPGME_GLIB_LIBRARIES )
+ set( _seem_to_have_cached_gpgme true )
+ endif()
+ endif()
+
+ if ( _seem_to_have_cached_gpgme )
+
+ macro_bool_to_bool( GPGME_VANILLA_LIBRARIES GPGME_VANILLA_FOUND )
+ macro_bool_to_bool( GPGME_GLIB_LIBRARIES GPGME_GLIB_FOUND )
+ macro_bool_to_bool( GPGME_QT_LIBRARIES GPGME_QT_FOUND )
+ # this would have been preferred:
+ #set( GPGME_*_FOUND macro_bool_to_bool(GPGME_*_LIBRARIES) )
+
+ if ( GPGME_VANILLA_FOUND OR GPGME_GLIB_FOUND OR GPGME_QT_FOUND )
+ set( GPGME_FOUND true )
+ else()
+ set( GPGME_FOUND false )
+ endif()
+
+ else()
+
+ # is this needed, of just unreflected cut'n'paste?
+ # this isn't a KDE library, after all!
+ if( NOT KDEWIN_FOUND )
+ find_package( KDEWIN REQUIRED )
+ endif()
+
+ set( GPGME_FOUND false )
+ set( GPGME_VANILLA_FOUND false )
+ set( GPGME_GLIB_FOUND false )
+ set( GPGME_QT_FOUND false )
+
+ find_path( GPGME_INCLUDES gpgme.h
+ ${CMAKE_INCLUDE_PATH}
+ ${CMAKE_INSTALL_PREFIX}/include
+ )
+
+ if (NOT WINCE)
+ find_library( _gpgme_vanilla_library NAMES gpgme libgpgme gpgme-11 libgpgme-11
+ PATHS
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+ else (NOT WINCE)
+ find_library( _gpgme_vanilla_library NAMES libgpgme-11-msc
+ PATHS
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+ endif()
+
+ find_library( _gpgme_glib_library NAMES gpgme-glib libgpgme-glib gpgme-glib-11 libgpgme-glib-11
+ PATHS
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+
+ find_library( _gpgme_qt_library NAMES gpgme-qt libgpgme-qt gpgme-qt-11 libgpgme-qt-11
+ PATHS
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+
+ if ( WINCE )
+ set( _gpg_error_library )
+ else()
+ find_library( _gpg_error_library NAMES gpg-error libgpg-error gpg-error-0 libgpg-error-0
+ PATHS
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+ endif()
+
+ set( GPGME_INCLUDES ${GPGME_INCLUDES} )
+
+ if ( _gpgme_vanilla_library AND ( _gpg_error_library OR WINCE ) )
+ set( GPGME_VANILLA_LIBRARIES ${_gpgme_vanilla_library} ${_gpg_error_library} )
+ set( GPGME_VANILLA_FOUND true )
+ set( GPGME_FOUND true )
+ endif()
+
+ if ( _gpgme_glib_library AND ( _gpg_error_library OR WINCE ) )
+ set( GPGME_GLIB_LIBRARIES ${_gpgme_glib_library} ${_gpg_error_library} )
+ set( GPGME_GLIB_FOUND true )
+ set( GPGME_FOUND true )
+ endif()
+
+ if ( _gpgme_qt_library AND ( _gpg_error_library OR WINCE ) )
+ set( GPGME_QT_LIBRARIES ${_gpgme_qt_library} ${_gpg_error_library} )
+ set( GPGME_QT_FOUND true )
+ set( GPGME_FOUND true )
+ endif()
+
+ endif()
+
+ # these are Unix-only:
+ set( GPGME_PTHREAD_FOUND false )
+ set( GPGME_PTH_FOUND false )
+ set( HAVE_GPGME_PTHREAD 0 )
+ set( HAVE_GPGME_PTH 0 )
+
+ macro_bool_to_01( GPGME_FOUND HAVE_GPGME )
+ macro_bool_to_01( GPGME_VANILLA_FOUND HAVE_GPGME_VANILLA )
+ macro_bool_to_01( GPGME_GLIB_FOUND HAVE_GPGME_GLIB )
+ macro_bool_to_01( GPGME_QT_FOUND HAVE_GPGME_QT )
+
+else() # not WIN32
+
+ # On *nix, we have the gpgme-config script which can tell us all we
+ # need to know:
+
+ # see WIN32 case for an explanation of what this does:
+ set( _seem_to_have_cached_gpgme false )
+ if ( GPGME_INCLUDES )
+ if ( GPGME_VANILLA_LIBRARIES OR GPGME_PTHREAD_LIBRARIES OR GPGME_PTH_LIBRARIES )
+ set( _seem_to_have_cached_gpgme true )
+ endif()
+ endif()
+
+ if ( _seem_to_have_cached_gpgme )
+
+ macro_bool_to_bool( GPGME_VANILLA_LIBRARIES GPGME_VANILLA_FOUND )
+ macro_bool_to_bool( GPGME_PTHREAD_LIBRARIES GPGME_PTHREAD_FOUND )
+ macro_bool_to_bool( GPGME_PTH_LIBRARIES GPGME_PTH_FOUND )
+
+ if ( GPGME_VANILLA_FOUND OR GPGME_PTHREAD_FOUND OR GPGME_PTH_FOUND )
+ set( GPGME_FOUND true )
+ else()
+ set( GPGME_FOUND false )
+ endif()
+
+ else()
+
+ set( GPGME_FOUND false )
+ set( GPGME_VANILLA_FOUND false )
+ set( GPGME_PTHREAD_FOUND false )
+ set( GPGME_PTH_FOUND false )
+
+ find_program( _GPGMECONFIG_EXECUTABLE NAMES gpgme-config )
+
+ # if gpgme-config has been found
+ if ( _GPGMECONFIG_EXECUTABLE )
+
+ message( STATUS "Found gpgme-config at ${_GPGMECONFIG_EXECUTABLE}" )
+
+ exec_program( ${_GPGMECONFIG_EXECUTABLE} ARGS --version OUTPUT_VARIABLE GPGME_VERSION )
+
+ set( _GPGME_MIN_VERSION "1.1.7" )
+
+ if ( ${GPGME_VERSION} VERSION_LESS ${_GPGME_MIN_VERSION} )
+
+ message( STATUS "The installed version of gpgme is too old: ${GPGME_VERSION} (required: >= ${_GPGME_MIN_VERSION})" )
+
+ else()
+
+ message( STATUS "Found gpgme v${GPGME_VERSION}, checking for flavours..." )
+
+ exec_program( ${_GPGMECONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE _gpgme_config_vanilla_libs RETURN_VALUE _ret )
+ if ( _ret )
+ set( _gpgme_config_vanilla_libs )
+ endif()
+
+ exec_program( ${_GPGMECONFIG_EXECUTABLE} ARGS --thread=pthread --libs OUTPUT_VARIABLE _gpgme_config_pthread_libs RETURN_VALUE _ret )
+ if ( _ret )
+ set( _gpgme_config_pthread_libs )
+ endif()
+
+ exec_program( ${_GPGMECONFIG_EXECUTABLE} ARGS --thread=pth --libs OUTPUT_VARIABLE _gpgme_config_pth_libs RETURN_VALUE _ret )
+ if ( _ret )
+ set( _gpgme_config_pth_libs )
+ endif()
+
+ # append -lgpg-error to the list of libraries, if necessary
+ foreach ( _flavour vanilla pthread pth )
+ if ( _gpgme_config_${_flavour}_libs AND NOT _gpgme_config_${_flavour}_libs MATCHES "lgpg-error" )
+ set( _gpgme_config_${_flavour}_libs "${_gpgme_config_${_flavour}_libs} -lgpg-error" )
+ endif()
+ endforeach()
+
+ if ( _gpgme_config_vanilla_libs OR _gpgme_config_pthread_libs OR _gpgme_config_pth_libs )
+
+ exec_program( ${_GPGMECONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE _GPGME_CFLAGS )
+
+ if ( _GPGME_CFLAGS )
+ string( REGEX REPLACE "(\r?\n)+$" " " _GPGME_CFLAGS "${_GPGME_CFLAGS}" )
+ string( REGEX REPLACE " *-I" ";" GPGME_INCLUDES "${_GPGME_CFLAGS}" )
+ endif()
+
+ foreach ( _flavour vanilla pthread pth )
+ if ( _gpgme_config_${_flavour}_libs )
+
+ set( _gpgme_library_dirs )
+ set( _gpgme_library_names )
+ string( TOUPPER "${_flavour}" _FLAVOUR )
+
+ string( REGEX REPLACE " +" ";" _gpgme_config_${_flavour}_libs "${_gpgme_config_${_flavour}_libs}" )
+
+ foreach( _flag ${_gpgme_config_${_flavour}_libs} )
+ if ( "${_flag}" MATCHES "^-L" )
+ string( REGEX REPLACE "^-L" "" _dir "${_flag}" )
+ file( TO_CMAKE_PATH "${_dir}" _dir )
+ set( _gpgme_library_dirs ${_gpgme_library_dirs} "${_dir}" )
+ elseif( "${_flag}" MATCHES "^-l" )
+ string( REGEX REPLACE "^-l" "" _name "${_flag}" )
+ set( _gpgme_library_names ${_gpgme_library_names} "${_name}" )
+ endif()
+ endforeach()
+
+ set( GPGME_${_FLAVOUR}_FOUND true )
+
+ foreach( _name ${_gpgme_library_names} )
+ set( _gpgme_${_name}_lib )
+
+ # if -L options were given, look only there
+ if ( _gpgme_library_dirs )
+ find_library( _gpgme_${_name}_lib NAMES ${_name} PATHS ${_gpgme_library_dirs} NO_DEFAULT_PATH )
+ endif()
+
+ # if not found there, look in system directories
+ if ( NOT _gpgme_${_name}_lib )
+ find_library( _gpgme_${_name}_lib NAMES ${_name} )
+ endif()
+
+ # if still not found, then the whole flavour isn't found
+ if ( NOT _gpgme_${_name}_lib )
+ if ( GPGME_${_FLAVOUR}_FOUND )
+ set( GPGME_${_FLAVOUR}_FOUND false )
+ set( _not_found_reason "dependant library ${_name} wasn't found" )
+ endif()
+ endif()
+
+ set( GPGME_${_FLAVOUR}_LIBRARIES ${GPGME_${_FLAVOUR}_LIBRARIES} "${_gpgme_${_name}_lib}" )
+ endforeach()
+
+ #check_c_library_exists_explicit( gpgme gpgme_check_version "${_GPGME_CFLAGS}" "${GPGME_LIBRARIES}" GPGME_FOUND )
+ if ( GPGME_${_FLAVOUR}_FOUND )
+ message( STATUS " Found flavour '${_flavour}', checking whether it's usable...yes" )
+ else()
+ message( STATUS " Found flavour '${_flavour}', checking whether it's usable...no" )
+ message( STATUS " (${_not_found_reason})" )
+ endif()
+ endif()
+
+ endforeach( _flavour )
+
+ # ensure that they are cached
+ # This comment above doesn't make sense, the four following lines seem to do nothing. Alex
+ set( GPGME_INCLUDES ${GPGME_INCLUDES} )
+ set( GPGME_VANILLA_LIBRARIES ${GPGME_VANILLA_LIBRARIES} )
+ set( GPGME_PTHREAD_LIBRARIES ${GPGME_PTHREAD_LIBRARIES} )
+ set( GPGME_PTH_LIBRARIES ${GPGME_PTH_LIBRARIES} )
+
+ if ( GPGME_VANILLA_FOUND OR GPGME_PTHREAD_FOUND OR GPGME_PTH_FOUND )
+ set( GPGME_FOUND true )
+ else()
+ set( GPGME_FOUND false )
+ endif()
+
+ endif()
+
+ endif()
+
+ endif()
+
+ endif()
+
+ # these are Windows-only:
+ set( GPGME_GLIB_FOUND false )
+ set( GPGME_QT_FOUND false )
+ set( HAVE_GPGME_GLIB 0 )
+ set( HAVE_GPGME_QT 0 )
+
+ macro_bool_to_01( GPGME_FOUND HAVE_GPGME )
+ macro_bool_to_01( GPGME_VANILLA_FOUND HAVE_GPGME_VANILLA )
+ macro_bool_to_01( GPGME_PTHREAD_FOUND HAVE_GPGME_PTHREAD )
+ macro_bool_to_01( GPGME_PTH_FOUND HAVE_GPGME_PTH )
+
+endif() # WIN32 | Unix
+
+
+set( _gpgme_flavours "" )
+
+if ( GPGME_VANILLA_FOUND )
+ set( _gpgme_flavours "${_gpgme_flavours} vanilla" )
+endif()
+
+if ( GPGME_GLIB_FOUND )
+ set( _gpgme_flavours "${_gpgme_flavours} Glib" )
+endif()
+
+if ( GPGME_QT_FOUND )
+ set( _gpgme_flavours "${_gpgme_flavours} Qt" )
+endif()
+
+if ( GPGME_PTHREAD_FOUND )
+ set( _gpgme_flavours "${_gpgme_flavours} pthread" )
+endif()
+
+if ( GPGME_PTH_FOUND )
+ set( _gpgme_flavours "${_gpgme_flavours} pth" )
+endif()
+
+# determine the library in one of the found flavours, can be reused e.g. by FindQgpgme.cmake, Alex
+foreach(_currentFlavour vanilla glib qt pth pthread)
+ if(NOT GPGME_LIBRARY_DIR)
+ get_filename_component(GPGME_LIBRARY_DIR "${_gpgme_${_currentFlavour}_lib}" PATH)
+ endif()
+endforeach()
+
+if ( NOT Gpgme_FIND_QUIETLY )
+
+ if ( GPGME_FOUND )
+ message( STATUS "Usable gpgme flavours found: ${_gpgme_flavours}" )
+ else()
+ message( STATUS "No usable gpgme flavours found." )
+ endif()
+
+ macro_bool_to_bool( Gpgme_FIND_REQUIRED _req )
+
+ if ( WIN32 )
+ set( _gpgme_homepage "http://www.gpg4win.org" )
+ else()
+ set( _gpgme_homepage "http://www.gnupg.org/related_software/gpgme" )
+ endif()
+
+ #macro_log_feature(
+ # GPGME_FOUND
+ # "gpgme"
+ # "GNU Privacy Guard (GPG/PGP) support"
+ # ${_gpgme_homepage}
+ # ${_req}
+ # "${_GPGME_MIN_VERSION} or greater"
+ # "Necessary to compile many PIM applications, including KMail"
+ #)
+
+else()
+
+ if ( Gpgme_FIND_REQUIRED AND NOT GPGME_FOUND )
+ message( FATAL_ERROR "Did not find GPGME" )
+ endif()
+
+endif()
+
+set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS_gpgme_saved )
diff --git a/kmime/cmake/modules/FindLdap.cmake b/kmime/cmake/modules/FindLdap.cmake
new file mode 100644
index 0000000..b5428e1
--- /dev/null
+++ b/kmime/cmake/modules/FindLdap.cmake
@@ -0,0 +1,46 @@
+# - Try to find the LDAP client libraries
+# Once done this will define
+#
+# LDAP_FOUND - system has libldap
+# LDAP_INCLUDE_DIR - the ldap include directory
+# LDAP_LIBRARIES - libldap + liblber (if found) library
+# LBER_LIBRARIES - liblber library
+
+if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
+ # Already in cache, be silent
+ set(Ldap_FIND_QUIETLY TRUE)
+endif()
+
+
+FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
+
+if(APPLE)
+ FIND_LIBRARY(LDAP_LIBRARIES NAMES LDAP
+ PATHS
+ /System/Library/Frameworks
+ /Library/Frameworks
+ )
+else(APPLE)
+ FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
+
+ FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
+endif()
+
+if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
+ set(LDAP_FOUND TRUE)
+ if(LBER_LIBRARIES)
+ set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES})
+ endif()
+endif()
+
+if(LDAP_FOUND)
+ if(NOT Ldap_FIND_QUIETLY)
+ message(STATUS "Found ldap: ${LDAP_LIBRARIES}")
+ endif()
+else(LDAP_FOUND)
+ if (Ldap_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find ldap")
+ endif()
+endif()
+
+MARK_AS_ADVANCED(LDAP_INCLUDE_DIR LDAP_LIBRARIES LBER_LIBRARIES)
diff --git a/kmime/cmake/modules/FindLibical.cmake b/kmime/cmake/modules/FindLibical.cmake
new file mode 100644
index 0000000..85074cb
--- /dev/null
+++ b/kmime/cmake/modules/FindLibical.cmake
@@ -0,0 +1,95 @@
+# Find Libical
+#
+# LIBICAL_FOUND - system has Libical with the minimum version needed
+# LIBICAL_INCLUDE_DIRS - the Libical include directories
+# LIBICAL_LIBRARIES - The libraries needed to use Libical
+# LIBICAL_VERSION = The value of ICAL_VERSION defined in ical.h
+# LIBICAL_MAJOR_VERSION = The library major version number
+# LIBICAL_MINOR_VERSION = The library minor version number
+
+# Copyright (c) 2008,2010 Allen Winter <winter@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if(NOT LIBICAL_MIN_VERSION)
+ set(LIBICAL_MIN_VERSION "0.33")
+endif()
+
+if (WIN32)
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
+endif()
+
+set(LIBICAL_FIND_REQUIRED ${Libical_FIND_REQUIRED})
+if(LIBICAL_INCLUDE_DIRS AND LIBICAL_LIBRARIES)
+
+ # Already in cache, be silent
+ set(LIBICAL_FIND_QUIETLY TRUE)
+
+endif()
+
+#set the root from the LIBICAL_BASE environment
+file(TO_CMAKE_PATH "$ENV{LIBICAL_BASE}" libical_root )
+#override the root from LIBICAL_BASE defined to cmake
+if(DEFINED LIBICAL_BASE)
+ file(TO_CMAKE_PATH "${LIBICAL_BASE}" libical_root )
+endif()
+
+find_path(LIBICAL_INCLUDE_DIRS NAMES libical/ical.h
+ HINTS ${libical_root}/include ${_program_FILES_DIR}/libical/include ${KDE4_INCLUDE_DIR}
+)
+
+find_library(LIBICAL_LIBRARY NAMES ical libical
+ HINTS ${libical_root}/lib ${_program_FILES_DIR}/libical/lib ${KDE4_LIB_DIR}
+)
+find_library(LIBICALSS_LIBRARY NAMES icalss libicalss
+ HINTS ${libical_root}/lib ${_program_FILES_DIR}/libical/lib ${KDE4_LIB_DIR}
+)
+set(LIBICAL_LIBRARIES ${LIBICAL_LIBRARY} ${LIBICALSS_LIBRARY})
+
+if(LIBICAL_INCLUDE_DIRS AND LIBICAL_LIBRARIES)
+ set(FIND_LIBICAL_VERSION_SOURCE
+ "#include <libical/ical.h>\n int main()\n {\n printf(\"%s\",ICAL_VERSION);return 1;\n }\n")
+ set(FIND_LIBICAL_VERSION_SOURCE_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/FindLIBICAL.cxx)
+ file(WRITE "${FIND_LIBICAL_VERSION_SOURCE_FILE}" "${FIND_LIBICAL_VERSION_SOURCE}")
+
+ set(FIND_LIBICAL_VERSION_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${LIBICAL_INCLUDE_DIRS}")
+
+ if(NOT CMAKE_CROSSCOMPILING)
+ try_run(RUN_RESULT COMPILE_RESULT
+ ${CMAKE_BINARY_DIR}
+ ${FIND_LIBICAL_VERSION_SOURCE_FILE}
+ CMAKE_FLAGS "${FIND_LIBICAL_VERSION_ADD_INCLUDES}"
+ RUN_OUTPUT_VARIABLE LIBICAL_VERSION)
+ endif()
+
+ if(COMPILE_RESULT AND RUN_RESULT EQUAL 1 AND NOT CMAKE_CROSSCOMPILING)
+ message(STATUS "Found Libical version ${LIBICAL_VERSION}")
+ if(${LIBICAL_VERSION} VERSION_LESS ${LIBICAL_MIN_VERSION})
+ message(STATUS "Libcal version ${LIBICAL_VERSION} is too old. At least version ${LIBICAL_MIN_VERSION} is needed.")
+ set(LIBICAL_INCLUDE_DIRS "")
+ set(LIBICAL_LIBRARIES "")
+ endif()
+ if((LIBICAL_VERSION VERSION_EQUAL 0.46) OR (LIBICAL_VERSION VERSION_GREATER 0.46))
+ set(USE_ICAL_0_46 TRUE)
+ endif()
+ else(COMPILE_RESULT AND RUN_RESULT EQUAL 1 AND NOT CMAKE_CROSSCOMPILING)
+ if(NOT CMAKE_CROSSCOMPILING)
+ message(FATAL_ERROR "Unable to compile or run the libical version detection program.")
+ endif()
+ endif()
+
+ #compute the major and minor version numbers
+ if(NOT CMAKE_CROSSCOMPILING)
+ string(REGEX REPLACE "\\..*$" "" LIBICAL_MAJOR_VERSION ${LIBICAL_VERSION})
+ string(REGEX REPLACE "^.*\\." "" LIBICAL_MINOR_VERSION ${LIBICAL_VERSION})
+ endif()
+
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBICAL DEFAULT_MSG LIBICAL_LIBRARIES LIBICAL_INCLUDE_DIRS)
+
+mark_as_advanced(LIBICAL_INCLUDE_DIRS LIBICAL_LIBRARIES)
+
diff --git a/kmime/cmake/modules/FindQGpgme.cmake b/kmime/cmake/modules/FindQGpgme.cmake
new file mode 100644
index 0000000..0355ebe
--- /dev/null
+++ b/kmime/cmake/modules/FindQGpgme.cmake
@@ -0,0 +1,46 @@
+# - Try to find the QGpgME library
+# Once done this will define
+#
+# QGPGME_FOUND
+# QGPGME_LIBRARIES
+# QGPGME_INCLUDE_DIR
+
+# What we do here is a bit simplictic, but it's no worse than what
+# people were using in kdepim up to now...
+
+find_package(Gpgme)
+
+if(GPGME_FOUND)
+
+ if ( WIN32 )
+ find_library(_QGPGME_EXTRA_LIBRARY gpgme++
+ HINTS ${GPGME_LIBRARY_DIR})
+ else ( WIN32 )
+ find_library(_QGPGME_EXTRA_LIBRARY gpgme++-pthread
+ HINTS ${GPGME_LIBRARY_DIR})
+ endif()
+
+ find_library(QGPGME_LIBRARY qgpgme
+ HINTS ${GPGME_LIBRARY_DIR})
+
+ if (QGPGME_LIBRARY)
+ # get the libdirectory and then go one up
+ get_filename_component(_QGPGME_PREFIX "${QGPGME_LIBRARY}" PATH)
+ get_filename_component(_QGPGME_PREFIX "${_QGPGME_PREFIX}" PATH)
+ find_path(QGPGME_INCLUDE_DIR qgpgme/qgpgme_export.h
+ HINTS "${_QGPGME_PREFIX}/include" )
+ endif()
+
+ if ( WIN32 )
+ set(QGPGME_LIBRARIES ${QGPGME_LIBRARY} ${_QGPGME_EXTRA_LIBRARY} ${GPGME_VANILLA_LIBRARIES} ${GPGME_QT_LIBRARIES})
+ else ( WIN32 )
+ set(QGPGME_LIBRARIES ${QGPGME_LIBRARY} ${_QGPGME_EXTRA_LIBRARY} ${GPGME_PTHREAD_LIBRARIES})
+ endif()
+
+endif()
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(QGpgme DEFAULT_MSG QGPGME_LIBRARY QGPGME_INCLUDE_DIR _QGPGME_EXTRA_LIBRARY)
+
+mark_as_advanced(QGPGME_LIBRARY _QGPGME_EXTRA_LIBRARY QGPGME_INCLUDE_DIR)
diff --git a/kmime/kmime_content.cpp b/kmime/kmime_content.cpp
index 569be32..37ca474 100644
--- a/kmime/kmime_content.cpp
+++ b/kmime/kmime_content.cpp
@@ -427,7 +427,7 @@ QString Content::decodedText( bool trimText, bool removeTrailingNewlines )
bool ok = true;
QTextCodec *codec =
- KCharsets::charsets()->codecForName( QLatin1String( contentType()->charset() ), ok );
+ KGlobal::charsets()->codecForName( QLatin1String( contentType()->charset() ), ok );
if ( !ok || codec == NULL ) { // no suitable codec found => try local settings and hope the best ;-)
codec = KGlobal::locale()->codecForEncoding();
QByteArray chset = KGlobal::locale()->encoding();
@@ -464,7 +464,7 @@ void Content::fromUnicodeString( const QString &s )
{
bool ok = true;
QTextCodec *codec =
- KCharsets::charsets()->codecForName( QLatin1String( contentType()->charset() ), ok );
+ KGlobal::charsets()->codecForName( QLatin1String( contentType()->charset() ), ok );
if ( !ok ) { // no suitable codec found => try local settings and hope the best ;-)
codec = KGlobal::locale()->codecForEncoding();
diff --git a/kmime/kmime_header_parsing.cpp b/kmime/kmime_header_parsing.cpp
index 200e79f..6c530e2 100644
--- a/kmime/kmime_header_parsing.cpp
+++ b/kmime/kmime_header_parsing.cpp
@@ -366,12 +366,12 @@ bool parseEncodedWord( const char* &scursor, const char * const send,
bool matchOK = false;
QTextCodec *textCodec = 0;
if ( forceCS || maybeCharset.isEmpty() ) {
- textCodec = KCharsets::charsets()->codecForName( QLatin1String( defaultCS ), matchOK );
+ textCodec = KGlobal::charsets()->codecForName( QLatin1String( defaultCS ), matchOK );
usedCS = cachedCharset( defaultCS );
} else {
- textCodec = KCharsets::charsets()->codecForName( QLatin1String( maybeCharset ), matchOK );
+ textCodec = KGlobal::charsets()->codecForName( QLatin1String( maybeCharset ), matchOK );
if ( !matchOK ) { //no suitable codec found => use default charset
- textCodec = KCharsets::charsets()->codecForName( QLatin1String( defaultCS ), matchOK );
+ textCodec = KGlobal::charsets()->codecForName( QLatin1String( defaultCS ), matchOK );
usedCS = cachedCharset( defaultCS );
} else {
usedCS = cachedCharset( maybeCharset );
@@ -1591,7 +1591,7 @@ static void decodeRFC2231Value( Codec* &rfc2231Codec,
//
bool matchOK = false;
- textcodec = KCharsets::charsets()->codecForName( QLatin1String( charset ), matchOK );
+ textcodec = KGlobal::charsets()->codecForName( QLatin1String( charset ), matchOK );
if ( !matchOK ) {
textcodec = 0;
KMIME_WARN_UNKNOWN( Charset, charset );
diff --git a/kmime/kmime_headerfactory.cpp b/kmime/kmime_headerfactory.cpp
index 7863c32..12bc465 100644
--- a/kmime/kmime_headerfactory.cpp
+++ b/kmime/kmime_headerfactory.cpp
@@ -36,8 +36,8 @@
#include <QHash>
-#include <KDebug>
-#include <KGlobal>
+#include <QDebug>
+#include <kglobal.h>
using namespace KMime;
@@ -102,12 +102,12 @@ bool HeaderFactory::registerHeaderMaker( const QByteArray &type, HeaderMakerBase
if( type.isEmpty() ) {
// This is probably a generic (but not abstract) header,
// like Address or MailboxList. We cannot register those.
- kWarning() << "Tried to register header with empty type.";
+ qWarning() << "Tried to register header with empty type.";
return false;
}
const QByteArray ltype = type.toLower();
if( d->headerMakers.contains( ltype ) ) {
- kWarning() << "Header of type" << type << "already registered.";
+ qWarning() << "Header of type" << type << "already registered.";
// TODO should we make this an error?
return false;
}
diff --git a/kmime/kmime_message.cpp b/kmime/kmime_message.cpp
index ff8fac1..04710c0 100644
--- a/kmime/kmime_message.cpp
+++ b/kmime/kmime_message.cpp
@@ -25,7 +25,7 @@
#include "kmime_message_p.h"
#include "kmime_util_p.h"
-#include <KGlobal>
+#include <kglobal.h>
using namespace KMime;
diff --git a/kmime/kmime_newsarticle.h b/kmime/kmime_newsarticle.h
index d951440..2f88b65 100644
--- a/kmime/kmime_newsarticle.h
+++ b/kmime/kmime_newsarticle.h
@@ -25,7 +25,7 @@
#include "kmime_export.h"
#include "kmime_message.h"
-#include <kpimutils/supertrait.h>
+// #include <kpimutils/supertrait.h>
namespace KMime {
@@ -117,9 +117,9 @@ class KMIME_EXPORT NewsArticle : public Message
//@cond PRIVATE
// super class trait specialization
-namespace KPIMUtils {
- template <> struct SuperClass<KMime::NewsArticle> : public SuperClassTrait<KMime::Message>{};
-}
+// namespace KPIMUtils {
+// template <> struct SuperClass<KMime::NewsArticle> : public SuperClassTrait<KMime::Message>{};
+// }
//@endcond
#endif // __KMIME_NEWSARTICLE_H__
diff --git a/kmime/kmime_util.cpp b/kmime/kmime_util.cpp
index 1a68c17..64ae748 100644
--- a/kmime/kmime_util.cpp
+++ b/kmime/kmime_util.cpp
@@ -250,7 +250,7 @@ QString decodeRFC2047String( const QByteArray &src, QByteArray &usedCS,
// use the fallback charset if it exists
const QString tryUtf8 = QString::fromUtf8( result );
if ( tryUtf8.contains( 0xFFFD ) && !f_allbackCharEnc.isEmpty() ) {
- QTextCodec* codec = KCharsets::charsets()->codecForName( f_allbackCharEnc );
+ QTextCodec* codec = KGlobal::charsets()->codecForName( f_allbackCharEnc );
return codec->toUnicode( result );
} else {
return tryUtf8;
@@ -273,13 +273,13 @@ QByteArray encodeRFC2047String( const QString &src, const QByteArray &charset,
bool nonAscii=false, ok=true, useQEncoding=false;
// fromLatin1() is safe here, codecForName() uses toLatin1() internally
- const QTextCodec *codec = KCharsets::charsets()->codecForName( QString::fromLatin1( charset ), ok );
+ const QTextCodec *codec = KGlobal::charsets()->codecForName( QString::fromLatin1( charset ), ok );
QByteArray usedCS;
if ( !ok ) {
//no codec available => try local8Bit and hope the best ;-)
usedCS = KGlobal::locale()->encoding();
- codec = KCharsets::charsets()->codecForName( QString::fromLatin1( usedCS ), ok );
+ codec = KGlobal::charsets()->codecForName( QString::fromLatin1( usedCS ), ok );
}
else {
Q_ASSERT( codec );
@@ -431,7 +431,7 @@ QByteArray encodeRFC2231String( const QString& str, const QByteArray& charset )
return QByteArray();
- const QTextCodec *codec = KCharsets::charsets()->codecForName( QString::fromLatin1( charset ) );
+ const QTextCodec *codec = KGlobal::charsets()->codecForName( QString::fromLatin1( charset ) );
QByteArray latin;
if ( charset == "us-ascii" )
latin = str.toAscii();
@@ -485,7 +485,7 @@ QString decodeRFC2231String( const QByteArray &str, QByteArray &usedCS, const QB
bool forceCS )
{
int p = str.indexOf('\'');
- if (p < 0) return KCharsets::charsets()->codecForName( QString::fromLatin1( defaultCS ))->toUnicode( str );
+ if (p < 0) return KGlobal::charsets()->codecForName( QString::fromLatin1( defaultCS ))->toUnicode( str );
QByteArray charset = str.left(p);
@@ -515,9 +515,9 @@ QString decodeRFC2231String( const QByteArray &str, QByteArray &usedCS, const QB
}
kDebug() << "Got pre-decoded:" << st;
QString result;
- const QTextCodec * charsetcodec = KCharsets::charsets()->codecForName( QString::fromLatin1( charset ) );
+ const QTextCodec * charsetcodec = KGlobal::charsets()->codecForName( QString::fromLatin1( charset ) );
if ( !charsetcodec || forceCS )
- charsetcodec = KCharsets::charsets()->codecForName( QString::fromLatin1( defaultCS ) );
+ charsetcodec = KGlobal::charsets()->codecForName( QString::fromLatin1( defaultCS ) );
usedCS = charsetcodec->name();
return charsetcodec->toUnicode( st );