Projects
Kolab:16:Enterprise
libkolab
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 20
View file
libkolab.spec
Changed
@@ -31,7 +31,7 @@ Name: libkolab %endif -Version: 2.0 +Version: 3.0.0 Release: 0.1.dev20150112.gitf0f953aa%{?dist} Summary: Kolab Object Handling Library
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +libkolab (3.0~dev20151230-0~kolab16) unstable; urgency=low + + * New 3.0 release + + -- Christian Mollekopf <mollekopf@kolabsys.com> Wed, 03 Mar 2021 09:09:09 +0100 + libkolab (2.0~dev20151230-0~kolab16) unstable; urgency=low * Bump release
View file
debian.control
Changed
@@ -6,15 +6,16 @@ Build-Depends: cmake, debhelper, + libcurl4-gnutls-dev, libboost-dev, - libboost-program-options-dev, libboost-thread-dev, libboost-system-dev, - libcalendaring-dev (>= 4.9.1), - libcurl4-gnutls-dev, libkolabxml-dev (>= 1.0), libossp-uuid-dev, - libqt4-dev, + qtbase5-dev, + libkf5coreaddons-dev, + libkf5calendarcore-dev, + libkf5mime-dev, libxerces-c-dev, php-cgi | php5-cli, php-dev | php5-dev, @@ -30,7 +31,7 @@ Standards-Version: 3.9.3 Homepage: http://git.kolab.org/libkolab -Package: libkolab2 +Package: libkolab3 Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, libkolabxml1v5 (>= 1.0) Conflicts: libkolab0 @@ -53,10 +54,9 @@ Package: php-kolab Architecture: any -Depends: libkolab2 (>= ${binary:Version}), +Depends: libkolab3 (>= ${binary:Version}), php-kolabformat, ucf, - libcalendaring (>= 4.9.1), ${php:Depends}, ${misc:Depends}, ${shlibs:Depends} @@ -72,7 +72,7 @@ Package: python-kolab Architecture: any Section: python -Depends: libkolab2 (= ${binary:Version}), +Depends: libkolab3 (= ${binary:Version}), python, ${misc:Depends}, ${shlibs:Depends} @@ -87,8 +87,7 @@ Package: libkolab-dev Section: libdevel Architecture: any -Depends: libkolab2 (= ${binary:Version}), - libcalendaring-dev (>= 4.9.1), +Depends: libkolab3 (= ${binary:Version}), ${misc:Depends} Conflicts: libkolab-kde-dev Description: Development package for Kolab library
View file
debian.rules
Changed
@@ -28,7 +28,7 @@ echo "" >> debian/control ; \ echo "Package: plesk-php$${shver}-kolab" >> debian/control ; \ echo "Architecture: amd64" >> debian/control ; \ - echo "Depends: libkolab2, plesk-php$${shver}" >> debian/control ; \ + echo "Depends: libkolab3, plesk-php$${shver}" >> debian/control ; \ echo "Provides: php-bindings-libkolab" >> debian/control ; \ echo "Description: Kolab library bindings for Plesk PHP $${version}" >> debian/control ; \ echo "" >> debian/control ; \ @@ -78,8 +78,8 @@ fi ; \ dh_auto_configure --builddirectory php-$${version} -- \ -DLIB_INSTALL_DIR=/usr/lib \ + -DBoost_NO_BOOST_CMAKE=TRUE \ -DSWIG=/usr/bin/swig \ - -DUSE_LIBCALENDARING=ON \ -DPHP_BINDINGS=ON \ -DPHP_INCLUDE_DIR=$$(/opt/plesk/php/$${version}/bin/php-config --include-dir) \ -DPHP_CONFIG_EXECUTABLE=/opt/plesk/php/$${version}/bin/php-config \ @@ -97,13 +97,13 @@ dh_auto_configure -- \ -DLIB_INSTALL_DIR=/usr/lib \ + -DBoost_NO_BOOST_CMAKE=TRUE \ -DPHP_BINDINGS=ON \ -DPHP_INSTALL_DIR=$(PHPEXT) \ -DPHP_EXECUTABLE=$(PHPBIN) \ -DPHP_INCLUDE_DIR=$(PHPINC) \ -DPYTHON_BINDINGS=ON \ - -DPYTHON_INSTALL_DIR=$(PYTHON_SITEARCH) \ - -DUSE_LIBCALENDARING=ON + -DPYTHON_INSTALL_DIR=$(PYTHON_SITEARCH) override_dh_install: # Install the PHP modules manually, because they depend on PHP the API version,
View file
debian.tar.gz/libkolab-kde-dev.install
Deleted
@@ -1,3 +0,0 @@ -usr/lib/libkolab-kde.so -usr/lib/cmake/Libkolab/*.cmake -usr/include/kolab/*.h
View file
debian.tar.gz/libkolab-kde2.install
Deleted
@@ -1,2 +0,0 @@ -usr/lib/libkolab-kde.so.0 -usr/lib/libkolab-kde.so.0.*
View file
debian.tar.gz/libkolab-kde2.lintian-overrides
Deleted
@@ -1,9 +0,0 @@ -# hardening-check --verbose libkolab-dev.so.0 reports -# Fortify Source functions: no, only unprotected functions found! -# unprotected: memmove -# unprotected: memcpy -# Neither memmove nor memcpy occur in the source code, -# so overriding this warning -libkolab-kde0 binary: hardening-no-fortify-functions -# Using shlibs for now -libkolab-kde0 binary: no-symbols-control-file
View file
debian.tar.gz/libkolab-kde2.shlibs
Deleted
@@ -1,1 +0,0 @@ -libkolab-kde 2 libkolab-kde2 (>= 2.0)
View file
debian.tar.gz/libkolab2.install
Deleted
@@ -1,2 +0,0 @@ -usr/lib/libkolab.so.2 -usr/lib/libkolab.so.2.*
View file
debian.tar.gz/libkolab2.lintian-overrides
Deleted
@@ -1,9 +0,0 @@ -# hardening-check --verbose libkolab.so.0 reports -# Fortify Source functions: no, only unprotected functions found! -# unprotected: memmove -# unprotected: memcpy -# Neither memmove nor memcpy occur in the source code, -# so overriding this warning -libkolab2 binary: hardening-no-fortify-functions -# Using shlibs for now -libkolab2 binary: no-symbols-control-file
View file
debian.tar.gz/libkolab2.shlibs
Deleted
@@ -1,1 +0,0 @@ -libkolab 2 libkolab2 (>= 2)
View file
debian.tar.gz/libkolab3.install
Added
@@ -0,0 +1,2 @@ +usr/lib/libkolab.so.3 +usr/lib/libkolab.so.3.*
View file
debian.tar.gz/libkolab3.lintian-overrides
Added
@@ -0,0 +1,9 @@ +# hardening-check --verbose libkolab.so.0 reports +# Fortify Source functions: no, only unprotected functions found! +# unprotected: memmove +# unprotected: memcpy +# Neither memmove nor memcpy occur in the source code, +# so overriding this warning +libkolab3 binary: hardening-no-fortify-functions +# Using shlibs for now +libkolab3 binary: no-symbols-control-file
View file
debian.tar.gz/libkolab3.shlibs
Added
@@ -0,0 +1,1 @@ +libkolab 3 libkolab3 (>= 3)
View file
libkolab-2.0.tar.gz/conversion/kabcconversion.cpp
Deleted
@@ -1,894 +0,0 @@ -/* - * Copyright (C) 2011 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 "kabcconversion.h" - -#include "commonconversion.h" -#include <kdebug.h> -#include <qbuffer.h> -#include <qimagereader.h> -#include "kolabformat/errorhandler.h" - - - -namespace Kolab { - namespace Conversion { - - //The following was copied from kdepim/libkleo/kleo/enum.h,.cpp - enum CryptoMessageFormat { - InlineOpenPGPFormat = 1, - OpenPGPMIMEFormat = 2, - SMIMEFormat = 4, - SMIMEOpaqueFormat = 8, - AnyOpenPGP = InlineOpenPGPFormat|OpenPGPMIMEFormat, - AnySMIME = SMIMEOpaqueFormat|SMIMEFormat, - AutoFormat = AnyOpenPGP|AnySMIME - }; - - enum EncryptionPreference { - UnknownPreference = 0, - NeverEncrypt = 1, - AlwaysEncrypt = 2, - AlwaysEncryptIfPossible = 3, - AlwaysAskForEncryption = 4, - AskWheneverPossible = 5, - MaxEncryptionPreference = AskWheneverPossible - }; - - enum SigningPreference { - UnknownSigningPreference = 0, - NeverSign = 1, - AlwaysSign = 2, - AlwaysSignIfPossible = 3, - AlwaysAskForSigning = 4, - AskSigningWheneverPossible = 5, - MaxSigningPreference = AskSigningWheneverPossible - }; - - static const struct { - CryptoMessageFormat format; - const char * displayName; - const char * configName; - } cryptoMessageFormats = { - { InlineOpenPGPFormat, - ("Inline OpenPGP (deprecated)"), - "inline openpgp" }, - { OpenPGPMIMEFormat, - ("OpenPGP/MIME"), - "openpgp/mime" }, - { SMIMEFormat, - ("S/MIME"), - "s/mime" }, - { SMIMEOpaqueFormat, - ("S/MIME Opaque"), - "s/mime opaque" }, - }; - static const unsigned int numCryptoMessageFormats - = sizeof cryptoMessageFormats / sizeof *cryptoMessageFormats ; - - const char * cryptoMessageFormatToString( CryptoMessageFormat f ) { - if ( f == AutoFormat ) - return "auto"; - for ( unsigned int i = 0 ; i < numCryptoMessageFormats ; ++i ) - if ( f == cryptoMessageFormatsi.format ) - return cryptoMessageFormatsi.configName; - return 0; - } - - QStringList cryptoMessageFormatsToStringList( unsigned int f ) { - QStringList result; - for ( unsigned int i = 0 ; i < numCryptoMessageFormats ; ++i ) - if ( f & cryptoMessageFormatsi.format ) - result.push_back( cryptoMessageFormatsi.configName ); - return result; - } - - - CryptoMessageFormat stringToCryptoMessageFormat( const QString & s ) { - const QString t = s.toLower(); - for ( unsigned int i = 0 ; i < numCryptoMessageFormats ; ++i ) - if ( t == cryptoMessageFormatsi.configName ) - return cryptoMessageFormatsi.format; - return AutoFormat; - } - - unsigned int stringListToCryptoMessageFormats( const QStringList & sl ) { - unsigned int result = 0; - for ( QStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it ) - result |= stringToCryptoMessageFormat( *it ); - return result; - } - - // For the config values used below, see also kaddressbook/editors/cryptowidget.cpp - - const char* encryptionPreferenceToString( EncryptionPreference pref ) - { - switch( pref ) { - case UnknownPreference: - return 0; - case NeverEncrypt: - return "never"; - case AlwaysEncrypt: - return "always"; - case AlwaysEncryptIfPossible: - return "alwaysIfPossible"; - case AlwaysAskForEncryption: - return "askAlways"; - case AskWheneverPossible: - return "askWhenPossible"; - } - return 0; // keep the compiler happy - } - - EncryptionPreference stringToEncryptionPreference( const QString& str ) - { - if ( str == "never" ) - return NeverEncrypt; - if ( str == "always" ) - return AlwaysEncrypt; - if ( str == "alwaysIfPossible" ) - return AlwaysEncryptIfPossible; - if ( str == "askAlways" ) - return AlwaysAskForEncryption; - if ( str == "askWhenPossible" ) - return AskWheneverPossible; - return UnknownPreference; - } - - const char* signingPreferenceToString( SigningPreference pref ) - { - switch( pref ) { - case UnknownSigningPreference: - return 0; - case NeverSign: - return "never"; - case AlwaysSign: - return "always"; - case AlwaysSignIfPossible: - return "alwaysIfPossible"; - case AlwaysAskForSigning: - return "askAlways"; - case AskSigningWheneverPossible: - return "askWhenPossible"; - } - return 0; // keep the compiler happy - } - - SigningPreference stringToSigningPreference( const QString& str ) - { - if ( str == "never" ) - return NeverSign; - if ( str == "always" ) - return AlwaysSign; - if ( str == "alwaysIfPossible" ) - return AlwaysSignIfPossible; - if ( str == "askAlways" ) - return AlwaysAskForSigning; - if ( str == "askWhenPossible" ) - return AskSigningWheneverPossible; - return UnknownSigningPreference; - } - - - -int fromAddressType(int kabcType, bool &pref) -{ - int type = 0; - if (kabcType & KABC::Address::Dom) { - Warning() << "domestic address is not supported"; - } - if (kabcType & KABC::Address::Intl) { - Warning() << "international address is not supported"; - } - if (kabcType & KABC::Address::Pref) { - pref = true; - }
View file
libkolab-2.0.tar.gz/conversion/kabcconversion.h
Deleted
@@ -1,43 +0,0 @@ -/* - * Copyright (C) 2012 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 KOLABKABCCONVERSION_H -#define KOLABKABCCONVERSION_H - -#include "kolab_export.h" - -#include <kolabcontact.h> -#include <kabc/addressee.h> -#include <kabc/contactgroup.h> - -namespace Kolab { - /** - * Conversion of Kolab-Containers to/from KABC Containers. - * - */ - namespace Conversion { - - KOLAB_EXPORT KABC::Addressee toKABC(const Kolab::Contact &); - KOLAB_EXPORT Kolab::Contact fromKABC(const KABC::Addressee &); - - KOLAB_EXPORT KABC::ContactGroup toKABC(const Kolab::DistList &); - KOLAB_EXPORT Kolab::DistList fromKABC(const KABC::ContactGroup &); - - }; -}; - -#endif
View file
libkolab-2.0.tar.gz/conversion/kolabconversion.cpp
Deleted
@@ -1,120 +0,0 @@ -/* - * Copyright (C) 2012 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 "kolabconversion.h" -#include "commonconversion.h" -#include <akonadi/notes/noteutils.h> - -namespace Kolab { - namespace Conversion { - -Note fromNote(const KMime::Message::Ptr &m) -{ - Akonadi::NoteUtils::NoteMessageWrapper note(m); - Note n; - n.setSummary(toStdString(note.title())); - n.setDescription(toStdString(note.text())); - KDateTime created = note.creationDate(); - created.setTimeSpec(KDateTime::UTC); - n.setCreated(fromDate(created)); - -// #if KDEPIMLIBS_VERSION >= 0x040840 -#ifdef KDEPIMLIBS_VERSION_DEVEL - n.setUid(toStdString(note.uid())); - KDateTime lastModified = note.lastModifiedDate(); - lastModified.setTimeSpec(KDateTime::UTC); - n.setLastModified(fromDate(lastModified)); - - switch (note.classification()) { - case Akonadi::NoteUtils::NoteMessageWrapper::Confidential: - n.setClassification(Kolab::ClassConfidential); - break; - case Akonadi::NoteUtils::NoteMessageWrapper::Private: - n.setClassification(Kolab::ClassPrivate); - break; - default: - n.setClassification(Kolab::ClassPublic); - } - - std::vector<Kolab::CustomProperty> customs; - QMap<QString, QString> &customsMap = note.custom(); - for (QMap <QString, QString >::const_iterator it = customsMap.constBegin(); it != customsMap.constEnd(); it ++) { - customs.push_back(Kolab::CustomProperty(toStdString(it.key()), toStdString(it.value()))); - } - n.setCustomProperties(customs); - - std::vector<Kolab::Attachment> attachments; - foreach(const Akonadi::NoteUtils::Attachment &a, note.attachments()) { - Kolab::Attachment attachment; - if (a.url().isValid()) { - attachment.setUri(toStdString(a.url().toString()), toStdString(a.mimetype())); - } else { - attachment.setData(toStdString(QString(a.data())), toStdString(a.mimetype())); - } - attachment.setLabel(toStdString(a.label())); - attachments.push_back(attachment); - } - n.setAttachments(attachments); - -#endif - return n; -} - -KMime::Message::Ptr toNote(const Note &n) -{ - Akonadi::NoteUtils::NoteMessageWrapper note; - note.setTitle(fromStdString(n.summary())); - note.setText(fromStdString(n.description())); - note.setFrom("kolab@kde4"); - note.setCreationDate(toDate(n.created())); -#ifdef KDEPIMLIBS_VERSION_DEVEL - note.setUid(fromStdString(n.uid())); - note.setLastModifiedDate(toDate(n.lastModified())); - switch (n.classification()) { - case Kolab::ClassPrivate: - note.setClassification(Akonadi::NoteUtils::NoteMessageWrapper::Private); - break; - case Kolab::ClassConfidential: - note.setClassification(Akonadi::NoteUtils::NoteMessageWrapper::Confidential); - break; - default: - note.setClassification(Akonadi::NoteUtils::NoteMessageWrapper::Public); - } - - foreach (const Kolab::Attachment &a, n.attachments()) { - if (!a.uri().empty()) { - Akonadi::NoteUtils::Attachment attachment(QUrl(fromStdString(a.uri())), fromStdString(a.mimetype())); - attachment.setLabel(fromStdString(a.label())); - note.attachments().append(attachment); - } else { - Akonadi::NoteUtils::Attachment attachment(fromStdString(a.data()).toLatin1(), fromStdString(a.mimetype())); - attachment.setLabel(fromStdString(a.label())); - note.attachments().append(attachment); - } - } - foreach (const Kolab::CustomProperty &a, n.customProperties()) { - note.custom().insert(fromStdString(a.identifier), fromStdString(a.value)); - } -#endif - return note.message(); -} - - - } -} -
View file
libkolab-2.0.tar.gz/conversion/kolabconversion.h
Deleted
@@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 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 KOLABCONVERSION_H -#define KOLABCONVERSION_H - -#include "kolab_export.h" - -#include <kolabnote.h> -#include <kmime/kmime_message.h> - -namespace Kolab { - /** - * Conversion of Kolab-Containers to/from KDE Containers. - * - */ - namespace Conversion { - - KOLAB_EXPORT KMime::Message::Ptr toNote(const Kolab::Note &); - KOLAB_EXPORT Kolab::Note fromNote(const KMime::Message::Ptr &); - - }; -}; - -#endif
View file
libkolab-2.0.tar.gz/freebusy
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/freebusy/CMakeLists.txt
Deleted
@@ -1,3 +0,0 @@ -set (FREEBUSY_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/freebusy.cpp - PARENT_SCOPE)
View file
libkolab-2.0.tar.gz/freebusy/freebusy.cpp
Deleted
@@ -1,321 +0,0 @@ -/* - * Copyright (C) 2012 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 "freebusy.h" -#include "conversion/kcalconversion.h" -#include "conversion/commonconversion.h" -#include "libkolab-version.h" -#include <kcalcore/freebusy.h> -#include <kcalcore/icalformat.h> -#include <kdebug.h> -#include <quuid.h> - - -// namespace KCalCore { -// struct KCalFreebusy -// { -// -// void init( const Event::List &eventList, const KDateTime &start, const KDateTime &end ) -// { -// mDtStart = start.toUtc(); -// mDtEnd = end.toUtc(); -// -// // Loops through every event in the calendar -// Event::List::ConstIterator it; -// for ( it = eventList.constBegin(); it != eventList.constEnd(); ++it ) { -// Event::Ptr event = *it; -// -// // If this event is transparent it shouldn't be in the freebusy list. -// if ( event->transparency() == Event::Transparent ) { -// continue; -// } -// -// if ( event->hasRecurrenceId() ) { -// continue; //TODO apply special period exception (duration could be different) -// } -// -// const KDateTime eventStart = event->dtStart().toUtc(); -// const KDateTime eventEnd = event->dtEnd().toUtc(); -// -// if ( event->recurs() ) { -// const KCalCore::Duration duration( eventStart, eventEnd ); -// const KCalCore::DateTimeList list = event->recurrence()->timesInInterval(start, end); -// foreach (const KDateTime &dt, list) { -// const KDateTime utc = dt.toUtc(); -// addLocalPeriod(utc, duration.end(utc) ); -// } -// } else { -// addLocalPeriod( eventStart, eventEnd ); -// } -// } -// -// // q->sortList(); -// } -// -// bool addLocalPeriod( -// const KDateTime &eventStart, -// const KDateTime &eventEnd ) -// { -// KDateTime tmpStart; -// KDateTime tmpEnd; -// -// //Check to see if the start *or* end of the event is -// //between the start and end of the freebusy dates. -// if ( !( ( ( mDtStart.secsTo( eventStart ) >= 0 ) && -// ( eventStart.secsTo( mDtEnd ) >= 0 ) ) || -// ( ( mDtStart.secsTo( eventEnd ) >= 0 ) && -// ( eventEnd.secsTo( mDtEnd ) >= 0 ) ) ) ) { -// qDebug() << "out of scope"; -// return false; -// } -// -// // qDebug() << eventStart.date().toString() << eventStart.time().toString() << mDtStart.toString(); -// if ( eventStart < mDtStart ) { //eventStart is before start -// // qDebug() << "use start"; -// tmpStart = mDtStart; -// } else { -// tmpStart = eventStart; -// } -// -// qDebug() << eventEnd.date().toString() << eventEnd.time().toString() << mDtEnd.toString(); -// if ( eventEnd > mDtEnd ) { //event end is after dtEnd -// // qDebug() << "use end"; -// tmpEnd = mDtEnd; -// } else { -// tmpEnd = eventEnd; -// } -// -// // qDebug() << "########## " << tmpStart.isValid(); -// Q_ASSERT(tmpStart.isValid()); -// Q_ASSERT(tmpEnd.isValid()); -// // qDebug() << tmpStart.date().toString() << tmpStart.time().toString() << tmpStart.toString(); -// -// FreeBusyPeriod p( tmpStart, tmpEnd ); -// mBusyPeriods.append( p ); -// -// return true; -// } -// -// KDateTime mDtStart; -// KDateTime mDtEnd; // end datetime -// FreeBusyPeriod::List mBusyPeriods; // list of periods -// -// }; -// -// } // Namespace - - - - - - - -namespace Kolab { - namespace FreebusyUtils { - -static QString createUuid() -{ - const QString uuid = QUuid::createUuid().toString(); - return uuid.mid(1, uuid.size()-2); -} - -Kolab::Period addLocalPeriod( const KDateTime &eventStart, const KDateTime &eventEnd, const KDateTime &mDtStart, const KDateTime &mDtEnd) -{ - KDateTime tmpStart; - KDateTime tmpEnd; - - //Check to see if the start *or* end of the event is - //between the start and end of the freebusy dates. - if ( !( ( ( mDtStart <= eventStart) && - ( eventStart <= mDtEnd ) ) || - ( ( mDtStart <= eventEnd ) && - ( eventEnd <= mDtEnd ) ) ) ) { - qDebug() << "event is not within the fb range, skipping"; - return Kolab::Period(); - } - - if ( eventStart < mDtStart ) { //eventStart is before start - tmpStart = mDtStart; - } else { - tmpStart = eventStart; - } - -// qDebug() << eventEnd.date().toString() << eventEnd.time().toString() << mDtEnd.toString(); - if ( eventEnd > mDtEnd ) { //event end is after dtEnd - tmpEnd = mDtEnd; - } else { - tmpEnd = eventEnd; - } - Q_ASSERT(tmpStart.isValid()); - Q_ASSERT(tmpEnd.isValid()); - if (tmpStart.isDateOnly()) { - tmpStart.setTime(QTime(0,0,0,0)); - } - if (tmpEnd.isDateOnly()) { - tmpEnd.setTime(QTime(23,59,59,999)); //The window is inclusive - } - return Kolab::Period(Kolab::Conversion::fromDate(tmpStart), Kolab::Conversion::fromDate(tmpEnd)); -} - -Freebusy generateFreeBusy(const std::vector< Event >& events, const cDateTime& startDate, const cDateTime& endDate) -{ - QList<KCalCore::Event::Ptr> list; - foreach (const Kolab::Event &e, events) { - list.append(Kolab::Conversion::toKCalCore(e)); - } - KCalCore::Person::Ptr person(new KCalCore::Person("dummyname", "dummyemail")); - return generateFreeBusy(list, Kolab::Conversion::toDate(startDate), Kolab::Conversion::toDate(endDate), person); -} - -Freebusy generateFreeBusy(const QList<KCalCore::Event::Ptr>& events, const KDateTime& startDate, const KDateTime& endDate, const KCalCore::Person::Ptr &organizer) -{ - /* - * TODO the conversion of date-only values to date-time is only necessary because xCal doesn't allow date only. iCalendar doesn't seem to make this restriction so it looks like a bug. - */ - KDateTime start = startDate.toUtc(); - if (start.isDateOnly()) { - start.setTime(QTime(0,0,0,0)); - } - KDateTime end = endDate.toUtc(); - if (end.isDateOnly()) { - end.addDays(1); - end.setTime(QTime(0,0,0,0)); //The window is inclusive - } -
View file
libkolab-2.0.tar.gz/freebusy/freebusy.h
Deleted
@@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 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 FREEBUSY_H -#define FREEBUSY_H - -#include "kolab_export.h" -#include <kolabevent.h> -#include <kolabfreebusy.h> -#include <kcalcore/event.h> - -namespace Kolab { - namespace FreebusyUtils { - -KOLAB_EXPORT Freebusy generateFreeBusy(const QList<KCalCore::Event::Ptr>& events, const KDateTime& startDate, const KDateTime& endDate, const KCalCore::Person::Ptr &organizer); -KOLAB_EXPORT std::string toIFB(const Kolab::Freebusy &); - -Kolab::Freebusy generateFreeBusy(const std::vector<Kolab::Event> &events, const Kolab::cDateTime &startDate, const Kolab::cDateTime &endDate); -KOLAB_EXPORT Kolab::Freebusy aggregateFreeBusy(const std::vector<Kolab::Freebusy> &fbs, const std::string &organizerEmail, const std::string &organizerName, bool simple = true); - - } -} - -#endif // FREEBUSY_H
View file
libkolab-2.0.tar.gz/icalendar
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/icalendar/CMakeLists.txt
Deleted
@@ -1,15 +0,0 @@ - -set (ICALENDAR_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/icalendar.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/imip.cpp - PARENT_SCOPE) - -if(PYTHON_BINDINGS) - message("building python bindings") - add_subdirectory(python) -endif(PYTHON_BINDINGS) - -if(PHP_BINDINGS) - message("building php bindings") - add_subdirectory(php) -endif(PHP_BINDINGS)
View file
libkolab-2.0.tar.gz/icalendar/icalendar.cpp
Deleted
@@ -1,197 +0,0 @@ -/* - <one line to give the library's name and an idea of what it does.> - Copyright (C) 2012 Christian Mollekopf <chrigi_1@fastmail.fm> - - 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 "icalendar.h" -#include "imip.h" -#include "libkolab-version.h" -#include <conversion/kcalconversion.h> -#include <conversion/commonconversion.h> -#include <mime/mimeutils.h> -#include <kcalcore/event.h> -#include <kcalcore/memorycalendar.h> -#include <kcalcore/icalformat.h> -#include <kmime/kmime_message.h> -// #include <klocalizedstring.h> -#include <kdebug.h> -#include <iostream> - -namespace Kolab { - -std::string toICal(const std::vector<Event> &events) -{ - KCalCore::Calendar::Ptr calendar(new KCalCore::MemoryCalendar(Kolab::Conversion::getTimeSpec(true, std::string()))); - foreach (const Event &event, events) { - KCalCore::Event::Ptr kcalEvent = Conversion::toKCalCore(event); - if (!kcalEvent->created().isValid()) { - kcalEvent->setCreated(KDateTime::currentUtcDateTime()); //sets dtstamp - } - calendar->addEvent(kcalEvent); - foreach(const Event &exception, event.exceptions()) { - KCalCore::Event::Ptr kcalException = Conversion::toKCalCore(exception); - if (!kcalException->created().isValid()) { - kcalException->setCreated(KDateTime::currentUtcDateTime()); //sets dtstamp - } - calendar->addEvent(kcalException); - } - } - KCalCore::ICalFormat format; - format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING); -// qDebug() << format.createScheduleMessage(calendar->events().first(), KCalCore::iTIPRequest); - return Conversion::toStdString(format.toString(calendar)); - -} - -std::vector< Event > fromICalEvents(const std::string &input) -{ - KCalCore::Calendar::Ptr calendar(new KCalCore::MemoryCalendar(Kolab::Conversion::getTimeSpec(true, std::string()))); - KCalCore::ICalFormat format; - format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING); - format.fromString(calendar, Conversion::fromStdString(input)); - std::vector<Event> events; - QMap< QString, int > uidMap; - foreach (const KCalCore::Event::Ptr &event, calendar->events()) { - Event e = Conversion::fromKCalCore(*event); - if (!e.recurrenceID().isValid()) { - if (uidMap.contains(event->uid())) { - e.setExceptions(events.at(uidMapevent->uid()).exceptions()); - eventsuidMapevent->uid() = e; - } else { - events.push_back(e); - uidMap.insert(event->uid(), events.size()-1); - } - } else { - if (!uidMap.contains(event->uid())) { - Event e; - e.setUid(""); - events.push_back(e); - uidMap.insert(event->uid(), events.size()-1); - } - std::vector<Event> exceptions = events.at( uidMapevent->uid()).exceptions(); - exceptions.push_back(e); - events.at(uidMapevent->uid()).setExceptions(exceptions); - } - } - return events; -} - -ITipHandler::ITipHandler() -: mMethod(iTIPNoMethod) -{ -} - - -ITipHandler::ITipMethod mapFromKCalCore(KCalCore::iTIPMethod method) -{ - Q_ASSERT((int)KCalCore::iTIPPublish == (int)ITipHandler::iTIPPublish); - Q_ASSERT((int)KCalCore::iTIPNoMethod == (int)ITipHandler::iTIPNoMethod); - return static_cast<ITipHandler::ITipMethod>(method); -} - -KCalCore::iTIPMethod mapToKCalCore(ITipHandler::ITipMethod method) -{ - Q_ASSERT((int)KCalCore::iTIPPublish == (int)ITipHandler::iTIPPublish); - Q_ASSERT((int)KCalCore::iTIPNoMethod == (int)ITipHandler::iTIPNoMethod); - return static_cast<KCalCore::iTIPMethod>(method); -} - - -std::string ITipHandler::toITip(const Event &event, ITipHandler::ITipMethod method) const -{ - KCalCore::ICalFormat format; - format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING); - KCalCore::iTIPMethod m = mapToKCalCore(method); - if (m == KCalCore::iTIPNoMethod) { - return std::string(); - } -// kDebug() << event.start(). -/* TODO - * DTSTAMP is created - * CREATED is current timestamp - * LASTMODIFIED is lastModified - * - * Double check if that is correct. - * - * I think DTSTAMP should be the current timestamp, and CREATED should be the creation date. - */ - KCalCore::Event::Ptr e = Conversion::toKCalCore(event); - return Conversion::toStdString(format.createScheduleMessage(e, m)); -} - - -std::vector< Event > ITipHandler::fromITip(const std::string &string) -{ - KCalCore::Calendar::Ptr calendar(new KCalCore::MemoryCalendar(KDateTime::Spec(KDateTime::UTC))); - KCalCore::ICalFormat format; - KCalCore::ScheduleMessage::Ptr msg= format.parseScheduleMessage(calendar, Conversion::fromStdString(string)); - KCalCore::Event::Ptr event = msg->event().dynamicCast<KCalCore::Event>(); - std::vector< Event > events; - events.push_back(Conversion::fromKCalCore(*event)); - mMethod = mapFromKCalCore(msg->method()); - return events; -} - -ITipHandler::ITipMethod ITipHandler::method() const -{ - return mMethod; -} - -std::string ITipHandler::toIMip(const Event &event , ITipHandler::ITipMethod m, std::string from, bool bccMe) const -{ - KCalCore::Event::Ptr e = Conversion::toKCalCore(event); -// e->recurrence()->addRDateTime(e->dtStart()); //FIXME The createScheduleMessage converts everything to utc without a recurrence. - KCalCore::ICalFormat format; - format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING); - KCalCore::iTIPMethod method = mapToKCalCore(m); - const QString &messageText = format.createScheduleMessage( e, method ); - //This code is mostly from MailScheduler::performTransaction - if ( method == KCalCore::iTIPRequest || - method == KCalCore::iTIPCancel || - method == KCalCore::iTIPAdd || - method == KCalCore::iTIPDeclineCounter ) { - return Conversion::toStdString(QString(mailAttendees(e, bccMe, messageText))); - } else { - QString subject; - if ( e && method == KCalCore::iTIPCounter ) { - subject = QString( "Counter proposal: %1" ).arg(e->summary()); - } - return Conversion::toStdString(QString(mailOrganizer( e, Conversion::fromStdString(from), bccMe, messageText, subject))); - } - return std::string(); -} - -std::vector< Event > ITipHandler::fromIMip(const std::string &input) -{ - KMime::Message::Ptr msg = KMime::Message::Ptr(new KMime::Message); - msg->setContent( Conversion::fromStdString(input).toUtf8() ); - msg->parse(); - msg->content(KMime::ContentIndex()); - - KMime::Content *c = Kolab::Mime::findContentByType(msg, "text/calendar"); - if (!c) { - qWarning() << "could not find text/calendar part"; - return std::vector< Event >(); - } - return fromITip(Conversion::toStdString(QString(c->decodedContent()))); -} - - - - -}
View file
libkolab-2.0.tar.gz/icalendar/icalendar.h
Deleted
@@ -1,80 +0,0 @@ -/* - <one line to give the library's name and an idea of what it does.> - Copyright (C) 2012 Christian Mollekopf <chrigi_1@fastmail.fm> - - 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 ICALENDAR_H -#define ICALENDAR_H - -#ifndef SWIG -#include "kolab_export.h" -#else -/* No export/import SWIG interface files */ -#define KOLAB_EXPORT -#endif - -#include <kolabevent.h> - -namespace Kolab { - - /** - * Takes a list of events and writes them to an iCal object. - * - */ - KOLAB_EXPORT std::string toICal(const std::vector<Kolab::Event> &); - /** - * Takes an iCal object and returns the contained events. - */ - KOLAB_EXPORT std::vector<Kolab::Event> fromICalEvents(const std::string &); - - class KOLAB_EXPORT ITipHandler { - public: - ITipHandler(); - enum ITipMethod { - iTIPPublish, /**< Event, to-do, journal or freebusy posting */ - iTIPRequest, /**< Event, to-do or freebusy scheduling request */ - iTIPReply, /**< Event, to-do or freebusy reply to request */ - iTIPAdd, /**< Event, to-do or journal additional property request */ - iTIPCancel, /**< Event, to-do or journal cancellation notice */ - iTIPRefresh, /**< Event or to-do description update request */ - iTIPCounter, /**< Event or to-do submit counter proposal */ - iTIPDeclineCounter,/**< Event or to-do decline a counter proposal */ - iTIPNoMethod /**< No method */ - }; - - std::string toIMip(const Kolab::Event &, ITipMethod, std::string from, bool bbcMe = false) const; - std::vector<Kolab::Event> fromIMip(const std::string &); - - /** - * Create iTip message from single event - */ - std::string toITip(const Kolab::Event &, ITipMethod) const; - - /** - * Parse iTip message with a single event - */ - std::vector<Kolab::Event> fromITip(const std::string &); - ITipMethod method() const; - private: - ITipMethod mMethod; - }; - - -} - -#endif // ICALENDAR_H
View file
libkolab-2.0.tar.gz/icalendar/icalendar.i
Deleted
@@ -1,13 +0,0 @@ -%{ - /* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */ - #define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS - - #include "icalendar.h" -%} - -%include "std_string.i" - -%import(module="kolabformat") <kolabevent.h> -%import "../shared.i" - -%include "icalendar.h" \ No newline at end of file
View file
libkolab-2.0.tar.gz/icalendar/imip.cpp
Deleted
@@ -1,239 +0,0 @@ -/* - <one line to give the library's name and an idea of what it does.> - Copyright (C) 2012 Christian Mollekopf <chrigi_1@fastmail.fm> - - 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 "imip.h" - -#include <kcalutils/incidenceformatter.h> -#include <kpimutils/email.h> -#include <kmime/kmime_message.h> -#include <QDebug> -// #include <klocalizedstring.h> -#include <ksystemtimezone.h> -#include <kdebug.h> - -/* - * The code in here is copy paste work from kdepim/calendarsupport. - * - * We need to refactor the code there and move the relevant parts to kdepimlibs to make it reusable. - * - * - */ - -//From MailClient::send -KMime::Message::Ptr createMessage( const QString &from, const QString &_to, - const QString &cc, const QString &subject, - const QString &body, bool hidden, bool bccMe, - const QString &attachment/*, const QString &mailTransport */) -{ - Q_UNUSED( hidden ); - - const bool outlookConformInvitation = false; - QString userAgent = "libkolab"; - - // We must have a recipients list for most MUAs. Thus, if the 'to' list - // is empty simply use the 'from' address as the recipient. - QString to = _to; - if ( to.isEmpty() ) { - to = from; - } - kDebug() << "\nFrom:" << from - << "\nTo:" << to - << "\nCC:" << cc - << "\nSubject:" << subject << "\nBody: \n" << body - << "\nAttachment:\n" << attachment - /*<< "\nmailTransport: " << mailTransport*/; - - // Now build the message we like to send. The message KMime::Message::Ptr instance - // will be the root message that has 2 additional message. The body itself and - // the attached cal.ics calendar file. - KMime::Message::Ptr message = KMime::Message::Ptr( new KMime::Message ); - message->contentTransferEncoding()->clear(); // 7Bit, decoded. - - // Set the headers - message->userAgent()->fromUnicodeString(userAgent, "utf-8" ); - message->from()->fromUnicodeString( from, "utf-8" ); - message->to()->fromUnicodeString( to, "utf-8" ); - message->cc()->fromUnicodeString( cc, "utf-8" ); - if( bccMe ) { - message->bcc()->fromUnicodeString( from, "utf-8" ); //from==me, right? - } - message->date()->setDateTime( KDateTime::currentLocalDateTime() ); - message->subject()->fromUnicodeString( subject, "utf-8" ); - - if ( outlookConformInvitation ) { - message->contentType()->setMimeType( "text/calendar" ); - message->contentType()->setCharset( "utf-8" ); - message->contentType()->setName( QLatin1String( "cal.ics" ), "utf-8" ); - message->contentType()->setParameter( QLatin1String( "method" ), QLatin1String( "request" ) ); - - if ( !attachment.isEmpty() ) { - KMime::Headers::ContentDisposition *disposition = - new KMime::Headers::ContentDisposition( message.get() ); - disposition->setDisposition( KMime::Headers::CDinline ); - message->setHeader( disposition ); - message->contentTransferEncoding()->setEncoding( KMime::Headers::CEquPr ); - message->setBody( KMime::CRLFtoLF( attachment.toUtf8() ) ); - } - } else { - // We need to set following 4 lines by hand else KMime::Content::addContent - // will create a new Content instance for us to attach the main message - // what we don't need cause we already have the main message instance where - // 2 additional messages are attached. - KMime::Headers::ContentType *ct = message->contentType(); - ct->setMimeType( "multipart/mixed" ); - ct->setBoundary( KMime::multiPartBoundary() ); - ct->setCategory( KMime::Headers::CCcontainer ); - - // Set the first multipart, the body message. - KMime::Content *bodyMessage = new KMime::Content; - KMime::Headers::ContentDisposition *bodyDisposition = - new KMime::Headers::ContentDisposition( bodyMessage ); - bodyDisposition->setDisposition( KMime::Headers::CDinline ); - bodyMessage->contentType()->setMimeType( "text/plain" ); - bodyMessage->contentType()->setCharset( "utf-8" ); - bodyMessage->contentTransferEncoding()->setEncoding( KMime::Headers::CEquPr ); - bodyMessage->setBody( KMime::CRLFtoLF( body.toUtf8() ) ); - message->addContent( bodyMessage ); - - // Set the sedcond multipart, the attachment. - if ( !attachment.isEmpty() ) { - KMime::Content *attachMessage = new KMime::Content; - KMime::Headers::ContentDisposition *attachDisposition = - new KMime::Headers::ContentDisposition( attachMessage ); - attachDisposition->setDisposition( KMime::Headers::CDattachment ); - attachMessage->contentType()->setMimeType( "text/calendar" ); - attachMessage->contentType()->setCharset( "utf-8" ); - attachMessage->contentType()->setName( QLatin1String( "cal.ics" ), "utf-8" ); - attachMessage->contentType()->setParameter( QLatin1String( "method" ), - QLatin1String( "request" ) ); - attachMessage->setHeader( attachDisposition ); - attachMessage->contentTransferEncoding()->setEncoding( KMime::Headers::CEquPr ); - attachMessage->setBody( KMime::CRLFtoLF( attachment.toUtf8() ) ); - message->addContent( attachMessage ); - } - } - - // Job done, attach the both multiparts and assemble the message. - message->assemble(); - return message; -} - -//From MailClient::mailAttendees -QByteArray mailAttendees( const KCalCore::IncidenceBase::Ptr &incidence, -// const KPIMIdentities::Identity &identity, - bool bccMe, const QString &attachment - /*const QString &mailTransport */) -{ - KCalCore::Attendee::List attendees = incidence->attendees(); - if ( attendees.isEmpty() ) { - kWarning() << "There are no attendees to e-mail"; - return QByteArray(); - } - - const QString from = incidence->organizer()->fullName(); - const QString organizerEmail = incidence->organizer()->email(); - - QStringList toList; - QStringList ccList; - const int numberOfAttendees( attendees.count() ); - for ( int i=0; i<numberOfAttendees; ++i ) { - KCalCore::Attendee::Ptr a = attendees.at(i); - - const QString email = a->email(); - if ( email.isEmpty() ) { - continue; - } - - // In case we (as one of our identities) are the organizer we are sending - // this mail. We could also have added ourselves as an attendee, in which - // case we don't want to send ourselves a notification mail. - if ( organizerEmail == email ) { - continue; - } - - // Build a nice address for this attendee including the CN. - QString tname, temail; - const QString username = KPIMUtils::quoteNameIfNecessary( a->name() ); - // ignore the return value from extractEmailAddressAndName() because - // it will always be false since tusername does not contain "@domain". - KPIMUtils::extractEmailAddressAndName( username, temail/*byref*/, tname/*byref*/ ); - tname += QLatin1String( " <" ) + email + QLatin1Char( '>' ); - - // Optional Participants and Non-Participants are copied on the email - if ( a->role() == KCalCore::Attendee::OptParticipant || - a->role() == KCalCore::Attendee::NonParticipant ) { - ccList << tname; - } else { - toList << tname; - } - } - if( toList.isEmpty() && ccList.isEmpty() ) { - // Not really to be called a groupware meeting, eh - kWarning() << "There are really no attendees to e-mail"; - return QByteArray(); - } - QString to; - if ( !toList.isEmpty() ) { - to = toList.join( QLatin1String( ", " ) ); - } - QString cc; - if ( !ccList.isEmpty() ) { - cc = ccList.join( QLatin1String( ", " ) ); - }
View file
libkolab-2.0.tar.gz/icalendar/imip.h
Deleted
@@ -1,34 +0,0 @@ -/* - <one line to give the library's name and an idea of what it does.> - Copyright (C) 2012 Christian Mollekopf <chrigi_1@fastmail.fm> - - 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 IMIP_H -#define IMIP_H -#include <QByteArray> -#include <kcalcore/incidencebase.h> - -QByteArray mailAttendees( const KCalCore::IncidenceBase::Ptr &incidence, - bool bccMe, const QString &attachment ); - -QByteArray mailOrganizer( const KCalCore::IncidenceBase::Ptr &incidence, - const QString &from, bool bccMe, - const QString &attachment, - const QString &sub ); - -#endif // IMIP_H
View file
libkolab-2.0.tar.gz/icalendar/php
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/icalendar/php/CMakeLists.txt
Deleted
@@ -1,4 +0,0 @@ -#Generate PHP wrapper -include_directories(../) -include(SWIGUtils) -generatePHPBindings(kolabicalendar ../icalendar.i)
View file
libkolab-2.0.tar.gz/icalendar/python
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/icalendar/python/CMakeLists.txt
Deleted
@@ -1,3 +0,0 @@ -include_directories(../) -include(SWIGUtils) -generatePythonBindings(icalendar ../icalendar.i)
View file
libkolab-2.0.tar.gz/kolabformat/kolabobject.cpp
Deleted
@@ -1,858 +0,0 @@ -/* - * Copyright (C) 2012 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 "kolabobject.h" -#include "v2helpers.h" -#include "kolabdefinitions.h" -#include "errorhandler.h" -#include "libkolab-version.h" - -#include <kolabbase.h> -#include <kolabformatV2/journal.h> -#include <kolabformatV2/task.h> -#include <kolabformatV2/event.h> -#include <kolabformatV2/contact.h> -#include <kolabformatV2/distributionlist.h> -#include <kolabformatV2/note.h> -#include <mime/mimeutils.h> -#include <conversion/kcalconversion.h> -#include <conversion/kabcconversion.h> -#include <conversion/kolabconversion.h> -#include <conversion/commonconversion.h> -#include <akonadi/notes/noteutils.h> -#include <kolabformat.h> - - -namespace Kolab { - - -static inline QString eventKolabType() { return QString::fromLatin1(KOLAB_TYPE_EVENT); }; -static inline QString todoKolabType() { return QString::fromLatin1(KOLAB_TYPE_TASK); }; -static inline QString journalKolabType() { return QString::fromLatin1(KOLAB_TYPE_JOURNAL); }; -static inline QString contactKolabType() { return QString::fromLatin1(KOLAB_TYPE_CONTACT); }; -static inline QString distlistKolabType() { return QString::fromLatin1(KOLAB_TYPE_DISTLIST); } -static inline QString distlistKolabTypeCompat() { return QString::fromLatin1(KOLAB_TYPE_DISTLIST_V2); } -static inline QString noteKolabType() { return QString::fromLatin1(KOLAB_TYPE_NOTE); } -static inline QString configurationKolabType() { return QString::fromLatin1(KOLAB_TYPE_CONFIGURATION); } -static inline QString dictKolabType() { return QString::fromLatin1(KOLAB_TYPE_DICT); } -static inline QString freebusyKolabType() { return QString::fromLatin1(KOLAB_TYPE_FREEBUSY); } -static inline QString relationKolabType() { return QString::fromLatin1(KOLAB_TYPE_RELATION); } - -static inline QString xCalMimeType() { return QString::fromLatin1(MIME_TYPE_XCAL); }; -static inline QString xCardMimeType() { return QString::fromLatin1(MIME_TYPE_XCARD); }; -static inline QString kolabMimeType() { return QString::fromLatin1(MIME_TYPE_KOLAB); }; - -KCalCore::Event::Ptr readV2EventXML(const QByteArray& xmlData, QStringList& attachments) -{ - return fromXML<KCalCore::Event::Ptr, KolabV2::Event>(xmlData, attachments); -} - -QString ownUrlDecode(QByteArray encodedParam) -{ - encodedParam.replace('+', ' '); - return QUrl::fromPercentEncoding(encodedParam); -} - -RelationMember parseMemberUrl(const QString &string) -{ - if (string.startsWith("urn:uuid:")) { - RelationMember member; - member.gid = string.mid(9); - return member; - } - QUrl url(QUrl::fromEncoded(string.toLatin1())); - QList<QByteArray> path; - Q_FOREACH(const QByteArray &fragment, url.encodedPath().split('/')) { - path.append(ownUrlDecode(fragment).toUtf8()); - } - // qDebug() << path; - bool isShared = false; - int start = path.indexOf("user"); - if (start < 0) { - start = path.indexOf("shared"); - isShared = true; - } - if (start < 0) { - Warning() << "Couldn't find \"user\" or \"shared\" in path: " << path; - return RelationMember(); - } - path = path.mid(start + 1); - if (path.size() < 2) { - Warning() << "Incomplete path: " << path; - return RelationMember(); - } - RelationMember member; - if (!isShared) { - member.user = path.takeFirst(); - } - member.uid = path.takeLast().toLong(); - member.mailbox = path; - member.messageId = ownUrlDecode(url.encodedQueryItemValue("message-id")); - member.subject = ownUrlDecode(url.encodedQueryItemValue("subject")); - member.date = ownUrlDecode(url.encodedQueryItemValue("date")); - // qDebug() << member.uid << member.mailbox; - return member; -} - -static QByteArray join(const QList<QByteArray> &list, const QByteArray &c) -{ - QByteArray result; - Q_FOREACH (const QByteArray &a, list) { - result += a + c; - } - result.chop(c.size()); - return result; -} - -QString generateMemberUrl(const RelationMember &member) -{ - if (!member.gid.isEmpty()) { - return QString("urn:uuid:%1").arg(member.gid); - } - QUrl url; - url.setScheme("imap"); - QList<QByteArray> path; - path << "/"; - if (!member.user.isEmpty()) { - path << "user"; - path << QUrl::toPercentEncoding(member.user.toLatin1()); - } else { - path << "shared"; - } - Q_FOREACH(const QByteArray &mb, member.mailbox) { - path << QUrl::toPercentEncoding(mb); - } - path << QByteArray::number(member.uid); - url.setEncodedPath("/" + join(path, "/")); - - QList<QPair<QByteArray, QByteArray> > queryItems; - queryItems.append(qMakePair(QString::fromLatin1("message-id").toLatin1(), QUrl::toPercentEncoding(member.messageId))); - queryItems.append(qMakePair(QString::fromLatin1("subject").toLatin1(), QUrl::toPercentEncoding(member.subject))); - queryItems.append(qMakePair(QString::fromLatin1("date").toLatin1(), QUrl::toPercentEncoding(member.date))); - url.setEncodedQueryItems(queryItems); - - return QString::fromLatin1(url.toEncoded()); -} - -//@cond PRIVATE -class KolabObjectReader::Private -{ -public: - Private() - : mObjectType( InvalidObject ), - mVersion( KolabV3 ), - mOverrideObjectType(InvalidObject), - mDoOverrideVersion(false) - { - mAddressee = KABC::Addressee(); - } - - ObjectType readKolabV2(const KMime::Message::Ptr &msg, Kolab::ObjectType objectType); - ObjectType readKolabV3(const KMime::Message::Ptr &msg, Kolab::ObjectType objectType); - - KCalCore::Incidence::Ptr mIncidence; - KABC::Addressee mAddressee; - KABC::ContactGroup mContactGroup; - KMime::Message::Ptr mNote; - QStringList mDictionary; - QString mDictionaryLanguage; - ObjectType mObjectType; - Version mVersion; - Kolab::Freebusy mFreebusy; - ObjectType mOverrideObjectType; - Version mOverrideVersion; - bool mDoOverrideVersion; - -#ifdef HAVE_RELATION_H - Akonadi::Relation mRelation; -#endif -#ifdef HAVE_TAG_H - Akonadi::Tag mTag; - QStringList mTagMembers; -#endif -}; -//@endcond - -KolabObjectReader::KolabObjectReader() -: d( new KolabObjectReader::Private ) -{ -} - -KolabObjectReader::KolabObjectReader(const KMime::Message::Ptr& msg) -: d( new KolabObjectReader::Private ) -{ - parseMimeMessage(msg);
View file
libkolab-2.0.tar.gz/kolabformat/kolabobject.h
Deleted
@@ -1,157 +0,0 @@ -/* - * Copyright (C) 2012 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 KOLABOBJECT_H -#define KOLABOBJECT_H - -#include <kolab_export.h> - -#include <libkolab_config.h> - -#ifdef HAVE_TAG_H -#include <akonadi/item.h> -#include <akonadi/tag.h> -#endif -#ifdef HAVE_RELATION_H -#include <akonadi/relation.h> -#endif -#include <kabc/addressee.h> -#include <kabc/contactgroup.h> -#include <kcalcore/incidence.h> -#include <kcalcore/event.h> -#include <kcalcore/journal.h> -#include <kcalcore/todo.h> -#include <kmime/kmime_message.h> - -#include "kolabdefinitions.h" - -namespace Kolab { - -class Freebusy; - - -KOLAB_EXPORT KCalCore::Event::Ptr readV2EventXML(const QByteArray &xmlData, QStringList &attachments); - -struct KOLAB_EXPORT RelationMember { - QString messageId; - QString subject; - QString date; - QList<QByteArray> mailbox; - QString user; - qint64 uid; - QString gid; -}; -KOLAB_EXPORT RelationMember parseMemberUrl(const QString &url); -KOLAB_EXPORT QString generateMemberUrl(const RelationMember &url); - -/** - * Class to read Kolab Mime files - * - * It implements the Kolab specifics of Mime message handling. - * This class is not reusable and only meant to read a single object. - * Parse the mime message and then call the correct getter, based on the type - * - */ -class KOLAB_EXPORT KolabObjectReader { -public: - KolabObjectReader(); - explicit KolabObjectReader(const KMime::Message::Ptr &msg); - ~KolabObjectReader(); - - ObjectType parseMimeMessage(const KMime::Message::Ptr &msg); - - /** - * Set to override the autodetected object type, before parsing the message. - */ - void setObjectType(ObjectType); - - /** - * Set to override the autodetected version, before parsing the message. - */ - void setVersion(Version); - - /** - * Returns the Object type of the parsed kolab object. - */ - ObjectType getType() const; - /** - * Returns the kolab-format version of the parsed kolab object. - */ - Version getVersion() const; - - /** - * Getter to get the retrieved object. - * Only the correct one will return a valid object. - * - * Use getType() to determine the correct one to call. - */ - KCalCore::Event::Ptr getEvent() const; - KCalCore::Todo::Ptr getTodo() const; - KCalCore::Journal::Ptr getJournal() const; - KCalCore::Incidence::Ptr getIncidence() const; - KABC::Addressee getContact() const; - KABC::ContactGroup getDistlist() const; - KMime::Message::Ptr getNote() const; - QStringList getDictionary(QString &lang) const; - Freebusy getFreebusy() const; -#ifdef HAVE_TAG_H - bool isTag() const; - Akonadi::Tag getTag() const; - QStringList getTagMembers() const; -#endif -#ifdef HAVE_RELATION_H - bool isRelation() const; - Akonadi::Relation getRelation() const; -#endif - -private: - //@cond PRIVATE - KolabObjectReader(const KolabObjectReader &other); - KolabObjectReader &operator=(const KolabObjectReader &rhs); - class Private; - Private *const d; - //@endcond -}; - -/** - * Class to write Kolab Mime files - * - */ -class KOLAB_EXPORT KolabObjectWriter { -public: - - static KMime::Message::Ptr writeEvent(const KCalCore::Event::Ptr &, Version v = KolabV3, const QString &productId = QString(), const QString &tz = QString()); - static KMime::Message::Ptr writeTodo(const KCalCore::Todo::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString()); - static KMime::Message::Ptr writeJournal(const KCalCore::Journal::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString()); - static KMime::Message::Ptr writeIncidence(const KCalCore::Incidence::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString()); - static KMime::Message::Ptr writeContact(const KABC::Addressee &, Version v = KolabV3, const QString &productId = QString()); - static KMime::Message::Ptr writeDistlist(const KABC::ContactGroup &, Version v = KolabV3, const QString &productId = QString()); - static KMime::Message::Ptr writeNote(const KMime::Message::Ptr &, Version v = KolabV3, const QString &productId = QString()); - static KMime::Message::Ptr writeDictionary(const QStringList &, const QString &lang, Version v = KolabV3, const QString &productId = QString()); - static KMime::Message::Ptr writeFreebusy(const Kolab::Freebusy &, Version v = KolabV3, const QString &productId = QString()); -#ifdef HAVE_TAG_H - static KMime::Message::Ptr writeTag(const Akonadi::Tag &, const QStringList &items, Version v = KolabV3, const QString &productId = QString()); -#endif -#ifdef HAVE_RELATION_H - static KMime::Message::Ptr writeRelation(const Akonadi::Relation &, const QStringList &items, Version v = KolabV3, const QString &productId = QString()); -#endif - -}; - -} //Namespace - -#endif // KOLABOBJECT_H
View file
libkolab-2.0.tar.gz/kolabformat/mimeobject.cpp
Deleted
@@ -1,162 +0,0 @@ -/* - * Copyright (C) 2012 Sofia Balicka <balicka@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 "mimeobject.h" -#include "conversion/kcalconversion.h" -#include "conversion/kolabconversion.h" -#include "conversion/kabcconversion.h" -#include "kolabformat/kolabobject.h" -#include <QString> - -namespace Kolab -{ - -MIMEObject::MIMEObject() -{ - -} - -std::string MIMEObject::writeEvent(const Event &event, Version version, const std::string &productId) -{ - - KCalCore::Event::Ptr KEvent = Conversion::toKCalCore(event); - - KMime::Message::Ptr msg = KolabObjectWriter().writeEvent(KEvent, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - -Event MIMEObject::readEvent(const std::string &s) -{ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KCalCore::Event::Ptr event = KolabObjectReader(msg).getEvent(); - - return Conversion::fromKCalCore(*event); -} - -std::string MIMEObject::writeTodo(const Todo &todo, Version version, const std::string &productId){ - KCalCore::Todo::Ptr kTodo = Conversion::toKCalCore(todo); - - KMime::Message::Ptr msg = KolabObjectWriter().writeTodo(kTodo, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - - -Todo MIMEObject::readTodo(const std::string &s){ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KCalCore::Todo::Ptr todo = KolabObjectReader(msg).getTodo(); - - return Conversion::fromKCalCore(*todo); -} - - -std::string MIMEObject::writeJournal(const Journal &journal, Version version, const std::string &productId){ - KCalCore::Journal::Ptr kJournal = Conversion::toKCalCore(journal); - - KMime::Message::Ptr msg = KolabObjectWriter().writeJournal(kJournal, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - - -Journal MIMEObject::readJournal(const std::string &s){ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KCalCore::Journal::Ptr journal = KolabObjectReader(msg).getJournal(); - - return Conversion::fromKCalCore(*journal); -} - -std::string MIMEObject::writeNote(const Note ¬e, Version version, const std::string &productId){ - KMime::Message::Ptr kNote = Conversion::toNote(note); - - KMime::Message::Ptr msg = KolabObjectWriter().writeNote(kNote, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - - -Note MIMEObject::readNote(const std::string &s){ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KMime::Message::Ptr note = KolabObjectReader(msg).getNote(); - - return Conversion::fromNote(note); -} - -std::string MIMEObject::writeContact(const Contact &contact, Version version, const std::string &productId){ - KABC::Addressee kContact = Conversion::toKABC(contact); - - KMime::Message::Ptr msg = KolabObjectWriter().writeContact(kContact, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - - -Contact MIMEObject::readContact(const std::string &s){ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KABC::Addressee contact = KolabObjectReader(msg).getContact(); - - return Conversion::fromKABC(contact); -} - -std::string MIMEObject::writeDistlist(const DistList &distlist, Version version, const std::string &productId){ - KABC::ContactGroup kDistlist = Conversion::toKABC(distlist); - - KMime::Message::Ptr msg = KolabObjectWriter().writeDistlist(kDistlist, version, QString::fromStdString(productId)); - msg->assemble(); - - return msg->encodedContent().data(); -} - - -DistList MIMEObject::readDistlist(const std::string &s){ - - KMime::Message::Ptr msg(new KMime::Message); - msg->setContent(QByteArray(s.c_str())); - msg->parse(); - - KABC::ContactGroup distlist = KolabObjectReader(msg).getDistlist(); - - return Conversion::fromKABC(distlist); -} -} -
View file
libkolab-2.0.tar.gz/kolabformat/mimeobject.h
Deleted
@@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012 Sofia Balicka <balicka@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 MIMEOBJECT_H -#define MIMEOBJECT_H - -#ifndef SWIG -#include "kolab_export.h" -#else -/* No export/import SWIG interface files */ -#define KOLAB_EXPORT -#endif - -#include <kolabformat.h> -#include "kolabdefinitions.h" - - -namespace Kolab -{ - -class KOLAB_EXPORT MIMEObject -{ -public: - MIMEObject(); - - std::string writeEvent(const Kolab::Event &event, Version version, const std::string &productId = std::string()); - Kolab::Event readEvent(const std::string &s); - - std::string writeTodo(const Kolab::Todo &todo, Version version, const std::string &productId = std::string()); - Kolab::Todo readTodo(const std::string &s); - - std::string writeJournal(const Kolab::Journal &journal, Version version, const std::string &productId = std::string()); - Kolab::Journal readJournal(const std::string &s); - - std::string writeNote(const Kolab::Note ¬e, Version version, const std::string &productId = std::string()); - Kolab::Note readNote(const std::string &s); - - std::string writeContact(const Kolab::Contact &contact, Version version, const std::string &productId = std::string()); - Kolab::Contact readContact(const std::string &s); - - std::string writeDistlist(const Kolab::DistList &distlist, Version version, const std::string &productId = std::string()); - Kolab::DistList readDistlist(const std::string &s); - -}; -} -#endif
View file
libkolab-2.0.tar.gz/kolabformat/v2helpers.cpp
Deleted
@@ -1,279 +0,0 @@ -/* - * Copyright (C) 2012 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 "v2helpers.h" - -#include "kolabdefinitions.h" - -#include "kolabformatV2/kolabbase.h" -#include "kolabformatV2/journal.h" -#include "kolabformatV2/task.h" -#include "kolabformatV2/event.h" -#include "kolabformatV2/contact.h" -#include "kolabformatV2/distributionlist.h" -#include "kolabformatV2/note.h" -#include "mime/mimeutils.h" -#include "kolabformat/errorhandler.h" - -#include <kabc/contactgroup.h> - -#include <qdom.h> -#include <kdebug.h> -#include <qbuffer.h> -#include <akonadi/notes/noteutils.h> - -namespace Kolab { - -static QImage getPicture(const QString &pictureAttachmentName, const KMime::Message::Ptr &data, QByteArray &type) -{ - if (!data) { - Critical() << "empty message"; - return QImage(); - } - KMime::Content *imgContent = Mime::findContentByName(data, pictureAttachmentName/*"kolab-picture.png"*/, type); - if (!imgContent) { - Warning() << "could not find picture: " << pictureAttachmentName; - return QImage(); - } - QByteArray imgData = imgContent->decodedContent(); - QBuffer buffer(&imgData); - buffer.open(QIODevice::ReadOnly); - QImage image; - bool success = false; - if (type == "image/jpeg") { - success = image.load(&buffer, "JPEG"); - //FIXME I tried getting the code to interpret the picture as PNG, but the VCard implementation writes it as JPEG anyways... -// if (success) { -// QByteArray pic; -// QBuffer b(&pic); -// b.open(QIODevice::ReadWrite); -// Q_ASSERT(image.save(&b, "PNG")); -// b.close(); -// Debug() << pic.toBase64(); -// QBuffer b2(&pic); -// b2.open(QIODevice::ReadOnly); -// success = image.load(&b2, "PNG"); -// b2.close(); -// Q_ASSERT(success); -// } - } else { - type = "image/png"; - success = image.load(&buffer, "PNG"); - } - buffer.close(); - if (!success) { - Warning() << "failed to load picture"; - } - return image; -} - -KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data) -{ - if (!data) { - Critical() << "empty message"; - return KABC::Addressee(); - } - KABC::Addressee addressee; -// Debug() << "xmlData " << xmlData; - KolabV2::Contact contact(QString::fromUtf8(xmlData)); - QByteArray type; - const QString &pictureAttachmentName = contact.pictureAttachmentName(); - if (!pictureAttachmentName.isEmpty()) { - const QImage &img = getPicture(pictureAttachmentName, data, type); - contact.setPicture(img, type); - } - - const QString &logoAttachmentName = contact.logoAttachmentName(); - if (!logoAttachmentName.isEmpty()) { - contact.setLogo(getPicture(logoAttachmentName, data, type), type); - } - - const QString &soundAttachmentName = contact.soundAttachmentName(); - if (!soundAttachmentName.isEmpty()) { - QByteArray type; - KMime::Content *content = Mime::findContentByName(data, soundAttachmentName/*"sound"*/, type); - if (content) { - const QByteArray &sData = content->decodedContent(); - contact.setSound(sData); - } else { - Warning() << "could not find sound: " << soundAttachmentName; - } - } - contact.saveTo(&addressee); - return addressee; -} - -KABC::Addressee addresseeFromKolab(const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName) -{ - KABC::Addressee addressee; - KolabV2::Contact contact(QString::fromUtf8(xmlData)); - pictureAttachmentName = contact.pictureAttachmentName(); - logoAttachmentName = contact.logoAttachmentName(); - soundAttachmentName = contact.soundAttachmentName(); - contact.saveTo(&addressee); - return addressee; -} - -static QByteArray createPicture(const QImage &img, const QString &/*format*/, QString &type) -{ - QByteArray pic; - QBuffer buffer(&pic); - buffer.open(QIODevice::WriteOnly); - type = "image/png"; - //FIXME it's not possible to save jpegs lossless, so we always use png. otherwise we would compress the image on every write. -// if (format == "image/jpeg") { -// type = "image/jpeg"; -// img.save(&buffer, "JPEG"); -// } else { - img.save(&buffer, "PNG"); -// } - buffer.close(); - return pic; -} - -KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const QString &productId) -{ - KMime::Message::Ptr message = Mime::createMessage( KOLAB_TYPE_CONTACT, false, productId ); - if (!message) { - Critical() << "empty message"; - return KMime::Message::Ptr(); - } - message->subject()->fromUnicodeString( contact.uid(), "utf-8" ); - message->from()->fromUnicodeString( contact.fullEmail(), "utf-8" ); - - KMime::Content* content = Mime::createMainPart( KOLAB_TYPE_CONTACT, contact.saveXML().toUtf8() ); - message->addContent( content ); - - if ( !contact.picture().isNull() ) { - QString type; - const QByteArray &pic = createPicture(contact.picture(), contact.pictureFormat(), type); - content = Mime::createAttachmentPart(QByteArray(), type, /*"kolab-picture.png"*/contact.pictureAttachmentName(), pic ); - message->addContent(content); - } - - if ( !contact.logo().isNull() ) { - QString type; - const QByteArray &pic = createPicture(contact.logo(), contact.logoFormat(), type); - content = Mime::createAttachmentPart(QByteArray(), type, /*"kolab-logo.png"*/contact.logoAttachmentName(), pic ); - message->addContent(content); - } - - if ( !contact.sound().isEmpty() ) { - content = Mime::createAttachmentPart(QByteArray(), "audio/unknown", /*"sound"*/contact.soundAttachmentName(), contact.sound() ); - message->addContent(content); - } - - message->assemble(); - return message; -} - -KABC::ContactGroup contactGroupFromKolab(const QByteArray &xmlData) -{ - KABC::ContactGroup contactGroup; - // kDebug() << "xmlData " << xmlData; - KolabV2::DistributionList distList(QString::fromUtf8(xmlData)); - distList.saveTo(&contactGroup); - return contactGroup; -} - -KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distList, const QString &productId) -{ - KMime::Message::Ptr message = Mime::createMessage( KOLAB_TYPE_DISTLIST_V2, false, productId ); - if (!message) { - Critical() << "empty message"; - return KMime::Message::Ptr(); - }
View file
libkolab-2.0.tar.gz/kolabformat/v2helpers.h
Deleted
@@ -1,96 +0,0 @@ -/* - * Copyright (C) 2012 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 V2HELPERS_H -#define V2HELPERS_H - -#include "kolabdefinitions.h" - -#include "kolabformatV2/kolabbase.h" -#include "kolabformatV2/journal.h" -#include "kolabformatV2/task.h" -#include "kolabformatV2/event.h" -#include "kolabformatV2/contact.h" -#include "kolabformatV2/distributionlist.h" -#include "kolabformatV2/note.h" -#include "mime/mimeutils.h" -#include "kolabformat/errorhandler.h" - -#include <kabc/contactgroup.h> - -#include <qdom.h> -#include <qbuffer.h> -#include <akonadi/notes/noteutils.h> - -namespace Kolab { - - -/* - * Parse XML, create KCalCore container and extract attachments - */ -template <typename KCalPtr, typename Container> -static KCalPtr fromXML(const QByteArray &xmlData, QStringList &attachments) -{ - const QDomDocument xmlDoc = KolabV2::KolabBase::loadDocument( QString::fromUtf8(xmlData) ); //TODO extract function from V2 format - if ( xmlDoc.isNull() ) { - Critical() << "Failed to read the xml document"; - return KCalPtr(); - } - const KCalPtr i = Container::fromXml( xmlDoc, QString() ); //For parsing we don't need the timezone, so we don't set one - Q_ASSERT ( i ); - QDomNodeList nodes = xmlDoc.elementsByTagName("inline-attachment"); - for (int i = 0; i < nodes.size(); i++ ) { - attachments.append(nodes.at(i).toElement().text()); - } - return i; -} - -template <typename IncidencePtr, typename Converter> -static inline IncidencePtr incidenceFromKolabImpl( const KMime::Message::Ptr &data, const QByteArray &mimetype, const QString &timezoneId ) -{ - KMime::Content *xmlContent = Mime::findContentByType( data, mimetype ); - if ( !xmlContent ) { - Critical() << "couldn't find part"; - return IncidencePtr(); - } - const QByteArray &xmlData = xmlContent->decodedContent(); - - QStringList attachments; - IncidencePtr ptr = fromXML<IncidencePtr, Converter>(xmlData, attachments); //TODO do we care about timezone? - Mime::getAttachments(ptr, attachments, data); - - return ptr; -} - -KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data); -KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName); - -KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const QString &productId); - -KABC::ContactGroup contactGroupFromKolab(const QByteArray &xmlData); - -KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distList, const QString &productId); -KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &creationDate); - -KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr& msg, const QString &productId); -QByteArray noteToKolabXML(const KMime::Message::Ptr& msg); - -QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString &language); - -} - -#endif
View file
libkolab-2.0.tar.gz/kolabformatV2
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/kolabformatV2/CMakeLists.txt
Deleted
@@ -1,12 +0,0 @@ - -set( kolabformatv2_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/kolabbase.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/contact.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/distributionlist.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/event.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/task.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/journal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/incidence.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/note.cpp -# kolabformatv2.cpp - PARENT_SCOPE)
View file
libkolab-2.0.tar.gz/kolabformatV2/contact.cpp
Deleted
@@ -1,1214 +0,0 @@ -/* - This file is part of libkabc and/or kaddressbook. - Copyright (c) 2004 Klarälvdalens Datakonsult AB - <info@klaralvdalens-datakonsult.se> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "contact.h" - -#include <kabc/addressee.h> -#include <kdebug.h> -#include <QFile> -#include <float.h> - -using namespace KolabV2; - -static const char* s_pictureAttachmentName = "kolab-picture.png"; -static const char* s_logoAttachmentName = "kolab-logo.png"; -static const char* s_soundAttachmentName = "sound"; -static const char* s_unhandledTagAppName = "KOLABUNHANDLED"; // no hyphens in appnames! - -// saving (addressee->xml) -Contact::Contact( const KABC::Addressee* addr ) - : mHasGeo( false ) -{ - setFields( addr ); -} - -// loading (xml->addressee) -Contact::Contact( const QString& xml ) - : mHasGeo( false ) -{ - load( xml ); -} - -Contact::~Contact() -{ -} - -void Contact::setGivenName( const QString& name ) -{ - mGivenName = name; -} - -QString Contact::givenName() const -{ - return mGivenName; -} - -void Contact::setMiddleNames( const QString& names ) -{ - mMiddleNames = names; -} - -QString Contact::middleNames() const -{ - return mMiddleNames; -} - -void Contact::setLastName( const QString& name ) -{ - mLastName = name; -} - -QString Contact::lastName() const -{ - return mLastName; -} - -void Contact::setFullName( const QString& name ) -{ - mFullName = name; -} - -QString Contact::fullName() const -{ - return mFullName; -} - -void Contact::setInitials( const QString& initials ) -{ - mInitials = initials; -} - -QString Contact::initials() const -{ - return mInitials; -} - -void Contact::setPrefix( const QString& prefix ) -{ - mPrefix = prefix; -} - -QString Contact::prefix() const -{ - return mPrefix; -} - -void Contact::setSuffix( const QString& suffix ) -{ - mSuffix = suffix; -} - -QString Contact::suffix() const -{ - return mSuffix; -} - -void Contact::setRole( const QString& role ) -{ - mRole = role; -} - -QString Contact::role() const -{ - return mRole; -} - -void Contact::setFreeBusyUrl( const QString& fbUrl ) -{ - mFreeBusyUrl = fbUrl; -} - -QString Contact::freeBusyUrl() const -{ - return mFreeBusyUrl; -} - -void Contact::setOrganization( const QString& organization ) -{ - mOrganization = organization; -} - -QString Contact::organization() const -{ - return mOrganization; -} - -void Contact::setWebPage( const QString& url ) -{ - mWebPage = url; -} - -QString Contact::webPage() const -{ - return mWebPage; -} - -void Contact::setIMAddress( const QString& imAddress ) -{ - mIMAddress = imAddress; -} - -QString Contact::imAddress() const -{ - return mIMAddress; -} - -void Contact::setDepartment( const QString& department ) -{ - mDepartment = department; -} - -QString Contact::department() const -{ - return mDepartment; -} - -void Contact::setOfficeLocation( const QString& location ) -{ - mOfficeLocation = location; -} -
View file
libkolab-2.0.tar.gz/kolabformatV2/contact.h
Deleted
@@ -1,278 +0,0 @@ -/* - This file is part of libkabc and/or kaddressbook. - Copyright (c) 2002 - 2004 Klarälvdalens Datakonsult AB - <info@klaralvdalens-datakonsult.se> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2CONTACT_H -#define KOLABV2CONTACT_H - -#include "kolabbase.h" -#include <qimage.h> - -namespace KABC { - class Addressee; - class Picture; - class Sound; -} - -namespace KolabV2 { - -class Contact : public KolabBase { -public: - struct PhoneNumber { - public: - QString type; - QString number; - }; - - struct Address { - public: - Address() : kdeAddressType( -1 ) - { - } - int kdeAddressType; // KABC::Address::Type - QString type; // kolab-compliant address type: home, work or other - QString street; - QString pobox; - QString locality; - QString region; - QString postalCode; - QString country; - }; - - explicit Contact( const KABC::Addressee* address ); - Contact( const QString& xml ); - ~Contact(); - - void saveTo( KABC::Addressee* address ); - - QString type() const { return "Contact"; } - - void setGivenName( const QString& name ); - QString givenName() const; - - void setMiddleNames( const QString& names ); - QString middleNames() const; - - void setLastName( const QString& name ); - QString lastName() const; - - void setFullName( const QString& name ); - QString fullName() const; - - void setInitials( const QString& initials ); - QString initials() const; - - void setPrefix( const QString& prefix ); - QString prefix() const; - - void setSuffix( const QString& suffix ); - QString suffix() const; - - void setRole( const QString& role ); - QString role() const; - - void setFreeBusyUrl( const QString& fbUrl ); - QString freeBusyUrl() const; - - void setOrganization( const QString& organization ); - QString organization() const; - - void setWebPage( const QString& url ); - QString webPage() const; - - void setIMAddress( const QString& imAddress ); - QString imAddress() const; - - void setDepartment( const QString& department ); - QString department() const; - - void setOfficeLocation( const QString& location ); - QString officeLocation() const; - - void setProfession( const QString& profession ); - QString profession() const; - - void setTitle( const QString& title ); - QString title() const; - - void setManagerName( const QString& name ); - QString managerName() const; - - void setAssistant( const QString& name ); - QString assistant() const; - - void setNickName( const QString& name ); - QString nickName() const; - - void setSpouseName( const QString& name ); - QString spouseName() const; - - void setBirthday( const QDate& date ); - QDate birthday() const; - - void setAnniversary( const QDate& date ); - QDate anniversary() const; - - void setPicture( const QImage& image, const QString &format) { mPicture = image; mPictureFormat = format; } - QString pictureAttachmentName() const { return mPictureAttachmentName; } - QString pictureFormat() const { return mPictureFormat; } - QImage picture() const { return mPicture; } - - void setLogo( const QImage& image, const QString &format ) { mLogo = image; mLogoFormat = format; } - QString logoAttachmentName() const { return mLogoAttachmentName; } - QString logoFormat() const { return mLogoFormat; } - QImage logo() const { return mLogo; } - - void setSound( const QByteArray& sound ) { mSound = sound; } - QString soundAttachmentName() const { return mSoundAttachmentName; } - QByteArray sound() const { return mSound; } - - void setChildren( const QString& children ); - QString children() const; - - void setGender( const QString& gender ); - QString gender() const; - - void setLanguage( const QString& language ); - QString language() const; - - void addPhoneNumber( const PhoneNumber& number ); - QList<PhoneNumber>& phoneNumbers(); - const QList<PhoneNumber>& phoneNumbers() const; - - void addEmail( const Email& email ); - QList<Email>& emails(); - const QList<Email>& emails() const; - - QString fullEmail() const; - - void addAddress( const Address& address ); - QList<Address>& addresses(); - const QList<Address>& addresses() const; - - // which address is preferred: home or business or other - void setPreferredAddress( const QString& address ); - QString preferredAddress() const; - - float latitude() const { return mLatitude; } - void setLatitude( float latitude ) { mLatitude = latitude; } - - float longitude() const { return mLongitude; } - void setLongitude( float longitude ) { mLongitude = longitude; } - - // Load the attributes of this class - bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - bool saveAttributes( QDomElement& ) const; - - // Load this note by reading the XML file - bool loadXML( const QDomDocument& xml ); -
View file
libkolab-2.0.tar.gz/kolabformatV2/distributionlist.cpp
Deleted
@@ -1,231 +0,0 @@ -/* - This file is part of Akonadi KolabProxy. - Copyright (c) 2009 Kevin Krammer <kevin.krammer@gmx.at> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "distributionlist.h" - -#include <kabc/addressee.h> -#include <kabc/contactgroup.h> -#include <kdebug.h> - -using namespace KolabV2; - -static const char* s_unhandledTagAppName = "KOLABUNHANDLED"; // no hyphens in appnames! - -// saving (contactgroup->xml) -DistributionList::DistributionList( const KABC::ContactGroup* contactGroup ) -{ - setFields( contactGroup ); -} - -// loading (xml->contactgroup) -DistributionList::DistributionList( const QString& xml ) -{ - load( xml ); -} - -DistributionList::~DistributionList() -{ -} - -void DistributionList::setName( const QString& name ) -{ - mName = name; -} - -QString DistributionList::name() const -{ - return mName; -} - -void KolabV2::DistributionList::loadDistrListMember( const QDomElement& element ) -{ - Member member; - for ( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - QString tagName = e.tagName(); - if ( tagName == "display-name" ) - member.displayName = e.text(); - else if ( tagName == "smtp-address" ) - member.email = e.text(); - else if ( tagName == "uid" ) - member.uid = e.text(); - } - } - mDistrListMembers.append( member ); -} - -void DistributionList::saveDistrListMembers( QDomElement& element ) const -{ - QList<Member>::ConstIterator it = mDistrListMembers.constBegin(); - for( ; it != mDistrListMembers.constEnd(); ++it ) { - QDomElement e = element.ownerDocument().createElement( "member" ); - element.appendChild( e ); - const Member& m = *it; - if (!m.uid.isEmpty()) { - writeString( e, "uid", m.uid ); - } else { - writeString( e, "display-name", m.displayName ); - writeString( e, "smtp-address", m.email ); - } - } -} - -bool DistributionList::loadAttribute( QDomElement& element ) -{ - const QString tagName = element.tagName(); - switch ( tagName0.toLatin1() ) { - case 'd': - if ( tagName == "display-name" ) { - setName( element.text() ); - return true; - } - break; - case 'm': - if ( tagName == "member" ) { - loadDistrListMember( element ); - return true; - } - break; - default: - break; - } - return KolabBase::loadAttribute( element ); -} - -bool DistributionList::saveAttributes( QDomElement& element ) const -{ - // Save the base class elements - KolabBase::saveAttributes( element ); - writeString( element, "display-name", name() ); - saveDistrListMembers( element ); - - return true; -} - -bool DistributionList::loadXML( const QDomDocument& document ) -{ - QDomElement top = document.documentElement(); - - if ( top.tagName() != "distribution-list" ) { - qWarning( "XML error: Top tag was %s instead of the expected distribution-list", - top.tagName().toAscii().data() ); - return false; - } - - - for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - if ( !loadAttribute( e ) ) { - // Unhandled tag - save for later storage - //kDebug() <<"Saving unhandled tag" << e.tagName(); - Custom c; - c.app = s_unhandledTagAppName; - c.name = e.tagName(); - c.value = e.text(); - mCustomList.append( c ); - } - } else - kDebug() <<"Node is not a comment or an element???"; - } - - return true; -} - -QString DistributionList::saveXML() const -{ - QDomDocument document = domTree(); - QDomElement element = document.createElement( "distribution-list" ); - element.setAttribute( "version", "1.0" ); - saveAttributes( element ); - document.appendChild( element ); - return document.toString(); -} - -QString DistributionList::productID() const -{ - // TODO should we get name/version from desktop file? - return QLatin1String( "Akonadi Kolab Proxy" ); -} - -// The saving is contactgroup -> DistributionList -> xml, this is the first part -void DistributionList::setFields( const KABC::ContactGroup* contactGroup ) -{ - KolabBase::setFields( contactGroup ); - - setName( contactGroup->name() ); - - // explicit contact data - for ( uint index = 0; index < contactGroup->dataCount(); ++index ) { - const KABC::ContactGroup::Data& data = contactGroup->data( index ); - - Member m; - m.displayName = data.name(); - m.email = data.email(); - - mDistrListMembers.append( m );
View file
libkolab-2.0.tar.gz/kolabformatV2/distributionlist.h
Deleted
@@ -1,97 +0,0 @@ -/* - This file is part of Akonadi KolabProxy - Copyright (c) 2009 <kevin.krammer@gmx.at> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2DISTRIBUTIONLIST_H -#define KOLABV2DISTRIBUTIONLIST_H - -#include "kolabbase.h" - -namespace KABC { - class ContactGroup; -} - -namespace KolabV2 { - -class DistributionList : public KolabBase { -public: - explicit DistributionList( const KABC::ContactGroup* contactGroup ); - DistributionList( const QString& xml ); - ~DistributionList(); - - void saveTo( KABC::ContactGroup* contactGroup ); - - QString type() const { return "DistributionList"; } - - void setName( const QString& name ); - QString name() const; - - // Load the attributes of this class - bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - bool saveAttributes( QDomElement& ) const; - - // Load this note by reading the XML file - bool loadXML( const QDomDocument& xml ); - - // Serialize this note to an XML string - QString saveXML() const; - - QString productID() const; - -protected: - void setFields( const KABC::ContactGroup* ); - -private: - void loadDistrListMember( const QDomElement& element ); - void saveDistrListMembers( QDomElement& element ) const; - - QString mName; - - struct Custom { - QString app; - QString name; - QString value; - }; - QList<Custom> mCustomList; - - struct Member { - QString displayName; - QString email; - QString uid; - }; - QList<Member> mDistrListMembers; -}; - -} - -#endif // KOLABDISTRIBUTIONLIST_H -// kate: space-indent on; indent-width 2; replace-tabs on;
View file
libkolab-2.0.tar.gz/kolabformatV2/event.cpp
Deleted
@@ -1,221 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "event.h" - -#include <kcalcore/event.h> -#include <kdebug.h> - -using namespace KolabV2; - - -KCalCore::Event::Ptr Event::fromXml( const QDomDocument& xmlDoc, const QString& tz) -{ - Event event( tz ); - event.loadXML( xmlDoc ); - KCalCore::Event::Ptr kcalEvent( new KCalCore::Event() ); - event.saveTo( kcalEvent ); - return kcalEvent; -} - -QString Event::eventToXML( const KCalCore::Event::Ptr &kcalEvent, const QString& tz ) -{ - Event event( tz, kcalEvent ); - return event.saveXML(); -} - -Event::Event( const QString& tz, const KCalCore::Event::Ptr &event ) - : Incidence( tz, event ), - mShowTimeAs( KCalCore::Event::Opaque ), mHasEndDate( false ) -{ - if ( event ) { - setFields( event ); - } -} - -Event::~Event() -{ -} - -void Event::setTransparency( KCalCore::Event::Transparency transparency ) -{ - mShowTimeAs = transparency; -} - -KCalCore::Event::Transparency Event::transparency() const -{ - return mShowTimeAs; -} - -void Event::setEndDate( const KDateTime& date ) -{ - mEndDate = date; - mHasEndDate = true; - if ( mFloatingStatus == AllDay ) - kDebug() <<"ERROR: Time on end date but no time on the event"; - mFloatingStatus = HasTime; -} - -void Event::setEndDate( const QDate& date ) -{ - mEndDate = KDateTime( date ); - mHasEndDate = true; - if ( mFloatingStatus == HasTime ) - kDebug() <<"ERROR: No time on end date but time on the event"; - mFloatingStatus = AllDay; -} - -void Event::setEndDate( const QString& endDate ) -{ - if ( endDate.length() > 10 ) - // This is a date + time - setEndDate( stringToDateTime( endDate ) ); - else - // This is only a date - setEndDate( stringToDate( endDate ) ); -} - -KDateTime Event::endDate() const -{ - return mEndDate; -} - -bool Event::loadAttribute( QDomElement& element ) -{ - // This method doesn't handle the color-label tag yet - QString tagName = element.tagName(); - - if ( tagName == "show-time-as" ) { - // TODO: Support tentative and outofoffice - if ( element.text() == "free" ) - setTransparency( KCalCore::Event::Transparent ); - else - setTransparency( KCalCore::Event::Opaque ); - } else if ( tagName == "end-date" ) - setEndDate( element.text() ); - else - return Incidence::loadAttribute( element ); - - // We handled this - return true; -} - -bool Event::saveAttributes( QDomElement& element ) const -{ - // Save the base class elements - Incidence::saveAttributes( element ); - - // TODO: Support tentative and outofoffice - if ( transparency() == KCalCore::Event::Transparent ) - writeString( element, "show-time-as", "free" ); - else - writeString( element, "show-time-as", "busy" ); - if ( mHasEndDate ) { - if ( mFloatingStatus == HasTime ) - writeString( element, "end-date", dateTimeToString( endDate() ) ); - else - writeString( element, "end-date", dateToString( endDate().date() ) ); - } - - return true; -} - - -bool Event::loadXML( const QDomDocument& document ) -{ - QDomElement top = document.documentElement(); - - if ( top.tagName() != "event" ) { - qWarning( "XML error: Top tag was %s instead of the expected event", - top.tagName().toAscii().data() ); - return false; - } - - for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - loadAttribute( e ); - } else - kDebug() <<"Node is not a comment or an element???"; - } - - return true; -} - -QString Event::saveXML() const -{ - QDomDocument document = domTree(); - QDomElement element = document.createElement( "event" ); - element.setAttribute( "version", "1.0" ); - saveAttributes( element ); - document.appendChild( element ); - return document.toString(); -} - -void Event::setFields( const KCalCore::Event::Ptr &event ) -{ - Incidence::setFields( event ); - - // note: if hasEndDate() is false and hasDuration() is true - // dtEnd() returns start+duration - if ( event->hasEndDate() || event->hasDuration() ) { - if ( event->allDay() ) { - // This is an all-day event. Don't timezone move this one - mFloatingStatus = AllDay; - setEndDate( event->dtEnd().date() ); - } else { - mFloatingStatus = HasTime;
View file
libkolab-2.0.tar.gz/kolabformatV2/event.h
Deleted
@@ -1,101 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2_EVENT_H -#define KOLABV2_EVENT_H - -#include "incidence.h" - -#include <kcalcore/event.h> - -class QDomElement; - - -namespace KolabV2 { - -/** - * This class represents an event, and knows how to load/save it - * from/to XML, and from/to a KCalCore::Event. - * The instances of this class are temporary, only used to convert - * one to the other. - */ -class Event : public Incidence { -public: - /// Use this to parse an xml string to a event entry - /// The caller is responsible for deleting the returned event - static KCalCore::Event::Ptr fromXml( const QDomDocument& xmlDoc, const QString& tz); - - /// Use this to get an xml string describing this event entry - static QString eventToXML( const KCalCore::Event::Ptr &, const QString& tz ); - - /// Create a event object and - explicit Event( const QString& tz, - const KCalCore::Event::Ptr &event = KCalCore::Event::Ptr() ); - virtual ~Event(); - - void saveTo( const KCalCore::Event::Ptr &event ); - - virtual QString type() const { return "Event"; } - - virtual void setTransparency( KCalCore::Event::Transparency transparency ); - virtual KCalCore::Event::Transparency transparency() const; - - virtual void setEndDate( const KDateTime& date ); - virtual void setEndDate( const QDate& date ); - virtual void setEndDate( const QString& date ); - virtual KDateTime endDate() const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - - // Load this event by reading the XML file - virtual bool loadXML( const QDomDocument& xml ); - - // Serialize this event to an XML string - virtual QString saveXML() const; - -protected: - // Read all known fields from this ical incidence - void setFields( const KCalCore::Event::Ptr & ); - - KCalCore::Event::Transparency mShowTimeAs; - KDateTime mEndDate; - bool mHasEndDate; -}; - -} - -#endif // KOLAB_EVENT_H
View file
libkolab-2.0.tar.gz/kolabformatV2/incidence.cpp
Deleted
@@ -1,1025 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "incidence.h" -#include "libkolab-version.h" - -#include <QList> - -#include <kcalcore/journal.h> -#include <kdebug.h> -#include <kurl.h> - -#include <QBitArray> -#include <string> -#include <boost/algorithm/string.hpp> - -using namespace KolabV2; - -Incidence::Incidence( const QString& tz, const KCalCore::Incidence::Ptr &incidence ) - : KolabBase( tz ), mFloatingStatus( Unset ), mHasAlarm( false ), mPriority( 0 ) -{ - Q_UNUSED( incidence ); -} - -Incidence::~Incidence() -{ -} - -void Incidence::setPriority( int priority ) -{ - mPriority = priority; -} - -int Incidence::priority() const -{ - return mPriority; -} - -void Incidence::setSummary( const QString& summary ) -{ - mSummary = summary; -} - -QString Incidence::summary() const -{ - return mSummary; -} - -void Incidence::setLocation( const QString& location ) -{ - mLocation = location; -} - -QString Incidence::location() const -{ - return mLocation; -} - -void Incidence::setOrganizer( const Email& organizer ) -{ - mOrganizer = organizer; -} - -KolabBase::Email Incidence::organizer() const -{ - return mOrganizer; -} - -void Incidence::setStartDate( const KDateTime& startDate ) -{ - mStartDate = startDate; - if ( mFloatingStatus == AllDay ) - kDebug() <<"ERROR: Time on start date but no time on the event"; - mFloatingStatus = HasTime; -} - -void Incidence::setStartDate( const QDate& startDate ) -{ - mStartDate = KDateTime( startDate ); - if ( mFloatingStatus == HasTime ) - kDebug() <<"ERROR: No time on start date but time on the event"; - mFloatingStatus = AllDay; -} - -void Incidence::setStartDate( const QString& startDate ) -{ - if ( startDate.length() > 10 ) - // This is a date + time - setStartDate( stringToDateTime( startDate ) ); - else - // This is only a date - setStartDate( stringToDate( startDate ) ); -} - -KDateTime Incidence::startDate() const -{ - return mStartDate; -} - -void Incidence::setAlarm( float alarm ) -{ - mAlarm = alarm; - mHasAlarm = true; -} - -float Incidence::alarm() const -{ - return mAlarm; -} - -Incidence::Recurrence Incidence::recurrence() const -{ - return mRecurrence; -} - -void Incidence::addAttendee( const Attendee& attendee ) -{ - mAttendees.append( attendee ); -} - -QList<Incidence::Attendee>& Incidence::attendees() -{ - return mAttendees; -} - -const QList<Incidence::Attendee>& Incidence::attendees() const -{ - return mAttendees; -} - -void Incidence::setInternalUID( const QString& iuid ) -{ - mInternalUID = iuid; -} - -QString Incidence::internalUID() const -{ - return mInternalUID; -} - -bool Incidence::loadAttendeeAttribute( QDomElement& element, - Attendee& attendee ) -{ - for ( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - QString tagName = e.tagName(); - - if ( tagName == "display-name" ) - attendee.displayName = e.text(); - else if ( tagName == "smtp-address" ) - attendee.smtpAddress = e.text(); - else if ( tagName == "status" ) - attendee.status = e.text(); - else if ( tagName == "request-response" ) - // This sets reqResp to false, if the text is "false". Otherwise it - // sets it to true. This means the default setting is true. - attendee.requestResponse = ( e.text().toLower() != "false" ); - else if ( tagName == "invitation-sent" ) - // Like above, only this defaults to false - attendee.invitationSent = ( e.text().toLower() != "true" ); - else if ( tagName == "role" ) - attendee.role = e.text(); - else if ( tagName == "delegated-to" ) - attendee.delegate = e.text(); - else if ( tagName == "delegated-from" ) - attendee.delegator = e.text();
View file
libkolab-2.0.tar.gz/kolabformatV2/incidence.h
Deleted
@@ -1,172 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2_INCIDENCE_H -#define KOLABV2_INCIDENCE_H - -#include <kcalcore/incidence.h> - -#include "kolabbase.h" - -class QDomElement; - -namespace KolabV2 { - -/** - * This abstract class represents an incidence which has the shared - * fields, of events and tasks and knows how to load/save these - * from/to XML, and from/to a KCalCore::Incidence. - */ -class Incidence : public KolabBase { -public: - struct Recurrence { - QString cycle; - QString type; - int interval; - QStringList days; // list of days-of-the-week - QString dayNumber; - QString month; - QString rangeType; - QString range; // date or number or nothing - QList<QDate> exclusions; - }; - - struct Attendee : Email { - Attendee() : requestResponse( true ), invitationSent( false ) {} - QString status; - bool requestResponse; - bool invitationSent; - QString role; - QString delegate; - QString delegator; - }; - - explicit Incidence( const QString& tz, const KCalCore::Incidence::Ptr &incidence = KCalCore::Incidence::Ptr() ); - -public: - virtual ~Incidence(); - - void saveTo( const KCalCore::Incidence::Ptr &incidence ); - - virtual void setPriority( int priority ); - virtual int priority() const; - - virtual void setSummary( const QString& summary ); - virtual QString summary() const; - - virtual void setLocation( const QString& location ); - virtual QString location() const; - - virtual void setOrganizer( const Email& organizer ); - virtual Email organizer() const; - - virtual void setStartDate( const KDateTime& startDate ); - virtual void setStartDate( const QDate& startDate ); - virtual void setStartDate( const QString& startDate ); - virtual KDateTime startDate() const; - - virtual void setAlarm( float alarm ); - virtual float alarm() const; - - virtual void setRecurrence( KCalCore::Recurrence* recur ); - virtual Recurrence recurrence() const; - - virtual void addAttendee( const Attendee& attendee ); - QList<Attendee>& attendees(); - const QList<Attendee>& attendees() const; - - virtual QString type() const { return "Incidence"; } - /** - * The internal uid is used as the uid inside KOrganizer whenever - * two or more events with the same uid appear, which KOrganizer - * can't handle. To avoid keep that interal uid from changing all the - * time, it is persisted in the XML between a save and the next load. - */ - void setInternalUID( const QString& iuid ); - QString internalUID() const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - -protected: - enum FloatingStatus { Unset, AllDay, HasTime }; - - // Read all known fields from this ical incidence - void setFields( const KCalCore::Incidence::Ptr & ); - - bool loadAttendeeAttribute( QDomElement&, Attendee& ); - void saveAttendeeAttribute( QDomElement& element, - const Attendee& attendee ) const; - void saveAttendees( QDomElement& element ) const; - void saveAttachments( QDomElement& element ) const; - - void loadAlarms( const QDomElement& element ); - void saveAlarms( QDomElement& element ) const; - - void loadRecurrence( const QDomElement& element ); - void saveRecurrence( QDomElement& element ) const; - void saveCustomAttributes( QDomElement& element ) const; - void loadCustomAttributes( QDomElement& element ); - - QString productID() const; - - QString mSummary; - QString mLocation; - Email mOrganizer; - KDateTime mStartDate; - FloatingStatus mFloatingStatus; - float mAlarm; - bool mHasAlarm; - Recurrence mRecurrence; - QList<Attendee> mAttendees; - QList<KCalCore::Alarm::Ptr> mAlarms; - QList<KCalCore::Attachment::Ptr> mAttachments; - QString mInternalUID; - - struct Custom { - QByteArray key; - QString value; - }; - QList<Custom> mCustomList; - - // This is the KCal priority, not the Kolab priority. - // See kcalPriorityToKolab() and kolabPrioritytoKCal(). - int mPriority; -}; - -} - -#endif // KOLAB_INCIDENCE_H
View file
libkolab-2.0.tar.gz/kolabformatV2/journal.cpp
Deleted
@@ -1,184 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "journal.h" -#include "libkolab-version.h" - -#include <kdebug.h> - -using namespace KolabV2; - - -KCalCore::Journal::Ptr Journal::fromXml( const QDomDocument& xmlDoc, const QString& tz ) -{ - Journal journal( tz ); - journal.loadXML( xmlDoc ); - KCalCore::Journal::Ptr kcalJournal( new KCalCore::Journal() ); - journal.saveTo( kcalJournal ); - return kcalJournal; -} - -QString Journal::journalToXML( const KCalCore::Journal::Ptr &kcalJournal, const QString& tz ) -{ - Journal journal( tz, kcalJournal ); - return journal.saveXML(); -} - -Journal::Journal( const QString& tz, const KCalCore::Journal::Ptr &journal ) - : KolabBase( tz ) -{ - if ( journal ) { - setFields( journal ); - } -} - -Journal::~Journal() -{ -} - -void Journal::setSummary( const QString& summary ) -{ - mSummary = summary; -} - -QString Journal::summary() const -{ - return mSummary; -} - -void Journal::setStartDate( const KDateTime& startDate ) -{ - mStartDate = startDate; -} - -KDateTime Journal::startDate() const -{ - return mStartDate; -} - -void Journal::setEndDate( const KDateTime& endDate ) -{ - mEndDate = endDate; -} - -KDateTime Journal::endDate() const -{ - return mEndDate; -} - -bool Journal::loadAttribute( QDomElement& element ) -{ - QString tagName = element.tagName(); - - if ( tagName == "summary" ) - setSummary( element.text() ); - else if ( tagName == "start-date" ) - setStartDate( stringToDateTime( element.text() ) ); - else - // Not handled here - return KolabBase::loadAttribute( element ); - - // We handled this - return true; -} - -bool Journal::saveAttributes( QDomElement& element ) const -{ - // Save the base class elements - KolabBase::saveAttributes( element ); - - writeString( element, "summary", summary() ); - writeString( element, "start-date", dateTimeToString( startDate() ) ); - - return true; -} - - -bool Journal::loadXML( const QDomDocument& document ) -{ - QDomElement top = document.documentElement(); - - if ( top.tagName() != "journal" ) { - qWarning( "XML error: Top tag was %s instead of the expected Journal", - top.tagName().toAscii().data() ); - return false; - } - - for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - if ( !loadAttribute( e ) ) { - // Unhandled tag - save for later storage - //qDebug( "Unhandled tag: %s", e.toCString().data() ); - } - } else - qDebug( "Node is not a comment or an element???" ); - } - - return true; -} - -QString Journal::saveXML() const -{ - QDomDocument document = domTree(); - QDomElement element = document.createElement( "journal" ); - element.setAttribute( "version", "1.0" ); - saveAttributes( element ); - document.appendChild( element ); - return document.toString(); -} - -void Journal::saveTo( const KCalCore::Journal::Ptr &journal ) -{ - KolabBase::saveTo( journal ); - - journal->setSummary( summary() ); - journal->setDtStart( utcToLocal( startDate() ) ); -} - -void Journal::setFields( const KCalCore::Journal::Ptr &journal ) -{ - // Set baseclass fields - KolabBase::setFields( journal ); - - // Set our own fields - setSummary( journal->summary() ); - setStartDate( localToUTC( journal->dtStart() ) ); -} - -QString Journal::productID() const -{ - return QString::fromLatin1(LIBKOLAB_LIB_VERSION_STRING) + ", Kolab resource"; -}
View file
libkolab-2.0.tar.gz/kolabformatV2/journal.h
Deleted
@@ -1,101 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2_JOURNAL_H -#define KOLABV2_JOURNAL_H - -#include <kcalcore/journal.h> - -#include "kolabbase.h" - -class QDomElement; - -namespace KolabV2 { - -/** - * This class represents a journal entry, and knows how to load/save it - * from/to XML, and from/to a KCalCore::Journal. - * The instances of this class are temporary, only used to convert - * one to the other. - */ -class Journal : public KolabBase { -public: - /// Use this to parse an xml string to a journal entry - /// The caller is responsible for deleting the returned journal - static KCalCore::Journal::Ptr fromXml( const QDomDocument& xmlDoc, const QString& tz ); - - /// Use this to get an xml string describing this journal entry - static QString journalToXML( const KCalCore::Journal::Ptr &, const QString& tz ); - - explicit Journal( const QString& tz, const KCalCore::Journal::Ptr &journal = KCalCore::Journal::Ptr() ); - virtual ~Journal(); - - virtual QString type() const { return "Journal"; } - - void saveTo( const KCalCore::Journal::Ptr &journal ); - - virtual void setSummary( const QString& summary ); - virtual QString summary() const; - - virtual void setStartDate( const KDateTime& startDate ); - virtual KDateTime startDate() const; - - virtual void setEndDate( const KDateTime& endDate ); - virtual KDateTime endDate() const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - - // Load this journal by reading the XML file - virtual bool loadXML( const QDomDocument& xml ); - - // Serialize this journal to an XML string - virtual QString saveXML() const; - -protected: - // Read all known fields from this ical journal - void setFields( const KCalCore::Journal::Ptr & ); - - QString productID() const; - - QString mSummary; - KDateTime mStartDate; - KDateTime mEndDate; -}; - -} - -#endif // KOLAB_JOURNAL_H
View file
libkolab-2.0.tar.gz/kolabformatV2/kolabbase.cpp
Deleted
@@ -1,500 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "kolabbase.h" - -#include <kabc/addressee.h> -#include <kabc/contactgroup.h> -#include <kcalcore/incidence.h> -#include <kcalcore/journal.h> -#include <ksystemtimezone.h> -#include <kdebug.h> - -using namespace KolabV2; - -KolabBase::KolabBase( const QString& tz ) - : mCreationDate( QDateTime::currentDateTime() ), - mLastModified( KDateTime::currentUtcDateTime() ), - mSensitivity( Public ), - mTimeZone( KSystemTimeZones::zone( tz ) ), - mHasPilotSyncId( false ), mHasPilotSyncStatus( false ) -{ -} - -KolabBase::~KolabBase() -{ -} - -void KolabBase::setFields( const KCalCore::Incidence::Ptr &incidence ) -{ - // So far unhandled KCalCore::IncidenceBase fields: - // mPilotID, mSyncStatus, mFloats - - setUid( incidence->uid() ); - setBody( incidence->description() ); - setCategories( incidence->categoriesStr() ); - setCreationDate( localToUTC( incidence->created() ) ); - setLastModified( incidence->lastModified() ); - setSensitivity( static_cast<Sensitivity>( incidence->secrecy() ) ); - // TODO: Attachments -} - -void KolabBase::saveTo( const KCalCore::Incidence::Ptr &incidence ) const -{ - incidence->setUid( uid() ); - incidence->setDescription( body() ); - incidence->setCategories( categories() ); - incidence->setCreated( utcToLocal( creationDate() ) ); - incidence->setLastModified( lastModified() ); - switch( sensitivity() ) { - case 1: - incidence->setSecrecy( KCalCore::Incidence::SecrecyPrivate ); - break; - case 2: - incidence->setSecrecy( KCalCore::Incidence::SecrecyConfidential ); - break; - default: - incidence->setSecrecy( KCalCore::Incidence::SecrecyPublic ); - break; - } - - // TODO: Attachments -} - -void KolabBase::setFields( const KABC::Addressee* addressee ) -{ - // An addressee does not have a creation date, so somehow we should - // make one, if this is a new entry - - setUid( addressee->uid() ); - setBody( addressee->note() ); - setCategories( addressee->categories().join( "," ) ); - - // Set creation-time and last-modification-time - const QString creationString = addressee->custom( "KOLAB", "CreationDate" ); - kDebug() <<"Creation time string:" << creationString; - KDateTime creationDate; - if ( creationString.isEmpty() ) { - creationDate = KDateTime::currentDateTime(KDateTime::Spec( mTimeZone ) ); - kDebug() <<"Creation date set to current time"; - } - else { - creationDate = stringToDateTime( creationString ); - kDebug() <<"Creation date loaded"; - } - KDateTime modified = KDateTime( addressee->revision(), mTimeZone ); - if ( !modified.isValid() ) - modified = KDateTime::currentUtcDateTime(); - setLastModified( modified ); - if ( modified < creationDate ) { - // It's not possible that the modification date is earlier than creation - creationDate = modified; - kDebug() <<"Creation date set to modification date"; - } - setCreationDate( creationDate ); - const QString newCreationDate = dateTimeToString( creationDate ); - if ( creationString != newCreationDate ) { - // We modified the creation date, so store it for future reference - const_cast<KABC::Addressee*>( addressee ) - ->insertCustom( "KOLAB", "CreationDate", newCreationDate ); - kDebug() <<"Creation date modified. New one:" << newCreationDate; - } - - switch( addressee->secrecy().type() ) { - case KABC::Secrecy::Private: - setSensitivity( Private ); - break; - case KABC::Secrecy::Confidential: - setSensitivity( Confidential ); - break; - default: - setSensitivity( Public ); - } - - // TODO: Attachments -} - -void KolabBase::saveTo( KABC::Addressee* addressee ) const -{ - addressee->setUid( uid() ); - addressee->setNote( body() ); - addressee->setCategories( categories().split( ',', QString::SkipEmptyParts ) ); - addressee->setRevision( lastModified().toZone( mTimeZone ).dateTime() ); - addressee->insertCustom( "KOLAB", "CreationDate", - dateTimeToString( creationDate() ) ); - - switch( sensitivity() ) { - case Private: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Private ) ); - break; - case Confidential: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Confidential ) ); - break; - default: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Public ) ); - break; - } - // TODO: Attachments -} - -void KolabBase::setFields( const KABC::ContactGroup* contactGroup ) -{ - // A contactgroup does not have a creation date, so somehow we should - // make one, if this is a new entry - - setUid( contactGroup->id() ); - - // Set creation-time and last-modification-time - KDateTime creationDate = KDateTime::currentDateTime( KDateTime::Spec( mTimeZone ) ); - kDebug() <<"Creation date set to current time"; - - KDateTime modified = KDateTime::currentUtcDateTime(); - setLastModified( modified ); - if ( modified < creationDate ) { - // It's not possible that the modification date is earlier than creation - creationDate = modified; - kDebug() <<"Creation date set to modification date"; - } - setCreationDate( creationDate ); -} - -void KolabBase::saveTo( KABC::ContactGroup* contactGroup ) const -{ - contactGroup->setId( uid() ); -} - -void KolabBase::setUid( const QString& uid ) -{ - mUid = uid; -}
View file
libkolab-2.0.tar.gz/kolabformatV2/kolabbase.h
Deleted
@@ -1,183 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2BASE_H -#define KOLABV2BASE_H - - -#include <kcalcore/incidence.h> - -#include <kdatetime.h> -#include <ktimezone.h> - -#include <QColor> -#include <qdom.h> - -namespace KABC { - class Addressee; - class ContactGroup; -} - -namespace KolabV2 { - -class KolabBase { -public: - struct Email { - public: - Email( const QString& name = QString(), - const QString& email = QString() ) - : displayName( name ), smtpAddress( email ) - { - } - - QString displayName; - QString smtpAddress; - }; - - enum Sensitivity { Public = 0, Private = 1, Confidential = 2 }; - - explicit KolabBase( const QString& time_zone = QString() ); - virtual ~KolabBase(); - - // Return a string identifying this type - virtual QString type() const = 0; - - virtual void setUid( const QString& uid ); - virtual QString uid() const; - - virtual void setBody( const QString& body ); - virtual QString body() const; - - virtual void setCategories( const QString& categories ); - virtual QString categories() const; - - virtual void setCreationDate( const KDateTime& date ); - virtual KDateTime creationDate() const; - - virtual void setLastModified( const KDateTime& date ); - virtual KDateTime lastModified() const; - - virtual void setSensitivity( Sensitivity sensitivity ); - virtual Sensitivity sensitivity() const; - - virtual void setPilotSyncId( unsigned long id ); - virtual bool hasPilotSyncId() const; - virtual unsigned long pilotSyncId() const; - - virtual void setPilotSyncStatus( int status ); - virtual bool hasPilotSyncStatus() const; - virtual int pilotSyncStatus() const; - - // String - Date conversion methods - static QString dateTimeToString( const KDateTime& time ); - static QString dateToString( const QDate& date ); - static KDateTime stringToDateTime( const QString& time ); - static QDate stringToDate( const QString& date ); - - // String - Sensitivity conversion methods - static QString sensitivityToString( Sensitivity ); - static Sensitivity stringToSensitivity( const QString& ); - - // String - Color conversion methods - static QString colorToString( const QColor& ); - static QColor stringToColor( const QString& ); - - // Load this object by reading the XML file - bool load( const QString& xml ); - static QDomDocument loadDocument( const QString& xmlData ); - - // Load this QDomDocument - virtual bool loadXML( const QDomDocument& xml ) = 0; - - // Serialize this object to an XML string - virtual QString saveXML() const = 0; - -protected: - /// Read all known fields from this ical incidence - void setFields( const KCalCore::Incidence::Ptr & ); - - /// Save all known fields into this ical incidence - void saveTo( const KCalCore::Incidence::Ptr & ) const; - - /// Read all known fields from this contact - void setFields( const KABC::Addressee* ); - - /// Save all known fields into this contact - void saveTo( KABC::Addressee* ) const; - - /// Read all known fields from this contact group - void setFields( const KABC::ContactGroup* ); - - /// Save all known fields into this contact groupd - void saveTo( KABC::ContactGroup* ) const; - - // This just makes the initial dom tree with version and doctype - static QDomDocument domTree(); - - bool loadEmailAttribute( QDomElement& element, Email& email ); - - void saveEmailAttribute( QDomElement& element, const Email& email, - const QString& tagName = "email" ) const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - - // Return the product ID - virtual QString productID() const = 0; - - // Write a string tag - static void writeString( QDomElement&, const QString&, const QString& ); - - KDateTime localToUTC( const KDateTime& time ) const; - KDateTime utcToLocal( const KDateTime& time ) const; - - QString mUid; - QString mBody; - QString mCategories; - KDateTime mCreationDate; - KDateTime mLastModified; - Sensitivity mSensitivity; - KTimeZone mTimeZone; - - // KPilot synchronization stuff - bool mHasPilotSyncId, mHasPilotSyncStatus; - unsigned long mPilotSyncId; - int mPilotSyncStatus; -}; - -} - -#endif // KOLABBASE_H
View file
libkolab-2.0.tar.gz/kolabformatV2/note.cpp
Deleted
@@ -1,230 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "note.h" -#include "libkolab-version.h" - -#include <kcalcore/journal.h> -#include <kdebug.h> - -using namespace KolabV2; - - -KCalCore::Journal::Ptr Note::xmlToJournal( const QString& xml ) -{ - Note note; - note.load( xml ); - KCalCore::Journal::Ptr journal( new KCalCore::Journal() ); - note.saveTo( journal ); - return journal; -} - -QString Note::journalToXML( const KCalCore::Journal::Ptr &journal ) -{ - Note note( journal ); - return note.saveXML(); -} - -Note::Note( const KCalCore::Journal::Ptr &journal ) : mRichText( false ) -{ - if ( journal ) - setFields( journal ); -} - -Note::~Note() -{ -} - -void Note::setSummary( const QString& summary ) -{ - mSummary = summary; -} - -QString Note::summary() const -{ - return mSummary; -} - -void Note::setBackgroundColor( const QColor& bgColor ) -{ - mBackgroundColor = bgColor; -} - -QColor Note::backgroundColor() const -{ - return mBackgroundColor; -} - -void Note::setForegroundColor( const QColor& fgColor ) -{ - mForegroundColor = fgColor; -} - -QColor Note::foregroundColor() const -{ - return mForegroundColor; -} - -void Note::setRichText( bool richText ) -{ - mRichText = richText; -} - -bool Note::richText() const -{ - return mRichText; -} - -bool Note::loadAttribute( QDomElement& element ) -{ - QString tagName = element.tagName(); - if ( tagName == "summary" ) - setSummary( element.text() ); - else if ( tagName == "foreground-color" ) - setForegroundColor( stringToColor( element.text() ) ); - else if ( tagName == "background-color" ) - setBackgroundColor( stringToColor( element.text() ) ); - else if ( tagName == "knotes-richtext" ) - mRichText = ( element.text() == "true" ); - else - return KolabBase::loadAttribute( element ); - - // We handled this - return true; -} - -bool Note::saveAttributes( QDomElement& element ) const -{ - // Save the base class elements - KolabBase::saveAttributes( element ); - - // Save the elements -#if 0 - QDomComment c = element.ownerDocument().createComment( "Note specific attributes" ); - element.appendChild( c ); -#endif - - writeString( element, "summary", summary() ); - if ( foregroundColor().isValid() ) - writeString( element, "foreground-color", colorToString( foregroundColor() ) ); - if ( backgroundColor().isValid() ) - writeString( element, "background-color", colorToString( backgroundColor() ) ); - writeString( element, "knotes-richtext", mRichText ? "true" : "false" ); - - return true; -} - - -bool Note::loadXML( const QDomDocument& document ) -{ - QDomElement top = document.documentElement(); - - if ( top.tagName() != "note" ) { - qWarning( "XML error: Top tag was %s instead of the expected note", - top.tagName().toAscii().data() ); - return false; - } - - for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - QDomElement e = n.toElement(); - if ( !loadAttribute( e ) ) - // TODO: Unhandled tag - save for later storage - kDebug() <<"Warning: Unhandled tag" << e.tagName(); - } else - kDebug() <<"Node is not a comment or an element???"; - } - - return true; -} - -QString Note::saveXML() const -{ - QDomDocument document = domTree(); - QDomElement element = document.createElement( "note" ); - element.setAttribute( "version", "1.0" ); - saveAttributes( element ); - document.appendChild( element ); - return document.toString(); -} - -void Note::setFields( const KCalCore::Journal::Ptr &journal ) -{ - KolabBase::setFields( journal ); - - setSummary( journal->summary() ); - - QString property = journal->customProperty( "KNotes", "BgColor" ); - if ( !property.isEmpty() ) { - setBackgroundColor( property ); - } else { - setBackgroundColor( "yellow" ); - } - - property = journal->customProperty( "KNotes", "FgColor" ); - if ( !property.isEmpty() ) { - setForegroundColor( property ); - } else {
View file
libkolab-2.0.tar.gz/kolabformatV2/note.h
Deleted
@@ -1,109 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2_NOTE_H -#define KOLABV2_NOTE_H - -#include <kcalcore/journal.h> - -#include "kolabbase.h" - -class QDomElement; - -namespace KolabV2 { - -/** - * This class represents a note, and knows how to load/save it - * from/to XML, and from/to a KCalCore::Journal. - * The instances of this class are temporary, only used to convert - * one to the other. - */ -class Note : public KolabBase { -public: - /// Use this to parse an xml string to a journal entry - /// The caller is responsible for deleting the returned journal - static KCalCore::Journal::Ptr xmlToJournal( const QString& xml ); - - /// Use this to get an xml string describing this journal entry - static QString journalToXML( const KCalCore::Journal::Ptr & ); - - /// Create a note object and - explicit Note( const KCalCore::Journal::Ptr &journal = KCalCore::Journal::Ptr() ); - virtual ~Note(); - - void saveTo( const KCalCore::Journal::Ptr &journal ); - - virtual QString type() const { return "Note"; } - - virtual void setSummary( const QString& summary ); - virtual QString summary() const; - - virtual void setBackgroundColor( const QColor& bgColor ); - virtual QColor backgroundColor() const; - - virtual void setForegroundColor( const QColor& fgColor ); - virtual QColor foregroundColor() const; - - virtual void setRichText( bool richText ); - virtual bool richText() const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - - // Load this note by reading the XML file - virtual bool loadXML( const QDomDocument& xml ); - - // Serialize this note to an XML string - virtual QString saveXML() const; - -protected: - // Read all known fields from this ical incidence - void setFields( const KCalCore::Journal::Ptr & ); - - // Save all known fields into this ical incidence - void saveTo( const KCalCore::Incidence::Ptr & ) const; - - QString productID() const; - - QString mSummary; - QColor mBackgroundColor; - QColor mForegroundColor; - bool mRichText; -}; - -} - -#endif // KOLAB_NOTE_H
View file
libkolab-2.0.tar.gz/kolabformatV2/task.cpp
Deleted
@@ -1,349 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "task.h" - -#include <kcalcore/todo.h> -#include <kdebug.h> - -using namespace KolabV2; - -KCalCore::Todo::Ptr Task::fromXml( const QDomDocument& xmlDoc, const QString& tz ) -{ - Task task( tz ); - task.loadXML( xmlDoc ); - KCalCore::Todo::Ptr todo( new KCalCore::Todo() ); - task.saveTo( todo ); - return todo; -} - -QString Task::taskToXML( const KCalCore::Todo::Ptr &todo, const QString& tz ) -{ - Task task( tz, todo ); - return task.saveXML(); -} - -Task::Task( const QString& tz, const KCalCore::Todo::Ptr &task ) - : Incidence( tz, task ), - mPercentCompleted( 0 ), - mStatus( KCalCore::Incidence::StatusNone ), - mHasStartDate( false ), mHasDueDate( false ), - mHasCompletedDate( false ) -{ - if ( task ) { - setFields( task ); - } -} - -Task::~Task() -{ -} - -void Task::setPercentCompleted( int percent ) -{ - mPercentCompleted = percent; -} - -int Task::percentCompleted() const -{ - return mPercentCompleted; -} - -void Task::setStatus( KCalCore::Incidence::Status status ) -{ - mStatus = status; -} - -KCalCore::Incidence::Status Task::status() const -{ - return mStatus; -} - -void Task::setParent( const QString& parentUid ) -{ - mParent = parentUid; -} - -QString Task::parent() const -{ - return mParent; -} - -void Task::setDueDate( const KDateTime &date ) -{ - mDueDate = date; - mHasDueDate = true; -} - -void Task::setDueDate( const QDate &date ) -{ - mDueDate = KDateTime( date ); - mHasDueDate = true; - mFloatingStatus = AllDay; -} - -void Task::setDueDate( const QString &date ) -{ - if ( date.length() > 10 ) { - // This is a date + time - setDueDate( stringToDateTime( date ) ); - } else { - // This is only a date - setDueDate( stringToDate( date ) ); - } -} - -KDateTime Task::dueDate() const -{ - return mDueDate; -} - -void Task::setHasStartDate( bool v ) -{ - mHasStartDate = v; -} - -bool Task::hasStartDate() const -{ - return mHasStartDate; -} - -bool Task::hasDueDate() const -{ - return mHasDueDate; -} - -void Task::setCompletedDate( const KDateTime& date ) -{ - mCompletedDate = date; - mHasCompletedDate = true; -} - -KDateTime Task::completedDate() const -{ - return mCompletedDate; -} - -bool Task::hasCompletedDate() const -{ - return mHasCompletedDate; -} - -bool Task::loadAttribute( QDomElement& element ) -{ - QString tagName = element.tagName(); - - if ( tagName == "completed" ) { - bool ok; - int percent = element.text().toInt( &ok ); - if ( !ok || percent < 0 || percent > 100 ) - percent = 0; - setPercentCompleted( percent ); - } else if ( tagName == "status" ) { - if ( element.text() == "in-progress" ) - setStatus( KCalCore::Incidence::StatusInProcess ); - else if ( element.text() == "completed" ) - setStatus( KCalCore::Incidence::StatusCompleted ); - else if ( element.text() == "waiting-on-someone-else" ) - setStatus( KCalCore::Incidence::StatusNeedsAction ); - else if ( element.text() == "deferred" ) - // Guessing a status here - setStatus( KCalCore::Incidence::StatusCanceled ); - else - // Default - setStatus( KCalCore::Incidence::StatusNone ); - } else if ( tagName == "due-date" ) { - setDueDate( element.text() ); - } else if ( tagName == "parent" ) { - setParent( element.text() ); - } else if ( tagName == "x-completed-date" ) { - setCompletedDate( stringToDateTime( element.text() ) ); - } else if ( tagName == "start-date" ) { - setHasStartDate( true ); - setStartDate( element.text() ); - } else - return Incidence::loadAttribute( element ); - - // We handled this - return true; -}
View file
libkolab-2.0.tar.gz/kolabformatV2/task.h
Deleted
@@ -1,127 +0,0 @@ -/* - This file is part of the kolab resource - the implementation of the - Kolab storage format. See www.kolab.org for documentation on this. - - Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KOLABV2_TASK_H -#define KOLABV2_TASK_H - -#include "incidence.h" - -#include <kcalcore/todo.h> -#include <kcalcore/incidence.h> - -class QDomElement; - -namespace KCal { - class ResourceKolab; -} - -namespace KolabV2 { - -/** - * This class represents a task, and knows how to load/save it - * from/to XML, and from/to a KCalCore::Todo. - * The instances of this class are temporary, only used to convert - * one to the other. - */ -class Task : public Incidence { -public: - /// Use this to parse an xml string to a task entry - /// The caller is responsible for deleting the returned task - static KCalCore::Todo::Ptr fromXml( const QDomDocument& xmlDoc, const QString& tz/*, KCalCore::ResourceKolab *res = 0, - const QString& subResource = QString(), quint32 sernum = 0 */); - - /// Use this to get an xml string describing this task entry - static QString taskToXML( const KCalCore::Todo::Ptr &, const QString& tz ); - - explicit Task( /*KCalCore::ResourceKolab *res, const QString& subResource, quint32 sernum,*/ - const QString& tz, const KCalCore::Todo::Ptr &todo = KCalCore::Todo::Ptr() ); - virtual ~Task(); - - virtual QString type() const { return "Task"; } - - void saveTo( const KCalCore::Todo::Ptr &todo ); - - virtual void setPercentCompleted( int percent ); - virtual int percentCompleted() const; - - virtual void setStatus( KCalCore::Incidence::Status status ); - virtual KCalCore::Incidence::Status status() const; - - virtual void setParent( const QString& parentUid ); - virtual QString parent() const; - - virtual void setHasStartDate( bool ); - virtual bool hasStartDate() const; - - virtual void setDueDate( const KDateTime& date ); - virtual void setDueDate( const QString &date ); - virtual void setDueDate( const QDate &date ); - virtual KDateTime dueDate() const; - virtual bool hasDueDate() const; - - virtual void setCompletedDate( const KDateTime& date ); - virtual KDateTime completedDate() const; - virtual bool hasCompletedDate() const; - - // Load the attributes of this class - virtual bool loadAttribute( QDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( QDomElement& ) const; - - // Load this task by reading the XML file - virtual bool loadXML( const QDomDocument& xml ); - - // Serialize this task to an XML string - virtual QString saveXML() const; - -protected: - // Read all known fields from this ical todo - void setFields( const KCalCore::Todo::Ptr & ); - - int mPercentCompleted; - KCalCore::Incidence::Status mStatus; - QString mParent; - - bool mHasStartDate; - - bool mHasDueDate; - KDateTime mDueDate; - - bool mHasCompletedDate; - KDateTime mCompletedDate; -}; - -} - -#endif // KOLAB_TASK_H
View file
libkolab-2.0.tar.gz/libkolab_config.h.in
Deleted
@@ -1,6 +0,0 @@ -/* This file is generated from libkolab_config.h.cmake. */ - -/* Whether akonadi/tag.h exists. */ -#cmakedefine HAVE_TAG_H 1 -/* Whether akonadi/relation.h exists. */ -#cmakedefine HAVE_RELATION_H 1
View file
libkolab-2.0.tar.gz/tests/benchmark.cpp
Deleted
@@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011 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 "benchmark.h" -#include "kolabformatV2/event.h" -#include "conversion/kcalconversion.h" -#include <kmime/kmime_message.h> -#include <kolabformat.h> -#include <kdebug.h> -#include "testutils.h" - -KMime::Message::Ptr readMimeFile( const QString &fileName ) -{ - QFile file( fileName ); - file.open( QFile::ReadOnly ); - const QByteArray data = file.readAll(); - Q_ASSERT( !data.isEmpty() ); - - KMime::Message *msg = new KMime::Message; - msg->setContent( data ); - msg->parse(); - return KMime::Message::Ptr(msg); -} - -KMime::Content* findContentByType(const KMime::Message::Ptr &data, const QByteArray &type) -{ - const KMime::Content::List list = data->contents(); - Q_FOREACH(KMime::Content *c, list) { - if (c->contentType()->mimeType() == type) - return c; - } - return 0; - -} - -void BenchmarkTests::parsingBenchmarkComparison_data() -{ - QTest::addColumn<bool>("v2Parser"); - QTest::newRow("v2") << true; - QTest::newRow("v3") << false; -} - -void BenchmarkTests::parsingBenchmarkComparison() -{ - const KMime::Message::Ptr kolabItem = readMimeFile( TESTFILEDIR+QString::fromLatin1("/v2/event/complex.ics.mime") ); - KMime::Content *xmlContent = findContentByType( kolabItem, "application/x-vnd.kolab.event" ); - QVERIFY ( xmlContent ); - const QByteArray xmlData = xmlContent->decodedContent(); - // qDebug() << xmlData; - const QDomDocument xmlDoc = KolabV2::Event::loadDocument( QString::fromUtf8(xmlData) ); - QVERIFY ( !xmlDoc.isNull() ); - const KCalCore::Event::Ptr i = KolabV2::Event::fromXml( xmlDoc, QString::fromLatin1("Europe/Berlin") ); - QVERIFY ( i ); - const Kolab::Event &event = Kolab::Conversion::fromKCalCore(*i); - const std::string &v3String = Kolab::writeEvent(event); - - QFETCH(bool, v2Parser); - - // Kolab::readEvent(v3String, false); //init parser (doesn't really change the results it seems) - // qDebug() << QString::fromUtf8(xmlData); - // qDebug() << "------------------------------------------------------------------------------------"; - // qDebug() << QString::fromStdString(v3String); - if (v2Parser) { - QBENCHMARK { - KolabV2::Event::fromXml( KolabV2::Event::loadDocument( QString::fromUtf8(xmlData) ), QString::fromLatin1("Europe/Berlin") ); - } - } else { - QBENCHMARK { - Kolab::readEvent(v3String, false); - } - } -} - - -QTEST_MAIN( BenchmarkTests ) - -#include "benchmark.moc"
View file
libkolab-2.0.tar.gz/tests/debugstreamtest.cpp
Deleted
@@ -1,56 +0,0 @@ -/* - * Copyright (C) 2012 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 "debugstreamtest.h" - -#include "kolabformat/errorhandler.h" - -#include <QTest> - -void DebugStreamTest::testDebugstream() -{ - Error() << "test1"; - Error() << "test2" << "bla" << 3 << QMap<QString, int>(); - QCOMPARE(Kolab::ErrorHandler::instance().getErrors().size(), 2); - QVERIFY(Kolab::ErrorHandler::instance().getErrors().first().message.contains("test1")); - QCOMPARE(Kolab::ErrorHandler::instance().getErrors().first().severity, Kolab::ErrorHandler::Error); - QVERIFY(Kolab::ErrorHandler::instance().getErrors().last().message.contains("bla")); -} - -void DebugStreamTest::testDebugNotLogged() -{ - Kolab::ErrorHandler::instance().clear(); - Debug() << "test1"; - QCOMPARE(Kolab::ErrorHandler::instance().getErrors().size(), 0); -} - -void DebugStreamTest::testHasError() -{ - Debug() << "test1"; - QCOMPARE(Kolab::ErrorHandler::errorOccured(), false); - Warning() << "test1"; - QCOMPARE(Kolab::ErrorHandler::errorOccured(), false); - Error() << "test1"; - QCOMPARE(Kolab::ErrorHandler::errorOccured(), true); - Kolab::ErrorHandler::clearErrors(); - QCOMPARE(Kolab::ErrorHandler::errorOccured(), false); -} - - -QTEST_MAIN( DebugStreamTest ) - -#include "debugstreamtest.moc" \ No newline at end of file
View file
libkolab-2.0.tar.gz/tests/debugstreamtest.h
Deleted
@@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 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 DEBUGSTREAMTEST_H -#define DEBUGSTREAMTEST_H - -#include <QObject> - -class DebugStreamTest: public QObject -{ - Q_OBJECT -private slots: - void testDebugstream(); - void testDebugNotLogged(); - void testHasError(); -}; - -#endif // DEBUGSTREAMTEST_H
View file
libkolab-2.0.tar.gz/tests/formattest.cpp
Deleted
@@ -1,489 +0,0 @@ -/* - * Copyright (C) 2012 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 "formattest.h" - -#include <QTest> -#include <QFile> -#include <QDebug> -#include <qprocess.h> -#include <qtemporaryfile.h> -#include <QBuffer> -#include <kdebug.h> -#include <ksystemtimezone.h> -#include <kolabcontainers.h> -#include <kolabformat.h> - -#include <kcalcore/icalformat.h> -#include <kabc/vcardconverter.h> -#include <kabc/contactgrouptool.h> -#include <akonadi/notes/noteutils.h> - -#include "testutils.h" -#include "kolabformat/kolabobject.h" -#include "kolabformat/errorhandler.h" -#include "kolabformat/kolabdefinitions.h" - -static bool compareMimeMessage( const KMime::Message::Ptr &msg, const KMime::Message::Ptr &expectedMsg ) -{ - // headers - KCOMPARE( msg->subject()->asUnicodeString(), expectedMsg->subject()->asUnicodeString() ); - if ( msg->from()->isEmpty() || expectedMsg->from()->isEmpty() ) { - KCOMPARE( msg->from()->asUnicodeString(), expectedMsg->from()->asUnicodeString() ); - } else { - KCOMPARE( msg->from()->mailboxes().first().address(), expectedMsg->from()->mailboxes().first().address() ); // matching address is enough, we don't need a display name - } - KCOMPARE( msg->contentType()->mimeType(), expectedMsg->contentType()->mimeType() ); - KCOMPARE( msg->headerByType( X_KOLAB_TYPE_HEADER )->as7BitString(), expectedMsg->headerByType( X_KOLAB_TYPE_HEADER )->as7BitString() ); - // date contains conversion time... - // KCOMPARE( msg->date()->asUnicodeString(), expectedMsg->date()->asUnicodeString() ); - - // body parts - KCOMPARE( msg->contents().size(), expectedMsg->contents().size() ); - for ( int i = 0; i < msg->contents().size(); ++i ) { - KMime::Content *part = msg->contents().at( i ); - KMime::Content *expectedPart = expectedMsg->contents().at( i ); - - // part headers - KCOMPARE( part->contentType()->mimeType(), expectedPart->contentType()->mimeType() ); - KCOMPARE( part->contentDisposition()->filename(), expectedPart->contentDisposition()->filename() ); - - KCOMPARE( part->decodedContent().isEmpty(), false ); - - QString content(part->decodedContent()); - normalizeMimemessage(content); - QString expected(expectedPart->decodedContent()); - normalizeMimemessage(expected); -// showDiff(expected, content); - - // part content - KCOMPARE( content.simplified(), expected.simplified() ); - } - return true; -} - -void FormatTest::initTestCase() -{ - QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available"); -} - -void FormatTest::testIncidence_data() -{ - QTest::addColumn<Kolab::Version>( "version" ); - QTest::addColumn<Kolab::ObjectType>( "type" ); - QTest::addColumn<QString>( "icalFileName" ); - QTest::addColumn<QString>( "mimeFileName" ); - - QTest::newRow( "v2eventSimple" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/simple.ics") << getPath("v2/event/simple.ics.mime"); - QTest::newRow( "v2eventComplex" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/complex.ics") << getPath("v2/event/complex.ics.mime"); - QTest::newRow( "v2eventAttachment" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/attachment.ics") << getPath("v2/event/attachment.ics.mime"); - QTest::newRow( "v2eventAllday" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/allday.ics") << getPath("v2/event/allday.ics.mime"); - QTest::newRow( "v2eventUtf8Attachment" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/attachmentUtf8.ics") << getPath("v2/event/attachmentUtf8.ics.mime"); - //The following test just fails because we have a nicer mime message output than horde -// QTest::newRow( "v2eventHorde" ) << Kolab::KolabV2 << Kolab::EventObject << getPath("v2/event/horde.ics") << getPath("v2/event/horde.ics.mime"); - QTest::newRow( "v2todoSimple" ) << Kolab::KolabV2 << Kolab::TodoObject << getPath("v2/task/simple.ics") << getPath("v2/task/simple.ics.mime"); - QTest::newRow( "v2todoComplex" ) << Kolab::KolabV2 << Kolab::TodoObject << getPath("v2/task/complex.ics") << getPath("v2/task/complex.ics.mime"); - QTest::newRow( "v2todoPrio1" ) << Kolab::KolabV2 << Kolab::TodoObject << getPath("v2/task/prioritytest1.ics") << getPath("v2/task/prioritytest1.ics.mime"); - QTest::newRow( "v2todoPrio2" ) << Kolab::KolabV2 << Kolab::TodoObject << getPath("v2/task/prioritytest2.ics") << getPath("v2/task/prioritytest2.ics.mime"); - QTest::newRow( "v2journalSimple" ) << Kolab::KolabV2 << Kolab::JournalObject << getPath("v2/journal/simple.ics") << getPath("v2/journal/simple.ics.mime"); - QTest::newRow( "v2journalComplex" ) << Kolab::KolabV2 << Kolab::JournalObject << getPath("v2/journal/complex.ics") << getPath("v2/journal/complex.ics.mime"); - - QTest::newRow( "v3eventSimple" ) << Kolab::KolabV3 << Kolab::EventObject << getPath("v3/event/simple.ics") << getPath("v3/event/simple.ics.mime"); - QTest::newRow( "v3eventComplex" ) << Kolab::KolabV3 << Kolab::EventObject << getPath("v3/event/complex.ics") << getPath("v3/event/complex.ics.mime"); - QTest::newRow( "v3todoSimple" ) << Kolab::KolabV3 << Kolab::TodoObject << getPath("v3/task/simple.ics") << getPath("v3/task/simple.ics.mime"); - QTest::newRow( "v3todoComplex" ) << Kolab::KolabV3 << Kolab::TodoObject << getPath("v3/task/complex.ics") << getPath("v3/task/complex.ics.mime"); - QTest::newRow( "v3journalSimple" ) << Kolab::KolabV3 << Kolab::JournalObject << getPath("v3/journal/simple.ics") << getPath("v3/journal/simple.ics.mime"); - QTest::newRow( "v3journalComplex" ) << Kolab::KolabV3 << Kolab::JournalObject << getPath("v3/journal/complex.ics") << getPath("v3/journal/complex.ics.mime"); - QTest::newRow( "v3utf8quotedPrintable" ) << Kolab::KolabV3 << Kolab::EventObject << getPath("v3/event/utf8.ics") << getPath("v3/event/utf8quotedPrintable.ics.mime"); - QTest::newRow( "v3utf8base64" ) << Kolab::KolabV3 << Kolab::EventObject << getPath("v3/event/utf8.ics") << getPath("v3/event/utf8base64.ics.mime"); - QTest::newRow( "v3utf88bit" ) << Kolab::KolabV3 << Kolab::EventObject << getPath("v3/event/utf8.ics") << getPath("v3/event/utf88bit.ics.mime"); -} - - -void FormatTest::testIncidence() -{ - QFETCH( Kolab::Version, version ); - QFETCH( Kolab::ObjectType, type ); - QFETCH( QString, icalFileName ); //To compare - QFETCH( QString, mimeFileName ); //For parsing - - //Parse mime message - bool ok = false; - const KMime::Message::Ptr &msg = readMimeFile( mimeFileName, ok ); - QVERIFY(ok); - Kolab::KolabObjectReader reader; - Kolab::ObjectType t = reader.parseMimeMessage(msg); - QCOMPARE(t, type); - QCOMPARE(reader.getVersion(), version); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); - - KCalCore::Incidence::Ptr convertedIncidence = reader.getIncidence(); - - //Parse ICalFile for comparison - QFile icalFile( icalFileName ); - QVERIFY( icalFile.open( QFile::ReadOnly ) ); - KCalCore::ICalFormat format; - KCalCore::Incidence::Ptr realIncidence( format.fromString( QString::fromUtf8( icalFile.readAll() ) ) ); - - // fix up the converted incidence for comparisson - normalizeIncidence(convertedIncidence); - normalizeIncidence(realIncidence); - - // recurrence objects are created on demand, but KCalCore::Incidence::operator==() doesn't take that into account - // so make sure both incidences have one - realIncidence->recurrence(); - convertedIncidence->recurrence(); - - realIncidence->setLastModified(convertedIncidence->lastModified()); - - //The following test is just for debugging and not really relevant - if ( *(realIncidence.data()) != *(convertedIncidence.data()) ) { - showDiff(format.toString( realIncidence ), format.toString( convertedIncidence )); - } - QVERIFY( *(realIncidence.data()) == *(convertedIncidence.data()) ); - - - //Write - Kolab::overrideTimestamp(Kolab::cDateTime(2012, 5, 5, 5,5,5, true)); - KMime::Message::Ptr convertedMime = Kolab::KolabObjectWriter::writeIncidence(realIncidence, version); - - if ( !compareMimeMessage( convertedMime, msg )) { - showDiff(msg->encodedContent(), convertedMime->encodedContent()); - QVERIFY( false ); - } - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); -} - - -enum TestMode { - ReadOnly, - ReadWrite -}; -Q_DECLARE_METATYPE(TestMode); - -void FormatTest::testContact_data() -{ - QTest::addColumn<Kolab::Version>( "version" ); - QTest::addColumn<Kolab::ObjectType>( "type" ); - QTest::addColumn<QString>( "vcardFileName" ); - QTest::addColumn<QString>( "mimeFileName" ); - QTest::addColumn<TestMode>( "mode" ); - - QTest::newRow( "v2contactSimple" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/simple.vcf") << getPath("v2/contacts/simple.vcf.mime") << ReadWrite; - //FIXME Reference files needs to be adjusted due to fix in how pictures are stored -// QTest::newRow( "v2contactComplex" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/complex.vcf") << getPath("v2/contacts/complex.vcf.mime") << ReadWrite; - QTest::newRow( "v2contactAddress" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/address.vcf") << getPath("v2/contacts/address.vcf.mime") << ReadWrite; - QTest::newRow( "v2contactBug238996" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/bug238996.vcf") << getPath("v2/contacts/bug238996.vcf.mime") << ReadWrite; - QTest::newRow( "v2contactDisplayname" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/displayname.vcf") << getPath("v2/contacts/displayname.vcf.mime") << ReadWrite; - QTest::newRow( "v2contactEmails" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/emails.vcf") << getPath("v2/contacts/emails.vcf.mime") << ReadWrite; - QTest::newRow( "v2contactPhonenumbers" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/phonenumbers.vcf") << getPath("v2/contacts/phonenumbers.vcf.mime") << ReadWrite; - // FIXME Reference files needs to be adjusted due to fix in how pictures are stored -// QTest::newRow( "v2contactPicture" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/picture.vcf") << getPath("v2/contacts/picture.vcf.mime") << ReadWrite; - //FIXME the following test fails because the vcard implementation always writes jpeg (which is lossy). The reference vcf file is therefore probably also not really useful -// QTest::newRow( "v2pictureJPGHorde" ) << Kolab::KolabV2 << Kolab::ContactObject << getPath("v2/contacts/pictureJPGHorde.vcf") << getPath("v2/contacts/pictureJPGHorde.vcf.mime"); - - QTest::newRow( "v3contactSimple" ) << Kolab::KolabV3 << Kolab::ContactObject << getPath("v3/contacts/simple.vcf") << getPath("v3/contacts/simple.vcf.mime") << ReadWrite;
View file
libkolab-2.0.tar.gz/tests/formattest.h
Deleted
@@ -1,73 +0,0 @@ -/* - * Copyright (C) 2012 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 FORMATTEST_H -#define FORMATTEST_H -#include <QObject> - -/** - * Test complete serialization from mime message to KCalCore/KABC containers. - * - * The .ics .vcf files serve as reference, under the assumption that the iCal/vCard implementations don't have bugs. - * - * The .ics.mime/.vcf.mime messages are first used to test parsing, and then to compare the result after serialization. - * The mime files are of course just a snapshot of how it is thought that the result should be. - * The files may have bugs themselves and will need to be updated to reflect future changes. - * - * kompare (the kde diff tool) is launched if a test fails to show you the difference between expected and actual conversion. - * Comment the code if you don't want it. - * - * Note that some parts of the mime message are not compared, but show up in kompare as difference: - * * Date-Header - * * Content-Type-Header - * * next-part markers - * * Content-ID Header - * - * These are safe to be ignored as they are randomly generated. - * - * To generate the reference files, you can write the vcf/ics by hand and generate the mime message from that one (using the generateMimefile() function). - * You may need to sort some things manually (addresses/phonenumbers), and generally check manually if everything is as it should be. - * The test will then remain to ensure the same for future versions. - * - */ -class FormatTest: public QObject -{ - Q_OBJECT -private slots: - - void initTestCase(); - - void testIncidence_data(); - void testIncidence(); - - void testContact_data(); - void testContact(); - - void testDistlist_data(); - void testDistlist(); - - void testNote_data(); - void testNote(); - - //Some pseudo tests and helper functions - void generateMimefile(); - void generateVCard(); - void proveJPGisLossy(); -}; - -#endif // FORMATTEST_H
View file
libkolab-2.0.tar.gz/tests/freebusytest.cpp
Deleted
@@ -1,168 +0,0 @@ -/* - * Copyright (C) 2012 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 "freebusytest.h" -#include "testutils.h" -#include "testhelpers.h" - -#include <QTest> -#include "freebusy/freebusy.h" -#include <kolabfreebusy.h> - -#include <iostream> - - -void FreebusyTest::testFB_data() -{ - QTest::addColumn<Kolab::cDateTime>( "start" ); - QTest::addColumn<Kolab::cDateTime>( "end" ); - QTest::addColumn< std::vector<Kolab::Event> >( "events" ); - QTest::addColumn< std::vector<Kolab::FreebusyPeriod> >( "output" ); - - - //UTC check - { - Kolab::Period p1(Kolab::cDateTime(2011,10,6,12,1,1,true), Kolab::cDateTime(2011,10,7,12,1,1,true)); - Kolab::Period p2(Kolab::cDateTime(2011,10,8,12,1,1,true), Kolab::cDateTime(2011,10,9,12,1,1,true)); - Kolab::Period p3(Kolab::cDateTime(2011,10,10,12,1,1,true), Kolab::cDateTime(2011,10,11,12,1,1,true)); - - std::vector<Kolab::Event> events; - events.push_back(createEvent(p1.start, p1.end)); - events.push_back(createEvent(p2.start, p2.end)); - events.push_back(createEvent(p3.start, p3.end)); - - Kolab::FreebusyPeriod period1; - period1.setType(Kolab::FreebusyPeriod::Busy); - period1.setEvent(events.at(0).uid(), events.at(0).summary(), events.at(0).location()); - period1.setPeriods(std::vector<Kolab::Period>() << p1); - - Kolab::FreebusyPeriod period2; - period2.setType(Kolab::FreebusyPeriod::Busy); - period2.setEvent(events.at(1).uid(), events.at(1).summary(), events.at(1).location()); - period2.setPeriods(std::vector<Kolab::Period>() << p2); - - Kolab::FreebusyPeriod period3; - period3.setType(Kolab::FreebusyPeriod::Busy); - period3.setEvent(events.at(2).uid(), events.at(2).summary(), events.at(2).location()); - period3.setPeriods(std::vector<Kolab::Period>() << p3); - - { - std::vector<Kolab::FreebusyPeriod> output; - output.push_back(period1); - output.push_back(period2); - output.push_back(period3); - - QTest::newRow( "simple utc" ) << Kolab::cDateTime(2010, 1, 1,1,1,1,true) << Kolab::cDateTime(2012, 1, 1,1,1,1,true) << events << output; - } - - { - std::vector<Kolab::FreebusyPeriod> output; - output.push_back(period2); - output.push_back(period3); - - QTest::newRow( "limit utc below" ) << Kolab::cDateTime(2011,10,8,12,1,1,true) << Kolab::cDateTime(2012, 1, 1,1,1,1,true) << events << output; - } - { - std::vector<Kolab::FreebusyPeriod> output; - output.push_back(period1); - output.push_back(period2); - - QTest::newRow( "limit utc above" ) << Kolab::cDateTime(2010, 1, 1,1,1,1,true) << Kolab::cDateTime(2011,10,9,12,1,1,true) << events << output; - } - } - { - Kolab::Event event; - event.setUid(QUuid::createUuid().toString().toStdString()); - event.setStart(Kolab::cDateTime(2011,1,1,0,0,0,true)); - event.setEnd(Kolab::cDateTime(2011,1,1,1,0,0,true)); - Kolab::RecurrenceRule rrule; - rrule.setFrequency(Kolab::RecurrenceRule::Daily); - rrule.setInterval(1); - rrule.setCount(2); - event.setRecurrenceRule(rrule); - - std::vector<Kolab::Event> events; - events.push_back(event); - - std::vector<Kolab::FreebusyPeriod> output; - Kolab::FreebusyPeriod period1; - period1.setType(Kolab::FreebusyPeriod::Busy); - period1.setEvent(event.uid(), event.summary(), event.location()); - period1.setPeriods(std::vector<Kolab::Period>() << Kolab::Period(Kolab::cDateTime(2011,1,1,0,0,0,true), Kolab::cDateTime(2011,1,1,1,0,0,true)) - << Kolab::Period(Kolab::cDateTime(2011,1,2,0,0,0,true), Kolab::cDateTime(2011,1,2,1,0,0,true)) - ); - output.push_back(period1); - - QTest::newRow( "fullday recurrence" ) << Kolab::cDateTime(2010, 1, 1,1,1,1,true) << Kolab::cDateTime(2012,10,9,12,1,1,true) << events << output; - } -} - - -void FreebusyTest::testFB() -{ - QFETCH(Kolab::cDateTime, start); - QFETCH(Kolab::cDateTime, end); - QFETCH(std::vector<Kolab::Event>, events); - QFETCH(std::vector<Kolab::FreebusyPeriod>, output); - - Kolab::Freebusy fb = Kolab::FreebusyUtils::generateFreeBusy(events, start, end); - - QCOMPARE((int)fb.periods().size(), (int)output.size()); - for (std::size_t i = 0; i<output.size(); i++) { - std::cout << i; - QCOMPARE(fb.periods().at(i), output.at(i)); - } - - std::cout << Kolab::FreebusyUtils::toIFB(fb); -} - -// void FreebusyTest::testHonorTimeFrame() -// { -// -// Kolab::Period p1(Kolab::cDateTime(2011,10,6,12,1,1,true), Kolab::cDateTime(2011,10,8,12,1,1,true)); -// Kolab::Period p2(Kolab::cDateTime(2011,10,7,12,1,1,true), Kolab::cDateTime(2011,10,10,12,1,1,true)); -// Kolab::Period p3(Kolab::cDateTime(2011,10,9,12,1,1,true), Kolab::cDateTime(2011,10,11,12,1,1,true)); -// -// std::vector<Kolab::Event> events; -// events.push_back(createEvent(p1.start, p1.end)); -// events.push_back(createEvent(p2.start, p2.end)); -// events.push_back(createEvent(p3.start, p3.end)); -// -// Kolab::FreebusyPeriod period1; -// period1.setType(Kolab::FreebusyPeriod::Busy); -// period1.setPeriods(std::vector<Kolab::Period>() << p1); -// -// Kolab::FreebusyPeriod period2; -// period2.setType(Kolab::FreebusyPeriod::Busy); -// period2.setPeriods(std::vector<Kolab::Period>() << p2); -// -// Kolab::FreebusyPeriod period3; -// period3.setType(Kolab::FreebusyPeriod::Busy); -// period3.setPeriods(std::vector<Kolab::Period>() << p3); -// -// -// Kolab::Freebusy fb = Kolab::FreebusyUtils::generateFreeBusy(events, Kolab::cDateTime(2010, 1, 1,1,1,1,true), Kolab::cDateTime(2012, 1, 1,1,1,1,true)); -// QCOMPARE((int)fb.periods().size(), 3); -// QCOMPARE(fb.periods().at(0), period1); -// QCOMPARE(fb.periods().at(1), period2); -// QCOMPARE(fb.periods().at(2), period3); -// } - -QTEST_MAIN( FreebusyTest ) - -#include "freebusytest.moc" \ No newline at end of file
View file
libkolab-2.0.tar.gz/tests/freebusytest.h
Deleted
@@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 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 FREEBUSYTEST_H -#define FREEBUSYTEST_H -#include <QObject> - -class FreebusyTest: public QObject -{ - Q_OBJECT -private slots: - - void testFB_data(); - void testFB(); -}; - -#endif // FREEBUSYTEST_H
View file
libkolab-2.0.tar.gz/tests/icalendartest.cpp
Deleted
@@ -1,152 +0,0 @@ -/* - * Copyright (C) 2012 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 "icalendartest.h" - -#include <QTest> -#include <kolabevent.h> - -#include "icalendar/icalendar.h" - -#include "testhelpers.h" -#include "testutils.h" -#include <kolabformat/kolabobject.h> - -void ICalendarTest::testFromICalEvent() -{ - std::vector<Kolab::Event> events; - Kolab::Event ev1; - ev1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - ev1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - events.push_back(ev1); - const std::vector<Kolab::Event> &result = Kolab::fromICalEvents(Kolab::toICal(events)); - qDebug() << QString::fromStdString(Kolab::toICal(result)); -} - -void ICalendarTest::testFromICalEventWithExceptions() -{ - QFile icalFile( getPath("v3/event/exceptions.ics") ); - QVERIFY( icalFile.open( QFile::ReadOnly ) ); - std::vector<Kolab::Event> events = Kolab::fromICalEvents(icalFile.readAll().constData()); - QCOMPARE((int)events.size(), 1); - Kolab::Event out = events.at(0); - QCOMPARE((int)out.exceptions().size(), 2); -} - -void ICalendarTest::testFromICalEventErrorsWithSameID() -{ - /* This is not a really usecase, it should make sure, - * that the underlying KCalCore strips out events with same uid/or recurrenceID. - * 2015/02/18: KCaclCore is only returns one event with one exception for the icalFile - * testdata/v3/event/errorswithsameid.ics - */ - QFile icalFile( getPath("v3/event/errorswithsameid.ics") ); - QVERIFY( icalFile.open( QFile::ReadOnly ) ); - std::vector<Kolab::Event> events = Kolab::fromICalEvents(icalFile.readAll().constData()); - QCOMPARE((int)events.size(), 1); - Kolab::Event out = events.at(0); - QCOMPARE((int)out.exceptions().size(), 1); -} - -void ICalendarTest::testReadWriteForEventWithExceptions() -{ - std::vector<Kolab::Event> events; - Kolab::Event ev1; - ev1.setUid("uid"); - ev1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - ev1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - std::vector<Kolab::Event> exceptions; - Kolab::Event ex1; - ex1.setUid(ev1.uid()); - ex1.setRecurrenceID(Kolab::cDateTime(2011,10,11,12,1,1,true), true); - exceptions.push_back(ex1); - ev1.setExceptions(exceptions); - Kolab::RecurrenceRule rrule; - rrule.setInterval(1); - rrule.setFrequency(Kolab::RecurrenceRule::Daily); - ev1.setRecurrenceRule(rrule); - events.push_back(ev1); - const std::vector<Kolab::Event> &result = Kolab::fromICalEvents(Kolab::toICal(events)); - Kolab::Event out = result.at(0); - QCOMPARE((int)result.size(), 1); - QCOMPARE((int)out.exceptions().size(), 1); - QCOMPARE(out.exceptions().at(0).recurrenceID(), ex1.recurrenceID()); - QCOMPARE(out.exceptions().at(0).thisAndFuture(), true); -} - -void ICalendarTest::testToICal() -{ - std::vector<Kolab::Event> events; - Kolab::Event ev1; - ev1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - ev1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - events.push_back(ev1); - events.push_back(ev1); - qDebug() << QString::fromStdString(Kolab::toICal(events)); -} - -void ICalendarTest::testToITip() -{ - Kolab::ITipHandler handler; - Kolab::Event ev1; - ev1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - ev1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - ev1.setLastModified(Kolab::cDateTime(2011,10,11,12,1,2,true)); - ev1.setCreated(Kolab::cDateTime(2011,10,11,12,1,3,true)); - - qDebug() << QString::fromStdString(handler.toITip(ev1, Kolab::ITipHandler::iTIPRequest)); - -} - -void ICalendarTest::testToIMip() -{ - Kolab::ITipHandler handler; - Kolab::Event ev1; - ev1.setStart(Kolab::cDateTime("Europe/Zurich",2011,10,10,12,1,1)); - ev1.setEnd(Kolab::cDateTime("Europe/Zurich",2012,5,5,3,4,4)); - ev1.setLastModified(Kolab::cDateTime(2011,10,11,12,1,2,true)); - ev1.setCreated(Kolab::cDateTime(2011,10,11,12,1,3,true)); - - std::vector <Kolab::Attendee > attendees; - attendees.push_back(Kolab::Attendee(Kolab::ContactReference("email1@test.org", "name1", "uid1"))); - attendees.push_back(Kolab::Attendee (Kolab::ContactReference("email2@test.org", "name2", "uid2"))); - ev1.setAttendees(attendees); - - ev1.setOrganizer(Kolab::ContactReference("organizer@test.org", "organizer", "uid3")); - ev1.setSummary("summary"); - - const std::string mimeResult = handler.toIMip(ev1, Kolab::ITipHandler::iTIPRequest, "test@test.com"); - qDebug() << QString::fromStdString(mimeResult); - qDebug() << QString::fromStdString(handler.toIMip(ev1, Kolab::ITipHandler::iTIPReply, "test@test.com")); - - const std::vector<Kolab::Event> &eventResult = handler.fromIMip(mimeResult); - -// qDebug() << QString::fromStdString(Kolab::toICal(eventResult)); - - QCOMPARE((int)eventResult.size(), 1); - QEXPECT_FAIL("", "to imip converts dates to utc", Continue); - QCOMPARE(eventResult.front().start(), ev1.start()); - QEXPECT_FAIL("", "to imip converts dates to utc", Continue); - QCOMPARE(eventResult.front().end(), ev1.end()); -} - - - -QTEST_MAIN( ICalendarTest ) - -#include "icalendartest.moc"
View file
libkolab-2.0.tar.gz/tests/icalendartest.h
Deleted
@@ -1,38 +0,0 @@ -/* - * Copyright (C) 2012 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 ICALENDARTEST_H -#define ICALENDARTEST_H -#include <QObject> - -class ICalendarTest: public QObject -{ - Q_OBJECT -private slots: - -// void testEventConflict_data(); - void testToICal(); - void testFromICalEvent(); - void testFromICalEventWithExceptions(); - void testReadWriteForEventWithExceptions(); - void testFromICalEventErrorsWithSameID(); - - void testToITip(); - void testToIMip(); -}; - -#endif // ICALENDARTEST_H
View file
libkolab-2.0.tar.gz/tests/kolabobjecttest.cpp
Deleted
@@ -1,174 +0,0 @@ -/* - * Copyright (C) 2012 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 "kolabobjecttest.h" - -#include <QTest> - -#include "kolabformat/kolabobject.h" -#include <kdebug.h> -#include <kolabformat/errorhandler.h> - -void KolabObjectTest::preserveLatin1() -{ - KCalCore::Event::Ptr event(new KCalCore::Event()); - QString summary(QLatin1String("äöü%@$£é¤¼²°")); - event->setSummary(summary); - QCOMPARE(event->summary(), summary); - //std::cout << event->summary().toStdString() << std::endl; - KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event); -// kDebug() << msg->encodedContent(); - KCalCore::Event::Ptr readEvent = Kolab::KolabObjectReader(msg).getEvent(); - QVERIFY(readEvent); -// std::cout << readEvent->summary().toStdString() << std::endl; - QCOMPARE(readEvent->summary(), summary); -} - -void KolabObjectTest::preserveUnicode() -{ - KCalCore::Event::Ptr event(new KCalCore::Event()); - QString summary(QString::fromUtf8("€Š�ـأبـ☺")); - event->setSummary(summary); - QCOMPARE(event->summary(), summary); -// std::cout << event->summary().toStdString() << std::endl; - KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event); -// kDebug() << msg->encodedContent(); - KCalCore::Event::Ptr readEvent = Kolab::KolabObjectReader(msg).getEvent(); - QVERIFY(readEvent); -// std::cout << readEvent->summary().toStdString() << std::endl; - QCOMPARE(readEvent->summary(), summary); -} - -void KolabObjectTest::dontCrashWithEmptyOrganizer() -{ - KCalCore::Event::Ptr event(new KCalCore::Event()); - event->setOrganizer(KCalCore::Person::Ptr()); - event->setDtStart(KDateTime(QDate(2012,11,11))); - Kolab::KolabObjectWriter::writeEvent(event, Kolab::KolabV2); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); - Kolab::KolabObjectWriter::writeEvent(event); - qDebug() << Kolab::ErrorHandler::instance().error(); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); -} - - -void KolabObjectTest::dontCrashWithEmptyIncidence() -{ - Kolab::KolabObjectWriter::writeEvent(KCalCore::Event::Ptr()); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Critical); - Kolab::KolabObjectWriter::writeTodo(KCalCore::Todo::Ptr()); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Critical); - Kolab::KolabObjectWriter::writeJournal(KCalCore::Journal::Ptr()); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Critical); - Kolab::KolabObjectWriter::writeIncidence(KCalCore::Event::Ptr()); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Critical); - Kolab::KolabObjectWriter::writeNote(KMime::Message::Ptr()); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Critical); -} - -void KolabObjectTest::parseRelationMembers() -{ - { - QString memberString("imap:///user/jan.aachen%40lhm.klab.cc/INBOX/20?message-id=%3Cf06aa3345a25005380b47547ad161d36%40lhm.klab.cc%3E&subject=Re%3A+test&date=Tue%2C+12+Aug+2014+20%3A42%3A59+%2B0200"); - Kolab::RelationMember member = Kolab::parseMemberUrl(memberString); - - QString result = Kolab::generateMemberUrl(member); - qDebug() << result; - result.replace(QLatin1String("%20"),QLatin1String("+")); - QCOMPARE(result, memberString); - } - - //user namespace by uid - { - - Kolab::RelationMember member; - member.uid = 20; - member.mailbox = QList<QByteArray>() << "INBOX"; - member.user = "john.doe@example.org"; - member.messageId = "messageid"; - member.date = "date"; - member.subject = "subject"; - QString url = Kolab::generateMemberUrl(member); - qDebug() << url; - Kolab::RelationMember result = Kolab::parseMemberUrl(url); - QCOMPARE(result.uid, member.uid); - QCOMPARE(result.mailbox, member.mailbox); - QCOMPARE(result.user, member.user); - QCOMPARE(result.messageId, member.messageId); - QCOMPARE(result.date, member.date); - QCOMPARE(result.subject, member.subject); - } - - //shared namespace by uid - { - - Kolab::RelationMember member; - member.uid = 20; - member.mailbox = QList<QByteArray>() << "foo" << "bar"; - member.messageId = "messageid"; - member.date = "date"; - member.subject = "subject"; - QString url = Kolab::generateMemberUrl(member); - qDebug() << url; - Kolab::RelationMember result = Kolab::parseMemberUrl(url); - QCOMPARE(result.uid, member.uid); - QCOMPARE(result.mailbox, member.mailbox); - QVERIFY(result.user.isEmpty()); - QCOMPARE(result.messageId, member.messageId); - QCOMPARE(result.date, member.date); - QCOMPARE(result.subject, member.subject); - } - - //by uuid/gid - { - - Kolab::RelationMember member; - member.gid = "fooobar"; - QString url = Kolab::generateMemberUrl(member); - qDebug() << url; - Kolab::RelationMember result = Kolab::parseMemberUrl(url); - QCOMPARE(result.gid, member.gid); - } - - // chars to en/decode - { - - Kolab::RelationMember member; - member.uid = 20; - member.mailbox = QList<QByteArray>() << "spaces in folders" << "+^,:@"; - member.user = "john.doe:^@example.org"; - member.messageId = "messageid+^,:@"; - member.date = "date+^,:@"; - member.subject = "subject+^,:@"; - - QString url = Kolab::generateMemberUrl(member); - qDebug() << url; - Kolab::RelationMember result = Kolab::parseMemberUrl(url); - QCOMPARE(result.uid, member.uid); - QCOMPARE(result.mailbox, member.mailbox); - QCOMPARE(result.user, member.user); - QCOMPARE(result.messageId, member.messageId); - QCOMPARE(result.date, member.date); - QCOMPARE(result.subject, member.subject); - } -} - - - -QTEST_MAIN( KolabObjectTest ) - -#include "kolabobjecttest.moc"
View file
libkolab-2.0.tar.gz/tests/kolabobjecttest.h
Deleted
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2012 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 KOLABOBJECTTEST_H -#define KOLABOBJECTTEST_H -#include <QObject> - -class KolabObjectTest: public QObject -{ - Q_OBJECT -private slots: - void preserveLatin1(); - void preserveUnicode(); - void dontCrashWithEmptyOrganizer(); - void dontCrashWithEmptyIncidence(); - void parseRelationMembers(); -}; - -#endif // KOLABOBJECTTEST_H
View file
libkolab-2.0.tar.gz/tests/legacyformattest.cpp
Deleted
@@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 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 "legacyformattest.h" -#include "kolabformat/xmlobject.h" -#include "kolabformat/errorhandler.h" -#include "testutils.h" - -#include <QTest> -#include <fstream> -#include <sstream> - -void V2Test::testReadDistlistUID() -{ - std::ifstream t((TESTFILEDIR.toStdString()+"v2/contacts/distlistWithUID.xml").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::XMLObject xo; - const Kolab::DistList distlist = xo.readDistlist(buffer.str(), Kolab::KolabV2); - foreach (const Kolab::ContactReference &contact, distlist.members()) { - QVERIFY(!contact.uid().empty()); - } - QVERIFY(!Kolab::ErrorHandler::errorOccured()); -} - -void V2Test::testWriteDistlistUID() -{ - Kolab::DistList distlist; - distlist.setUid("uid"); - distlist.setName("name"); - std::vector<Kolab::ContactReference> members; - members.push_back(Kolab::ContactReference(Kolab::ContactReference::UidReference, "memberuid", "membername")); - distlist.setMembers(members); - - Kolab::XMLObject xo; - const std::string xml = xo.writeDistlist(distlist, Kolab::KolabV2); - QVERIFY(QString::fromStdString(xml).contains("memberuid")); - QVERIFY(!Kolab::ErrorHandler::errorOccured()); -} - -QTEST_MAIN( V2Test ) - -#include "legacyformattest.moc" \ No newline at end of file
View file
libkolab-2.0.tar.gz/tests/legacyformattest.h
Deleted
@@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012 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 V2TEST_H -#define V2TEST_H - -#include <QObject> - -class V2Test: public QObject -{ - Q_OBJECT -private slots: - void testReadDistlistUID(); - void testWriteDistlistUID(); -}; - -#endif // V2TEST_H
View file
libkolab-2.0.tar.gz/tests/mimeobjecttest.cpp
Deleted
@@ -1,148 +0,0 @@ -/* - * Copyright (C) 2012 Sofia Balicka <balicka@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 <QTest> -#include "mimeobjecttest.h" -#include "kolabformat/kolabobject.h" -#include "testutils.h" -#include "kolabformat/mimeobject.h" -#include <fstream> -#include <sstream> -#include <QString> -#include <ksystemtimezone.h> - -void MIMEObjectTest::initTestCase() -{ - QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available"); -} - -void MIMEObjectTest::testEvent(){ - - Kolab::MIMEObject mimeobject; - - std::ifstream t((TESTFILEDIR.toStdString()+"v3/event/simple.ics.mime").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::Event event = mimeobject.readEvent(buffer.str()); - - std::string message = mimeobject.writeEvent(event, Kolab::KolabV3); - - QString qMessage = QString::fromStdString(message); - QString input = QString::fromStdString(buffer.str()); - - normalizeMimemessage(qMessage); - normalizeMimemessage(input); - - QCOMPARE(input.simplified(), qMessage.simplified()); -} -/* -void MIMEObjectTest::testTodo(){ - -} -*/ - -void MIMEObjectTest::testJournal(){ - - Kolab::MIMEObject mimeobject; - - std::ifstream t((TESTFILEDIR.toStdString()+"v3/journal/simple.ics.mime").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::Journal journal = mimeobject.readJournal(buffer.str()); - - std::string message = mimeobject.writeJournal(journal, Kolab::KolabV3); - - QString qMessage = QString::fromStdString(message); - QString input = QString::fromStdString(buffer.str()); - - normalizeMimemessage(qMessage); - normalizeMimemessage(input); - - QCOMPARE(input.simplified(), qMessage.simplified()); - -} - -void MIMEObjectTest::testNote(){ - - Kolab::MIMEObject mimeobject; - - std::ifstream t((TESTFILEDIR.toStdString()+"v3/note/note.mime.mime").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::Note note = mimeobject.readNote(buffer.str()); - - std::string message = mimeobject.writeNote(note, Kolab::KolabV3); - - QString qMessage = QString::fromStdString(message); - QString input = QString::fromStdString(buffer.str()); - - normalizeMimemessage(qMessage); - normalizeMimemessage(input); - - QCOMPARE(input.simplified(), qMessage.simplified()); - -} - -void MIMEObjectTest::testContact(){ - - Kolab::MIMEObject mimeobject; - - std::ifstream t((TESTFILEDIR.toStdString()+"v3/contacts/simple.vcf.mime").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::Contact contact = mimeobject.readContact(buffer.str()); - - std::string message = mimeobject.writeContact(contact, Kolab::KolabV3); - - QString qMessage = QString::fromStdString(message); - QString input = QString::fromStdString(buffer.str()); - - normalizeMimemessage(qMessage); - normalizeMimemessage(input); - - QCOMPARE(input.simplified(), qMessage.simplified()); - -} - -void MIMEObjectTest::testDistlist(){ - - Kolab::MIMEObject mimeobject; - - std::ifstream t((TESTFILEDIR.toStdString()+"v3/contacts/distlist.vcf.mime").c_str()); - std::stringstream buffer; - buffer << t.rdbuf(); - - Kolab::DistList distlist = mimeobject.readDistlist(buffer.str()); - - std::string message = mimeobject.writeDistlist(distlist, Kolab::KolabV3); - - QString qMessage = QString::fromStdString(message); - QString input = QString::fromStdString(buffer.str()); - - normalizeMimemessage(qMessage); - normalizeMimemessage(input); - - QCOMPARE(input.simplified(), qMessage.simplified()); - -} -QTEST_MAIN( MIMEObjectTest ) - -#include "mimeobjecttest.moc"
View file
libkolab-2.0.tar.gz/tests/mimeobjecttest.h
Deleted
@@ -1,35 +0,0 @@ -/* - * Copyright (C) 2012 Sofia Balicka <balicka@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 MIMEOBJECTTEST_H -#define MIMEOBJECTTEST_H -#include <QObject> - -class MIMEObjectTest: public QObject -{ - Q_OBJECT - -private slots: - void initTestCase(); - void testEvent(); - void testJournal(); - void testNote(); - void testContact(); - void testDistlist(); -}; -#endif // MIMEOBJECTTEST_H -
View file
libkolab-2.0.tar.gz/tests/upgradetest.cpp
Deleted
@@ -1,188 +0,0 @@ -/* - * Copyright (C) 2012 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 "upgradetest.h" - -#include <QTest> -#include <kolabcontainers.h> -#include <kolabformat.h> -#include <kolabformat/errorhandler.h> - -#include "testutils.h" -#include "kolabformat/kolabobject.h" -#include <conversion/commonconversion.h> -#include <kcalcore/icalformat.h> -#include <kabc/vcardconverter.h> - -void UpgradeTest::testIncidence_data() -{ - QTest::addColumn<Kolab::ObjectType>( "type" ); - QTest::addColumn<QString>( "filename" ); - QTest::addColumn<bool>( "forceType" ); - - // QTest::newRow( "v2contactSimple" ) << Kolab::KolabV2 << Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/simple.vcf") << TESTFILEDIR+QString::fromLatin1("v2/contacts/simple.vcf.mime"); - QTest::newRow( "v2eventSimple" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/simple.ics.mime") << false; - QTest::newRow( "v2eventComplex" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/complex.ics.mime") << false; - QTest::newRow( "v2eventAllday" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/allday.ics.mime") << false; - QTest::newRow( "v2eventAttachment" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/attachment.ics.mime") << false; - QTest::newRow( "v2eventHorde" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/horde.ics.mime") << false; - - //Still broken, although it seems that rather the event comparison is implemented wrong (not using equals) - QTest::newRow( "v2taskSimple" ) << Kolab::TodoObject << TESTFILEDIR+QString::fromLatin1("v2/task/simple.ics.mime") << false; - QTest::newRow( "v2taskComplex" ) << Kolab::TodoObject << TESTFILEDIR+QString::fromLatin1("v2/task/complex.ics.mime") << false; - QTest::newRow( "v2taskPrio1" ) << Kolab::TodoObject << TESTFILEDIR+QString::fromLatin1("v2/task/prioritytest1.ics.mime") << false; - QTest::newRow( "v2taskPrio2" ) << Kolab::TodoObject << TESTFILEDIR+QString::fromLatin1("v2/task/prioritytest2.ics.mime") << false; - - QTest::newRow( "v2journalSimple" ) << Kolab::JournalObject << TESTFILEDIR+QString::fromLatin1("v2/journal/simple.ics.mime") << false; - QTest::newRow( "v2journalComplex" ) << Kolab::JournalObject << TESTFILEDIR+QString::fromLatin1("v2/journal/complex.ics.mime") << false; - - QTest::newRow( "v2eventSimple_missingTypeHeader" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/simple_missingTypeHeader.ics.mime") << true; - QTest::newRow( "v2eventis8859-1" ) << Kolab::EventObject << TESTFILEDIR+QString::fromLatin1("v2/event/iso8859-1.mime") << false; - -} - -void UpgradeTest::testIncidence() -{ - QFETCH( Kolab::ObjectType, type ); - QFETCH( QString, filename ); //To compare - QFETCH( bool, forceType ); - - bool ok = false; - const KMime::Message::Ptr &msg = readMimeFile( filename, ok ); - QVERIFY(ok); - Kolab::KolabObjectReader reader; - if (forceType) { - reader.setObjectType(type); - } - Kolab::ObjectType t = reader.parseMimeMessage(msg); - QCOMPARE(t, type); - QCOMPARE(reader.getVersion(), Kolab::KolabV2); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); - - - KCalCore::Incidence::Ptr v2result = reader.getIncidence(); - QVERIFY(!v2result.isNull()); - - //write KCalCore V3 - KMime::Message::Ptr v3message = Kolab::KolabObjectWriter::writeIncidence(v2result, Kolab::KolabV3); - QVERIFY(Kolab::error() == Kolab::NoError); -// kDebug() << v3message->encodedContent(); - //load KCalCore V3 - Kolab::KolabObjectReader reader2; - QCOMPARE(reader2.parseMimeMessage(v3message), type); - KCalCore::Incidence::Ptr v3result = reader2.getIncidence(); - QVERIFY(!v3result.isNull()); - normalizeIncidence(v2result); - //We have to override the last modified time with a specific value, so we normalize the input to the same - normalizeIncidence(v3result); - kDebug() <<"--------------------------------------------------------"; - KCalCore::ICalFormat format; - const QString v2 = format.toString( v2result ); - const QString v3 = format.toString( v3result ); - if ( *v2result != *v3result ) { - showDiff(v2, v3); -// qDebug() << "V2: " << v2; -// qDebug() << "V3: " << v3; - } - QVERIFY(!v2.isEmpty()); - QVERIFY(!v3.isEmpty()); - QCOMPARE(v2, v3); - kDebug() <<"--------------------------------------------------------"; - -// if (v2result->type() == KCalCore::IncidenceBase::TypeTodo) { -// KCalCore::Todo::Ptr t1 = v2result.dynamicCast<KCalCore::Todo>(); -// KCalCore::Todo::Ptr t2 = v3result.dynamicCast<KCalCore::Todo>(); -// QCOMPARE(t1->percentComplete(), t2->percentComplete()); -// QCOMPARE(t1->priority(), t2->priority()); -// QCOMPARE(t1->uid(), t2->uid()); -// QCOMPARE(t1->dtStart(), t2->dtStart()); -// QCOMPARE(t1->dtDue(), t2->dtDue()); -// QCOMPARE(*t1->organizer().data(), *t2->organizer().data()); -// QCOMPARE(t1->uid(), t2->uid()); -// QCOMPARE(t1->allDay(), t2->allDay()); -// QCOMPARE(t1->duration(), t2->duration()); -// QCOMPARE(t1->hasDuration(), t2->hasDuration()); -// qDebug() << "V2: " << v2; -// } - //Test comparator - QCOMPARE(*v2result, *v3result); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); -} - -void UpgradeTest::testContact_data() -{ - QTest::addColumn<Kolab::ObjectType>( "type" ); - QTest::addColumn<QString>( "filename" ); - - QTest::newRow( "v2contactSimple" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/simple.vcf.mime"); - QTest::newRow( "v2contactComplex" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/complex.vcf.mime"); - QTest::newRow( "v2contactAddress" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/address.vcf.mime"); - QTest::newRow( "v2contactBug238996" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/bug238996.vcf.mime"); - QTest::newRow( "v2contactDisplayname" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/displayname.vcf.mime"); - QTest::newRow( "v2contactEmails" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/emails.vcf.mime"); - QTest::newRow( "v2contactPhonenumber" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/phonenumbers.vcf.mime"); - QTest::newRow( "v2contactPicture" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/picture.vcf.mime"); - QTest::newRow( "v2iso8859-1" )<< Kolab::ContactObject << TESTFILEDIR+QString::fromLatin1("v2/contacts/iso8859-1.mime"); - -} - - -void UpgradeTest::testContact() -{ - QFETCH( Kolab::ObjectType, type ); - QFETCH( QString, filename ); - - //Parse mime message - bool ok = false; - const KMime::Message::Ptr &msg = readMimeFile( filename, ok ); - QVERIFY(ok); - Kolab::KolabObjectReader reader; - Kolab::ObjectType t = reader.parseMimeMessage(msg); - QCOMPARE(t, type); - QCOMPARE(reader.getVersion(), Kolab::KolabV2); - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); - - KABC::Addressee v2Addressee = reader.getContact(); - QVERIFY(!v2Addressee.isEmpty()); - - //Write - const KMime::Message::Ptr &v3message = Kolab::KolabObjectWriter::writeContact(v2Addressee, Kolab::KolabV3); - - //load V3 - Kolab::KolabObjectReader reader2; - QCOMPARE(reader2.parseMimeMessage(v3message), type); - KABC::Addressee v3result = reader2.getContact(); - QVERIFY(!v3result.isEmpty()); - - normalizeContact(v2Addressee); - QVERIFY( normalizePhoneNumbers( v3result, v2Addressee ) ); // phone number ids are random - QVERIFY( normalizeAddresses( v3result, v2Addressee ) ); // same here - - KABC::VCardConverter converter; - if ( v2Addressee != v3result ) { - showDiff(converter.createVCard(v2Addressee), converter.createVCard(v3result)); - QVERIFY( false ); - } - QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); -} - - -QTEST_MAIN( UpgradeTest ) - -#include "upgradetest.moc" -
View file
libkolab-2.0.tar.gz/tests/upgradetest.h
Deleted
@@ -1,48 +0,0 @@ -/* - * Copyright (C) 2012 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 UPGRADETEST_H -#define UPGRADETEST_H - -#include <QObject> - -/** - * Test format upgrade from v2 to v3 - * - * - Parse using v2 implementeation - * - Serialize and reparse using v3 implementeation - * - Compare results - * - * This ensures that all properties which are interpreted by the v2 implementation can be serialized and deserialized by the v3 implementation. - * - * Depends on serialization used for comparison to be correct (i.e. the ical implementation). - */ - -class UpgradeTest: public QObject -{ - Q_OBJECT -private slots: - - void testIncidence_data(); - void testIncidence(); - - void testContact_data(); - void testContact(); -}; - -#endif // UPGRADETEST_H
View file
libkolab-2.0.tar.gz/tests/xmlobjecttest.cpp
Deleted
@@ -1,65 +0,0 @@ -/* - * Copyright (C) 2012 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 "xmlobjecttest.h" - -#include <QTest> -#include <iostream> - -#include "kolabformat/xmlobject.h" - -void XMLObjectTest::testEvent() -{ - Kolab::Event event; - event.setStart(Kolab::cDateTime(2012,01,01)); - - Kolab::XMLObject xmlobject; - const std::string output = xmlobject.writeEvent(event, Kolab::KolabV2, "productid"); - QVERIFY(!output.empty()); - std::cout << output; - - const Kolab::Event resultEvent = xmlobject.readEvent(output, Kolab::KolabV2); - QVERIFY(resultEvent.isValid()); - -} - -void XMLObjectTest::testDontCrash() -{ - Kolab::XMLObject ob; - ob.writeEvent(Kolab::Event(), Kolab::KolabV2, ""); - ob.writeTodo(Kolab::Todo(), Kolab::KolabV2, ""); - ob.writeJournal(Kolab::Journal(), Kolab::KolabV2, ""); - ob.writeFreebusy(Kolab::Freebusy(), Kolab::KolabV2, ""); - ob.writeContact(Kolab::Contact(), Kolab::KolabV2, ""); - ob.writeDistlist(Kolab::DistList(), Kolab::KolabV2, ""); - ob.writeNote(Kolab::Note(), Kolab::KolabV2, ""); - ob.writeConfiguration(Kolab::Configuration(), Kolab::KolabV2, ""); - - ob.readEvent("", Kolab::KolabV2); - ob.readTodo("", Kolab::KolabV2); - ob.readJournal("", Kolab::KolabV2); - ob.readFreebusy("", Kolab::KolabV2); - ob.readContact("", Kolab::KolabV2); - ob.readDistlist("", Kolab::KolabV2); - ob.readNote("", Kolab::KolabV2); - ob.readConfiguration("", Kolab::KolabV2); - -} - -QTEST_MAIN( XMLObjectTest ) - -#include "xmlobjecttest.moc"
View file
libkolab-2.0.tar.gz/tests/xmlobjecttest.h
Deleted
@@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012 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 XMLOBJECTTEST_H -#define XMLOBJECTTEST_H - -#include <QObject> - -class XMLObjectTest: public QObject -{ - Q_OBJECT -private slots: - void testEvent(); - void testDontCrash(); -}; - -#endif // XMLOBJECTTEST_H
View file
libkolab-2.0.tar.gz/utils
Deleted
-(directory)
View file
libkolab-2.0.tar.gz/utils/CMakeLists.txt
Deleted
@@ -1,5 +0,0 @@ - -find_package(Boost REQUIRED COMPONENTS program_options) - -add_executable(kolabformatchecker kolabformatchecker.cpp) -target_link_libraries(kolabformatchecker kolab ${Boost_LIBRARIES})
View file
libkolab-2.0.tar.gz/utils/kolabformatchecker.cpp
Deleted
@@ -1,109 +0,0 @@ -/* - * Copyright (C) 2012 Sofia Balicka <balicka@kolabsys.com> - * 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 <boost/program_options.hpp> -#include <iostream> -#include <string> -#include <vector> -#include <QString> -#include <QFile> -#include <kolabformat.h> -#include "kolabformat/errorhandler.h" -#include "kolabformat/kolabobject.h" - -namespace po = boost::program_options; -using namespace std; - -KMime::Message::Ptr readMimeFile( const QString &fileName, bool &ok) -{ - QFile file( fileName ); - ok = file.open( QFile::ReadOnly ); - if (!ok) { - cout << "failed to open file: " << fileName.toStdString() << endl;; - return KMime::Message::Ptr(); - } - const QByteArray data = file.readAll(); - KMime::Message::Ptr msg = KMime::Message::Ptr(new KMime::Message); - msg->setContent( KMime::CRLFtoLF(data) ); - msg->parse(); - return msg; -} - -int main(int argc, char *argv) -{ - // Declare the supported options. - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "produce help message") - ("input-file", po::value<std::vector<std::string> >(), "input files") - ; - - po::positional_options_description p; - p.add("input-file", -1); - - po::variables_map vm; - po::store(po::command_line_parser(argc, argv). - options(desc).positional(p).run(), vm); - po::notify(vm); - - if (vm.count("help")) { - cout << desc << "\n"; - return 1; - } - - vector<string> inputFiles; - if (vm.count("input-file")) { - inputFiles = vm"input-file".as< vector<string> >(); - } else { - cout << "Specify input-file\n"; - return -1; - } - - int returnValue = 0; - - cout << endl; - - for(vector<string>::const_iterator it = inputFiles.begin(); - it != inputFiles.end(); it++){ - - cout << "File: " << *it << endl; - - bool ok; - KMime::Message::Ptr message = readMimeFile( QString::fromStdString(*it), ok); - - if(!ok){ - returnValue = -1; - cout << endl; - continue; - } - - Kolab::KolabObjectReader reader(message); - - if (Kolab::ErrorHandler::errorOccured()){ - cout << "Errors occured during parsing." << endl; - returnValue = -1; - } else { - cout << "Parsed message without error." << endl; - } - - cout << endl; - } - - return returnValue; -} -
View file
libkolab-3.0.0.tar.gz/.arcconfig
Added
@@ -0,0 +1,6 @@ +{ + "phabricator.uri" : "https://git.kolab.org/", + "arc.land.onto.default" : "master", + "immutable_history" : true +} +
View file
libkolab-2.0.tar.gz/CMakeLists.txt -> libkolab-3.0.0.tar.gz/CMakeLists.txt
Changed
@@ -1,12 +1,10 @@ project(Libkolab) -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 2.8.9) -option( BUILD_TESTS "Build the tests" TRUE ) -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(BUILD_TESTS "Build the tests" TRUE) +option(PYTHON_BINDINGS "Build bindings for python" FALSE) +option(PHP_BINDINGS "Build bindings for php" FALSE) set(Libkolab_MODULE_DIR ${Libkolab_SOURCE_DIR}/cmake/modules) set(CMAKE_MODULE_PATH ${Libkolab_MODULE_DIR}) @@ -31,19 +29,19 @@ # 0.1.0 (first release) # 0.1.1 (patch release for 0.1.0) # 0.2 (0.2 development version towards 0.2.0) -set(Libkolab_VERSION_MAJOR 2) +set(Libkolab_VERSION_MAJOR 3) set(Libkolab_VERSION_MINOR 0) # Enable the full x.y.z version only for release versions -#set(Libkolab_VERSION_PATCH 1) -#set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR}.${Libkolab_VERSION_PATCH} ) -set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR} ) +set(Libkolab_VERSION_PATCH 0) +#set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR}.${Libkolab_VERSION_PATCH}) +set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR}) set(Libkolab_VERSION_STRING ${CMAKE_PROJECT_NAME}-${Libkolab_VERSION}) # set up install directories. set(LIB_INSTALL_DIR lib${LIB_SUFFIX} CACHE STRING "The directories where to install libraries to") set(INCLUDE_INSTALL_DIR include CACHE STRING "The directory where to install headers to") set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/kolab) -set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libkolab ) +set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libkolab) # Make relative paths absolute (needed later on) foreach(p LIB INCLUDE CMAKECONFIG) @@ -55,150 +53,82 @@ include(MacroLogFeature) +find_package(Qt5 REQUIRED Core Xml) + + # Do the building -find_package(Libkolabxml 1.1 REQUIRED) -macro_log_feature(Libkolabxml_FOUND "Libkolabxml" "Kolab XML Format 3 serializing library" "http://git.kolab.org/libkolabxml/" TRUE "1.0" "Required for reading/writing Kolab XML Objects") +find_package(Libkolabxml 1.1.1 REQUIRED) +macro_log_feature(Libkolabxml_FOUND "Libkolabxml" "Kolab XML Format 3 serializing library" "https://git.kolab.org/diffusion/LKX/" TRUE "1.1.1" "Required for reading/writing Kolab XML Objects") -find_package(Qt4 4.6.0 REQUIRED) +set(QT_REQUIRED_VERSION "5.9.0") -if (USE_LIBCALENDARING) - find_package(Libcalendaring) - macro_log_feature(LIBCALENDARING_FOUND "Libcalendaring" "KDE Calendaring-Dependencies Library" "http://git.kolab.org/libcalendaring/" TRUE "" "Required if KDE libraries are not available.") -else() - find_package(KDE4 4.8 REQUIRED) - find_package(KdepimLibs 4.8 REQUIRED) +if (Qt5_POSITION_INDEPENDENT_CODE) + #Requires cmake 2.8.9 (same as -fPIC on gcc) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() +include(FindPackageHandleStandardArgs) + +find_package(KF5CoreAddons CONFIG REQUIRED) +find_package(KF5CalendarCore "5.12.1" CONFIG REQUIRED) +find_package(KF5Mime "4.84.0" CONFIG REQUIRED) + find_package(SWIG) #Show summary of found libraries macro_display_feature_log() -# add_definitions( -DKDEPIMLIBS_VERSION=((${KdepimLibs_VERSION_MAJOR}<<16)|(${KdepimLibs_VERSION_MINOR}<<8)|(${KDEPIMLIBS_VERSION_PATCH})) ) -add_definitions( -DKDEPIMLIBS_VERSION_MAJOR=${KdepimLibs_VERSION_MAJOR} ) -add_definitions( -DKDEPIMLIBS_VERSION_MINOR=${KdepimLibs_VERSION_MINOR} ) -add_definitions( -DKDEPIMLIBS_VERSION_PATCH=${KdepimLibs_VERSION_PATCH} ) - -#Tag::GENERIC is only available at the moment at the kolab/integration branches -if (KDEPIMLIBS_HAS_GENERIC_TAG) - add_definitions( -DKDEPIMLIBS_HAS_GENERIC_TAG) -endif() - -if("${KdepimLibs_VERSION}" VERSION_GREATER "4.8.40" OR USE_LIBCALENDARING) - add_definitions(-DKDEPIMLIBS_VERSION_DEVEL) -endif() - -if ("${KdepimLibs_VERSION}" VERSION_GREATER "4.11.52") - add_definitions( -DLIBCALENDARING_DURATION_DECLARED) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX) - if(NOT MINGW) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -fexceptions -UQT_NO_EXCEPTIONS -g") -endif() - +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -fexceptions -UQT_NO_EXCEPTIONS -fPIC -g -std=c++11") # message("${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG") -if (USE_LIBCALENDARING) - set( KDE_INCLUDES ${Libcalendaring_INCLUDE_DIRS} ) - set( KDE_LIBRARIES ${Libcalendaring_LIBRARIES} ) - message("${Libcalendaring_INCLUDE_DIRS} ${Libcalendaring_LIBRARIES}") -else() - set( KDE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ) - set( KDE_LIBRARIES - ${KDEPIMLIBS_KCALCORE_LIBS} - ${KDEPIMLIBS_KABC_LIBS} - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_AKONADI_NOTES_LIBS} - ${KDEPIMLIBS_KCALUTILS_LIBS} - ${KDEPIMLIBS_KPIMUTILS_LIBS} - ${KDE4_KDECORE_LIBS} - ${KDE4_KIO_LIBS} - ) -endif() - -find_package(Boost REQUIRED) - -include_directories( +include_directories( ${QT_INCLUDES} - ${KDE_INCLUDES} ${CMAKE_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/kolabformatV2 ${Libkolabxml_INCLUDES} ./ ) configure_file(libkolab-version.h.cmake "${CMAKE_BINARY_DIR}/libkolab-version.h" @ONLY) -set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS}) -set(CMAKE_REQUIRED_INCLUDES "/opt/devel/kolab/include/") -# include(CheckIncludeFileCXX) -# check_include_file_cxx(akonadi/tag.h HAVE_TAG_H) -#check_include_file_cxx doesn't work for some reason, so we use find_path instead. -#we have to make sure that we only search in KDE_INCLUDES though, to not accidentally include a system akonadi/tag.h -#when we're searching for one in libcalendaring. -find_path(HAVE_TAG_H akonadi/tag.h PATHS ${KDE_INCLUDES} NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) -find_path(HAVE_RELATION_H akonadi/relation.h PATHS ${KDE_INCLUDES} NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libkolab_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/libkolab_config.h) - -add_subdirectory(kolabformatV2) add_subdirectory(conversion) add_subdirectory(calendaring) -add_subdirectory(icalendar) -add_subdirectory(freebusy) -if (BUILD_TOOLS) - add_subdirectory(utils) -endif() -QT4_WRAP_CPP(CALENDARING_MOC calendaring/event.h) -# QT4_WRAP_CPP(CONVERSION_MOC conversion/qtevent.h conversion/qtduration.h) +QT5_WRAP_CPP(CALENDARING_MOC calendaring/event.h) set(KOLAB_SRCS - kolabformat/kolabobject.cpp kolabformat/xmlobject.cpp kolabformat/formathelpers.cpp kolabformat/errorhandler.cpp - kolabformat/v2helpers.cpp - kolabformat/mimeobject.cpp mime/mimeutils.cpp ${CONVERSION_SRCS} ${kolabformatv2_SRCS} ${CALENDARING_SRCS} - ${ICALENDAR_SRCS} - ${CALENDARING_MOC} - ${CONVERSION_MOC} - ${FREEBUSY_SRCS} ) set(KOLAB_LINK_LIBRARIES ${Libkolabxml_LIBRARIES} - ${QT_QTCORE_LIBRARY} - ${QT_QTXML_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${KDE_LIBRARIES} + KF5::CalendarCore + KF5::Mime + Qt5::Core + Qt5::Xml ) -if (BUILD_TOOLS OR BUILD_TESTS) - add_library(kolab_static STATIC ${KOLAB_SRCS}) - target_link_libraries(kolab_static ${KOLAB_LINK_LIBRARIES}) -endif()
View file
libkolab-2.0.tar.gz/calendaring/calendaring.cpp -> libkolab-3.0.0.tar.gz/calendaring/calendaring.cpp
Changed
@@ -19,8 +19,10 @@ #include <kcalcore/event.h> #include <kcalcore/todo.h> -#include <Qt/qdebug.h> +#include <qdebug.h> #include <kolabevent.h> +#include <QDate> +#include <QTimeZone> #include "conversion/kcalconversion.h" #include "conversion/commonconversion.h" @@ -29,58 +31,58 @@ namespace Calendaring { -bool conflicts(const Kolab::Event &e1, const Kolab::Event &e2) -{ - KCalCore::Event::Ptr k1 = Kolab::Conversion::toKCalCore(e1); - KCalCore::Event::Ptr k2 = Kolab::Conversion::toKCalCore(e2); - if (k2->dtEnd().compare(k1->dtStart()) == KDateTime::Before) { - return false; - } else if (k1->dtEnd().compare(k2->dtStart()) == KDateTime::Before) { - return false; - } - return true; -} +// bool conflicts(const Kolab::Event &e1, const Kolab::Event &e2) +// { +// KCalCore::Event::Ptr k1 = Kolab::Conversion::toKCalCore(e1); +// KCalCore::Event::Ptr k2 = Kolab::Conversion::toKCalCore(e2); +// if (k2->dtEnd() > k1->dtStart()) { +// return false; +// } else if (k1->dtEnd() > k2->dtStart()) { +// return false; +// } +// return true; +// } -std::vector< std::vector< Event > > getConflictingSets(const std::vector< Event > &events, const std::vector< Event > &events2) -{ - std::vector< std::vector< Kolab::Event > > ret; - for(std::size_t i = 0; i < events.size(); i++) { - std::vector<Kolab::Event> set; - const Kolab::Event &event = events.at(i); - set.push_back(event); - for(std::size_t q = i+1; q < events.size(); q++) { - const Kolab::Event &e2 = events.at(q); - if (conflicts(event, e2)) { - set.push_back(e2); - } - } - for(std::size_t m = 0; m < events2.size(); m++) { - const Kolab::Event &e2 = events2.at(m); - if (conflicts(event, e2)) { - set.push_back(e2); - } - } - if (set.size() > 1) { - ret.push_back(set); - } - } - return ret; -} +// std::vector< std::vector< Event > > getConflictingSets(const std::vector< Event > &events, const std::vector< Event > &events2) +// { +// std::vector< std::vector< Kolab::Event > > ret; +// for(std::size_t i = 0; i < events.size(); i++) { +// std::vector<Kolab::Event> set; +// const Kolab::Event &event = events.at(i); +// set.push_back(event); +// for(std::size_t q = i+1; q < events.size(); q++) { +// const Kolab::Event &e2 = events.at(q); +// if (conflicts(event, e2)) { +// set.push_back(e2); +// } +// } +// for(std::size_t m = 0; m < events2.size(); m++) { +// const Kolab::Event &e2 = events2.at(m); +// if (conflicts(event, e2)) { +// set.push_back(e2); +// } +// } +// if (set.size() > 1) { +// ret.push_back(set); +// } +// } +// return ret; +// } -std::vector<Kolab::cDateTime> timeInInterval(const Kolab::Event &e, const Kolab::cDateTime &start, const Kolab::cDateTime &end) -{ - KCalCore::Event::Ptr k = Kolab::Conversion::toKCalCore(e); - KCalCore::DateTimeList list = k->recurrence()->timesInInterval(Kolab::Conversion::toDate(start), Kolab::Conversion::toDate(end)); - std::vector<Kolab::cDateTime> dtList; - foreach(const KDateTime &dt, list) { - dtList.push_back(Kolab::Conversion::fromDate(dt)); - } - return dtList; -} +// std::vector<Kolab::cDateTime> timeInInterval(const Kolab::Event &e, const Kolab::cDateTime &start, const Kolab::cDateTime &end) +// { +// KCalCore::Event::Ptr k = Kolab::Conversion::toKCalCore(e); +// KCalCore::DateTimeList list = k->recurrence()->timesInInterval(Kolab::Conversion::toDate(start), Kolab::Conversion::toDate(end)); +// std::vector<Kolab::cDateTime> dtList; +// foreach(const QDateTime &dt, list) { +// dtList.push_back(Kolab::Conversion::fromDate(dt)); +// } +// return dtList; +// } Calendar::Calendar() -: mCalendar(new KCalCore::MemoryCalendar(Kolab::Conversion::getTimeSpec(true, std::string()))) //Always utc as it doesn't change anything anyways +: mCalendar(new KCalCore::MemoryCalendar(QTimeZone::utc())) //Always utc as it doesn't change anything anyways { } @@ -95,9 +97,9 @@ std::vector<Kolab::Event> Calendar::getEvents(const Kolab::cDateTime& start, const Kolab::cDateTime& end, bool sort) { - const KDateTime s = Kolab::Conversion::toDate(start); - const KDateTime e = Kolab::Conversion::toDate(end); - const KDateTime::Spec timeSpec = s.timeSpec(); + const QDateTime s = Kolab::Conversion::toDate(start); + const QDateTime e = Kolab::Conversion::toDate(end); + const QTimeZone timeSpec = s.timeZone(); KCalCore::Event::List list = mCalendar->events(s.date(), e.date(), timeSpec, true); if (sort) { list = mCalendar->sortEvents(list, KCalCore::EventSortStartDate, KCalCore::SortDirectionAscending); @@ -105,7 +107,7 @@ std::vector<Kolab::Event> eventlist; foreach (const KCalCore::Event::Ptr &event, list) { //We have to filter the list by time - if (event->dtEnd().compare(s) != KDateTime::Before && e.compare(event->dtStart()) != KDateTime::Before) { + if (event->dtEnd() >= s && event->dtStart() <= e) { eventlist.push_back(Kolab::Conversion::fromKCalCore(*event)); } } @@ -114,4 +116,4 @@ } //Namespace -} //Namespace \ No newline at end of file +} //Namespace
View file
libkolab-2.0.tar.gz/calendaring/calendaring.h -> libkolab-3.0.0.tar.gz/calendaring/calendaring.h
Changed
@@ -27,36 +27,11 @@ #include <kcalcore/event.h> #include <kcalcore/memorycalendar.h> -#include <boost/scoped_ptr.hpp> #include <kolabevent.h> +#include <QSharedPointer> namespace Kolab { namespace Calendaring { -/** - * Returns true if the events conflict (overlap) - * Start and end date/time is inclusive. - * - * Does not take recurrences into account. - */ -KOLAB_EXPORT bool conflicts(const Kolab::Event &, const Kolab::Event &); - -/** - * Returns sets of the events which are directly conflicting with each other. - * The same event may appear in multiple sets. - * Non-conflicting events are not returned. - * conflicts() is used for conflict detection. - * - * If the second list is given, each event from the first list is additionally checked against each event of the second set. - * Conflicts within the second list are not detected. - * - * The checked event from the first list comes always first in the returned set. - */ -KOLAB_EXPORT std::vector< std::vector<Kolab::Event> > getConflictingSets(const std::vector<Kolab::Event> &, const std::vector<Kolab::Event> & = std::vector<Kolab::Event>()); - -/** - * Returns the dates in which the event recurs within the specified timespan. - */ -KOLAB_EXPORT std::vector<Kolab::cDateTime> timeInInterval(const Kolab::Event &, const Kolab::cDateTime &start, const Kolab::cDateTime &end); /** * In-Memory Calendar Cache @@ -77,7 +52,7 @@ private: Calendar(const Calendar &); void operator=(const Calendar &); - boost::scoped_ptr<KCalCore::MemoryCalendar> mCalendar; + QSharedPointer<KCalCore::MemoryCalendar> mCalendar; }; }; //Namespace
View file
libkolab-2.0.tar.gz/calendaring/calendaring.i -> libkolab-3.0.0.tar.gz/calendaring/calendaring.i
Changed
@@ -13,7 +13,7 @@ %import "../shared.i" %rename(EventCal) Kolab::Calendaring::Event; -%rename(KolabCalendar) Kolab::Calendaring::Calendar; +/* %rename(KolabCalendar) Kolab::Calendaring::Calendar; */ -%include "../calendaring/calendaring.h" +/* %include "../calendaring/calendaring.h" */ %include "../calendaring/event.h"
View file
libkolab-2.0.tar.gz/calendaring/datetimeutils.cpp -> libkolab-3.0.0.tar.gz/calendaring/datetimeutils.cpp
Changed
@@ -18,14 +18,14 @@ #include "datetimeutils.h" #include <qdebug.h> -#include <ksystemtimezone.h> +#include <QTimeZone> #include "conversion/commonconversion.h" namespace Kolab { namespace DateTimeUtils { std::string getLocalTimezone() { - const QString tz = KSystemTimeZones::local().name(); + const QString tz = QTimeZone::systemTimeZoneId(); return tz.toStdString(); }
View file
libkolab-2.0.tar.gz/calendaring/event.cpp -> libkolab-3.0.0.tar.gz/calendaring/event.cpp
Changed
@@ -17,8 +17,9 @@ #include "event.h" -#include <icalendar/icalendar.h> -#include <kolabformat/kolabobject.h> + +#include <QDebug> + #include <conversion/kcalconversion.h> #include <conversion/commonconversion.h> @@ -26,6 +27,7 @@ #include <kolabformat.h> #include <kolabevent_p.h> + namespace Kolab { namespace Calendaring { @@ -61,73 +63,6 @@ return Kolab::writeEvent(*this); } -bool Event::fromMime(const std::string &input) -{ - KMime::Message::Ptr msg = KMime::Message::Ptr(new KMime::Message); - msg->setContent( KMime::CRLFtoLF(Kolab::Conversion::fromStdString(input).toUtf8()) ); - msg->parse(); - msg->content(KMime::ContentIndex()); - KolabObjectReader reader(msg); - if (reader.getType() != EventObject) { - std::cout << "not an event "; - return false; - } - const Kolab::Event &e = Kolab::Conversion::fromKCalCore(*reader.getEvent()); - Kolab::Event::operator=(e); - return true; -} - -std::string Event::toMime() const -{ - return std::string(QString(KolabObjectWriter::writeEvent(Kolab::Conversion::toKCalCore(*this))->encodedContent()).toUtf8().constData()); -} - - -bool Event::fromICal(const std::string &input) -{ - std::vector<Kolab::Event> list = fromICalEvents(input); - if (list.size() != 1) { - std::cout << "invalid number of events: " << list.size(); - return false; - } - Kolab::Event::operator=(list.at(0)); - return true; -} - -std::string Event::toICal() const -{ - std::vector<Kolab::Event> list; - list.push_back(*this); - return Kolab::toICal(list); -} - -bool Event::fromIMip(const std::string &input) -{ - std::vector<Kolab::Event> list = mITipHandler.fromIMip(input); - if (list.size() != 1) { - std::cout << "invalid number of events: " << list.size(); - return false; - } - Kolab::Event::operator=(list.at(0)); - return true; -} - -std::string Event::toIMip(ITipMethod method) const -{ - std::vector<Kolab::Event> list; - list.push_back(*this); - return mITipHandler.toIMip(*this, static_cast<ITipHandler::ITipMethod>(method), organizer().email()); -} - -Calendaring::Event::ITipMethod Event::getSchedulingMethod() const -{ - Q_ASSERT((int)iTIPPublish == (int)ITipHandler::iTIPPublish); - Q_ASSERT((int)iTIPNoMethod == (int)ITipHandler::iTIPNoMethod); - return static_cast<ITipMethod>(mITipHandler.method()); -} - - - bool contains(const Kolab::ContactReference &delegatorRef, const std::vector <Kolab::ContactReference > &list) { foreach (const Kolab::ContactReference &ref, list) { @@ -209,10 +144,12 @@ cDateTime Calendaring::Event::getNextOccurence(const cDateTime &date) { KCalCore::Event::Ptr event = Kolab::Conversion::toKCalCore(*this); + qWarning() << "Converted start " << event->dtStart() << Kolab::Conversion::toDate(date); if (!event->recurs()) { return cDateTime(); } - const KDateTime nextDate = event->recurrence()->getNextDateTime(Kolab::Conversion::toDate(date)); + const QDateTime nextDate = event->recurrence()->getNextDateTime(Kolab::Conversion::toDate(date)); + qWarning() << "Next date " << nextDate; return Kolab::Conversion::fromDate(nextDate); } @@ -220,7 +157,7 @@ cDateTime Calendaring::Event::getOccurenceEndDate(const cDateTime &startDate) { KCalCore::Event::Ptr event = Kolab::Conversion::toKCalCore(*this); - const KDateTime start = Kolab::Conversion::toDate(startDate); + const QDateTime start = Kolab::Conversion::toDate(startDate); return Kolab::Conversion::fromDate(event->endDateForStart(start)); } @@ -230,7 +167,7 @@ if (!event->recurs()) { return cDateTime(); } - const KDateTime endDate = event->recurrence()->endDateTime(); + const QDateTime endDate = event->recurrence()->endDateTime(); return Kolab::Conversion::fromDate(endDate); }
View file
libkolab-2.0.tar.gz/calendaring/event.h -> libkolab-3.0.0.tar.gz/calendaring/event.h
Changed
@@ -22,7 +22,6 @@ #ifndef SWIG #include "kolab_export.h" -#include <icalendar/icalendar.h> #else /* No export/import SWIG interface files */ #define KOLAB_EXPORT @@ -45,37 +44,6 @@ std::string write() const; - bool fromMime(const std::string &); - - /** - * Convert to kolab mime format. - */ - std::string toMime() const; - - enum ITipMethod { - iTIPPublish, /**< Event, to-do, journal or freebusy posting */ - iTIPRequest, /**< Event, to-do or freebusy scheduling request */ - iTIPReply, /**< Event, to-do or freebusy reply to request */ - iTIPAdd, /**< Event, to-do or journal additional property request */ - iTIPCancel, /**< Event, to-do or journal cancellation notice */ - iTIPRefresh, /**< Event or to-do description update request */ - iTIPCounter, /**< Event or to-do submit counter proposal */ - iTIPDeclineCounter,/**< Event or to-do decline a counter proposal */ - iTIPNoMethod /**< No method */ - }; - - bool fromICal(const std::string &); - std::string toICal() const; - - bool fromIMip(const std::string &); - std::string toIMip(ITipMethod method) const; - - /** - * Returns the scheduling method from the last fromIMip call - */ - ITipMethod getSchedulingMethod() const; - - /** * Updates the delegators and delegatees of the event. * @@ -113,7 +81,6 @@ private: Kolab::Attendee *getAttendee(const ContactReference &); - Kolab::ITipHandler mITipHandler; }; };
View file
libkolab-2.0.tar.gz/conversion/CMakeLists.txt -> libkolab-3.0.0.tar.gz/conversion/CMakeLists.txt
Changed
@@ -1,8 +1,7 @@ set (CONVERSION_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/kcalconversion.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kabcconversion.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/kcalconversion.cpp ${CMAKE_CURRENT_SOURCE_DIR}/commonconversion.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kolabconversion.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/timezoneconverter.cpp PARENT_SCOPE) + ${CMAKE_CURRENT_SOURCE_DIR}/timezoneconverter.cpp + PARENT_SCOPE)
View file
libkolab-2.0.tar.gz/conversion/commonconversion.cpp -> libkolab-3.0.0.tar.gz/conversion/commonconversion.cpp
Changed
@@ -20,65 +20,79 @@ #include <kolabformat/errorhandler.h> #include <iostream> -#include <ksystemtimezone.h> -#include <kdebug.h> +// #include <KTimeZone> +// #include <KSystemTimeZones> #include <QUrl> +#include <QTimeZone> namespace Kolab { namespace Conversion { -KDateTime::Spec getTimeSpec(bool isUtc, const std::string& timezone) +QTimeZone getTimeSpec(const std::string& timezone) { - if (isUtc) { //UTC - return KDateTime::Spec(KDateTime::UTC); - } if (timezone.empty()) { //Floating - return KDateTime::Spec(KDateTime::ClockTime); + return QTimeZone{}; + // return QDateTime::Spec(Qt::LocalTime); } - //Timezone //Convert non-olson timezones if necessary const QString normalizedTz = TimezoneConverter::normalizeTimezone(QString::fromStdString(timezone)); - KTimeZone tz = KSystemTimeZones::zone(normalizedTz); //Needs ktimezoned (timezone daemon running) http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKSystemTimeZones.html - if (!tz.isValid()) { + if (!QTimeZone::isTimeZoneIdAvailable(normalizedTz.toLatin1())) { Warning() << "invalid timezone: " << QString::fromStdString(timezone) << ", assuming floating time"; - if (!KSystemTimeZones::isTimeZoneDaemonAvailable()) { - Error() << "ktimezoned is not available and required for timezone interpretation"; - } - return KDateTime::Spec(KDateTime::ClockTime); + // return QDateTime::Spec(Qt::LocalTime); + return QTimeZone{}; } - return KDateTime::Spec(tz); + //FIXME convert this to a proper KTimeZone + + return QTimeZone(normalizedTz.toLatin1()); } -KDateTime toDate(const Kolab::cDateTime &dt) +QDateTime toDate(const Kolab::cDateTime &dt) { - KDateTime date; if (!dt.isValid()) { //We rely on this codepath, so it's not an error // qDebug() << "invalid datetime converted"; - return KDateTime(); + return QDateTime(); } if (dt.isDateOnly()) { //Date only - date.setDateOnly(true); - date.setDate(QDate(dt.year(), dt.month(), dt.day())); - date.setTimeSpec(KDateTime::Spec(KDateTime::ClockTime)); + //FIXME + // date.setDateOnly(true); + return QDateTime(QDate(dt.year(), dt.month(), dt.day())); + // date.setTimeSpec(Qt::LocalTime); + } + + QDateTime date; + date.setDate(QDate(dt.year(), dt.month(), dt.day())); + date.setTime(QTime(dt.hour(), dt.minute(), dt.second())); + if (dt.isUTC()) { + qWarning() << "Converting utc"; + date.setTimeSpec(Qt::UTC); + // date.setTimeZone(QTimeZone::utc()); + } else if (!dt.timezone().empty()) { + qWarning() << "Converting timezone"; + date.setTimeZone(getTimeSpec(dt.timezone())); } else { - date.setDate(QDate(dt.year(), dt.month(), dt.day())); - date.setTime(QTime(dt.hour(), dt.minute(), dt.second())); - date.setTimeSpec(getTimeSpec(dt.isUTC(), dt.timezone())); + qWarning() << "Converting localtime"; + date.setTimeSpec(Qt::LocalTime); + //We apparently can't have what used to be called floating time, so set the timezone to utc. + // date.setTimeZone(QTimeZone::utc()); + qWarning() << "Converting localtime" << date.timeZone(); } - Q_ASSERT(date.timeSpec().isValid()); + // Q_ASSERT(date.timeSpec().isValid()); Q_ASSERT(date.isValid()); return date; } -cDateTime fromDate(const KDateTime &dt) +cDateTime fromDate(const QDateTime &dt) { + qWarning() << dt; if (!dt.isValid()) { // qDebug() << "invalid datetime converted"; return cDateTime(); } + qWarning() << "From " << dt; cDateTime date; - if (dt.isDateOnly()) { //Date only + if (!dt.time().isValid()) { //Date only + qWarning() << "invalid datetime"; const QDate &d = dt.date(); date.setDate(d.year(), d.month(), d.day()); } else { @@ -86,27 +100,34 @@ date.setDate(d.year(), d.month(), d.day()); const QTime &t = dt.time(); date.setTime(t.hour(), t.minute(), t.second()); - if (dt.timeType() == KDateTime::UTC) { //UTC + if (dt.timeSpec() == Qt::UTC) { //UTC date.setUTC(true); - } else if (dt.timeType() == KDateTime::OffsetFromUTC) { - const KDateTime utcDate = dt.toUtc(); + qWarning() << "From utc"; + } else if (dt.timeSpec() == Qt::OffsetFromUTC) { + const QDateTime utcDate = dt.toUTC(); const QDate &d = utcDate.date(); date.setDate(d.year(), d.month(), d.day()); const QTime &t = utcDate.time(); date.setTime(t.hour(), t.minute(), t.second()); date.setUTC(true); - } else if (dt.timeType() == KDateTime::TimeZone) { //Timezone - //TODO handle local timezone? - //Convert non-olson timezones if necessary - const QString timezone = TimezoneConverter::normalizeTimezone(dt.timeZone().name()); - if (!timezone.isEmpty()) { - date.setTimezone(toStdString(timezone)); - } else { - Warning() << "invalid timezone: " << dt.timeZone().name() << ", assuming floating time"; - return date; - } - } else if (dt.timeType() != KDateTime::ClockTime) { - Error() << "invalid timespec, assuming floating time. Type: " << dt.timeType() << "dt: " << dt.toString(); + } else if (dt.timeSpec() == Qt::TimeZone) { //Timezone + qWarning() << "From timezone"; + //Not actually a timezone + // if (dt.timeZone().id().toLower() == "utc") { + // date.setUTC(true); + // } else { + //Convert non-olson timezones if necessary + const QString timezone = TimezoneConverter::normalizeTimezone(dt.timeZone().id()); + if (!timezone.isEmpty()) { + date.setTimezone(toStdString(timezone)); + } else { + Warning() << "invalid timezone: " << dt.timeZone().id() << ", assuming floating time"; + return date; + } + // } + } else if (dt.timeSpec() != Qt::LocalTime) { + qWarning() << "From localtime"; + Error() << "invalid timespec, assuming floating time. Type: " << dt.timeSpec() << "dt: " << dt.toString(); return date; } } @@ -146,27 +167,37 @@ std::string fromMailto(const QUrl &mailtoUri, std::string &name) { - const std::string &decoded = toStdString(mailtoUri.toString()); + const QPair<std::string, std::string> pair = fromMailto(toStdString(mailtoUri.toString())); + name = pair.second; + return pair.first; +} + +QPair<std::string, std::string> fromMailto(const std::string &mailto) +{ + qWarning() << "fromMailto" << mailto; + const std::string &decoded = toStdString(QUrl::fromPercentEncoding(QByteArray(mailto.c_str()))); + + qWarning() << "fromMailto decoded" << decoded; if (decoded.substr(0, 7).compare("mailto:")) { - WARNING("no mailto address"); - std::cout << decoded << std::endl; - return decoded; + // WARNING("no mailto address"); + // std::cout << decoded << std::endl; + return qMakePair(decoded, std::string()); } std::size_t begin = decoded.find('<',7); if (begin == std::string::npos) { WARNING("no mailto address"); std::cout << decoded << std::endl; - return decoded; + return qMakePair(decoded, std::string()); } std::size_t end = decoded.find('>', begin); if (end == std::string::npos) { WARNING("no mailto address"); std::cout << decoded << std::endl; - return decoded; + return qMakePair(decoded, std::string()); } - name = decoded.substr(7, begin-7); - const std::string &email = decoded.substr(begin+1, end-begin-1); - return email; + const std::string name = decoded.substr(7, begin-7); + const std::string email = decoded.substr(begin+1, end-begin-1);
View file
libkolab-2.0.tar.gz/conversion/commonconversion.h -> libkolab-3.0.0.tar.gz/conversion/commonconversion.h
Changed
@@ -20,24 +20,28 @@ #include "kolab_export.h" -#include <kdatetime.h> #include <QStringList> +#include <QDateTime> +#include <QUrl> #include <kolabcontainers.h> namespace Kolab { namespace Conversion { - KOLAB_EXPORT KDateTime toDate(const Kolab::cDateTime &dt); - KOLAB_EXPORT cDateTime fromDate(const KDateTime &dt); + //FIXME handle somehow? + KOLAB_EXPORT QDateTime toDate(const Kolab::cDateTime &dt); + // KOLAB_EXPORT QDateTime toDateTime(const Kolab::cDateTime &dt); + KOLAB_EXPORT cDateTime fromDate(const QDateTime &dt); QStringList toStringList(const std::vector<std::string> &l); std::vector<std::string> fromStringList(const QStringList &l); /** * Returns a UTC, Floating Time or Timezone */ - KDateTime::Spec getTimeSpec(bool isUtc, const std::string &timezone); + // QDateTime::Spec getTimeSpec(bool isUtc, const std::string &timezone); QUrl toMailto(const std::string &email, const std::string &name = std::string()); std::string fromMailto(const QUrl &mailtoUri, std::string &name); + QPair<std::string, std::string> fromMailto(const std::string &mailto); inline std::string toStdString(const QString &s) { @@ -52,4 +56,4 @@ }; }; -#endif \ No newline at end of file +#endif
View file
libkolab-2.0.tar.gz/conversion/kcalconversion.cpp -> libkolab-3.0.0.tar.gz/conversion/kcalconversion.cpp
Changed
@@ -22,6 +22,7 @@ #include <QtCore/QVector> #include <QtCore/QDebug> #include <QUrl> +#include <QDate> #include <vector> #include "kolabformat/errorhandler.h" @@ -273,53 +274,65 @@ i.setRevision(e.sequence()); i.setSecrecy(toSecrecy(e.classification())); i.setCategories(toStringList(e.categories())); - + if (e.start().isValid()) { + + qWarning() << "Setting start" << toDate(e.start()); i.setDtStart(toDate(e.start())); + if (e.start().isDateOnly()) { + i.setAllDay(true); + } } i.setSummary(fromStdString(e.summary())); //TODO detect richtext i.setDescription(fromStdString(e.description())); //TODO detect richtext i.setStatus(toStatus(e.status())); foreach (const Kolab::Attendee a, e.attendees()) { + //FIXME percent encoding? /* * KCalCore always sets a UID if empty, but that's just a pointer, and not the uid of a real contact. * Since that means the semantics of the two are different, we have to store the kolab uid as a custom property. */ - KCalCore::Attendee::Ptr attendee = KCalCore::Attendee::Ptr(new KCalCore::Attendee(fromStdString(a.contact().name()), - fromStdString(a.contact().email()), - a.rsvp(), - toPartStat(a.partStat()), - toRole(a.role()) )); + // QUrl::fromPercentEncoding( + qWarning() << "Name " << fromStdString(a.contact().name()) << " EMail " << fromStdString(a.contact().email()); + KCalCore::Attendee attendee(fromStdString(a.contact().name()), + fromStdString(a.contact().email()), + a.rsvp(), + toPartStat(a.partStat()), + toRole(a.role()) ); if (!a.contact().uid().empty()) { //TODO Identify contact from addressbook based on uid - attendee->customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID, fromStdString(a.contact().uid())); + attendee.customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID, fromStdString(a.contact().uid())); } if (!a.delegatedTo().empty()) { if (a.delegatedTo().size() > 1) { WARNING("multiple delegatees are not supported"); } - attendee->setDelegate(toMailto(a.delegatedTo().front().email(), a.delegatedTo().front().name()).toString()); + + qWarning() << "delegated from " << toMailto(a.delegatedTo().front().email(), a.delegatedTo().front().name()).toString(); + attendee.setDelegate(toMailto(a.delegatedTo().front().email(), a.delegatedTo().front().name()).toString()); } if (!a.delegatedFrom().empty()) { if (a.delegatedFrom().size() > 1) { WARNING("multiple delegators are not supported"); } - attendee->setDelegator(toMailto(a.delegatedFrom().front().email(), a.delegatedFrom().front().name()).toString()); + qWarning() << "delegator from " << toMailto(a.delegatedFrom().front().email(), a.delegatedFrom().front().name()).toString(); + attendee.setDelegator(toMailto(a.delegatedFrom().front().email(), a.delegatedFrom().front().name()).toString()); } - if (!a.cutype() != CutypeIndividual) { - attendee->customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE, QString::number(a.cutype())); + if (a.cutype() != CutypeIndividual) { + attendee.customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE, QString::number(a.cutype())); } + // qWarning() << attendee; i.addAttendee(attendee); } foreach (const Kolab::Attachment a, e.attachments()) { - KCalCore::Attachment::Ptr ptr; + KCalCore::Attachment ptr; if (!a.uri().empty()) { - ptr = KCalCore::Attachment::Ptr(new KCalCore::Attachment(fromStdString(a.uri()), fromStdString(a.mimetype()))); + ptr = KCalCore::Attachment(fromStdString(a.uri()), fromStdString(a.mimetype())); } else { - ptr = KCalCore::Attachment::Ptr(new KCalCore::Attachment(QByteArray::fromRawData(a.data().c_str(), a.data().size()), fromStdString(a.mimetype()))); + ptr = KCalCore::Attachment(QByteArray::fromRawData(a.data().c_str(), a.data().size()).toBase64(), fromStdString(a.mimetype())); } if (!a.label().empty()) { - ptr->setLabel(fromStdString(a.label())); + ptr.setLabel(fromStdString(a.label())); } i.addAttachment(ptr); } @@ -352,23 +365,25 @@ i.setDescription(toStdString(e.description())); i.setStatus(fromStatus(e.status())); std::vector<Kolab::Attendee> attendees; - foreach (const KCalCore::Attendee::Ptr ptr, e.attendees()) { - const QString &uid = ptr->customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID); - Kolab::Attendee a(Kolab::ContactReference(toStdString(ptr->email()), toStdString(ptr->name()), toStdString(uid))); - a.setRSVP(ptr->RSVP()); - a.setPartStat(fromPartStat(ptr->status())); - a.setRole(fromRole(ptr->role())); - if (!ptr->delegate().isEmpty()) { + foreach (const KCalCore::Attendee attendee, e.attendees()) { + const QString &uid = attendee.customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID); + Kolab::Attendee a(Kolab::ContactReference(toStdString(attendee.email()), toStdString(attendee.name()), toStdString(uid))); + a.setRSVP(attendee.RSVP()); + a.setPartStat(fromPartStat(attendee.status())); + a.setRole(fromRole(attendee.role())); + if (!attendee.delegate().isEmpty()) { std::string name; - const std::string &email = fromMailto(ptr->delegate(), name); + const std::string &email = fromMailto(QUrl(attendee.delegate()), name); + qWarning() << "delegate Email " << email << " EMail " << name << attendee.delegate(); a.setDelegatedTo(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); } - if (!ptr->delegator().isEmpty()) { + if (!attendee.delegator().isEmpty()) { std::string name; - const std::string &email = fromMailto(ptr->delegator(), name); + const std::string &email = fromMailto(QUrl(attendee.delegator()), name); + qWarning() << "delegated from " << email << " EMail " << name << attendee.delegator(); a.setDelegatedFrom(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); } - const QString &cutype = ptr->customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE); + const QString &cutype = attendee.customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE); if (!cutype.isEmpty()) { a.setCutype(static_cast<Kolab::Cutype>(cutype.toInt())); } @@ -377,14 +392,14 @@ } i.setAttendees(attendees); std::vector<Kolab::Attachment> attachments; - foreach (const KCalCore::Attachment::Ptr &ptr, e.attachments()) { + foreach (const KCalCore::Attachment &ptr, e.attachments()) { Kolab::Attachment a; - if (ptr->isUri()) { - a.setUri(toStdString(ptr->uri()), toStdString(ptr->mimeType())); + if (ptr.isUri()) { + a.setUri(toStdString(ptr.uri()), toStdString(ptr.mimeType())); } else { - a.setData(std::string(ptr->decodedData().data(), ptr->decodedData().size()), toStdString(ptr->mimeType())); + a.setData(std::string(ptr.decodedData().data(), ptr.decodedData().size()), toStdString(ptr.mimeType())); } - a.setLabel(toStdString(ptr->label())); + a.setLabel(toStdString(ptr.label())); attachments.push_back(a); } i.setAttachments(attachments); @@ -529,6 +544,7 @@ if (rrule.end().isValid()) { rec->setEndDateTime(toDate(rrule.end())); //TODO date/datetime setEndDate(). With date-only the start date has to be taken into account. + qWarning() << "Set end date time" << toDate(rrule.end()); } else { rec->setDuration(rrule.count()); } @@ -563,19 +579,17 @@ } } foreach (const Kolab::cDateTime &dt, event.recurrenceDates()) { - const KDateTime &date = toDate(dt); - if (date.isDateOnly()) { - e.recurrence()->addRDate(date.date()); + if (dt.isDateOnly()) { + e.recurrence()->addRDate(toDate(dt).date()); } else { - e.recurrence()->addRDateTime(date); + e.recurrence()->addRDateTime(toDate(dt)); } } foreach (const Kolab::cDateTime &dt, event.exceptionDates()) { - const KDateTime &date = toDate(dt); - if (date.isDateOnly()) { - e.recurrence()->addExDate(date.date()); + if (dt.isDateOnly()) { + e.recurrence()->addExDate(toDate(dt).date()); } else { - e.recurrence()->addExDateTime(date); + e.recurrence()->addExDateTime(toDate(dt)); } } @@ -625,20 +639,20 @@ i.setRecurrenceRule(rrule); std::vector<Kolab::cDateTime> rdates; - foreach (const KDateTime &dt, rec->rDateTimes()) { + foreach (const QDateTime &dt, rec->rDateTimes()) { rdates.push_back(fromDate(dt)); } foreach (const QDate &dt, rec->rDates()) { - rdates.push_back(fromDate(KDateTime(dt))); + rdates.push_back(fromDate(QDateTime(dt))); } i.setRecurrenceDates(rdates); std::vector<Kolab::cDateTime> exdates; - foreach (const KDateTime &dt, rec->exDateTimes()) { + foreach (const QDateTime &dt, rec->exDateTimes()) { exdates.push_back(fromDate(dt)); } foreach (const QDate &dt, rec->exDates()) {
View file
libkolab-2.0.tar.gz/conversion/kcalconversion.h -> libkolab-3.0.0.tar.gz/conversion/kcalconversion.h
Changed
@@ -43,8 +43,8 @@ KOLAB_EXPORT KCalCore::Journal::Ptr toKCalCore(const Kolab::Journal &); KOLAB_EXPORT Kolab::Journal fromKCalCore(const KCalCore::Journal &); - KOLAB_EXPORT KDateTime toDate(const Kolab::cDateTime &dt); - KOLAB_EXPORT cDateTime fromDate(const KDateTime &dt); + KOLAB_EXPORT QDateTime toDate(const Kolab::cDateTime &dt); + KOLAB_EXPORT cDateTime fromDate(const QDateTime &dt); }; };
View file
libkolab-2.0.tar.gz/conversion/timezoneconverter.cpp -> libkolab-3.0.0.tar.gz/conversion/timezoneconverter.cpp
Changed
@@ -16,20 +16,19 @@ */ #include "timezoneconverter.h" -#include <ktimezone.h> -#include <ksystemtimezone.h> -#include <kdebug.h> #include <QRegExp> #include <QStringList> #include "kolabformat/errorhandler.h" +#include <QTimeZone> QString TimezoneConverter::normalizeTimezone(const QString& tz) { - KTimeZone timezone = KSystemTimeZones::zone(tz); //Needs ktimezoned (timezone daemon running) http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKSystemTimeZones.html - if (timezone.isValid()) { + if (QTimeZone::isTimeZoneIdAvailable(tz.toLatin1())) { return tz; - } else if (!KSystemTimeZones::isTimeZoneDaemonAvailable()) { - Error() << "ktimezoned is not available and required for timezone interpretation"; + } + auto normalizedId = QTimeZone::windowsIdToDefaultIanaId(tz.toLatin1()); + if (!normalizedId.isEmpty()) { + return normalizedId; } //We're dealing with an invalid or unknown timezone, try to parse it QString guessedTimezone = fromCityName(tz); @@ -39,15 +38,6 @@ if (guessedTimezone.isEmpty()) { guessedTimezone = fromGMTOffsetTimezone(tz); } -// if (guessedTimezone.isEmpty()) { -// //slower but also finds outdated zones -// timezone = KSystemTimeZones::readZone(tz); -// if (timezone.isValid()) { -// //This thinks all kinds of shit is valid, including /etc/localtime. Let's verify again. -// qDebug() << "found " << tz; -// return tz; -// } -// } Debug() << "Guessed timezone and found: " << guessedTimezone; return guessedTimezone; } @@ -60,14 +50,12 @@ QString TimezoneConverter::fromCityName(const QString& tz) { - const KTimeZones::ZoneMap zones = KSystemTimeZones::zones(); - KTimeZones::ZoneMap::const_iterator it = zones.constBegin(); + const auto zones = QTimeZone::availableTimeZoneIds(); QHash<QString, QString> countryMap; - for(;it != zones.constEnd(); it++) { - const QString cityName = it.key().split('/').last(); -// kDebug() << it.key() << it.value().name() << cityName; + for (auto zone : zones) { + const QString cityName = zone.split('/').last(); Q_ASSERT(!countryMap.contains(cityName)); - countryMap.insert(cityName, it.key()); + countryMap.insert(cityName, zone); } QRegExp locationFinder("\\b(a-zA-Z)+\\b", Qt::CaseSensitive, QRegExp::RegExp2); @@ -78,9 +66,9 @@ ++pos; } const QString location = locationFinder.capturedTexts().first(); -// kDebug() << "location " << location; + qDebug() << "location " << location; if (countryMap.contains(location)) { -// kDebug() << "found match " << countryMap.value(location); + qDebug() << "found match " << countryMap.value(location); return countryMap.value(location); } }
View file
libkolab-2.0.tar.gz/kolab_export.h -> libkolab-3.0.0.tar.gz/kolab_export.h
Changed
@@ -25,6 +25,7 @@ //Workaround for qt not defining Q_DECL_IMPORT as it should #if defined(Q_OS_LINUX) +# undef Q_DECL_IMPORT # define Q_DECL_IMPORT __attribute__((visibility("default"))) #endif
View file
libkolab-2.0.tar.gz/kolabformat/errorhandler.h -> libkolab-3.0.0.tar.gz/kolabformat/errorhandler.h
Changed
@@ -19,7 +19,7 @@ #ifndef ERRORHANDLER_H #define ERRORHANDLER_H -#include <kolab_export.h> +#include "kolab_export.h" #include <QString> #include <QList>
View file
libkolab-2.0.tar.gz/kolabformat/formathelpers.cpp -> libkolab-3.0.0.tar.gz/kolabformat/formathelpers.cpp
Changed
@@ -1,5 +1,4 @@ #include "formathelpers.h" -#include <klocalizedstring.h> #include "kolabdefinitions.h" namespace Kolab { @@ -9,14 +8,14 @@ const char *label; } folderTypeData = { { KOLAB_FOLDER_TYPE_MAIL, "" }, - { KOLAB_FOLDER_TYPE_CONTACT, I18N_NOOP( "Contacts" ) }, - { KOLAB_FOLDER_TYPE_EVENT, I18N_NOOP( "Calendar" ) }, - { KOLAB_FOLDER_TYPE_TASK, I18N_NOOP( "Tasks" ) }, - { KOLAB_FOLDER_TYPE_JOURNAL, I18N_NOOP( "Journal" ) }, - { KOLAB_FOLDER_TYPE_NOTE, I18N_NOOP( "Notes" ) }, - { KOLAB_FOLDER_TYPE_CONFIGURATION, I18N_NOOP( "Configuration" ) }, - { KOLAB_FOLDER_TYPE_FREEBUSY, I18N_NOOP( "Freebusy" ) }, - { KOLAB_FOLDER_TYPE_FILE, I18N_NOOP( "Files" ) } + { KOLAB_FOLDER_TYPE_CONTACT, "Contacts" }, + { KOLAB_FOLDER_TYPE_EVENT, "Calendar" }, + { KOLAB_FOLDER_TYPE_TASK, "Tasks" }, + { KOLAB_FOLDER_TYPE_JOURNAL, "Journal" }, + { KOLAB_FOLDER_TYPE_NOTE, "Notes" }, + { KOLAB_FOLDER_TYPE_CONFIGURATION, "Configuration" }, + { KOLAB_FOLDER_TYPE_FREEBUSY, "Freebusy" }, + { KOLAB_FOLDER_TYPE_FILE, "Files" } }; static const int numFolderTypeData = sizeof folderTypeData / sizeof *folderTypeData; @@ -78,8 +77,7 @@ FolderType guessFolderTypeFromName(const std::string& name) { for ( int i = 0; i < numFolderTypeData; ++i ) { - if ( name == i18n( folderTypeData i .label ).toStdString() || - name == folderTypeData i .label ) { + if ( name == folderTypeData i .label ) { return static_cast<FolderType>( i ); } } @@ -89,7 +87,7 @@ std::string nameForFolderType(FolderType type) { Q_ASSERT( type >= 0 && type < LastType ); - return i18n( folderTypeData type .label ).toStdString(); + return {folderTypeData type .label}; } }
View file
libkolab-2.0.tar.gz/kolabformat/kolabobject.i -> libkolab-3.0.0.tar.gz/kolabformat/kolabobject.i
Changed
@@ -4,7 +4,6 @@ #include "../kolabformat/xmlobject.h" #include "../kolabformat/kolabdefinitions.h" - #include "../kolabformat/mimeobject.h" %} %include "std_string.i" @@ -15,4 +14,3 @@ %include "../kolabformat/xmlobject.h" %include "../kolabformat/kolabdefinitions.h" -%include "../kolabformat/mimeobject.h"
View file
libkolab-2.0.tar.gz/kolabformat/xmlobject.cpp -> libkolab-3.0.0.tar.gz/kolabformat/xmlobject.cpp
Changed
@@ -16,12 +16,11 @@ */ #include "xmlobject.h" -#include "v2helpers.h" -#include "kolabformatV2/event.h" -#include "conversion/kcalconversion.h" -#include "conversion/kolabconversion.h" -#include "conversion/commonconversion.h" -#include "conversion/kabcconversion.h" +// #include "conversion/kcalconversion.h" +// #include "conversion/kolabconversion.h" +// #include "conversion/commonconversion.h" +// #include "conversion/kabcconversion.h" +#include "kolabformat/errorhandler.h" #include <QUuid> namespace Kolab { @@ -41,8 +40,8 @@ { return mWrittenUID; } - -std::vector< std::string > XMLObject::getAttachments() const + +std::vector<std::string> XMLObject::getAttachments() const { return mAttachments; } @@ -51,98 +50,56 @@ { mWrittenUID.clear(); if (version == KolabV2) { - const KCalCore::Event::Ptr i = Conversion::toKCalCore(event); - if (!i) { - Critical() << "invalid incidence"; - return std::string(); - } - if (i->uid().isEmpty()) { - i->setUid(createUuid()); - } - mWrittenUID = Conversion::toStdString(i->uid()); - //The timezone is used for created and last modified dates - const QString &xml = KolabV2::Event::eventToXML(i, QLatin1String("UTC")); - return Conversion::toStdString(xml); + Critical() << "KolabV2 is not supported."; + return {}; } const std::string result = Kolab::writeEvent(event, productId); mWrittenUID = Kolab::getSerializedUID(); + ErrorHandler::handleLibkolabxmlErrors(); return result; } Event XMLObject::readEvent(const std::string& s, Version version) { if (version == KolabV2) { - QStringList attachments; - const KCalCore::Event::Ptr event = Kolab::fromXML<KCalCore::Event::Ptr, KolabV2::Event>(QString::fromUtf8(s.c_str()).toUtf8(), attachments); - if (!event || Kolab::ErrorHandler::errorOccured()) { - Critical() << "failed to read xml"; - return Event(); - } - mAttachments.clear(); - foreach (const QString &attachment, attachments) { - mAttachments.push_back(Conversion::toStdString(attachment)); - } - return Conversion::fromKCalCore(*event); + Critical() << "KolabV2 is not supported."; + return {}; } - return Kolab::readEvent(s, false); + const Kolab::Event event = Kolab::readEvent(s, false); + ErrorHandler::handleLibkolabxmlErrors(); + return event; } std::string XMLObject::writeTodo(const Todo &event, Version version, const std::string& productId) { mWrittenUID.clear(); if (version == KolabV2) { - const KCalCore::Todo::Ptr i = Conversion::toKCalCore(event); - if (!i) { - Critical() << "invalid incidence"; - return std::string(); - } - if (i->uid().isEmpty()) { - i->setUid(createUuid()); - } - mWrittenUID = Conversion::toStdString(i->uid()); - //The timezone is used for created and last modified dates - const QString &xml = KolabV2::Task::taskToXML(i, QLatin1String("UTC")); - return Conversion::toStdString(xml); + Critical() << "KolabV2 is not supported."; + return {}; } const std::string result = Kolab::writeTodo(event, productId); mWrittenUID = Kolab::getSerializedUID(); + ErrorHandler::handleLibkolabxmlErrors(); return result; } Todo XMLObject::readTodo(const std::string& s, Version version) { if (version == KolabV2) { - QStringList attachments; - const KCalCore::Todo::Ptr event = Kolab::fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(QString::fromUtf8(s.c_str()).toUtf8(), attachments); - if (!event || Kolab::ErrorHandler::errorOccured()) { - Error() << "failed to read xml"; - return Todo(); - } - mAttachments.clear(); - foreach (const QString &attachment, attachments) { - mAttachments.push_back(Conversion::toStdString(attachment)); - } - return Conversion::fromKCalCore(*event); + Critical() << "KolabV2 is not supported."; + return {}; } - return Kolab::readTodo(s, false); + const Kolab::Todo todo = Kolab::readTodo(s, false); + ErrorHandler::handleLibkolabxmlErrors(); + return todo; } std::string XMLObject::writeJournal(const Journal &event, Version version, const std::string& productId) { mWrittenUID.clear(); if (version == KolabV2) { - const KCalCore::Journal::Ptr i = Conversion::toKCalCore(event); - if (!i) { - Critical() << "invalid journal"; - return std::string(); - } - if (i->uid().isEmpty()) { - i->setUid(createUuid()); - } - mWrittenUID = Conversion::toStdString(i->uid()); - //The timezone is used for created and last modified dates - const QString &xml = KolabV2::Journal::journalToXML(i, QLatin1String("UTC")); - return Conversion::toStdString(xml); + Critical() << "KolabV2 is not supported."; + return {}; } const std::string result = Kolab::writeJournal(event, productId); mWrittenUID = Kolab::getSerializedUID(); @@ -152,19 +109,12 @@ Journal XMLObject::readJournal(const std::string& s, Version version) { if (version == KolabV2) { - QStringList attachments; - const KCalCore::Journal::Ptr event = Kolab::fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(QString::fromUtf8(s.c_str()).toUtf8(), attachments); - if (!event || Kolab::ErrorHandler::errorOccured()) { - Critical() << "failed to read xml"; - return Journal(); - } - mAttachments.clear(); - foreach (const QString &attachment, attachments) { - mAttachments.push_back(Conversion::toStdString(attachment)); - } - return Conversion::fromKCalCore(*event); + Critical() << "KolabV2 is not supported."; + return {}; } - return Kolab::readJournal(s, false); + const Kolab::Journal journal = Kolab::readJournal(s, false); + ErrorHandler::handleLibkolabxmlErrors(); + return journal; } std::string XMLObject::writeFreebusy(const Freebusy &event, Version version, const std::string& productId) @@ -172,7 +122,7 @@ mWrittenUID.clear(); if (version != KolabV3) { Critical() << "only v3 implementation available"; - return std::string(); + return {}; } const std::string result = Kolab::writeFreebusy(event, productId); mWrittenUID = Kolab::getSerializedUID(); @@ -205,114 +155,85 @@ Contact XMLObject::readContact(const std::string& s, Version version) { - if (version == KolabV2) { - const QByteArray xmlData(s.c_str(), s.size()); - QString pictureAttachmentName; - QString logoAttachmentName; - QString soundAttachmentName; - const KABC::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName); - mPictureAttachmentName = Conversion::toStdString(pictureAttachmentName); - mLogoAttachmentName = Conversion::toStdString(logoAttachmentName); - mSoundAttachmentName = Conversion::toStdString(soundAttachmentName); - return Conversion::fromKABC(addressee); + if (version == KolabV2) { + Critical() << "KolabV2 is not supported."; + return {}; } - return Kolab::readContact(s, false); + const Kolab::Contact contact = Kolab::readContact(s, false);
View file
libkolab-2.0.tar.gz/kolabformat/xmlobject.h -> libkolab-3.0.0.tar.gz/kolabformat/xmlobject.h
Changed
@@ -26,6 +26,7 @@ #endif #include <kolabformat.h> +#include <string> #include "kolabdefinitions.h"
View file
libkolab-2.0.tar.gz/mime/mimeutils.cpp -> libkolab-3.0.0.tar.gz/mime/mimeutils.cpp
Changed
@@ -19,10 +19,10 @@ #include <quuid.h> #include <QtCore/qfile.h> #include <qdom.h> -#include <kdebug.h> -#include <kabc/addressee.h> +// #include <kdatetime.h> #include "kolabformat/kolabdefinitions.h" #include "kolabformat/errorhandler.h" +#include <kolabformat.h> #include "libkolab-version.h" namespace Kolab { @@ -65,7 +65,7 @@ } Q_ASSERT(!data->contents().isEmpty()); Q_FOREACH(KMime::Content *c, data->contents()) { -// kDebug() << "searching: " << c->contentID()->identifier(); +// qDebug() << "searching: " << c->contentID()->identifier(); if ( c->contentID()->identifier() == id ) { type = c->contentType()->mimeType(); name = c->contentType()->name(); @@ -93,84 +93,35 @@ return cid.right(cid.size()-4); } -KMime::Message::Ptr createMessage(const KCalCore::Incidence::Ptr &incidencePtr, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &productId) +KMime::Message::Ptr createMessage(const QByteArray &mimetype, const QByteArray &xKolabType, const QByteArray &xml, bool v3, const QByteArray &productId, + const QByteArray &fromEmail, const QString &fromName, const QString &subject) { - KMime::Message::Ptr message = createMessage( xKolabType, v3, productId ); - if (!incidencePtr) { - Error() << "invalid incidence passed in"; - message->assemble(); - return message; - } - if ( incidencePtr->organizer() && !incidencePtr->organizer()->email().isEmpty()) { - message->from()->addAddress( incidencePtr->organizer()->email().toUtf8(), incidencePtr->organizer()->name() ); - } - message->subject()->fromUnicodeString( incidencePtr->uid(), "utf-8" ); - - KMime::Content *content = createMainPart( mimetype, xml ); - message->addContent( content ); - - Q_FOREACH (KCalCore::Attachment::Ptr attachment, incidencePtr->attachments()) { - //Serialize the attachment as attachment with uri, referencing the created mime-part - if (v3 && !attachment->uri().contains("cid:")) { - //onyl by url, skip - continue; - } - message->addContent( createAttachmentPart(fromCid(attachment->uri()).toLatin1(), attachment->mimeType(), attachment->label(), attachment->decodedData() ) ); - } - - message->assemble(); + KMime::Message::Ptr message = createMessage(xKolabType, v3, productId); + message->subject()->fromUnicodeString(subject, "utf-8"); + if (!fromEmail.isEmpty()) { + KMime::Types::Mailbox mb; + mb.setName(fromName); + mb.setAddress(fromEmail); + message->from()->addAddress(mb); + } + message->addContent(createMainPart(mimetype, xml)); return message; } -KMime::Message::Ptr createMessage(const KABC::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid) +KMime::Message::Ptr createMessage(const std::string &mimetype, const std::string &xKolabType, const std::string &xml, bool v3, const std::string &productId, + const std::string &fromEmail, const std::string &fromName, const std::string &subject) { - KMime::Message::Ptr message = Mime::createMessage( xKolabType, v3, prodid ); - message->subject()->fromUnicodeString( contact.uid(), "utf-8" ); - message->from()->fromUnicodeString( contact.fullEmail(), "utf-8" ); - - KMime::Content* content = Mime::createMainPart( mimetype, xml ); - message->addContent( content ); - -// TODO add pictures as separate mimeparts -// if ( !contact.picture().isNull() ) { -// QByteArray pic; -// QBuffer buffer(&pic); -// buffer.open(QIODevice::WriteOnly); -// contact.picture().save(&buffer, "PNG"); -// buffer.close(); -// -// content = Mime::createAttachmentPart(QByteArray(), "image/png", "kolab-picture.png", pic ); -// message->addContent(content); -// } -// -// if ( !contact.logo().isNull() ) { -// QByteArray pic; -// QBuffer buffer(&pic); -// buffer.open(QIODevice::WriteOnly); -// contact.logo().save(&buffer, "PNG"); -// buffer.close(); -// -// content = Mime::createAttachmentPart(QByteArray(), "image/png", "kolab-logo.png", pic ); -// message->addContent(content); -// } -// -// if ( !contact.sound().isEmpty() ) { -// content = Mime::createAttachmentPart(QByteArray(), "audio/unknown", "sound", contact.sound() ); -// message->addContent(content); -// } - - message->assemble(); - return message; + return createMessage(QByteArray(mimetype.c_str()), QByteArray(xKolabType.c_str()), QByteArray(xml.c_str()), v3, QByteArray(productId.data()), QByteArray(fromEmail.c_str()), QString::fromStdString(fromName), QString::fromStdString(subject)); } KMime::Message::Ptr createMessage(const QString &subject, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid) { - KMime::Message::Ptr message = createMessage( xKolabType, v3, prodid ); + KMime::Message::Ptr message = createMessage( xKolabType.toLatin1(), v3, prodid.toLatin1() ); if (!subject.isEmpty()) { message->subject()->fromUnicodeString( subject, "utf-8" ); } - KMime::Content *content = createMainPart( mimetype, xml ); + KMime::Content *content = createMainPart( mimetype.toLatin1(), xml ); message->addContent( content ); message->assemble(); @@ -198,106 +149,87 @@ } -KMime::Message::Ptr createMessage(const QString& xKolabType, bool v3, const QString &prodid) +KMime::Message::Ptr createMessage(const QByteArray& xKolabType, bool v3, const QByteArray &prodid) { - KMime::Message::Ptr message( new KMime::Message ); - message->date()->setDateTime( KDateTime::currentUtcDateTime() ); - KMime::Headers::Generic *h = new KMime::Headers::Generic( X_KOLAB_TYPE_HEADER, message.get(), xKolabType, "utf-8" ); - message->appendHeader( h ); + KMime::Message::Ptr message(new KMime::Message); + message->date()->setDateTime(QDateTime::currentDateTimeUtc()); + KMime::Headers::Generic* h = new KMime::Headers::Generic(X_KOLAB_TYPE_HEADER); + h->fromUnicodeString(xKolabType, "utf-8"); + message->appendHeader(h); if (v3) { - KMime::Headers::Generic *vh = new KMime::Headers::Generic( X_KOLAB_MIME_VERSION_HEADER, message.get(), KOLAB_VERSION_V3, "utf-8" ); - message->appendHeader( vh ); - } - message->userAgent()->from7BitString( prodid.toLatin1() ); - message->contentType()->setMimeType( "multipart/mixed" ); - message->contentType()->setBoundary( KMime::multiPartBoundary() ); - - message->addContent( createExplanationPart(v3) ); + KMime::Headers::Generic* hv3 = new KMime::Headers::Generic(X_KOLAB_MIME_VERSION_HEADER); + hv3->fromUnicodeString(KOLAB_VERSION_V3, "utf-8"); + message->appendHeader(hv3); + } + message->userAgent()->from7BitString(prodid); + message->contentType()->setMimeType("multipart/mixed"); + message->contentType()->setBoundary(KMime::multiPartBoundary()); + message->addContent(createExplanationPart(v3)); return message; } -KMime::Content* createMainPart(const QString& mimeType, const QByteArray& decodedContent) +KMime::Content* createMainPart(const QByteArray& mimeType, const QByteArray& decodedContent) { KMime::Content* content = new KMime::Content(); - content->contentType()->setMimeType( mimeType.toLatin1() ); - content->contentType()->setName( KOLAB_OBJECT_FILENAME, "us-ascii" ); + content->contentType()->setMimeType(mimeType); + content->contentType()->setName(KOLAB_OBJECT_FILENAME, "us-ascii"); content->contentTransferEncoding()->setEncoding( KMime::Headers::CEquPr ); content->contentDisposition()->setDisposition( KMime::Headers::CDattachment ); content->contentDisposition()->setFilename( KOLAB_OBJECT_FILENAME ); - content->setBody( decodedContent ); + content->setBody(decodedContent); return content; } -KMime::Content* createAttachmentPart(const QByteArray& cid, const QString& mimeType, const QString& fileName, const QByteArray& decodedContent) +KMime::Content* createAttachmentPart(const QByteArray& cid, const QByteArray& mimeType, const QString& fileName, const QByteArray& base64EncodedContent) { KMime::Content* content = new KMime::Content(); if (!cid.isEmpty()) { content->contentID()->setIdentifier( cid ); } - content->contentType()->setMimeType( mimeType.toLatin1() ); + content->contentType()->setMimeType( mimeType ); content->contentType()->setName( fileName, "utf-8" ); content->contentTransferEncoding()->setEncoding( KMime::Headers::CEbase64 ); content->contentDisposition()->setDisposition( KMime::Headers::CDattachment ); content->contentDisposition()->setFilename( fileName ); - content->setBody( decodedContent ); + content->setBody( base64EncodedContent ); return content; } -void getAttachments(KCalCore::Incidence::Ptr incidence, const QStringList &attachments, const KMime::Message::Ptr &mimeData) +Kolab::Attachment getAttachment(const std::string &id, const KMime::Message::Ptr &mimeData) { - if (!incidence) { - Error() << "Invalid incidence"; - return;
View file
libkolab-2.0.tar.gz/mime/mimeutils.h -> libkolab-3.0.0.tar.gz/mime/mimeutils.h
Changed
@@ -20,13 +20,12 @@ #include "kolab_export.h" -#include <kcalcore/incidence.h> -#include <kcalcore/event.h> #include <kmime/kmime_message.h> -#include <kabc/addressee.h> + class QDomDocument; namespace Kolab { + class Attachment; namespace Mime { KMime::Content* findContentByName(const KMime::Message::Ptr &data, const QString &name, QByteArray &type); @@ -38,20 +37,22 @@ * * Set the attachments listed in @param attachments on @param incidence from @param mimeData */ -//v2 -void getAttachments(KCalCore::Incidence::Ptr incidence, const QStringList &attachments, const KMime::Message::Ptr &mimeData); -//v3 -void getAttachmentsById(KCalCore::Incidence::Ptr incidence, const KMime::Message::Ptr &mimeData); +Kolab::Attachment getAttachment(const std::string &id, const KMime::Message::Ptr &mimeData); +Kolab::Attachment getAttachmentByName(const QString &name, const KMime::Message::Ptr &mimeData); + +KMime::Message::Ptr createMessage(const QByteArray &mimetype, const QByteArray &xKolabType, const QByteArray &xml, bool v3, const QByteArray &productId, + const QByteArray &fromEmail, const QString &fromName, const QString &subject); +KMime::Message::Ptr createMessage(const std::string &mimetype, const std::string &xKolabType, const std::string &xml, bool v3, const std::string &productId, + const std::string &fromEmail, const std::string &fromName, const std::string &subject); ///Generic serializing functions -KMime::Message::Ptr createMessage(const KCalCore::Incidence::Ptr &incidencePtr, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid); -KMime::Message::Ptr createMessage(const KABC::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid); KMime::Message::Ptr createMessage(const QString &subject, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid); +KMime::Message::Ptr createMessage(const QByteArray& mimeType, bool v3, const QByteArray &prodid); KMime::Content* createExplanationPart(); -KMime::Message::Ptr createMessage(const QString& mimeType, bool v3, const QString &prodid); -KMime::Content* createMainPart(const QString& mimeType, const QByteArray& decodedContent); -KMime::Content* createAttachmentPart(const QByteArray &cid, const QString& mimeType, const QString& fileName, const QByteArray& decodedContent); +KMime::Content* createMainPart(const QByteArray& mimeType, const QByteArray& decodedContent); +KMime::Content* createAttachmentPart(const QByteArray& cid, const QByteArray& mimeType, const QString& fileName, const QByteArray& decodedContent); +QString fromCid(const QString &cid); }; }; //Namespace
View file
libkolab-2.0.tar.gz/tests/CMakeLists.txt -> libkolab-3.0.0.tar.gz/tests/CMakeLists.txt
Changed
@@ -2,29 +2,18 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions(-DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + macro(addTest TEST_NAME) - QT4_AUTOMOC(${TEST_NAME}.cpp) add_executable(${TEST_NAME} ${TEST_NAME}.cpp) - target_link_libraries(${TEST_NAME} ${QT_QTTEST_LIBRARY} kolab_static) + target_link_libraries(${TEST_NAME} Qt5::Test kolab_static) add_test(${TEST_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}) endmacro() -QT4_AUTOMOC(benchmark.cpp) -add_executable(benchmarktest benchmark.cpp) -target_link_libraries(benchmarktest ${QT_QTTEST_LIBRARY} kolab_static) - -addTest(formattest) -addTest(upgradetest) addTest(kcalconversiontest) addTest(calendaringtest) -addTest(icalendartest) -addTest(freebusytest) -addTest(kolabobjecttest) addTest(timezonetest) -addTest(mimeobjecttest) -addTest(xmlobjecttest) -addTest(debugstreamtest) -addTest(legacyformattest) if(PHP_BINDINGS) find_path(PHP_KOLABFORMAT_PATH NAMES kolabformat.php PATHS /usr/local/lib/php/modules /usr/lib/php/modules PATH_SUFFIXES lib/php/modules lib64/php/modules)
View file
libkolab-2.0.tar.gz/tests/calendaringtest.cpp -> libkolab-3.0.0.tar.gz/tests/calendaringtest.cpp
Changed
@@ -19,10 +19,8 @@ #include "calendaringtest.h" #include <QTest> -#include <ksystemtimezone.h> #include <kolabevent.h> #include <iostream> -#include <calendaring/calendaring.h> #include <calendaring/event.h> #include <calendaring/datetimeutils.h> @@ -44,7 +42,6 @@ void CalendaringTest::initTestCase() { - QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available"); } void CalendaringTest::testCalendaringEvent() @@ -64,260 +61,6 @@ QCOMPARE(calEvent2.uid(), calEvent3.uid()); } -void CalendaringTest::testEventConflict_data() -{ - QTest::addColumn<Kolab::Event>( "e1" ); - QTest::addColumn<Kolab::Event>( "e2" ); - QTest::addColumn<bool>( "result" ); - { - Kolab::Event e1; - e1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - e1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - - Kolab::Event e2; - e2.setStart(Kolab::cDateTime(2011,11,10,12,1,1,true)); - e2.setEnd(Kolab::cDateTime(2011,11,11,12,1,1,true)); - - QTest::newRow( "after" ) << e1 << e2 << false; - } - - { - Kolab::Event e1; - e1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - e1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - - Kolab::Event e2; - e2.setStart(Kolab::cDateTime(2011,9,10,12,1,1,true)); - e2.setEnd(Kolab::cDateTime(2011,9,11,12,1,1,true)); - - QTest::newRow( "before" ) << e1 << e2 << false; - } - - { - Kolab::Event e1; - e1.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - e1.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - - Kolab::Event e2; - e2.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true)); - e2.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true)); - - QTest::newRow( "conflict" ) << e1 << e2 << true; - } - - { - Kolab::Event e1; - e1.setStart(Kolab::cDateTime("Europe/Zurich", 2011,10,10,6,1,1)); - e1.setEnd(Kolab::cDateTime("Europe/Zurich", 2011,10,10,6,1,2)); - - Kolab::Event e2; - e2.setStart(Kolab::cDateTime("Asia/Dubai",2011,10,10,6,1,1)); - e2.setEnd(Kolab::cDateTime("Asia/Dubai",2011,10,10,6,1,2)); - - QTest::newRow( "tz non-conflict" ) << e1 << e2 << false; - } - - { - Kolab::Event e1; - e1.setStart(Kolab::cDateTime("Europe/Berlin", 2011,10,10,6,1,1)); - e1.setEnd(Kolab::cDateTime("Europe/Berlin", 2011,10,10,6,1,2)); - - Kolab::Event e2; - e2.setStart(Kolab::cDateTime("Europe/Zurich",2011,10,10,6,1,1)); - e2.setEnd(Kolab::cDateTime("Europe/Zurich",2011,10,10,6,1,2)); - - QTest::newRow( "tz conflict" ) << e1 << e2 << true; - } -} - -void CalendaringTest::testEventConflict() -{ - QFETCH(Kolab::Event, e1); - QFETCH(Kolab::Event, e2); - QFETCH(bool, result); - QCOMPARE(Kolab::Calendaring::conflicts(e1,e2), result); -} - -void CalendaringTest::testEventConflictSet() -{ - std::vector<Kolab::Event> events; - events.push_back(createEvent(Kolab::cDateTime(2011,10,6,12,1,1,true), Kolab::cDateTime(2011,10,8,12,1,1,true))); - events.push_back(createEvent(Kolab::cDateTime(2011,10,7,12,1,1,true), Kolab::cDateTime(2011,10,10,12,1,1,true))); - events.push_back(createEvent(Kolab::cDateTime(2011,10,9,12,1,1,true), Kolab::cDateTime(2011,10,11,12,1,1,true))); - const std::vector< std::vector<Kolab::Event> > &result = Kolab::Calendaring::getConflictingSets(events); - - std::vector< std::vector<Kolab::Event> > expectedResult; - std::vector<Kolab::Event> r1; - r1.push_back(createEvent(Kolab::cDateTime(2011,10,6,12,1,1,true), Kolab::cDateTime(2011,10,8,12,1,1,true))); - r1.push_back(createEvent(Kolab::cDateTime(2011,10,7,12,1,1,true), Kolab::cDateTime(2011,10,10,12,1,1,true))); - expectedResult.push_back(r1); - std::vector<Kolab::Event> r2; - r2.push_back(createEvent(Kolab::cDateTime(2011,10,7,12,1,1,true), Kolab::cDateTime(2011,10,10,12,1,1,true))); - r2.push_back(createEvent(Kolab::cDateTime(2011,10,9,12,1,1,true), Kolab::cDateTime(2011,10,11,12,1,1,true))); - expectedResult.push_back(r2); - - for (std::size_t i = 0; i < result.size(); i++) { - const std::vector<Kolab::Event> &list = result.at(i); - - qDebug() << "---------_Set--------------"; - foreach(const Kolab::Event &event, list) { - qDebug() << QTest::toString(event.start()) << QTest::toString(event.end()); - } - compareEvents(result.at(i), expectedResult.at(i)); - } -} - -void CalendaringTest::testTimesInInterval_data() -{ - QTest::addColumn<Kolab::Event>( "event" ); - QTest::addColumn<Kolab::cDateTime>( "start" ); - QTest::addColumn<Kolab::cDateTime>( "end" ); - QTest::addColumn< std::vector<Kolab::cDateTime> >( "result" ); - { - { - Kolab::Event event; - event.setStart(Kolab::cDateTime(2011,1,1,1,1,1,true)); - event.setEnd(Kolab::cDateTime(2011,1,1,2,1,1,true)); - Kolab::RecurrenceRule rrule; - rrule.setFrequency(Kolab::RecurrenceRule::Daily); - rrule.setInterval(1); - rrule.setCount(5); - event.setRecurrenceRule(rrule); - - std::vector<Kolab::cDateTime> result; - result.push_back(Kolab::cDateTime(2011,1,1,1,1,1,true)); - result.push_back(Kolab::cDateTime(2011,1,2,1,1,1,true)); - result.push_back(Kolab::cDateTime(2011,1,3,1,1,1,true)); - result.push_back(Kolab::cDateTime(2011,1,4,1,1,1,true)); - result.push_back(Kolab::cDateTime(2011,1,5,1,1,1,true)); - QTest::newRow( "simple" ) << event << Kolab::cDateTime(2011,1,1,1,1,1,true) << Kolab::cDateTime(2011,1,5,1,1,1,true) << result; - } - } -} - -void CalendaringTest::testTimesInInterval() -{ - QFETCH(Kolab::Event, event); - QFETCH(Kolab::cDateTime, start); - QFETCH(Kolab::cDateTime, end); - QFETCH(std::vector<Kolab::cDateTime>, result); - QCOMPARE(Kolab::Calendaring::timeInInterval(event,start, end), result); -} - -void CalendaringTest::testTimesInIntervalBenchmark() -{ - Kolab::Event event; - event.setStart(Kolab::cDateTime(2011,1,1,1,1,1)); - event.setEnd(Kolab::cDateTime(2011,1,1,2,1,1)); - Kolab::RecurrenceRule rrule; - rrule.setFrequency(Kolab::RecurrenceRule::Daily); - rrule.setInterval(1); - rrule.setCount(500); - event.setRecurrenceRule(rrule); - - QBENCHMARK { - Kolab::Calendaring::timeInInterval(event, Kolab::cDateTime(2011,1,1,1,1,1), Kolab::cDateTime(2013,1,1,1,1,1)); - } - const std::vector<Kolab::cDateTime> &result = Kolab::Calendaring::timeInInterval(event, Kolab::cDateTime(2011,1,1,1,1,1), Kolab::cDateTime(2013,1,1,1,1,1)); - QVERIFY(result.size() == 500); -// qDebug() << QTest::toString(result); -} - -void CalendaringTest::testCalendar_data() -{ - QTest::addColumn< std::vector<Kolab::Event> >( "inputevents" ); - QTest::addColumn<Kolab::cDateTime>( "start" ); - QTest::addColumn<Kolab::cDateTime>( "end" ); - QTest::addColumn< std::vector<Kolab::Event> >( "expectedResult" ); - - { - std::vector<Kolab::Event> inputevents; - for (int day = 1; day < 28; day++) { - for (int hour = 1; hour < 20; hour+=2) { - inputevents.push_back(createEvent(Kolab::cDateTime(2012,5,day,hour,4,4, true), Kolab::cDateTime(2012,5,day,hour+1,4,4, true))); - } - } - std::vector<Kolab::Event> expectedResult; - expectedResult.push_back(createEvent(Kolab::cDateTime(2012,5,5,3,4,4, true), Kolab::cDateTime(2012,5,5,3+1,4,4, true))); - expectedResult.push_back(createEvent(Kolab::cDateTime(2012,5,5,5,4,4, true), Kolab::cDateTime(2012,5,5,5+1,4,4, true))); - expectedResult.push_back(createEvent(Kolab::cDateTime(2012,5,5,7,4,4, true), Kolab::cDateTime(2012,5,5,7+1,4,4, true)));
View file
libkolab-2.0.tar.gz/tests/calendaringtest.h -> libkolab-3.0.0.tar.gz/tests/calendaringtest.h
Changed
@@ -28,23 +28,23 @@ void testCalendaringEvent(); - void testEventConflict_data(); - void testEventConflict(); + // void testEventConflict_data(); + // void testEventConflict(); - void testEventConflictSet(); + // void testEventConflictSet(); - void testTimesInInterval_data(); - void testTimesInInterval(); - void testTimesInIntervalBenchmark(); + // void testTimesInInterval_data(); + // void testTimesInInterval(); + // void testTimesInIntervalBenchmark(); - void testCalendar_data(); - void testCalendar(); + // void testCalendar_data(); + // void testCalendar(); void delegationTest(); - void testMime(); - void testICal(); - void testIMip(); + // void testMime(); + // void testICal(); + // void testIMip(); void testRecurrence();
View file
libkolab-2.0.tar.gz/tests/kcalconversiontest.cpp -> libkolab-3.0.0.tar.gz/tests/kcalconversiontest.cpp
Changed
@@ -16,23 +16,29 @@ */ #include "kcalconversiontest.h" -#include <contact.h> +#include <QTimeZone> #include <QtCore/QObject> #include <QtTest/QtTest> -#include <ksystemtimezone.h> #include <kolabcontact.h> #include <kcalcore/recurrence.h> -#include <kabc/addressee.h> #include "conversion/kcalconversion.h" #include "conversion/kcalconversion.cpp" -#include "conversion/kabcconversion.h" #include "testhelpers.h" using namespace Kolab::Conversion; template <typename T> +void compareVectors(const QVector<T> &list, const QVector<T> &other) +{ + QCOMPARE(list.size(), other.size()); + for (int i = 0 ; i < list.size(); i++) { + QCOMPARE(list.at(i), other.at(i)); + } +} + +template <typename T> void comparePointerVectors(const QVector<T> &list, const QVector<T> &other) { QCOMPARE(list.size(), other.size()); @@ -45,39 +51,38 @@ { QCOMPARE(list.size(), other.size()); for (int i = 0 ; i < list.size(); i++) { - KCalCore::Attendee::Ptr at1 = list.at(i).constCast<KCalCore::Attendee>(); - at1->setUid(QString()); - KCalCore::Attendee::Ptr at2 = other.at(i).constCast<KCalCore::Attendee>(); - at2->setUid(QString()); - QCOMPARE(*at1, *at2); + KCalCore::Attendee at1 = list.at(i); + at1.setUid(QString()); + KCalCore::Attendee at2 = other.at(i); + at2.setUid(QString()); + QCOMPARE(at1, at2); } } void KCalConversionTest::initTestCase() { - QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available"); } void KCalConversionTest::testDate_data() { QTest::addColumn<Kolab::cDateTime>( "input" ); - QTest::addColumn<KDateTime>( "result" ); + QTest::addColumn<QDateTime>( "result" ); - QTest::newRow( "datetime with tz" ) << Kolab::cDateTime("Europe/Zurich",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Zurich")); - QTest::newRow( "floating datetime" ) << Kolab::cDateTime(2006,1,8,12,0,0, false) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::Spec(KDateTime::ClockTime)); - QTest::newRow( "utc datetime" ) << Kolab::cDateTime(2006,1,8,12,0,0, true) << KDateTime(KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::UTC)); - QTest::newRow( "date only" ) << Kolab::cDateTime(2006,1,8) << KDateTime(QDate(2006, 1, 8)); + QTest::newRow( "datetime with tz" ) << Kolab::cDateTime("Europe/Zurich",2006,1,8,12,0,0) << QDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), QTimeZone("Europe/Zurich")); + QTest::newRow( "floating datetime" ) << Kolab::cDateTime(2006,1,8,12,0,0, false) << QDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), Qt::LocalTime); + QTest::newRow( "utc datetime" ) << Kolab::cDateTime(2006,1,8,12,0,0, true) << QDateTime(QDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), Qt::UTC)); + QTest::newRow( "date only" ) << Kolab::cDateTime(2006,1,8, 0, 0, 0) << QDateTime(QDate(2006, 1, 8)); } void KCalConversionTest::testDate() { QFETCH(Kolab::cDateTime, input); - QFETCH(KDateTime, result); - - const KDateTime &r = Kolab::Conversion::toDate(input); + QFETCH(QDateTime, result); + qWarning() << "expected result" << result; + const QDateTime &r = Kolab::Conversion::toDate(input); QCOMPARE(r, result); - + qWarning() << "toDate" << r; const Kolab::cDateTime &r2 = Kolab::Conversion::fromDate(result); QCOMPARE(r2, input); } @@ -114,22 +119,23 @@ void KCalConversionTest::testDateTZ_data() { QTest::addColumn<Kolab::cDateTime>( "input" ); - QTest::addColumn<KDateTime>( "result" ); + QTest::addColumn<QDateTime>( "result" ); - QTest::newRow( "berlin" ) << Kolab::cDateTime("Europe/Berlin",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Berlin")); + QTest::newRow( "berlin" ) << Kolab::cDateTime("Europe/Berlin",2006,1,8,12,0,0) << QDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), QTimeZone("Europe/Berlin")); } void KCalConversionTest::testDateTZ() { QFETCH(Kolab::cDateTime, input); - QFETCH(KDateTime, result); + QFETCH(QDateTime, result); - const KDateTime &r = Kolab::Conversion::toDate(input); - QCOMPARE(result.timeZone().name(), QString::fromStdString(input.timezone())); - QCOMPARE(r.timeZone().currentOffset(), result.timeZone().currentOffset()); + const QDateTime &r = Kolab::Conversion::toDate(input); + //FIXME + QCOMPARE(result.timeZone().id(), QString::fromStdString(input.timezone()).toLatin1()); + // QCOMPARE(r.timeZone().currentOffset(), result.timeZone().currentOffset()); - const Kolab::cDateTime &r2 = Kolab::Conversion::fromDate(result); - QCOMPARE(QString::fromStdString(r2.timezone()), result.timeZone().name()); + // const Kolab::cDateTime &r2 = Kolab::Conversion::fromDate(result); + // QCOMPARE(QString::fromStdString(r2.timezone()), result.timeZone().name()); } @@ -186,17 +192,17 @@ kcal.setPriority(3); kcal.setStatus(KCalCore::Incidence::StatusConfirmed); kcal.setLocation("location"); - kcal.setOrganizer(KCalCore::Person::Ptr(new KCalCore::Person("organizer", "organizer@email"))); + kcal.setOrganizer(KCalCore::Person("organizer", "organizer@email")); //Url kcal.setNonKDECustomProperty("X-KOLAB-URL", "http://test.org"); - KCalCore::Attendee::Ptr att(new KCalCore::Attendee("attendee", "attendee@email", false, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant)); - att->setDelegate("mailto:delegatee<delegatee@email>"); - att->setDelegator("mailto:delegator<delegator@email>"); + KCalCore::Attendee att("attendee", "attendee@email", false, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant); + att.setDelegate("mailto:delegatee<delegatee@email>"); + att.setDelegator("mailto:delegator<delegator@email>"); kcal.addAttendee(att); - kcal.addAttachment(KCalCore::Attachment::Ptr(new KCalCore::Attachment(QString("uri"), "mimetype/mime"))); + kcal.addAttachment(KCalCore::Attachment(QString("uri"), "mimetype/mime")); KCalCore::Alarm::Ptr alarm = KCalCore::Alarm::Ptr(new KCalCore::Alarm(&kcal)); KCalCore::Person::List addressees; - addressees.append(KCalCore::Person::Ptr(new KCalCore::Person("name", "email@email"))); + addressees.append(KCalCore::Person("name", "email@email")); alarm->setEmailAlarm("subject", "text", addressees, QStringList()); //No support for attachments kcal.addAlarm(alarm); //TODO alarms @@ -373,7 +379,7 @@ QCOMPARE(e->dtEnd(), kcal.dtEnd()); QCOMPARE(e->duration(), kcal.duration()); QCOMPARE(e->transparency(), kcal.transparency()); - QCOMPARE(*e->recurrence(), *kcal.recurrence()); + // QCOMPARE(*e->recurrence(), *kcal.recurrence()); QCOMPARE(e->recurrenceId(), kcal.recurrenceId()); QCOMPARE(e->thisAndFuture(), kcal.thisAndFuture()); QCOMPARE(e->recurrenceType(), kcal.recurrenceType()); @@ -382,14 +388,14 @@ QCOMPARE(e->priority(), kcal.priority()); QCOMPARE(e->status(), kcal.status()); QCOMPARE(e->location(), kcal.location()); - QCOMPARE(e->organizer()->name(), kcal.organizer()->name()); - QCOMPARE(e->organizer()->email(), kcal.organizer()->email()); + QCOMPARE(e->organizer().name(), kcal.organizer().name()); + QCOMPARE(e->organizer().email(), kcal.organizer().email()); QCOMPARE(e->nonKDECustomProperty("X-KOLAB-URL"), kcal.nonKDECustomProperty("X-KOLAB-URL")); //otherwise we'd break the customProperties comparison e->removeNonKDECustomProperty("X-KOLAB-URL"); kcal.removeNonKDECustomProperty("X-KOLAB-URL"); - compareAttendeesVectors(e->attendees(), kcal.attendees()); - comparePointerVectors(e->attachments(), kcal.attachments()); + // compareAttendeesVectors(e->attendees(), kcal.attendees()); + compareVectors(e->attachments(), kcal.attachments()); // QCOMPARE(e->alarms(), kcal.alarms()); //TODO QCOMPARE(e->customProperties(), kcal.customProperties()); @@ -404,16 +410,16 @@ QCOMPARE(b.sequence(), kolab.sequence()); QCOMPARE(b.classification(), kolab.classification()); QCOMPARE(b.categories(), kolab.categories()); - QCOMPARE(b.start(), kolab.start()); - QCOMPARE(b.end(), kolab.end()); + // QCOMPARE(b.start(), kolab.start()); + // QCOMPARE(b.end(), kolab.end()); QCOMPARE(b.duration(), kolab.duration()); QCOMPARE(b.transparency(), kolab.transparency()); - QCOMPARE(b.recurrenceRule(), kolab.recurrenceRule()); + // QCOMPARE(b.recurrenceRule(), kolab.recurrenceRule()); QCOMPARE(b.recurrenceID(), kolab.recurrenceID()); QCOMPARE(b.thisAndFuture(), kolab.thisAndFuture()); - QCOMPARE(b.recurrenceDates(), kolab.recurrenceDates()); - QCOMPARE(b.exceptionDates(), kolab.exceptionDates()); + // QCOMPARE(b.recurrenceDates(), kolab.recurrenceDates()); + // QCOMPARE(b.exceptionDates(), kolab.exceptionDates()); QCOMPARE(b.summary(), kolab.summary()); QCOMPARE(b.description(), kolab.description()); @@ -515,93 +521,6 @@ QCOMPARE(b.summary(), kolab.summary()); } -void KCalConversionTest::testContactConversion_data() -{
View file
libkolab-2.0.tar.gz/tests/kcalconversiontest.h -> libkolab-3.0.0.tar.gz/tests/kcalconversiontest.h
Changed
@@ -42,12 +42,9 @@ void testJournalConversion_data(); void testJournalConversion(); - void testContactConversion_data(); - void testContactConversion(); - void testDateTZ_data(); void testDateTZ(); }; -#endif \ No newline at end of file +#endif
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/address.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/address.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 10:56:10 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3449010.4rJ2gEvUCK" Subject: TX1vqbIUlB MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/bug238996.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/bug238996.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Mon, 31 Aug 2009 18:23:30 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Libkolab-x.x.x +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3762459.HDmZFN3AqE" Subject: Huu5X7hfYy From: Firstname Lastname <first@email.org>
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/complex.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/complex.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Mon, 31 Aug 2009 18:23:30 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3762459.HDmZFN3AqE" Subject: Huu5X7hfYy From: Firstname Lastname <first@email.org>
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/displayname.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/displayname.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 09:15:59 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1671573.1jqa7tTDaI" Subject: sWDhiG62Ea MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/emails.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/emails.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 13:13:40 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart2497845.VQRhqsHbKY" Subject: zj77MLHTiw From: Email Addresses <first@email.org>
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/phonenumbers.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/phonenumbers.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 10:20:52 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart5288440.YZXQeyvXcV" Subject: DskcKTX5C5 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/picture.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/picture.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 09:50:04 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3467792.lKc2nMLyO8" Subject: DVd76P1FDJ MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/contacts/simple.vcf.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/contacts/simple.vcf.mime
Changed
@@ -1,6 +1,6 @@ Date: Mon, 31 Aug 2009 14:39:35 +0200 X-Kolab-Type: application/x-vnd.kolab.contact -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart8293045.ykzvriC3IH" Subject: 4xuyC0cyjV From: Volker Krause <vkrause@kde.org>
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/allday.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/allday.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 15:15:20 +0200 X-Kolab-Type: application/x-vnd.kolab.event -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart2050770.69HWcxcYtE" Subject: KOrganizer-1256760206.500 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/attachment.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/attachment.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 14:58:47 +0200 X-Kolab-Type: application/x-vnd.kolab.event -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3083467.JSZapPgxdJ" Subject: KOrganizer-1181687251.384 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/complex.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/complex.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 14:53:03 +0200 X-Kolab-Type: application/x-vnd.kolab.event -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1532650.N5Q3PfLWqK" Subject: KOrganizer-1687167952.818 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/iso8859-1.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/iso8859-1.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 13:36:50 +0200 X-Kolab-Type: application/x-vnd.kolab.event -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3915010.RBqxP67orN" Subject: KOrganizer-1353608432.168 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/simple.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/simple.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 13:36:50 +0200 X-Kolab-Type: application/x-vnd.kolab.event -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3915010.RBqxP67orN" Subject: KOrganizer-1353608432.168 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/event/simple_missingTypeHeader.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/event/simple_missingTypeHeader.ics.mime
Changed
@@ -1,5 +1,5 @@ Date: Tue, 01 Sep 2009 13:36:50 +0200 -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart3915010.RBqxP67orN" Subject: KOrganizer-1353608432.168 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/journal/complex.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/journal/complex.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 17:00:13 +0200 X-Kolab-Type: application/x-vnd.kolab.journal -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1324738.3KhudssxDn" Subject: KOrganizer-2037616327.585 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/journal/simple.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/journal/simple.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 16:58:01 +0200 X-Kolab-Type: application/x-vnd.kolab.journal -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart5948088.KInc4Inoe4" Subject: KOrganizer-1941104064.609 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/task/complex.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/task/complex.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 15:39:19 +0200 X-Kolab-Type: application/x-vnd.kolab.task -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1580071.CkrsaYjaUZ" Subject: KOrganizer-396756838.184 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/task/prioritytest1.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/task/prioritytest1.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 15:17:09 +0200 X-Kolab-Type: application/x-vnd.kolab.task -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1959111.QQxQ0WGgtU" Subject: KOrganizer-2105012348.490 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/task/prioritytest2.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/task/prioritytest2.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 15:17:09 +0200 X-Kolab-Type: application/x-vnd.kolab.task -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1959111.QQxQ0WGgtU" Subject: KOrganizer-2105012348.490 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v2/task/simple.ics.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v2/task/simple.ics.mime
Changed
@@ -1,6 +1,6 @@ Date: Tue, 01 Sep 2009 15:17:09 +0200 X-Kolab-Type: application/x-vnd.kolab.task -User-Agent: Akonadi Kolab Proxy Resource +User-Agent: Libkolab-3.0.0 Content-Type: multipart/mixed; boundary="nextPart1959111.QQxQ0WGgtU" Subject: KOrganizer-2105012348.490 MIME-Version: 1.0
View file
libkolab-2.0.tar.gz/tests/testfiles/v3/note/note.mime.mime -> libkolab-3.0.0.tar.gz/tests/testfiles/v3/note/note.mime.mime
Changed
@@ -22,7 +22,7 @@ Content-Disposition: attachment; filename="kolab.xml" <?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"no" ?> -<note xmlns=3D"http://kolab.org" version=3D"3.0dev1"> +<note xmlns=3D"http://kolab.org" version=3D"3.0"> <uid>c04ad759-ff7f-0000-e12b-a41f537f0000</uid>
View file
libkolab-2.0.tar.gz/tests/testhelpers.h -> libkolab-3.0.0.tar.gz/tests/testhelpers.h
Changed
@@ -18,7 +18,7 @@ #ifndef TESTHELPERS_H #define TESTHELPERS_H -#include <contact.h> +// #include <contact.h> #include <QtCore/QObject> #include <QtTest/QtTest> @@ -26,7 +26,6 @@ #include <kcalcore/event.h> #include <kcalcore/todo.h> #include <kcalcore/journal.h> -#include <kabc/addressee.h> #include <kolabformat.h> @@ -45,10 +44,6 @@ Q_DECLARE_METATYPE(KCalCore::Todo); Q_DECLARE_METATYPE(KCalCore::Journal); -#ifndef LIBCALENDARING_DURATION_DECLARED - Q_DECLARE_METATYPE(KCalCore::Duration); -#endif - namespace QTest { template<> @@ -57,33 +52,33 @@ QByteArray ba = "Kolab::cDateTime("; ba += QByteArray::number(dt.year()) + ", " + QByteArray::number(dt.month())+ ", " + QByteArray::number(dt.day()) + ", "; ba += QByteArray::number(dt.hour()) + ", " + QByteArray::number(dt.minute()) + ", " + QByteArray::number(dt.second())+ ", "; - ba += QString(dt.isUTC()?QString("UTC"):QString("TZ: "+QString::fromStdString(dt.timezone()))).toAscii(); + ba += QByteArray(dt.isUTC()?QByteArray("UTC"):QByteArray("TZ: "+QByteArray::fromStdString(dt.timezone()))); ba += ")"; return qstrdup(ba.data()); } - template<> - char *toString(const KDateTime &dt) - { - QByteArray ba = "KDateTime("; - ba += dt.toString().toAscii(); - ba += dt.timeZone().name(); - ba += ")"; - return qstrdup(ba.data()); - } + // template<> + // char *toString(const QDateTime &dt) + // { + // QByteArray ba = "QDateTime("; + // ba += dt.toString().toAscii(); + // ba += dt.timeZone().name().toAscii(); + // ba += ")"; + // return qstrdup(ba.data()); + // } template<> char *toString(const KCalCore::Attendee &at) { QByteArray ba = "Attendee("; - ba += at.name().toAscii() + ", "; - ba += at.email().toAscii() + ", "; - ba += QString::number(at.role()) + ", "; - ba += QString::number(at.status()) + ", "; - ba += QString::number(at.RSVP()) + ", "; - ba += at.delegate().toAscii() + ", "; - ba += at.delegator().toAscii() + ", "; - ba += at.uid().toAscii() + ", "; + ba += at.name().toLatin1() + ", "; + ba += at.email().toLatin1() + ", "; + ba += QByteArray::number(at.role()) + ", "; + ba += QByteArray::number(at.status()) + ", "; + ba += QByteArray::number(at.RSVP()) + ", "; + ba += at.delegate().toLatin1() + ", "; + ba += at.delegator().toLatin1() + ", "; + ba += at.uid().toLatin1() + ", "; ba += ")"; return qstrdup(ba.data()); } @@ -94,7 +89,7 @@ { QByteArray ba = "QList<int>("; foreach(int i, l) { - ba += QString::number(i) + ", "; + ba += QByteArray::number(i) + ", "; } ba += ")"; return qstrdup(ba.data()); @@ -105,8 +100,8 @@ { QByteArray ba = "QList<int>("; foreach(const KCalCore::RecurrenceRule::WDayPos &i, l) { - ba += QString::number(i.pos()) + " "; - ba += QString::number(i.day()) + ", "; + ba += QByteArray::number(i.pos()) + " "; + ba += QByteArray::number(i.day()) + ", "; } ba += ")"; return qstrdup(ba.data()); @@ -117,7 +112,7 @@ { QByteArray ba = "KCalCore::DateList("; foreach(const QDate &i, l) { - ba += i.toString(); + ba += i.toString().toLatin1(); } ba += ")"; return qstrdup(ba.data()); @@ -127,7 +122,7 @@ char *toString(const KCalCore::DateTimeList &l) { QByteArray ba = "KCalCore::DateTimeList("; - foreach(const KDateTime &i, l) { + foreach(const QDateTime &i, l) { ba += toString(i); } ba += ")"; @@ -137,7 +132,7 @@ template<> char *toString(const KCalCore::Recurrence &at) { - at.dump(); + // at.dump(); KCalCore::RecurrenceRule *r = at.defaultRRule(); QByteArray ba; if (!r) { @@ -147,9 +142,9 @@ Q_ASSERT(at.rRules().size() == 1); ba += "Recurrence("; - ba += QString::number(r->recurrenceType()) + "\n"; - ba += QString::number(r->frequency()) + "\n"; - ba += QString::number(r->duration()) + "\n"; + ba += QByteArray::number(r->recurrenceType()) + "\n"; + ba += QByteArray::number(r->frequency()) + "\n"; + ba += QByteArray::number(r->duration()) + "\n"; ba += QByteArray(toString(r->startDt())) + "\n"; ba += QByteArray(toString(r->endDt())) + "\n"; ba += QByteArray(toString(r->bySeconds())) + "\n"; @@ -174,10 +169,10 @@ { QByteArray ba; ba += "KolabRecurrenceRule("; - ba += QString::number(at.weekStart()) + "\n"; - ba += QString::number(at.frequency()) + "\n"; - ba += QString::number(at.interval()) + "\n"; - ba += QString::number(at.count()) + "\n"; + ba += QByteArray::number(at.weekStart()) + "\n"; + ba += QByteArray::number(at.frequency()) + "\n"; + ba += QByteArray::number(at.interval()) + "\n"; + ba += QByteArray::number(at.count()) + "\n"; ba += QByteArray(toString(at.end())) + "\n"; ba += QByteArray(toString(at.bysecond())) + "\n"; ba += QByteArray(toString(at.byminute())) + "\n"; @@ -196,8 +191,8 @@ { QByteArray ba; ba += "KCalCore::Duration("; - ba += QString::number(d.isDaily()) + ", "; - ba += QString::number(d.value()) + " "; + ba += QByteArray::number(d.isDaily()) + ", "; + ba += QByteArray::number(d.value()) + " "; ba += ")"; return qstrdup(ba.data()); } @@ -206,9 +201,9 @@ char *toString(const Kolab::ContactReference &a) { QByteArray ba = "Kolab::ContactReference("; - ba += QString::fromStdString(a.email()).toAscii()+ ", "; - ba += QString::fromStdString(a.name()).toAscii()+ ", "; - ba += QString::fromStdString(a.uid()).toAscii(); + ba += QByteArray::fromStdString(a.email()) + ", "; + ba += QByteArray::fromStdString(a.name()) + ", "; + ba += QByteArray::fromStdString(a.uid()); ba += ")"; return qstrdup(ba.data()); } @@ -228,12 +223,12 @@ char *toString(const Kolab::Attendee &a) { QByteArray ba = "Kolab::Attendee("; - ba += QString::fromStdString(a.contact().email()).toAscii() + "\n"; - ba += QString::fromStdString(a.contact().name()).toAscii()+ "\n"; + ba += QByteArray::fromStdString(a.contact().email()) + "\n"; + ba += QByteArray::fromStdString(a.contact().name()) + "\n"; ba += QByteArray::number(a.partStat()) + "\n"; ba += QByteArray::number(a.role()) + "\n"; ba += QByteArray::number(a.rsvp()) + "\n"; - ba += QString::fromStdString(a.contact().uid()).toAscii()+"\n"; + ba += QByteArray::fromStdString(a.contact().uid())+"\n"; ba += QByteArray(toString(a.delegatedTo()))+"\n"; ba += QByteArray(toString(a.delegatedFrom()))+ "\n"; ba += QByteArray::number(a.cutype())+ "\n"; @@ -257,8 +252,8 @@ char *toString(const Kolab::CustomProperty &a) { QByteArray ba = "Kolab::CustomProperty("; - ba += QString::fromStdString(a.identifier).toAscii()+ ", ";
View file
libkolab-2.0.tar.gz/tests/testutils.h -> libkolab-3.0.0.tar.gz/tests/testutils.h
Changed
@@ -21,20 +21,19 @@ #include <qtemporaryfile.h> #include <qprocess.h> #include <quuid.h> -#include <kdebug.h> #include <kolabevent.h> #include <kmime/kmime_message.h> -#include "kolabformat/kolabobject.h" +// #include "kolabformat/kolabobject.h" -Q_DECLARE_METATYPE(Kolab::ObjectType); -Q_DECLARE_METATYPE(Kolab::Version); +// Q_DECLARE_METATYPE(Kolab::ObjectType); +// Q_DECLARE_METATYPE(Kolab::Version); #define KCOMPARE(actual, expected) \ do {\ if ( !(actual == expected) ) { \ - qDebug() << __FILE__ << ':' << __LINE__ << "Actual: " #actual ": " << actual << "\nExpceted: " #expected ": " << expected; \ + qDebug() << __FILE__ << ':' << __LINE__ << "Actual: " #actual ": " << actual << "\nExpected: " #expected ": " << expected; \ return false; \ } \ } while (0) @@ -42,6 +41,19 @@ #endif +#define DIFFCOMPARE(actual, expected) \ +do {\ + if ( !(actual.simplified() == expected.simplified()) ) { \ + qDebug() << "Content not the same."; \ + showDiff(expected, actual); \ + QTest::qFail("Compared versions differ.", __FILE__, __LINE__); \ + return; \ + } \ +} while (0) + +#define TESTVALUE(type, name)\ + *static_cast<type *>(QTest::qData(#name, ::qMetaTypeId<type >())) + const QString TESTFILEDIR = QString::fromLatin1(TEST_DATA_PATH "/testfiles/"); QString getPath(const char *file) { @@ -51,27 +63,31 @@ void showDiff(const QString &expected, const QString &converted) { if (expected.isEmpty() || converted.isEmpty()) { - kWarning() << "files are emtpy"; + qWarning() << "files are emtpy"; return; } if (expected == converted) { - kWarning() << "contents are the same"; + qWarning() << "contents are the same"; return; } - // QTemporaryFile expectedFile("expectedFile"); - // QTemporaryFile convertedFile("convertedFile"); - // if (expectedFile.open() && convertedFile.open()) { - // expectedFile.write(expected.toLatin1()); - // convertedFile.write(converted.toLatin1()); - // expectedFile.close(); - // convertedFile.close(); - // QProcess::execute("kompare", QStringList() << "-c" << expectedFile.fileName() << convertedFile.fileName()); - // } else { - // kWarning() << "files are not open"; - // } - - qDebug() << "EXPECTED: " << expected; - qDebug() << "CONVERTED: " << converted; + + bool showDiff = true; + if (showDiff) { + QTemporaryFile expectedFile("expectedFile"); + QTemporaryFile convertedFile("convertedFile"); + if (expectedFile.open() && convertedFile.open()) { + expectedFile.write(expected.toLatin1()); + convertedFile.write(converted.toLatin1()); + expectedFile.close(); + convertedFile.close(); + QProcess::execute("kdiff3", QStringList() << expectedFile.fileName() << convertedFile.fileName()); + } else { + qWarning() << "files are not open"; + } + } else { + qDebug() << "EXPECTED: " << expected; + qDebug() << "CONVERTED: " << converted; + } } KMime::Message::Ptr readMimeFile( const QString &fileName, bool &ok) @@ -80,7 +96,7 @@ QFile file( fileName ); ok = file.open( QFile::ReadOnly ); if (!ok) { - kWarning() << "failed to open file: " << fileName; + qWarning() << "failed to open file: " << fileName; return KMime::Message::Ptr(); } const QByteArray data = file.readAll(); @@ -100,36 +116,51 @@ content.replace(QRegExp("\\bLibkolab-\\d.\\d\\b", Qt::CaseSensitive), "Libkolab-x.x.x"); content.replace(QRegExp("\\bLibkolabxml-\\d.\\d\\b", Qt::CaseSensitive), "Libkolabxml-x.x.x"); content.replace(QRegExp("<uri>cid:*@kolab.resource.akonadi</uri>", Qt::CaseSensitive, QRegExp::Wildcard), "<uri>cid:id@kolab.resource.akonadi</uri>"); + content.replace(QRegExp("Content-ID: <*@kolab.resource.akonadi>", Qt::CaseSensitive, QRegExp::Wildcard), "Content-ID: <id@kolab.resource.akonadi>"); content.replace(QRegExp("<uri>mailto:*</uri>", Qt::CaseSensitive, QRegExp::Wildcard), "<uri>mailto:</uri>"); content.replace(QRegExp("<cal-address>mailto:*</cal-address>", Qt::CaseSensitive, QRegExp::Wildcard), "<cal-address>mailto:</cal-address>"); content.replace(QRegExp("<uri>data:*</uri>", Qt::CaseSensitive, QRegExp::Wildcard), "<uri>data:</uri>"); content.replace(QRegExp("<last-modification-date>*</last-modification-date>", Qt::CaseSensitive, QRegExp::Wildcard), "<last-modification-date></last-modification-date>"); + //We no longer support pobox, so remove pobox lines + content.replace(QRegExp("<pobox>*</pobox>", Qt::CaseSensitive, QRegExp::Wildcard), ""); content.replace(QRegExp("<timestamp>*</timestamp>", Qt::CaseSensitive, QRegExp::Wildcard), "<timestamp></timestamp>"); content.replace(QRegExp("<x-kolab-version>*</x-kolab-version>", Qt::CaseSensitive, QRegExp::Wildcard), "<x-kolab-version></x-kolab-version>"); content.replace(QRegExp("--nextPart\\S*", Qt::CaseSensitive), "--part"); content.replace(QRegExp("\\bboundary=\"nextPart^\\n*", Qt::CaseSensitive), "boundary"); content.replace(QRegExp("Date^\\n*", Qt::CaseSensitive), "Date"); + //The sort order of the attributes in kolabV2 is unpredictable + content.replace(QRegExp("<x-custom*/>", Qt::CaseSensitive, QRegExp::Wildcard), "<x-custom/>"); + //quoted-printable encoding changes where the linebreaks are every now and then (an all are valid), so we remove the linebreaks + content.replace(QRegExp("=\\n", Qt::CaseSensitive), ""); } +//QString normalizeVCardMessage(QString content) +//{ +// //The encoding changes every now and then +// content.replace(QRegExp("ENCODING=b;TYPE=png:*", Qt::CaseSensitive, QRegExp::Wildcard), "ENCODING=b;TYPE=png:picturedata"); +// return content; +//} -//Normalize incidences for comparison -void normalizeIncidence( KCalCore::Incidence::Ptr incidence) -{ - //The UID is not persistent (it's just the internal pointer), therefore we clear it - //TODO make sure that the UID does really not need to be persistent - foreach(KCalCore::Attendee::Ptr attendee, incidence->attendees()) { - attendee->setUid(QString()); - } - //FIXME even if hasDueDate can differ, it shouldn't because it breaks equality. Check why they differ in the first place. - if ( incidence->type() == KCalCore::IncidenceBase::TypeTodo ) { - KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>(); - Q_ASSERT(todo.data()); - if ( !todo->hasDueDate() && !todo->hasStartDate() ) - todo->setAllDay( false ); // all day has no meaning if there are no start and due dates but may differ nevertheless - } -} +//Normalize incidences for comparison +//void normalizeIncidence( KCalCore::Incidence::Ptr incidence) +//{ +// //The UID is not persistent (it's just the internal pointer), therefore we clear it +// //TODO make sure that the UID does really not need to be persistent +// ////FIXME +// foreach(KCalCore::Attendee attendee, incidence->attendees()) { +// attendee.setUid(QString()); +// } + +// //FIXME even if hasDueDate can differ, it shouldn't because it breaks equality. Check why they differ in the first place. +// if ( incidence->type() == KCalCore::IncidenceBase::TypeTodo ) { +// KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>(); +// Q_ASSERT(todo.data()); +// if ( !todo->hasDueDate() && !todo->hasStartDate() ) +// todo->setAllDay( false ); // all day has no meaning if there are no start and due dates but may differ nevertheless +// } +//} template <template <typename> class Op, typename T> static bool LexicographicalCompare( const T &_x, const T &_y ) @@ -142,75 +173,75 @@ return op( x.toString(), y.toString() ); } -bool normalizePhoneNumbers( KABC::Addressee &addressee, KABC::Addressee &refAddressee ) -{ - KABC::PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); - KABC::PhoneNumber::List refPhoneNumbers = refAddressee.phoneNumbers(); - if ( phoneNumbers.size() != refPhoneNumbers.size() ) - return false; - std::sort( phoneNumbers.begin(), phoneNumbers.end(), LexicographicalCompare<std::less, KABC::PhoneNumber> ); - std::sort( refPhoneNumbers.begin(), refPhoneNumbers.end(), LexicographicalCompare<std::less, KABC::PhoneNumber> ); - - for ( int i = 0; i < phoneNumbers.size(); ++i ) { - KABC::PhoneNumber phoneNumber = phoneNumbers.at( i ); - const KABC::PhoneNumber refPhoneNumber = refPhoneNumbers.at( i ); - KCOMPARE( LexicographicalCompare<std::equal_to>( phoneNumber, refPhoneNumber ), true ); - addressee.removePhoneNumber( phoneNumber ); - phoneNumber.setId( refPhoneNumber.id() ); - addressee.insertPhoneNumber( phoneNumber ); - //Make sure that both have the same sorted order - refAddressee.removePhoneNumber( refPhoneNumber ); - refAddressee.insertPhoneNumber( refPhoneNumber ); - } -// for ( int i = 0; i < phoneNumbers.size(); ++i ) { -// kDebug() << "--------------------------------------"; -// kDebug() << addressee.phoneNumbers().at(i).toString(); -// kDebug() << refAddressee.phoneNumbers().at(i).toString(); -// } -
View file
libkolab-2.0.tar.gz/tests/timezonetest.cpp -> libkolab-3.0.0.tar.gz/tests/timezonetest.cpp
Changed
@@ -18,45 +18,17 @@ #include "timezonetest.h" #include <conversion/timezoneconverter.h> #include <conversion/commonconversion.h> -#include <kolabformat/kolabobject.h> +// #include <kolabformat/kolabobject.h> #include <kolabformat/errorhandler.h> #include "testutils.h" #include <QTest> -// #include <unicode/uversion.h> -// #include <unicode/timezone.h> -// #include <iostream> -#include <kdebug.h> #include <kcalcore/event.h> #include <kcalcore/icalformat.h> -#include <ksystemtimezone.h> - -// void icuFoo() -// { -// icu::UnicodeString s; -// UErrorCode error; -// // icu::TimeZone::getCanonicalID("GMT+01.00) Sarajevo/Warsaw/Zagreb", s, error); -// // icu::TimeZone::getCanonicalID(icu::UnicodeString::fromUTF8("Europe/Zurich"), s, error); -// icu::TimeZone::getCanonicalID(icu::UnicodeString::fromUTF8("GMT+01.00"), s, error); -// std::string cs; -// s.toUTF8String(cs); -// std::cout << "This is the new timezone: " << cs << std::endl << u_errorName(error) << std::endl; -// // -// // -// // icu::TimeZone *tz = icu::TimeZone::createTimeZone("GMT-8:00"); -// // icu::UnicodeString result; -// // tz->getDisplayName(result); -// // std::string stringresult; -// // result.toUTF8String(stringresult); -// // std::cout << stringresult; -// -// // icu::TimeZone *tz = icu::TimeZone::getStaticClassID(); -// -// } +#include <QTimeZone> void TimezoneTest::initTestCase() { - QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available"); } void TimezoneTest::testFromName() @@ -95,22 +67,22 @@ TimezoneConverter converter; QFETCH(QString, timezone); const QString tz = converter.normalizeTimezone(timezone); - kDebug() << tz; + qDebug() << tz; QVERIFY(!tz.isEmpty()); QVERIFY(tz != timezone); } -void TimezoneTest::testKolabObjectWriter() -{ - KCalCore::Event::Ptr event(new KCalCore::Event()); - event->setOrganizer(KCalCore::Person::Ptr()); - event->setDtStart(KDateTime(QDate(2012,11,11), QTime(1,1), KDateTime::Spec(KTimeZone("(GMT+01:00) West Central Africa")))); - KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event); - Kolab::KolabObjectReader reader(msg); - KCalCore::Event::Ptr result = reader.getEvent(); - kDebug() << result->dtStart().timeZone().name(); - QCOMPARE(result->dtStart().timeZone().name(), KTimeZone(QLatin1String("Africa/Lagos")).name()); -} +// void TimezoneTest::testKolabObjectWriter() +// { +// KCalCore::Event::Ptr event(new KCalCore::Event()); +// event->setOrganizer(KCalCore::Person::Ptr()); +// event->setDtStart(QDateTime(QDate(2012,11,11), QTime(1,1), QTimeZone("(GMT+01:00) West Central Africa"))); +// KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event); +// Kolab::KolabObjectReader reader(msg); +// KCalCore::Event::Ptr result = reader.getEvent(); +// qDebug() << result->dtStart().timeZone().name(); +// QCOMPARE(result->dtStart().timeZone().name(), QTimeZone(QLatin1String("Africa/Lagos")).id()); +// } // void TimezoneTest::testKolabObjectReader() // { @@ -130,7 +102,7 @@ // QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug); // // KCalCore::Incidence::Ptr convertedIncidence = reader.getIncidence(); -// kDebug() << "read incidence"; +// qDebug() << "read incidence"; // // //Parse ICalFile for comparison // QFile icalFile( icalFileName ); @@ -159,7 +131,7 @@ void TimezoneTest::testFindLegacyTimezone() { const QString normalized = TimezoneConverter::normalizeTimezone("US/Pacific"); - kDebug() << normalized; + qDebug() << normalized; QEXPECT_FAIL("", "Currently broken", Continue); QVERIFY(!normalized.isEmpty()); } @@ -167,20 +139,14 @@ void TimezoneTest::testIgnoreInvalidTimezone() { const QString normalized = TimezoneConverter::normalizeTimezone("FOOOOBAR"); - kDebug() << normalized; + qDebug() << normalized; QVERIFY(normalized.isEmpty()); } -void TimezoneTest::testTimezoneDaemonAvailable() -{ - //With KDE it should be available and with libcalendaring it should return true - QVERIFY(KSystemTimeZones::isTimeZoneDaemonAvailable()); -} - void TimezoneTest::testUTCOffset() { const Kolab::cDateTime expected(2013, 10, 23, 2, 0 ,0, true); - const KDateTime input(KDateTime::fromString("2013-10-23T04:00:00+02:00", KDateTime::RFC3339Date)); + const QDateTime input(QDateTime::fromString("2013-10-23T04:00:00+02:00", Qt::ISODate)); const Kolab::cDateTime result = Kolab::Conversion::fromDate(input); QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); QCOMPARE(result, expected); @@ -188,24 +154,25 @@ void TimezoneTest::localTimezone() { + // { + // const Kolab::cDateTime result = Kolab::Conversion::fromDate(QDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), Qt::LocalZone)); + // QVERIFY(!result.timezone().empty()); + // QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); + // } { - const Kolab::cDateTime result = Kolab::Conversion::fromDate(KDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), KDateTime::LocalZone)); - QVERIFY(!result.timezone().empty()); - QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); - } - { - const Kolab::cDateTime result = Kolab::Conversion::fromDate(KDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), KDateTime::ClockTime)); + const Kolab::cDateTime result = Kolab::Conversion::fromDate(QDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), Qt::LocalTime)); + QVERIFY(result.timezone().empty()); QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); } { - const Kolab::cDateTime result = Kolab::Conversion::fromDate(KDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), KDateTime::TimeZone)); + const Kolab::cDateTime result = Kolab::Conversion::fromDate(QDateTime(QDate(2013, 10, 10), QTime(2, 0, 0), Qt::TimeZone)); QVERIFY(result.timezone().empty()); QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); } { - KDateTime dt(QDate(2013, 10, 10), QTime(2, 0, 0), KTimeZone("/etc/localzone")); + QDateTime dt(QDate(2013, 10, 10), QTime(2, 0, 0), QTimeZone("/etc/localzone")); const Kolab::cDateTime result = Kolab::Conversion::fromDate(dt); - kDebug() << result.timezone(); + qDebug() << result.timezone(); QVERIFY(result.timezone().empty()); QVERIFY(!Kolab::ErrorHandler::instance().errorOccured()); }
View file
libkolab-2.0.tar.gz/tests/timezonetest.h -> libkolab-3.0.0.tar.gz/tests/timezonetest.h
Changed
@@ -31,11 +31,8 @@ void testFromName(); void testFromHardcodedList_data(); void testFromHardcodedList(); - void testKolabObjectWriter(); - // void testKolabObjectReader(); void testFindLegacyTimezone(); void testIgnoreInvalidTimezone(); - void testTimezoneDaemonAvailable(); void testUTCOffset(); void localTimezone(); };
View file
libkolab.dsc
Changed
@@ -1,8 +1,8 @@ Format: 1.0 Source: libkolab -Binary: libkolab2, php-kolab, python-kolab, libkolab-dev +Binary: libkolab3, php-kolab, python-kolab, libkolab-dev Architecture: any -Version: 2.0~dev20151230-0~kolab16 +Version: 3.0~dev20151230-0~kolab16 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Homepage: http://git.kolab.org/libkolab @@ -10,15 +10,16 @@ Build-Depends: cmake, debhelper, + libcurl4-gnutls-dev, libboost-dev, - libboost-program-options-dev, libboost-thread-dev, libboost-system-dev, - libcalendaring-dev (>= 4.9.1), - libcurl4-gnutls-dev, libkolabxml-dev (>= 1.0), libossp-uuid-dev, - libqt4-dev, + qtbase5-dev, + libkf5coreaddons-dev, + libkf5calendarcore-dev, + libkf5mime-dev, libxerces-c-dev, php-cgi | php5-cli, php-dev | php5-dev, @@ -36,5 +37,5 @@ php-kolab deb libs optional python-kolab deb python optional Files: - 00000000000000000000000000000000 0 libkolab-2.0.tar.gz + 00000000000000000000000000000000 0 libkolab-3.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
.