File indexing completed on 2024-04-28 11:33:58
0001 /* 0002 This file is part of the kcalcore library. 0003 0004 SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "event.h" 0010 #include "freebusy.h" 0011 #include "icalformat.h" 0012 0013 #include <QDebug> 0014 0015 #include <iostream> 0016 0017 using namespace KCalendarCore; 0018 0019 int main(int, char **) 0020 { 0021 const QString fbString = QStringLiteral( 0022 "BEGIN:VCALENDAR\n" 0023 "PRODID:-//proko2//freebusy 1.0//EN\n" 0024 "METHOD:PUBLISH\n" 0025 "VERSION:2.0\n" 0026 "BEGIN:VFREEBUSY\n" 0027 "ORGANIZER:MAILTO:test3@kdab.net\n" 0028 "X-KDE-Foo:bla\n" 0029 "DTSTAMP:20071202T152453Z\n" 0030 "URL:http://mail.kdab.net/freebusy/test3%40kdab.net.ifb\n" 0031 "DTSTART:19700101T000000Z\n" 0032 "DTEND:200700101T000000Z\n" 0033 "COMMENT:This is a dummy vfreebusy that indicates an empty calendar\n" 0034 "FREEBUSY:19700101T000000Z/19700101T000000Z\n" 0035 "FREEBUSY;X-UID=bGlia2NhbC0xODk4MjgxNTcuMTAxMA==;X-\n" 0036 " SUMMARY=RW1wbG95ZWUgbWVldGluZw==;X-LOCATION=Um9vb\n" 0037 " SAyMTM=:20080131T170000Z/20080131T174500Z\n" 0038 "END:VFREEBUSY\n" 0039 "END:VCALENDAR\n"); 0040 0041 ICalFormat format; 0042 FreeBusy::Ptr fb = format.parseFreeBusy(fbString); 0043 qDebug() << fb->fullBusyPeriods().count() << " " << fb->dtStart().toString(); 0044 const FreeBusyPeriod::List lst = fb->fullBusyPeriods(); 0045 for (const auto &freebusy : lst) { 0046 qDebug() << freebusy.start().toString() << " " << freebusy.end().toString() << "+ " << freebusy.summary() << ":" << freebusy.location(); 0047 } 0048 0049 const QMap<QByteArray, QString> props = fb->customProperties(); 0050 for (auto it = props.cbegin(); it != props.cend(); ++it) { 0051 qDebug() << it.key() << ": " << it.value(); 0052 } 0053 }