Projects
Kolab:3.4
libkolabxml
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 26
View file
libkolabxml.spec
Changed
@@ -48,8 +48,8 @@ %else Name: libkolabxml %endif -Version: 1.0 -Release: 0.1.dev20130521.9d6e25%{?dist} +Version: 1.0.0 +Release: 1%{?dist} Summary: Kolab XML format collection parser library Group: System Environment/Libraries @@ -368,6 +368,9 @@ %endif %changelog +* Mon Oct 14 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 1.0.0-1 +- New upstream release + * Sun May 19 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 1.0-0.1 - Snapshot as required by the latest versions of roundcubemail-plugins-kolab and iRony
View file
boost-version.patch
Deleted
@@ -1,12 +0,0 @@ -diff -ur libkolabxml-0.8.4.orig/cmake/modules/FindLibkolabxmlDependencies.cmake libkolabxml-0.8.4/cmake/modules/FindLibkolabxmlDependencies.cmake ---- libkolabxml-0.8.4.orig/cmake/modules/FindLibkolabxmlDependencies.cmake 2013-04-11 10:35:34.000000000 +0100 -+++ libkolabxml-0.8.4/cmake/modules/FindLibkolabxmlDependencies.cmake 2013-06-17 12:31:13.915485864 +0100 -@@ -4,7 +4,7 @@ - find_package(PkgConfig) - include(FindPackageHandleStandardArgs) - --if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42) -+if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.43) - find_library(UUID NAMES ossp-uuid) - find_package_handle_standard_args(UUID DEFAULT_MSG - UUID)
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +libkolabxml (1.0.0-0~kolab1) unstable; urgency=low + + * Check in upstream release 1.0.0 + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Mon, 14 Oct 2013 16:38:05 +0200 + libkolabxml (1.0~dev20130521-1) unstable; urgency=low * Check in version 1.0~dev20130521 for Kolab 3.1
View file
debian.series
Changed
@@ -1,2 +1,1 @@ -boost-version.patch -p1 libossp-uuid-include.patch -p1
View file
libkolabxml-1.0.tar.gz/CMakeLists.txt -> libkolabxml-1.0.0.tar.gz/CMakeLists.txt
Changed
@@ -48,7 +48,7 @@ set (Libkolabxml_VERSION "${Libkolabxml_VERSION_MAJOR}.${Libkolabxml_VERSION_MINOR}" ) set (Libkolabxml_VERSION_STRING ${CMAKE_PROJECT_NAME}-${Libkolabxml_VERSION}) -set (KOLAB_FORMAT_VERSION "3.0dev1") +set (KOLAB_FORMAT_VERSION "3.1.0") message("Building DIST targets (make dist, make snapshot)") #make dist requires a tag with ${ARCHIVE_NAME} (e.g. libkolabxml-0.2.0) @@ -80,6 +80,14 @@ set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/kolabxml) set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libkolabxml ) +# Make relative paths absolute (needed later on) +foreach(p LIB INCLUDE CMAKECONFIG) + set(var ${p}_INSTALL_DIR) + if(NOT IS_ABSOLUTE "${${var}}") + set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() +endforeach() + configure_file(libkolabxml-version.h.cmake "${CMAKE_BINARY_DIR}/libkolabxml-version.h" @ONLY) set(Boost_USE_MULTITHREADED ON) @@ -189,9 +197,12 @@ add_subdirectory(tests) endif() -install(EXPORT LibkolabxmlExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibkolabxmlTargets.cmake ) +#Get the include directory relative to CMAKECONFIG_INSTALL_DIR +file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKECONFIG_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}") +#Assemble the full relative path. This will be used in the LibkolabxmlConfig.cmake, which will be installed in CMAKECONFIG_INSTALL_DIR +set(CONF_INCLUDE_DIRS "\${Libkolabxml_CMAKE_DIR}/${REL_INCLUDE_DIR}") -file(RELATIVE_PATH relInstallDir ${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX} ) +install(EXPORT LibkolabxmlExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibkolabxmlTargets.cmake ) configure_file(${Libkolabxml_MODULE_DIR}/LibkolabxmlConfig.cmake.in ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfig.cmake @ONLY ) configure_file(${Libkolabxml_MODULE_DIR}/LibkolabxmlConfigVersion.cmake.in ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfigVersion.cmake @ONLY )
View file
libkolabxml-1.0.tar.gz/cmake/modules/FindLibkolabxmlDependencies.cmake -> libkolabxml-1.0.0.tar.gz/cmake/modules/FindLibkolabxmlDependencies.cmake
Changed
@@ -4,7 +4,7 @@ find_package(PkgConfig) include(FindPackageHandleStandardArgs) -if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42) +if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.43) find_library(UUID NAMES ossp-uuid) find_package_handle_standard_args(UUID DEFAULT_MSG UUID)
View file
libkolabxml-1.0.tar.gz/cmake/modules/LibkolabxmlConfig.cmake.in -> libkolabxml-1.0.0.tar.gz/cmake/modules/LibkolabxmlConfig.cmake.in
Changed
@@ -1,18 +1,17 @@ -get_filename_component(myDir ${CMAKE_CURRENT_LIST_FILE} PATH) # get the directory where I myself am -get_filename_component(rootDir ${myDir}/@relInstallDir@ ABSOLUTE) # get the chosen install prefix +get_filename_component(Libkolabxml_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #get the directory where this *Config.cmake file is installed -# set the version of myself +# set the version set(Libkolabxml_VERSION_MAJOR @Libkolabxml_VERSION_MAJOR@) set(Libkolabxml_VERSION_MINOR @Libkolabxml_VERSION_MINOR@) set(Libkolabxml_VERSION_PATCH @Libkolabxml_VERSION_PATCH@) -set(Libkolabxml_VERSION ${Libkolabxml_VERSION_MAJOR}.${Libkolabxml_VERSION_MINOR}.${Libkolabxml_VERSION_PATCH} ) +set(Libkolabxml_VERSION ${Libkolabxml_VERSION_MAJOR}.${Libkolabxml_VERSION_MINOR}.${Libkolabxml_VERSION_PATCH}) -# what is my include directory -set(Libkolabxml_INSTALL_PREFIX "${rootDir}") -set(Libkolabxml_INCLUDES "${rootDir}/@INCLUDE_INSTALL_DIR@") +# Set the include directory +set(Libkolabxml_INCLUDES "@CONF_INCLUDE_DIRS@") # import the exported targets -include(${myDir}/LibkolabxmlTargets.cmake) +include(${Libkolabxml_CMAKE_DIR}/LibkolabxmlTargets.cmake) # set the expected library variable -set(Libkolabxml_LIBRARIES kolabxml ) +set(Libkolabxml_LIBRARIES kolabxml) +
View file
libkolabxml-1.0.tar.gz/schemas/kolabformat.xsd -> libkolabxml-1.0.0.tar.gz/schemas/kolabformat.xsd
Changed
@@ -101,6 +101,7 @@ <xs:restriction base="xs:token"> <xs:enumeration value="dictionary"/> <xs:enumeration value="categorycolor"/> + <xs:enumeration value="snippets"/> </xs:restriction> </xs:simpleType> @@ -117,6 +118,26 @@ <xs:element name="categorycolor" type="CategoryColor"/> + <xs:simpleType name="textformatType"> + <xs:restriction base="xs:token"> + <xs:enumeration value="PLAIN"/> + <xs:enumeration value="HTML"/> + </xs:restriction> + </xs:simpleType> + + <xs:element name="textformat" type="textformatType" /> + + <xs:complexType name="Snippet" mixed="true" > + <xs:sequence> + <xs:element name="name" type="xs:string"/> + <xs:element name="text" type="xs:string"/> + <xs:element name="textformat" type="textformatType"/> + <xs:element name="shortcut" type="xs:string" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="color" type="xs:string" /> + </xs:complexType> + + <xs:element name="snippet" type="Snippet"/> <xs:complexType name="Configuration"> <xs:complexContent mixed="false"> @@ -132,6 +153,9 @@ <xs:element name="e" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!-- Categorycolor --> <xs:element name="categorycolor" type="CategoryColor" minOccurs="0" maxOccurs="unbounded"/> + <!-- Snippets --> + <xs:element name="name" type="xs:string" minOccurs="0"/> + <xs:element name="snippet" type="Snippet" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:extension> </xs:complexContent>
View file
libkolabxml-1.0.tar.gz/src/CMakeLists.txt -> libkolabxml-1.0.0.tar.gz/src/CMakeLists.txt
Changed
@@ -7,6 +7,7 @@ # Library with serialization/deserialization code and kolab-containers add_library(kolabxml SHARED kolabformat.cpp + objectvalidation.cpp containers/kolabcontainers.cpp containers/kolabnote.cpp containers/kolabevent.cpp
View file
libkolabxml-1.0.tar.gz/src/containers/kolabconfiguration.cpp -> libkolabxml-1.0.0.tar.gz/src/containers/kolabconfiguration.cpp
Changed
@@ -24,6 +24,7 @@ std::vector<CategoryColor> categoryColor; Dictionary dictionary; + SnippetsCollection snippets; ConfigurationType type; std::string uid; cDateTime created; @@ -49,6 +50,13 @@ d->type = TypeDictionary; } +Configuration::Configuration(const SnippetsCollection &snippets) +: d(new Configuration::Private) +{ + d->snippets = snippets; + d->type = TypeSnippet; +} + Configuration::Configuration(const Configuration &other) : d(new Configuration::Private) { @@ -116,6 +124,9 @@ return d->dictionary; } - +SnippetsCollection Configuration::snippets() const +{ + return d->snippets; +} } //Namespace
View file
libkolabxml-1.0.tar.gz/src/containers/kolabconfiguration.h -> libkolabxml-1.0.0.tar.gz/src/containers/kolabconfiguration.h
Changed
@@ -62,11 +62,59 @@ std::vector<CategoryColor> mSubcategories; }; +struct Snippet { + enum TextType { + Plain, + HTML + }; + + Snippet(): mTextType(Plain) {} + Snippet(const std::string &name, const std::string &text): mName(name), mText(text), mTextType(Plain) {} + + bool operator==(const Snippet &other) const { + return mName == other.mName && mText == other.mText && mTextType == other.mTextType && mShortcut == other.mShortcut; + } + + std::string name() const { return mName; } + std::string text() const { return mText; } + + void setTextType(TextType type) { mTextType = type; } + TextType textType() const { return mTextType; } + + void setShortCut(const std::string &shortcut) { mShortcut = shortcut; } + std::string shortCut() const { return mShortcut; } + +private: + std::string mName; + std::string mText; + TextType mTextType; + std::string mShortcut; +}; + +struct SnippetsCollection { + SnippetsCollection() {} + SnippetsCollection(const std::string &name): mName(name) {} + + bool operator==(const SnippetsCollection &other) const { + return mName == other.mName && mSnippets == other.mSnippets; + } + + std::string name() const { return mName; } + + void setSnippets(const std::vector<Snippet> &snippets) { mSnippets = snippets; } + std::vector<Snippet> snippets() const { return mSnippets; } + +private: + std::string mName; + std::vector<Snippet> mSnippets; +}; + class Configuration { public: Configuration(); Configuration(const std::vector<CategoryColor> &); Configuration(const Dictionary &); + Configuration(const SnippetsCollection &); Configuration(const Configuration &); ~Configuration(); void operator=(const Configuration &); @@ -85,11 +133,13 @@ enum ConfigurationType { Invalid, TypeDictionary, - TypeCategoryColor + TypeCategoryColor, + TypeSnippet }; ConfigurationType type() const; std::vector<CategoryColor> categoryColor() const; Dictionary dictionary() const; + SnippetsCollection snippets() const; private: struct Private; boost::scoped_ptr<Private> d;
View file
libkolabxml-1.0.tar.gz/src/kolabconversions.h -> libkolabxml-1.0.0.tar.gz/src/kolabconversions.h
Changed
@@ -127,6 +127,8 @@ return KolabXSD::Configuration::type_type::dictionary; case Kolab::Configuration::TypeCategoryColor: return KolabXSD::Configuration::type_type::categorycolor; + case Kolab::Configuration::TypeSnippet: + return KolabXSD::Configuration::type_type::snippets; default: CRITICAL("Invalid configuration type"); } @@ -138,31 +140,30 @@ std::string serializeObject(const T &, const std::string prod = std::string()); template <> -std::string serializeObject <Kolab::Configuration> (const Kolab::Configuration ¬e, const std::string prod) +std::string serializeObject <Kolab::Configuration> (const Kolab::Configuration &configuration, const std::string prod) { - clearErrors(); try { - const std::string &uid = getUID(note.uid()); + const std::string &uid = getUID(configuration.uid()); setCreatedUid(uid); KolabXSD::Configuration::creation_date_type created(0,0,0,0,0,0); - if (note.created().isValid()) { - created = fromDateTime(note.created()); + if (configuration.created().isValid()) { + created = fromDateTime(configuration.created()); } else { created = fromDateTime(timestamp()); } KolabXSD::Configuration::last_modification_date_type lastModificationDate(0,0,0,0,0,0); - if (note.lastModified().isValid()) { - lastModificationDate = fromDateTime(note.lastModified()); + if (configuration.lastModified().isValid()) { + lastModificationDate = fromDateTime(configuration.lastModified()); } else { // WARNING("missing last_modification_date, fallback to current timestamp"); lastModificationDate = fromDateTime(timestamp()); } - KolabXSD::Configuration n(uid, getProductId(prod), created, lastModificationDate, getConfiguratinoType(note.type())); + KolabXSD::Configuration n(uid, getProductId(prod), created, lastModificationDate, getConfiguratinoType(configuration.type())); - switch (note.type()) { + switch (configuration.type()) { case Kolab::Configuration::TypeDictionary: { - const Kolab::Dictionary &dict = note.dictionary(); + const Kolab::Dictionary &dict = configuration.dictionary(); n.language(dict.language()); BOOST_FOREACH(const std::string &e, dict.entries()) { n.e().push_back(e); @@ -170,7 +171,23 @@ } break; case Kolab::Configuration::TypeCategoryColor: - writeColors(n.categorycolor(), note.categoryColor()); + writeColors(n.categorycolor(), configuration.categoryColor()); + break; + case Kolab::Configuration::TypeSnippet: { + const Kolab::SnippetsCollection &snippets = configuration.snippets(); + n.name(snippets.name()); + BOOST_FOREACH(const Kolab::Snippet &s, snippets.snippets()) { + KolabXSD::Snippet::textformat_type type = KolabXSD::Snippet::textformat_type::PLAIN; + if (s.textType() == Snippet::HTML) { + type = KolabXSD::Snippet::textformat_type::HTML; + } + KolabXSD::Configuration::snippet_type snippet(s.name(), s.text(), type); + if (!s.shortCut().empty()) { + snippet.shortcut(s.shortCut()); + } + n.snippet().push_back(snippet); + } + } break; default: CRITICAL("Invalid configuration type"); @@ -195,7 +212,6 @@ template <> std::string serializeObject <Kolab::Note> (const Kolab::Note ¬e, const std::string prod) { - clearErrors(); try { const std::string &uid = getUID(note.uid()); setCreatedUid(uid); @@ -273,7 +289,6 @@ template <> std::string serializeObject <Kolab::File> (const Kolab::File &file, const std::string prod) { - clearErrors(); try { const std::string &uid = getUID(file.uid()); setCreatedUid(uid); @@ -349,7 +364,6 @@ template <> boost::shared_ptr<Kolab::Note> deserializeObject <Kolab::Note> (const std::string& s, bool isUrl) { - clearErrors(); try { std::auto_ptr<KolabXSD::Note> note; if (isUrl) { @@ -442,7 +456,6 @@ template <> boost::shared_ptr<Kolab::Configuration> deserializeObject <Kolab::Configuration> (const std::string& s, bool isUrl) { - clearErrors(); try { std::auto_ptr<KolabXSD::Configuration> configuration; if (isUrl) { @@ -481,6 +494,27 @@ n = boost::shared_ptr<Kolab::Configuration>(new Kolab::Configuration(dict)); } else if (configuration->type() == KolabXSD::ConfigurationType::categorycolor) { n = boost::shared_ptr<Kolab::Configuration>(new Kolab::Configuration(readColors(configuration->categorycolor()))); + } else if (configuration->type() == KolabXSD::ConfigurationType::snippets) { + std::string name; + if (configuration->name()) { + name = *configuration->name(); + } + SnippetsCollection collection(name); + + std::vector<Snippet> snippets; + BOOST_FOREACH (const KolabXSD::Configuration::snippet_type &entry, configuration->snippet()) { + Snippet snippet(entry.name(), entry.text()); + if (entry.textformat() == KolabXSD::textformatType::HTML) { + snippet.setTextType(Snippet::HTML); + } + if (entry.shortcut()) { + snippet.setShortCut(*entry.shortcut()); + } + snippets.push_back(snippet); + } + collection.setSnippets(snippets); + + n = boost::shared_ptr<Kolab::Configuration>(new Kolab::Configuration(collection)); } else { CRITICAL("No valid configuration type"); } @@ -506,7 +540,6 @@ template <> boost::shared_ptr<Kolab::File> deserializeObject <Kolab::File> (const std::string& s, bool isUrl) { - clearErrors(); try { std::auto_ptr<KolabXSD::File> file; if (isUrl) {
View file
libkolabxml-1.0.tar.gz/src/kolabformat.cpp -> libkolabxml-1.0.0.tar.gz/src/kolabformat.cpp
Changed
@@ -23,6 +23,7 @@ #include "xcardconversions.h" #include "utils.h" #include "kolabconversions.h" +#include "objectvalidation.h" namespace Kolab { @@ -73,6 +74,7 @@ Kolab::Event readEvent(const std::string& s, bool isUrl) { + Utils::clearErrors(); Kolab::XCAL::IncidenceTrait <Kolab::Event >::IncidencePtr ptr = XCAL::deserializeIncidence< XCAL::IncidenceTrait<Kolab::Event> >(s, isUrl); if (!ptr.get()) { return Kolab::Event(); @@ -82,11 +84,14 @@ std::string writeEvent(const Kolab::Event &event, const std::string& productId) { + Utils::clearErrors(); + validate(event); return XCAL::serializeIncidence< XCAL::IncidenceTrait<Kolab::Event> >(event, productId); } Kolab::Todo readTodo(const std::string& s, bool isUrl) { + Utils::clearErrors(); XCAL::IncidenceTrait<Kolab::Todo>::IncidencePtr ptr = XCAL::deserializeIncidence< XCAL::IncidenceTrait<Kolab::Todo> >(s, isUrl); if (!ptr.get()) { return Kolab::Todo(); @@ -96,11 +101,14 @@ std::string writeTodo(const Kolab::Todo &event, const std::string& productId) { + Utils::clearErrors(); + validate(event); return XCAL::serializeIncidence< XCAL::IncidenceTrait<Kolab::Todo> >(event, productId); } Journal readJournal(const std::string& s, bool isUrl) { + Utils::clearErrors(); XCAL::IncidenceTrait<Kolab::Journal>::IncidencePtr ptr = XCAL::deserializeIncidence<XCAL::IncidenceTrait<Kolab::Journal> >(s, isUrl); if (!ptr.get()) { return Kolab::Journal(); @@ -110,11 +118,14 @@ std::string writeJournal(const Kolab::Journal &j, const std::string& productId) { + Utils::clearErrors(); + validate(j); return XCAL::serializeIncidence<XCAL::IncidenceTrait<Kolab::Journal> >(j, productId); } Kolab::Freebusy readFreebusy(const std::string& s, bool isUrl) { + Utils::clearErrors(); XCAL::IncidenceTrait<Kolab::Freebusy>::IncidencePtr ptr = XCAL::deserializeIncidence<XCAL::IncidenceTrait<Kolab::Freebusy> >(s, isUrl); if (!ptr.get()) { return Kolab::Freebusy(); @@ -124,11 +135,14 @@ std::string writeFreebusy(const Freebusy &f, const std::string& productId) { + Utils::clearErrors(); + validate(f); return XCAL::serializeFreebusy<XCAL::IncidenceTrait<Kolab::Freebusy> >(f, productId); } Kolab::Contact readContact(const std::string& s, bool isUrl) { + Utils::clearErrors(); boost::shared_ptr <Kolab::Contact > ptr = XCARD::deserializeCard<Kolab::Contact>(s, isUrl); if (!ptr.get()) { return Kolab::Contact(); @@ -138,11 +152,14 @@ std::string writeContact(const Contact &contact, const std::string& productId) { + Utils::clearErrors(); + validate(contact); return XCARD::serializeCard(contact, productId); } DistList readDistlist(const std::string& s, bool isUrl) { + Utils::clearErrors(); boost::shared_ptr <Kolab::DistList> ptr = XCARD::deserializeCard<Kolab::DistList>(s, isUrl); if (!ptr.get()) { return Kolab::DistList(); @@ -152,11 +169,14 @@ std::string writeDistlist(const DistList &list, const std::string& productId) { + Utils::clearErrors(); + validate(list); return XCARD::serializeCard(list, productId); } Note readNote(const std::string& s, bool isUrl) { + Utils::clearErrors(); boost::shared_ptr <Kolab::Note> ptr = Kolab::KolabObjects::deserializeObject<Kolab::Note>(s, isUrl); if (!ptr.get()) { return Kolab::Note(); @@ -166,11 +186,14 @@ std::string writeNote(const Note ¬e, const std::string& productId) { + Utils::clearErrors(); + validate(note); return Kolab::KolabObjects::serializeObject<Kolab::Note>(note, productId); } File readFile(const std::string& s, bool isUrl) { + Utils::clearErrors(); boost::shared_ptr <Kolab::File> ptr = Kolab::KolabObjects::deserializeObject<Kolab::File>(s, isUrl); if (!ptr.get()) { return Kolab::File(); @@ -180,11 +203,14 @@ std::string writeFile(const File &file, const std::string& productId) { + Utils::clearErrors(); + validate(file); return Kolab::KolabObjects::serializeObject<Kolab::File>(file, productId); } Configuration readConfiguration(const std::string& s, bool isUrl) { + Utils::clearErrors(); boost::shared_ptr <Kolab::Configuration> ptr = Kolab::KolabObjects::deserializeObject<Kolab::Configuration>(s, isUrl); if (!ptr.get()) { return Kolab::Configuration(); @@ -194,6 +220,8 @@ std::string writeConfiguration(const Configuration &config, const std::string& productId) { + Utils::clearErrors(); + validate(config); return Kolab::KolabObjects::serializeObject< Kolab::Configuration >(config, productId); }
View file
libkolabxml-1.0.0.tar.gz/src/objectvalidation.cpp
Added
@@ -0,0 +1,142 @@ +/* + * Copyright (C) 2013 Christian Mollekopf <mollekopf@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 "objectvalidation.h" + +#include "kolabevent.h" +#include "kolabtodo.h" +#include "kolabjournal.h" +#include "kolabcontact.h" +#include "kolabconfiguration.h" +#include "kolabfile.h" +#include "utils.h" +#include "tztable.h" +#include <boost/unordered_set.hpp> + +namespace Kolab { + +static boost::unordered_set<std::string> initializeTzSet() { + boost::unordered_set<std::string> set; + for (int i = 0; i < numOlsonTimezones; i++) { + set.insert(olsonTimezones[i]); + } + return set; +} + +const boost::unordered_set<std::string> tzSet = initializeTzSet(); + +bool isValid(const cDateTime &datetime) +{ + if (!datetime.isValid()) { + return true; + } + const std::string tz = datetime.timezone(); + if (!tz.empty()) { + if (datetime.isUTC() && !tz.empty()) { + Utils::logMessage("A UTC datetime may not have a timezone", "", 0, Error); + return false; + } + if (tzSet.find(tz) == tzSet.end()) { + Utils::logMessage("not a valid olson timezone.", "", 0, Error); + return false; + } + } + return true; +} + +#define ASSERT(arg) \ + do {\ + if ( !(arg) ) { \ + Utils::logMessage(#arg " is false", __FILE__, __LINE__, Error); \ + } \ + } while(0) + +#define ASSERTEQUAL(arg1, arg2) \ + do {\ + if ( (arg1) != (arg2) ) { \ + Utils::logMessage(#arg1 " != " #arg2, __FILE__, __LINE__, Error); \ + } \ + } while(0) + +#define ASSERTEXISTING(arg) \ + do {\ + if ( !(arg).isValid() ) { \ + Utils::logMessage(#arg " is not set", __FILE__, __LINE__, Error); \ + } \ + } while(0) + +#define ASSERTVALID(arg) \ + do {\ + if ( (arg).isValid() && !isValid((arg)) ) { \ + Utils::logMessage(#arg " is not valid", __FILE__, __LINE__, Error); \ + } \ + } while(0) + +void validate(const Event &event) +{ + ASSERTEXISTING(event.start()); + ASSERTVALID(event.start()); + ASSERTVALID(event.end()); + if (event.end().isValid()) { + ASSERTEQUAL(event.start().timezone(), event.end().timezone()); + } +} + +void validate(const Todo& todo) +{ + ASSERTVALID(todo.start()); + ASSERTVALID(todo.due()); + ASSERTEQUAL(todo.start().timezone(), todo.due().timezone()); +} + +void validate(const Journal& journal) +{ + ASSERTVALID(journal.start()); +} + +void validate(const Contact& contact) +{ + +} + +void validate(const DistList& distlist) +{ + +} + +void validate(const Freebusy& freebusy) +{ + +} + +void validate(const Note& note) +{ + +} + +void validate(const Configuration& configuration) +{ + +} + +void validate(const File& file) +{ + +} + +} +
View file
libkolabxml-1.0.0.tar.gz/src/objectvalidation.h
Added
@@ -0,0 +1,52 @@ +/* + * Copyright (C) 2013 Christian Mollekopf <mollekopf@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 OBJECTVALIDATION_H +#define OBJECTVALIDATION_H + +namespace Kolab { + +class Event; +class Todo; +class Journal; +class Freebusy; +class Contact; +class DistList; +class Note; +class Configuration; +class File; + +/** + * The validations in here are supposed to validate kolab objects beyond what the xml schema covers. + * + * A typical usecase is to check if event start/end date have the same timezone, or if all used timezones are valid. + */ + +void validate(const Kolab::Event &event); +void validate(const Kolab::Todo &todo); +void validate(const Kolab::Journal &journal); +void validate(const Kolab::Freebusy &freebusy); +void validate(const Kolab::Contact &contact); +void validate(const Kolab::DistList &distlist); +void validate(const Kolab::Note ¬e); +void validate(const Kolab::Configuration &configuration); +void validate(const Kolab::File &file); + +} + +#endif +
View file
libkolabxml-1.0.tar.gz/src/xcalconversions.h -> libkolabxml-1.0.0.tar.gz/src/xcalconversions.h
Changed
@@ -1466,10 +1466,6 @@ getIncidenceProperties<icalendar_2_0::KolabEvent::properties_type>(prop, event); getTodoEventProperties<icalendar_2_0::KolabEvent::properties_type>(prop, event); - if (!event.start().isValid()) { - ERROR("Start date is missing, but is mandatory for events"); - } - if (event.end().isValid()) { prop.dtend(fromDate<icalendar_2_0::KolabEvent::properties_type::dtend_type>(event.end())); } else if (event.duration().isValid()) { @@ -1860,8 +1856,6 @@ using namespace icalendar_2_0; typedef typename T::KolabType KolabType; - - clearErrors(); try { @@ -1923,8 +1917,7 @@ typedef typename T::IncidencePtr IncidencePtr; typedef typename T::IncidenceType IncidenceType; typedef typename T::KolabType KolabType; - - clearErrors(); + try { std::auto_ptr<icalendar_2_0::IcalendarType> icalendar; if (isUrl) { @@ -1978,8 +1971,6 @@ using namespace icalendar_2_0; typedef typename T::KolabType KolabType; - clearErrors(); - try { typename KolabType::properties_type::uid_type uid( getUID(incidence.uid()));
View file
libkolabxml-1.0.tar.gz/src/xcardconversions.h -> libkolabxml-1.0.0.tar.gz/src/xcardconversions.h
Changed
@@ -1131,8 +1131,6 @@ members.push_back(Shared::toContactReference(m.uri())); } distlist->setMembers(members); - } else { - WARNING("empty distlist"); } return distlist; }
View file
libkolabxml-1.0.tar.gz/tests/CMakeLists.txt -> libkolabxml-1.0.0.tar.gz/tests/CMakeLists.txt
Changed
@@ -29,6 +29,11 @@ add_executable(parsingtest parsingtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC}) target_link_libraries(parsingtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C}) add_test(parsingtest ${CMAKE_CURRENT_BINARY_DIR}/parsingtest) + + QT4_AUTOMOC(validationtest.cpp) + add_executable(validationtest validationtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC}) + target_link_libraries(validationtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C}) + add_test(validationtest ${CMAKE_CURRENT_BINARY_DIR}/validationtest) else() message(WARNING "Could not build tests because qt is missing") endif()
View file
libkolabxml-1.0.tar.gz/tests/bindingstest.cpp -> libkolabxml-1.0.0.tar.gz/tests/bindingstest.cpp
Changed
@@ -75,6 +75,35 @@ QCOMPARE(re.dictionary(), dict); } +void BindingsTest::snippetConfigurationCompletness() +{ + std::vector<Kolab::Snippet> list; + Kolab::Snippet snippet1("name1", "text1"); + snippet1.setShortCut("shrtct1"); + list.push_back(snippet1); + Kolab::Snippet snippet2("name1", "text1"); + snippet2.setTextType(Kolab::Snippet::HTML); + list.push_back(snippet2); + + Kolab::SnippetsCollection snippets("collectionname"); + snippets.setSnippets(list); + + Kolab::Configuration configuration(snippets); + configuration.setUid("uid"); + configuration.setCreated(Kolab::cDateTime(2006,1,6,12,0,0,true)); //UTC + configuration.setLastModified(Kolab::cDateTime(2006,1,6,12,0,0,true)); //UTC + + const std::string &result = Kolab::writeConfiguration(configuration); + QCOMPARE(Kolab::error(), Kolab::NoError); +// std::cout << result << std::endl; + const Kolab::Configuration &re = Kolab::readConfiguration(result, false); + QCOMPARE(Kolab::error(), Kolab::NoError); + QCOMPARE(re.uid(), configuration.uid()); + QCOMPARE(re.created(), configuration.created()); + QCOMPARE(re.lastModified(), configuration.lastModified()); + QCOMPARE(re.type(), Kolab::Configuration::TypeSnippet); + QCOMPARE(re.snippets(), snippets); +} void BindingsTest::noteCompletness() { @@ -770,6 +799,7 @@ void BindingsTest::BenchmarkRoundtripKolab() { const Kolab::Event &event = Kolab::readEvent(TEST_DATA_PATH "/testfiles/icalEvent.xml", true); + QVERIFY(!Kolab::errorOccurred()); std::string result = Kolab::writeEvent(event); QBENCHMARK { Kolab::readEvent(result, false); @@ -779,6 +809,7 @@ void BindingsTest::BenchmarkRoundtrip() { const Kolab::Event &event = Kolab::readEvent(TEST_DATA_PATH "/testfiles/icalEvent.xml", true); + QVERIFY(!Kolab::errorOccurred()); std::string result; QBENCHMARK { result = Kolab::writeEvent(event);
View file
libkolabxml-1.0.tar.gz/tests/bindingstest.h -> libkolabxml-1.0.0.tar.gz/tests/bindingstest.h
Changed
@@ -24,6 +24,7 @@ //Kolabformat void categorycolorConfigurationCompletness(); void dictionaryConfigurationCompletness(); + void snippetConfigurationCompletness(); void noteCompletness(); void fileCompletness(); void eventCompletness();
View file
libkolabxml-1.0.tar.gz/tests/conversiontest.cpp -> libkolabxml-1.0.0.tar.gz/tests/conversiontest.cpp
Changed
@@ -176,8 +176,8 @@ QTest::addColumn<QString>("email"); QTest::addColumn<QString>("name"); QTest::addColumn<QString>("resultEncoded"); - //Older versions used to encode "." and "_". Not sure which version is actually required though (fixed in 7.27.0 but broken in 7.19.7, we're testing for 7.27.0) - if (LIBCURL_VERSION_NUM >= 0x071b00) { + //Older versions used to encode "." and "_". Not sure which version is actually required though (fixed in 7.26.0 but broken in 7.19.7, we're testing for 7.26.0) + if (LIBCURL_VERSION_NUM >= 0x071a00) { QTest::newRow("1") << "email_1@email.com" << "John Doe" << "mailto:John%20Doe%3Cemail_1%40email.com%3E"; QTest::newRow("Reserved characters") << "!*'();:@&=+$,/?#[]@email.com" << "John Doe" << "mailto:John%20Doe%3C%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%23%5B%5D%40email.com%3E"; QTest::newRow("Unreserved characters") << "Aa0-_.~@email.com" << "John Doe" << "mailto:John%20Doe%3CAa0-_.~%40email.com%3E";
View file
libkolabxml-1.0.0.tar.gz/tests/validationtest.cpp
Added
@@ -0,0 +1,88 @@ +/* + Copyright (C) 2013 Christian Mollekopf <mollekopf@kolabsys.com> + + This library 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 2.1 of the License, or (at your option) any later version. + + This library 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 library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "validationtest.h" + +#include <QTest> + +#include "src/kolabformat.h" + +using namespace Kolab; + +void ValidationTest::testErrorOnEmptyEvent() +{ + Event event; + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::Error); +} + +void ValidationTest::testNoErrorOnValidEvent() +{ + Event event; + event.setStart(cDateTime(2013,1,1,1,1,1)); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::NoError); +} + +void ValidationTest::testOlsonTimezone() +{ + Event event; + event.setStart(cDateTime("Europe/Zurich",2013,1,1,1,1,1)); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::NoError); +} + +void ValidationTest::testDifferentTimezones() +{ + Event event; + event.setStart(cDateTime("Europe/Zurich",2013,1,1,1,1,1)); + event.setEnd(cDateTime("Europe/London",2013,1,1,1,1,1)); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::Error); +} + +void ValidationTest::testUTCwithTimezone() +{ + Event event; + cDateTime dt("Europe/Zurich",2013,1,1,1,1,1); + dt.setUTC(true); + event.setStart(dt); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::Error); +} + +void ValidationTest::testTimezoneZ() +{ + Event event; + event.setStart(cDateTime("Z",2013,1,1,1,1,1)); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::Error); +} + +void ValidationTest::testWindowsTimezone() +{ + Event event; + event.setStart(cDateTime("Central European Standard Time",2013,1,1,1,1,1)); + writeEvent(event); + QCOMPARE(Kolab::error(), Kolab::Error); +} + + +QTEST_MAIN( ValidationTest ) + +#include "validationtest.moc"
View file
libkolabxml-1.0.0.tar.gz/tests/validationtest.h
Added
@@ -0,0 +1,36 @@ +/* + Copyright (C) 2013 Christian Mollekopf <mollekopf@kolabsys.com> + + This library 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 2.1 of the License, or (at your option) any later version. + + This library 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 library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef VALIDATIONTEST_H +#define VALIDATIONTEST_H + + +#include <QObject> + +class ValidationTest: public QObject { + Q_OBJECT +private slots: + void testErrorOnEmptyEvent(); + void testNoErrorOnValidEvent(); + void testOlsonTimezone(); + void testDifferentTimezones(); + void testUTCwithTimezone(); + void testTimezoneZ(); + void testWindowsTimezone(); +}; + +#endif
View file
libkolabxml-1.0.0.tar.gz/tztable.h
Added
@@ -0,0 +1,424 @@ +//This file was generated by the zonetabconversion.py script +static const char* olsonTimezones[] = { + "Europe/Andorra", + "Asia/Dubai", + "Asia/Kabul", + "America/Antigua", + "America/Anguilla", + "Europe/Tirane", + "Asia/Yerevan", + "Africa/Luanda", + "Antarctica/McMurdo", + "Antarctica/South_Pole", + "Antarctica/Rothera", + "Antarctica/Palmer", + "Antarctica/Mawson", + "Antarctica/Davis", + "Antarctica/Casey", + "Antarctica/Vostok", + "Antarctica/DumontDUrville", + "Antarctica/Syowa", + "America/Argentina/Buenos_Aires", + "America/Argentina/Cordoba", + "America/Argentina/Salta", + "America/Argentina/Jujuy", + "America/Argentina/Tucuman", + "America/Argentina/Catamarca", + "America/Argentina/La_Rioja", + "America/Argentina/San_Juan", + "America/Argentina/Mendoza", + "America/Argentina/San_Luis", + "America/Argentina/Rio_Gallegos", + "America/Argentina/Ushuaia", + "Pacific/Pago_Pago", + "Europe/Vienna", + "Australia/Lord_Howe", + "Antarctica/Macquarie", + "Australia/Hobart", + "Australia/Currie", + "Australia/Melbourne", + "Australia/Sydney", + "Australia/Broken_Hill", + "Australia/Brisbane", + "Australia/Lindeman", + "Australia/Adelaide", + "Australia/Darwin", + "Australia/Perth", + "Australia/Eucla", + "America/Aruba", + "Europe/Mariehamn", + "Asia/Baku", + "Europe/Sarajevo", + "America/Barbados", + "Asia/Dhaka", + "Europe/Brussels", + "Africa/Ouagadougou", + "Europe/Sofia", + "Asia/Bahrain", + "Africa/Bujumbura", + "Africa/Porto-Novo", + "America/St_Barthelemy", + "Atlantic/Bermuda", + "Asia/Brunei", + "America/La_Paz", + "America/Kralendijk", + "America/Noronha", + "America/Belem", + "America/Fortaleza", + "America/Recife", + "America/Araguaina", + "America/Maceio", + "America/Bahia", + "America/Sao_Paulo", + "America/Campo_Grande", + "America/Cuiaba", + "America/Santarem", + "America/Porto_Velho", + "America/Boa_Vista", + "America/Manaus", + "America/Eirunepe", + "America/Rio_Branco", + "America/Nassau", + "Asia/Thimphu", + "Africa/Gaborone", + "Europe/Minsk", + "America/Belize", + "America/St_Johns", + "America/Halifax", + "America/Glace_Bay", + "America/Moncton", + "America/Goose_Bay", + "America/Blanc-Sablon", + "America/Montreal", + "America/Toronto", + "America/Nipigon", + "America/Thunder_Bay", + "America/Iqaluit", + "America/Pangnirtung", + "America/Resolute", + "America/Atikokan", + "America/Rankin_Inlet", + "America/Winnipeg", + "America/Rainy_River", + "America/Regina", + "America/Swift_Current", + "America/Edmonton", + "America/Cambridge_Bay", + "America/Yellowknife", + "America/Inuvik", + "America/Creston", + "America/Dawson_Creek", + "America/Vancouver", + "America/Whitehorse", + "America/Dawson", + "Indian/Cocos", + "Africa/Kinshasa", + "Africa/Lubumbashi", + "Africa/Bangui", + "Africa/Brazzaville", + "Europe/Zurich", + "Africa/Abidjan", + "Pacific/Rarotonga", + "America/Santiago", + "Pacific/Easter", + "Africa/Douala", + "Asia/Shanghai", + "Asia/Harbin", + "Asia/Chongqing", + "Asia/Urumqi", + "Asia/Kashgar", + "America/Bogota", + "America/Costa_Rica", + "America/Havana", + "Atlantic/Cape_Verde", + "America/Curacao", + "Indian/Christmas", + "Asia/Nicosia", + "Europe/Prague", + "Europe/Berlin", + "Europe/Busingen", + "Africa/Djibouti", + "Europe/Copenhagen", + "America/Dominica", + "America/Santo_Domingo", + "Africa/Algiers", + "America/Guayaquil", + "Pacific/Galapagos", + "Europe/Tallinn", + "Africa/Cairo", + "Africa/El_Aaiun", + "Africa/Asmara", + "Europe/Madrid", + "Africa/Ceuta", + "Atlantic/Canary", + "Africa/Addis_Ababa", + "Europe/Helsinki", + "Pacific/Fiji", + "Atlantic/Stanley", + "Pacific/Chuuk", + "Pacific/Pohnpei", + "Pacific/Kosrae", + "Atlantic/Faroe", + "Europe/Paris", + "Africa/Libreville", + "Europe/London", + "America/Grenada", + "Asia/Tbilisi", + "America/Cayenne", + "Europe/Guernsey", + "Africa/Accra", + "Europe/Gibraltar", + "America/Godthab", + "America/Danmarkshavn", + "America/Scoresbysund", + "America/Thule", + "Africa/Banjul", + "Africa/Conakry", + "America/Guadeloupe", + "Africa/Malabo", + "Europe/Athens", + "Atlantic/South_Georgia", + "America/Guatemala", + "Pacific/Guam", + "Africa/Bissau", + "America/Guyana", + "Asia/Hong_Kong", + "America/Tegucigalpa", + "Europe/Zagreb", + "America/Port-au-Prince", + "Europe/Budapest", + "Asia/Jakarta", + "Asia/Pontianak", + "Asia/Makassar", + "Asia/Jayapura", + "Europe/Dublin", + "Asia/Jerusalem", + "Europe/Isle_of_Man", + "Asia/Kolkata", + "Indian/Chagos", + "Asia/Baghdad",
View file
libkolabxml-1.0.0.tar.gz/utils/zonetabconversion.py
Added
@@ -0,0 +1,29 @@ +#!/bin/python2.7 + +tztable = open("tztable.h", "w") +tztable.write("//This file was generated by the zonetabconversion.py script\n"); +tztable.write("static const char* olsonTimezones[] = {\n"); + +zonefile = open("/usr/share/zoneinfo/zone.tab", "r") +first = True +for line in zonefile: + # print line + if line.startswith('#'): + # print "continue" + continue + else: + tz = line.split(None)[2] + print tz + if first: + first = False + tztable.write(" \"") + else: + tztable.write(",\n \"") + tztable.write(tz) + tztable.write("\"") + +tztable.write("\n};\n") +tztable.write("\n") +tztable.write("static const int numOlsonTimezones = sizeof olsonTimezones / sizeof *olsonTimezones;\n") +tztable.write("\n") +
View file
libkolabxml.dsc
Changed
@@ -2,7 +2,7 @@ Source: libkolabxml Binary: libkolabxml1, php-kolabformat, python-kolabformat, libkolabxml-dev Architecture: any -Version: 1.0~dev20130521-1 +Version: 1.0.0-0~kolab1 Maintainer: Debian Kolab Maintainers <pkg-kolab-devel@lists.alioth.debian.org> Uploaders: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>, Paul Klos <kolab@klos2day.nl> Homepage: http://git.kolab.org/libkolabxml @@ -26,5 +26,5 @@ php-kolabformat deb libs optional python-kolabformat deb python optional Files: - 00000000000000000000000000000000 0 libkolabxml-1.0.tar.gz + 00000000000000000000000000000000 0 libkolabxml-1.0.0.tar.gz 00000000000000000000000000000000 0 debian.tar.gz
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.