1 /*
2   This file is part of the kcalutils library.
3 
4   SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5   SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6   SPDX-FileCopyrightText: 2009-2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
7 
8   SPDX-License-Identifier: LGPL-2.0-or-later
9 */
10 /**
11   @file
12   This file is part of the API for handling calendar data and provides
13   static functions for formatting Incidence properties for various purposes.
14 
15   @author Cornelius Schumacher \<schumacher@kde.org\>
16   @author Reinhold Kainhofer \<reinhold@kainhofer.com\>
17   @author Allen Winter \<allen@kdab.com\>
18 */
19 #pragma once
20 
21 #include "kcalutils_export.h"
22 
23 #include <KCalendarCore/ScheduleMessage>
24 #include <KCalendarCore/Todo>
25 
26 #include <QTimeZone>
27 
28 namespace KCalendarCore
29 {
30 class Exception;
31 }
32 
33 namespace KCalUtils
34 {
35 /**
36   @brief Provides methods to format Incidence properties in various ways for display purposes.
37 */
38 namespace Stringify
39 {
40 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString incidenceType(KCalendarCore::Incidence::IncidenceType type);
41 
42 /**
43   Returns the incidence Secrecy as translated string.
44   @see incidenceSecrecyList().
45 */
46 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString incidenceSecrecy(KCalendarCore::Incidence::Secrecy secrecy);
47 
48 /**
49   Returns a list of all available Secrecy types as a list of translated strings.
50   @see incidenceSecrecy().
51 */
52 Q_REQUIRED_RESULT KCALUTILS_EXPORT QStringList incidenceSecrecyList();
53 
54 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString incidenceStatus(KCalendarCore::Incidence::Status status);
55 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString incidenceStatus(const KCalendarCore::Incidence::Ptr &incidence);
56 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString scheduleMessageStatus(KCalendarCore::ScheduleMessage::Status status);
57 
58 /**
59   Returns string containing the date/time when the to-do was completed,
60   formatted according to the user's locale settings.
61   @param shortfmt If true, use a short date format; else use a long format.
62 */
63 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalendarCore::Todo::Ptr &todo, bool shortfmt = false);
64 
65 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString attendeeRole(KCalendarCore::Attendee::Role role);
66 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString attendeeStatus(KCalendarCore::Attendee::PartStat status);
67 
68 /**
69   Returns a string containing the UTC offset of the specified QTimeZone @p tz (relative to the current date).
70   The format is [+-]HH::MM, according to standards.
71   @since 5.8
72 */
73 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString tzUTCOffsetStr(const QTimeZone &tz);
74 
75 /**
76    Build a translated message representing an exception
77 */
78 Q_REQUIRED_RESULT KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception);
79 } // namespace Stringify
80 } // namespace KCalUtils
81 
82