aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <[email protected]>2016-05-20 16:37:40 -0400
committerAllen Winter <[email protected]>2016-05-20 16:37:40 -0400
commit92b96359b8ace6e82567f0ab7423fa88093503fc (patch)
treec64d0b90a707a0936095760359b5d93552a7da95
parent202d4349aec259d4cba91ff9a1a5ac230ec57098 (diff)
new formatICalInvitation and formatICalInvitation without Outlookstyle
deprecate the old versions also fix unused and a spelling error
-rw-r--r--autotests/testincidenceformatter.cpp4
-rw-r--r--src/incidenceformatter.cpp34
-rw-r--r--src/incidenceformatter.h44
3 files changed, 70 insertions, 12 deletions
diff --git a/autotests/testincidenceformatter.cpp b/autotests/testincidenceformatter.cpp
index 44a4a22..5d26b55 100644
--- a/autotests/testincidenceformatter.cpp
+++ b/autotests/testincidenceformatter.cpp
@@ -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);
}
-
diff --git a/src/incidenceformatter.cpp b/src/incidenceformatter.cpp
index 043f9f5..3d43def 100644
--- a/src/incidenceformatter.cpp
+++ b/src/incidenceformatter.cpp
@@ -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:
@@ -2431,9 +2433,18 @@ static QString formatICalInvitationHelper(const QString &invitation,
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());
}
@@ -2441,9 +2452,19 @@ QString IncidenceFormatter::formatICalInvitation(const QString &invitation,
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;
}
-
diff --git a/src/incidenceformatter.h b/src/incidenceformatter.h
index af85a6e..03980c6 100644
--- a/src/incidenceformatter.h
+++ b/src/incidenceformatter.h
@@ -139,8 +139,10 @@ 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,
@@ -148,6 +150,22 @@ KCALUTILS_EXPORT QString formatICalInvitation(
/**
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)
have HTML formatting cleaned.
Use the time zone from calendar.
@@ -159,8 +177,10 @@ 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,
@@ -168,6 +188,26 @@ KCALUTILS_EXPORT QString formatICalInvitationNoHtml(
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
is to be formatted.