Commit facc8f55 authored by Allen Winter's avatar Allen Winter

restore tooltips in the apptsummaryplugin

Differential Revision: https://phabricator.kde.org/D9231
parent bb2d9888
......@@ -128,7 +128,7 @@ void ApptSummaryWidget::updateView()
mShowAnniversariesFromCal);
QDate currentDate = QDate::currentDate();
SummaryEventInfo::List events = SummaryEventInfo::eventsForRange(currentDate, currentDate.addDays(mDaysAhead - 1), mCalendar.data());
SummaryEventInfo::List events = SummaryEventInfo::eventsForRange(currentDate, currentDate.addDays(mDaysAhead - 1), mCalendar);
foreach (SummaryEventInfo *event, events) {
......@@ -286,4 +286,3 @@ QStringList ApptSummaryWidget::configModules() const
{
return QStringList() << QStringLiteral("kcmapptsummary.desktop");
}
message(STATUS "Warning: the summaryevent tests needs to be ported to Akonadi")
return()
set(summaryeventtest_SRCS summaryeventtest.cpp ../summaryeventinfo.cpp)
add_executable( summaryeventtest ${summaryeventtest_SRCS} )
......
......@@ -26,6 +26,8 @@
#include "summaryeventinfo.h"
#include <AkonadiCore/Item>
#include <KCalCore/Calendar>
#include <KCalCore/Event>
using namespace KCalCore;
......@@ -89,15 +91,15 @@ SummaryEventInfo::SummaryEventInfo()
/**static*/
SummaryEventInfo::List SummaryEventInfo::eventsForRange(const QDate &start, const QDate &end,
KCalCore::Calendar *calendar)
const Akonadi::ETMCalendar::Ptr &calendar)
{
KCalCore::Event::List allEvents = calendar->events();
KCalCore::Event::List events;
const auto currentDateTime = QDateTime::currentDateTime();
const QDate currentDate = currentDateTime.date();
sDateTimeByUid()->clear();
for (int i = 0; i < allEvents.count(); ++i) {
KCalCore::Event::Ptr event = allEvents.at(i);
if (skip(event)) {
......@@ -234,16 +236,16 @@ SummaryEventInfo::List SummaryEventInfo::eventsForRange(const QDate &start, cons
}
summaryEvent->summaryText = str;
summaryEvent->summaryUrl = ev->uid();
/*
Commented out because a ETMCalendar doesn't have any name, it's a group of selected
calendars, not an individual one.
QString tipText( KCalUtils::IncidenceFormatter::toolTipStr(
KCalUtils::IncidenceFormatter::resourceString(
calendar, ev ), ev, start, true, spec ) );
if ( !tipText.isEmpty() ) {
summaryEvent->summaryTooltip = tipText;
}*/
QString displayName;
Akonadi::Item item = calendar->item(ev);
if (item.isValid()) {
const Akonadi::Collection col = item.parentCollection();
if (col.isValid()) {
displayName = col.displayName();
}
}
summaryEvent->summaryTooltip = KCalUtils::IncidenceFormatter::toolTipStr(displayName, ev, start, true);
// Time range label (only for non-floating events)
str.clear();
......@@ -284,7 +286,7 @@ SummaryEventInfo::List SummaryEventInfo::eventsForRange(const QDate &start, cons
}
SummaryEventInfo::List SummaryEventInfo::eventsForDate(const QDate &date,
KCalCore::Calendar *calendar)
const Akonadi::ETMCalendar::Ptr &calendar)
{
return eventsForRange(date, date, calendar);
}
......@@ -26,11 +26,7 @@
#ifndef SUMMARYEVENTINFO_H
#define SUMMARYEVENTINFO_H
#include <KCalCore/Calendar>
#include <KCalCore/Event>
#include <QList>
#include <QString>
#include <Akonadi/Calendar/ETMCalendar>
class QDate;
......@@ -43,9 +39,9 @@ public:
SummaryEventInfo();
static List eventsForDate(const QDate &date,
KCalCore::Calendar *calendar);
const Akonadi::ETMCalendar::Ptr &calendar);
static List eventsForRange(const QDate &start, const QDate &end, // range is inclusive
KCalCore::Calendar *calendar);
const Akonadi::ETMCalendar::Ptr &calendar);
static void setShowSpecialEvents(bool skipBirthdays, bool skipAnniversaries);
KCalCore::Event::Ptr ev;
......
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