File indexing completed on 2024-05-12 05:15:04
0001 /* 0002 This file is part of the kcalutils library. 0003 0004 SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org> 0005 SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0006 SPDX-FileCopyrightText: 2009-2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> 0007 0008 SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 /** 0011 @file 0012 This file is part of the API for handling calendar data and provides 0013 static functions for formatting Incidence properties for various purposes. 0014 0015 @author Cornelius Schumacher \<schumacher@kde.org\> 0016 @author Reinhold Kainhofer \<reinhold@kainhofer.com\> 0017 @author Allen Winter \<allen@kdab.com\> 0018 */ 0019 #pragma once 0020 0021 #include "kcalutils_export.h" 0022 0023 #include <KCalendarCore/ScheduleMessage> 0024 #include <KCalendarCore/Todo> 0025 0026 #include <QTimeZone> 0027 0028 namespace KCalendarCore 0029 { 0030 class Exception; 0031 } 0032 0033 namespace KCalUtils 0034 { 0035 /** 0036 @brief Provides methods to format Incidence properties in various ways for display purposes. 0037 */ 0038 namespace Stringify 0039 { 0040 [[nodiscard]] KCALUTILS_EXPORT QString incidenceType(KCalendarCore::Incidence::IncidenceType type); 0041 0042 /** 0043 Returns the incidence Secrecy as translated string. 0044 @see incidenceSecrecyList(). 0045 */ 0046 [[nodiscard]] KCALUTILS_EXPORT QString incidenceSecrecy(KCalendarCore::Incidence::Secrecy secrecy); 0047 0048 /** 0049 Returns a list of all available Secrecy types as a list of translated strings. 0050 @see incidenceSecrecy(). 0051 */ 0052 [[nodiscard]] KCALUTILS_EXPORT QStringList incidenceSecrecyList(); 0053 0054 [[nodiscard]] KCALUTILS_EXPORT QString incidenceStatus(KCalendarCore::Incidence::Status status); 0055 [[nodiscard]] KCALUTILS_EXPORT QString incidenceStatus(const KCalendarCore::Incidence::Ptr &incidence); 0056 [[nodiscard]] KCALUTILS_EXPORT QString scheduleMessageStatus(KCalendarCore::ScheduleMessage::Status status); 0057 0058 /** 0059 Returns string containing the date/time when the to-do was completed, 0060 formatted according to the user's locale settings. 0061 @param shortfmt If true, use a short date format; else use a long format. 0062 */ 0063 [[nodiscard]] KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalendarCore::Todo::Ptr &todo, bool shortfmt = false); 0064 0065 [[nodiscard]] KCALUTILS_EXPORT QString attendeeRole(KCalendarCore::Attendee::Role role); 0066 [[nodiscard]] KCALUTILS_EXPORT QString attendeeStatus(KCalendarCore::Attendee::PartStat status); 0067 0068 /** 0069 Returns a string containing the UTC offset of the specified QTimeZone @p tz (relative to the current date). 0070 The format is [+-]HH::MM, according to standards. 0071 @since 5.8 0072 */ 0073 [[nodiscard]] KCALUTILS_EXPORT QString tzUTCOffsetStr(const QTimeZone &tz); 0074 0075 /** 0076 Build a translated message representing an exception 0077 */ 0078 [[nodiscard]] KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception); 0079 } // namespace Stringify 0080 } // namespace KCalUtils