Commit 92b96359 authored by Allen Winter's avatar Allen Winter

new formatICalInvitation and formatICalInvitation without Outlookstyle

deprecate the old versions
also fix unused and a spelling error
parent 202d4349
......@@ -415,12 +415,10 @@ void IncidenceFormatterTest::testFormatIcalInvitation()
const QString html = IncidenceFormatter::formatICalInvitation(QString::fromUtf8(data),
calendar,
&helper,
false);
&helper);
QVERIFY(validateHtml(name, html));
QVERIFY(compareHtml(name));
cleanup(name);
}
......@@ -851,7 +851,7 @@ static QString htmlCompare(const QString &value, const QString &oldvalue)
{
// if 'value' is empty, then print nothing
if (value.isEmpty()) {
return QString::null;
return QString();
}
// if 'value' is new or unchanged, then print normally
......@@ -1018,7 +1018,7 @@ static QString invitationDescriptionIncidence(const Incidence::Ptr &incidence, b
}
}
return QString::null;
return QString();
}
static bool slicesInterval(const Event::Ptr &event,
......@@ -1086,7 +1086,7 @@ static QVariantList eventsOnSameDays(InvitationFormatterHelper *helper,
}
if (!slicesInterval(*it, startDay, endDay)) {
/* Calendar::events includes events that have a recurrence that is
* "active" in the specified interval. Wether or not the event is actually
* "active" in the specified interval. Whether or not the event is actually
* happening ( has a recurrence that falls into the interval ).
* This appears to be done deliberately and not to be a bug so we additionally
* check if the event is actually happening here. */
......@@ -1290,6 +1290,7 @@ static QVariantHash invitationDetailsTodo(const Todo::Ptr &todo, const Todo::Ptr
static QVariantHash invitationDetailsJournal(const Journal::Ptr &journal, bool noHtmlMode,
const KDateTime::Spec &spec)
{
Q_UNUSED(spec);
if (!journal) {
return QVariantHash();
}
......@@ -1326,6 +1327,7 @@ static QVariantHash invitationDetailsFreeBusy(const FreeBusy::Ptr &fb, bool noHt
const KDateTime::Spec &spec)
{
Q_UNUSED(noHtmlMode);
Q_UNUSED(spec);
if (!fb) {
return QVariantHash();
......@@ -2063,7 +2065,7 @@ static QVariantList responseButtons(const Incidence::Ptr &incidence,
return buttons;
}
static QVariantList counterButtons(const Incidence::Ptr &incidence)
static QVariantList counterButtons()
{
QVariantList buttons;
......@@ -2339,7 +2341,7 @@ static QString formatICalInvitationHelper(const QString &invitation,
if (inc) {
// First, determine if this reply is really a counter in disguise.
if (replyMeansCounter(inc)) {
buttons = counterButtons(inc);
buttons = counterButtons();
break;
}
......@@ -2379,7 +2381,7 @@ static QString formatICalInvitationHelper(const QString &invitation,
case iTIPCounter:
// Counter proposal
buttons = counterButtons(inc);
buttons = counterButtons();
break;
case iTIPDeclineCounter:
......@@ -2429,21 +2431,40 @@ static QString formatICalInvitationHelper(const QString &invitation,
}
//@endcond
QString IncidenceFormatter::formatICalInvitation(const QString &invitation,
const MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper)
{
return formatICalInvitationHelper(invitation, calendar, helper, false,
KSystemTimeZones::local(), QString());
}
QString IncidenceFormatter::formatICalInvitation(const QString &invitation,
const MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
bool outlookCompareStyle)
{
Q_UNUSED(outlookCompareStyle);
return formatICalInvitationHelper(invitation, calendar, helper, false,
KSystemTimeZones::local(), QString());
}
QString IncidenceFormatter::formatICalInvitationNoHtml(const QString &invitation,
const MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
const QString &sender)
{
return formatICalInvitationHelper(invitation, calendar, helper, true,
KSystemTimeZones::local(), sender);
}
QString IncidenceFormatter::formatICalInvitationNoHtml(const QString &invitation,
const MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
const QString &sender,
bool outlookCompareStyle)
{
Q_UNUSED(outlookCompareStyle);
return formatICalInvitationHelper(invitation, calendar, helper, true,
KSystemTimeZones::local(), sender);
}
......@@ -3700,4 +3721,3 @@ QStringList IncidenceFormatter::reminderStringList(const Incidence::Ptr &inciden
return reminderStringList;
}
......@@ -139,13 +139,31 @@ KCALUTILS_EXPORT QString mailBodyStr(const KCalCore::IncidenceBase::Ptr &inciden
@param helper is a pointer to an InvitationFormatterHelper.
@param outlookCompareStyle if true, display updated invitation comparisons in the style
of Microsoft Outlook (tm); else use our own "classic" style.
@deprecated Use formatICalInvitation(const QString &, const KCalCore::MemoryCalendar::Ptr &, InvitationFormatterHelper *helper)
*/
KCALUTILS_EXPORT QString formatICalInvitation(
KCALUTILS_DEPRECATED KCALUTILS_EXPORT QString formatICalInvitation(
const QString &invitation,
const KCalCore::MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
bool outlookCompareStyle);
/**
Deliver an HTML formatted string displaying an invitation.
Use the time zone from mCalendar.
@param invitation a QString containing a string representation of a calendar Incidence
which will be intrepreted as an invitation.
@param calendar is a pointer to the Calendar that owns the invitation.
@param helper is a pointer to an InvitationFormatterHelper.
@since 5.23.0
*/
KCALUTILS_EXPORT QString formatICalInvitation(
const QString &invitation,
const KCalCore::MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper);
/**
Deliver an HTML formatted string displaying an invitation.
Differs from formatICalInvitation() in that invitation details (summary, location, etc)
......@@ -159,14 +177,36 @@ KCALUTILS_EXPORT QString formatICalInvitation(
@param sender is a QString containing the email address of the person sending the invitation.
@param outlookCompareStyle if true, display updated invitation comparisons in the style
of Microsoft Outlook (tm); else use our own "classic" style.
@deprecated Use formatICalInvitationNoHtml(const QString &, const KCalCore::MemoryCalendar::Ptr &, InvitationFormatterHelper *, const QString &)
*/
KCALUTILS_EXPORT QString formatICalInvitationNoHtml(
KCALUTILS_DEPRECATED KCALUTILS_EXPORT QString formatICalInvitationNoHtml(
const QString &invitation,
const KCalCore::MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
const QString &sender,
bool outlookCompareStyle);
/**
Deliver an HTML formatted string displaying an invitation.
Differs from formatICalInvitation() in that invitation details (summary, location, etc)
have HTML formatting cleaned.
Use the time zone from calendar.
@param invitation a QString containing a string representation of a calendar Incidence
which will be intrepreted as an invitation.
@param calendar is a pointer to the Calendar that owns the invitation.
@param helper is a pointer to an InvitationFormatterHelper.
@param sender is a QString containing the email address of the person sending the invitation.
@since 5.23.0
*/
KCALUTILS_EXPORT QString formatICalInvitationNoHtml(
const QString &invitation,
const KCalCore::MemoryCalendar::Ptr &calendar,
InvitationFormatterHelper *helper,
const QString &sender);
/**
Build a pretty QString representation of an Incidence's recurrence info.
@param incidence is a pointer to the Incidence whose recurrence info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment