Branch 'datetimeutils' - 2 commits - freebusy/freebusy.cpp kolabformat/errorhandler.cpp kolabformat/kolabdefinitions.h kolabformat/kolabobject.cpp

Christian Mollekopf mollekopf at kolabsys.com
Mon Jul 30 12:09:17 CEST 2012


 freebusy/freebusy.cpp          |    2 +-
 kolabformat/errorhandler.cpp   |   12 +++++++++---
 kolabformat/kolabdefinitions.h |    4 ++--
 kolabformat/kolabobject.cpp    |    5 +++++
 4 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit a78a53907eab1cb3e6b69361e08c8cae62bdeb04
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Jul 30 12:08:46 2012 +0200

    Debug output formatting, abort immediately if we fail to read the kolab object type.

diff --git a/freebusy/freebusy.cpp b/freebusy/freebusy.cpp
index 91f2055..cd090bd 100644
--- a/freebusy/freebusy.cpp
+++ b/freebusy/freebusy.cpp
@@ -138,7 +138,7 @@ Kolab::Period addLocalPeriod(  const KDateTime &eventStart, const KDateTime &eve
             ( eventStart <= mDtEnd ) ) ||
           ( ( mDtStart <= eventEnd ) &&
             ( eventEnd <= mDtEnd ) ) ) ) {
-    qDebug() << "out of scope";
+    qDebug() << "event is not within the fb range, skipping";
     return Kolab::Period();
   }
 
diff --git a/kolabformat/errorhandler.cpp b/kolabformat/errorhandler.cpp
index 3b2f98a..630135a 100644
--- a/kolabformat/errorhandler.cpp
+++ b/kolabformat/errorhandler.cpp
@@ -19,6 +19,9 @@
 #include "errorhandler.h"
 
 #include <qdebug.h>
+#include <QTime>
+#include <QStringList>
+#include <iostream>
 
 #include <kolabformat.h>
 
@@ -32,11 +35,14 @@ void logMessage(const QString &message, const QString &file, int line, ErrorHand
 
 void ErrorHandler::addError(ErrorHandler::Severity s, const QString& message, const QString &location)
 {
+    QString filename = location;
+    if (!filename.split(QLatin1Char('/')).isEmpty()) {
+       filename = filename.split(QLatin1Char('/')).last();
+    }
+    const QString output = filename + QTime::currentTime().toString(QLatin1String("(hh:mm:ss)")) + QLatin1String(": ") + message;
+    std::cout << output.toStdString() << std::endl;
     if (s == Debug) {
-        qDebug() << location << ": " << message;
         return;
-    } else {
-        qWarning() << location << ": " << message;
     }
     if (s > m_worstError) {
         m_worstError = s;
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 9190b94..0b25ac5 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -306,6 +306,11 @@ ObjectType KolabObjectReader::parseMimeMessage(const KMime::Message::Ptr &msg)
         d->mVersion = KolabV3;
     }
     Kolab::ObjectType objectType = getObjectType(kolabType);
+    if (objectType == InvalidObject) {
+        Warning() << "invalid object type";
+        printMessageDebugInfo(msg);
+        return InvalidObject;
+    }
     if (d->mVersion == KolabV2) {
         return d->readKolabV2(msg, objectType, kolabType);
     } else {


commit 8d8ceaa1a1302fbbe2253849a95270b55f3694fd
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Jul 30 12:01:59 2012 +0200

    Fixed kolab-type definitions

diff --git a/kolabformat/kolabdefinitions.h b/kolabformat/kolabdefinitions.h
index a9537c4..bf861f5 100644
--- a/kolabformat/kolabdefinitions.h
+++ b/kolabformat/kolabdefinitions.h
@@ -49,8 +49,8 @@ namespace Kolab {
 #define KOLAB_TYPE_JOURNAL    "application/x-vnd.kolab.journal"
 #define KOLAB_TYPE_CONTACT    "application/x-vnd.kolab.contact"
 #define KOLAB_TYPE_DISTLIST    "application/x-vnd.kolab.contact.distlist"
-#define KOLAB_TYPE_DISTLIST_COMPAT    "application/x-vnd.kolab.event"
-#define KOLAB_TYPE_NOTE    "application/x-vnd.kolab.distribution-list"
+#define KOLAB_TYPE_DISTLIST_COMPAT  "application/x-vnd.kolab.distribution-list"
+#define KOLAB_TYPE_NOTE   "application/x-vnd.kolab.note"
 #define KOLAB_TYPE_CONFIGURATION    "application/x-vnd.kolab.configuration"
 #define KOLAB_TYPE_DICT    "application/x-vnd.kolab.configuration.dictionary"
 #define KOLAB_TYPE_FREEBUSY    "application/x-vnd.kolab.freebusy"





More information about the commits mailing list