5 commits - calendaring/CMakeLists.txt calendaring/datetimeutils.cpp calendaring/datetimeutils.h freebusy/freebusy.cpp kolabformat/errorhandler.cpp kolabformat/errorhandler.h kolabformat/kolabdefinitions.h kolabformat/kolabobject.cpp tests/calendaringtest.cpp tests/calendaringtest.h
Christian Mollekopf
mollekopf at kolabsys.com
Mon Jul 30 14:40:13 CEST 2012
calendaring/CMakeLists.txt | 3 ++-
calendaring/datetimeutils.cpp | 33 +++++++++++++++++++++++++++++++++
calendaring/datetimeutils.h | 38 ++++++++++++++++++++++++++++++++++++++
freebusy/freebusy.cpp | 2 +-
kolabformat/errorhandler.cpp | 12 +++++++++---
kolabformat/errorhandler.h | 4 ++++
kolabformat/kolabdefinitions.h | 4 ++--
kolabformat/kolabobject.cpp | 5 +++++
tests/calendaringtest.cpp | 6 +++++-
tests/calendaringtest.h | 2 ++
10 files changed, 101 insertions(+), 8 deletions(-)
New commits:
commit 32630d81ed01919eeba9f71280d5413774bac03a
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Jul 30 14:38:00 2012 +0200
print doubles
diff --git a/kolabformat/errorhandler.h b/kolabformat/errorhandler.h
index 254a741..df40f93 100644
--- a/kolabformat/errorhandler.h
+++ b/kolabformat/errorhandler.h
@@ -125,6 +125,10 @@ struct KolabLogger {
isLast = false;
return KolabLogger(m_severity, m_message+maybeSpace()+QString::number(n), m_location);
}
+ KolabLogger operator<<(const double &n) {
+ isLast = false;
+ return KolabLogger(m_severity, m_message+maybeSpace()+QString::number(n), m_location);
+ }
inline KolabLogger operator<<(const char* t) {
isLast = false;
return KolabLogger(m_severity, m_message+maybeSpace()+QString::fromAscii(t), m_location);
commit 26b1883a128f15e755a8a558bf15d2aa27474135
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 042f91199608a16c1b99acbb76ddd2d8d9e5b7a5
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"
commit ff12ac0b43ad65966c23fc68a3435bfbfda96e61
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Jul 23 20:18:29 2012 +0200
print current timezone in test
diff --git a/tests/calendaringtest.cpp b/tests/calendaringtest.cpp
index 6dc9413..ce88c57 100644
--- a/tests/calendaringtest.cpp
+++ b/tests/calendaringtest.cpp
@@ -23,6 +23,7 @@
#include <iostream>
#include "calendaring/calendaring.h"
#include <calendaring/event.h>
+#include <calendaring/datetimeutils.h>
#include "testhelpers.h"
#include "testutils.h"
@@ -396,7 +397,7 @@ void CalendaringTest::testRecurrence()
void CalendaringTest::testDateTimeUtils()
{
-
+ std::cout << Kolab::DateTimeUtils::getLocalTimezone() << std::endl;
}
QTEST_MAIN( CalendaringTest )
commit e391eb5d6d79cf45830d2c68fc2e9d979fd51cc8
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Jul 23 04:30:07 2012 -0400
local timezone test function
diff --git a/calendaring/CMakeLists.txt b/calendaring/CMakeLists.txt
index 395050c..0cdbf08 100644
--- a/calendaring/CMakeLists.txt
+++ b/calendaring/CMakeLists.txt
@@ -1,6 +1,7 @@
set (CALENDARING_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/calendaring.cpp
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/datetimeutils.cpp
PARENT_SCOPE)
if(PYTHON_BINDINGS)
@@ -11,4 +12,4 @@ endif(PYTHON_BINDINGS)
if(PHP_BINDINGS)
message("building php bindings")
add_subdirectory(php)
-endif(PHP_BINDINGS)
\ No newline at end of file
+endif(PHP_BINDINGS)
diff --git a/calendaring/datetimeutils.cpp b/calendaring/datetimeutils.cpp
new file mode 100644
index 0000000..73f730d
--- /dev/null
+++ b/calendaring/datetimeutils.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "datetimeutils.h"
+
+#include <Qt/qdebug.h>
+#include <ksystemtimezone.h>
+#include "conversion/commonconversion.h"
+
+namespace Kolab {
+ namespace DateTimeUtils {
+ KOLAB_EXPORT std::string getLocalTimezone()
+ {
+ const QString tz = KSystemTimeZones::local().name();
+ return tz.toStdString();
+ }
+
+ } //Namespace
+} //Namespace
diff --git a/calendaring/datetimeutils.h b/calendaring/datetimeutils.h
new file mode 100644
index 0000000..969f8bc
--- /dev/null
+++ b/calendaring/datetimeutils.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KOLABDATETIMEUTILS_H
+#define KOLABDATETIMEUTILS_H
+
+#ifndef SWIG
+#include "kolab_export.h"
+#else
+/* No export/import SWIG interface files */
+#define KOLAB_EXPORT
+#endif
+
+#include <string>
+
+namespace Kolab {
+ namespace DateTimeUtils {
+
+ KOLAB_EXPORT std::string getLocalTimezone();
+
+ }; //Namespace
+}; //Namespace
+
+#endif
diff --git a/tests/calendaringtest.cpp b/tests/calendaringtest.cpp
index 28aa0c6..6dc9413 100644
--- a/tests/calendaringtest.cpp
+++ b/tests/calendaringtest.cpp
@@ -394,7 +394,10 @@ void CalendaringTest::testRecurrence()
}
+void CalendaringTest::testDateTimeUtils()
+{
+}
QTEST_MAIN( CalendaringTest )
diff --git a/tests/calendaringtest.h b/tests/calendaringtest.h
index 0751d48..14dd891 100644
--- a/tests/calendaringtest.h
+++ b/tests/calendaringtest.h
@@ -44,6 +44,8 @@ private slots:
void testIMip();
void testRecurrence();
+
+ void testDateTimeUtils();
};
#endif // CALENDARINGTEST_H
More information about the commits
mailing list