summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-04-22 16:34:30 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-04-22 16:34:30 +0200
commit04139781828ac6eb6ce413a8b94e69d364724f4b (patch)
tree3e5cc97cc112f2ad35c470f042df4b42ae0132fd
parent17aab407844207e39637b15e75ca8404a0a51461 (diff)
downloadlibkolab-libkolab-0.7.tar.gz
Intercept debug messages when building with libcalendaring.libkolab-0.7
-rw-r--r--CMakeLists.txt5
-rw-r--r--kolabformat/errorhandler.cpp23
2 files changed, 28 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ceeee4..4463d40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ option( BUILD_TOOLS "Build the tools" TRUE )
option( PYTHON_BINDINGS "Build bindings for python" FALSE )
option( PHP_BINDINGS "Build bindings for php" FALSE )
option( USE_LIBCALENDARING "Use libcalendaring" FALSE )
+option( INTERCEPT_DEBUGMESSAGES "Intercept Debugmessages" ${USE_LIBCALENDARING} )
set(Libkolab_MODULE_DIR ${Libkolab_SOURCE_DIR}/cmake/modules)
set(CMAKE_MODULE_PATH ${Libkolab_MODULE_DIR})
@@ -175,6 +176,10 @@ set(KOLAB_SRCS
${FREEBUSY_SRCS}
)
+if (INTERCEPT_DEBUGMESSAGES)
+ add_definitions( -DINTERCEPT_DEBUGMESSAGES )
+endif()
+
set(KOLAB_LINK_LIBRARIES
${Libkolabxml_LIBRARIES}
${QT_QTCORE_LIBRARY}
diff --git a/kolabformat/errorhandler.cpp b/kolabformat/errorhandler.cpp
index 91021f4..5a25b52 100644
--- a/kolabformat/errorhandler.cpp
+++ b/kolabformat/errorhandler.cpp
@@ -26,6 +26,29 @@
#include <kolabformat.h>
+#ifdef INTERCEPT_DEBUGMESSAGES
+
+void interceptDebugMsgs(QtMsgType type, const char *msg)
+{
+ switch (type) {
+ case QtFatalMsg:
+ abort();
+ default:
+ break;
+ }
+}
+
+struct Initializer {
+ Initializer()
+ {
+ qInstallMsgHandler(interceptDebugMsgs);
+ }
+};
+
+static Initializer initializer;
+
+#endif
+
QDebug operator<<(QDebug dbg, const std::string &s)
{
dbg.nospace() << QString::fromStdString(s);