Git commit 8e6581b25c26c1e0f451f9b40824579d2db99ce3 by Volker Krause. Committed on 02/04/2023 at 13:23. Pushed by carlschwan into branch 'master'.
Remove the HTML export feature This produces HTML files straight out of the 90s, in quick tests also with crucial data missing (such as the times). This is also the only user of the HTML export code in KCalUtils, which is the only user of dubious relations API in KCalendarCore::Calendar. So removing this here also enables more substantial cleanup up the stack. M +0 -1 .kde-ci.yml M +0 -2 CMakeLists.txt M +0 -1 calendarjanitor/CMakeLists.txt M +0 -26 doc/konsolekalendar/index.docbook M +1 -1 konsolekalendar/CMakeLists.txt M +0 -5 konsolekalendar/examples/testkalendar.sh M +36 -119 konsolekalendar/konsolekalendar.cpp M +0 -4 konsolekalendar/konsolekalendarvariables.h M +1 -10 konsolekalendar/main.cpp https://invent.kde.org/pim/akonadi-calendar-tools/commit/8e6581b25c26c1e0f451f9b40824579d2db99ce3 diff --git a/.kde-ci.yml b/.kde-ci.yml index 75b1073..173255a 100644 --- a/.kde-ci.yml +++ b/.kde-ci.yml @@ -9,5 +9,4 @@ Dependencies: 'pim/akonadi' : '@same' 'pim/akonadi-calendar' : '@same' 'pim/calendarsupport' : '@same' - 'pim/kcalutils' : '@same' 'pim/libkdepim' : '@same' diff --git a/CMakeLists.txt b/CMakeLists.txt index 04a5ee3..78317a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,6 @@ set(AKONADICALENDAR_LIB_VERSION "5.23.40") set(AKONADI_VERSION "5.23.40") set(CALENDARSUPPORT_LIB_VERSION "5.23.40") set(KCALENDARCORE_LIB_VERSION "5.23.40") -set(CALENDARUTILS_LIB_VERSION "5.23.40") set(KDEPIM_LIB_VERSION "${PIM_VERSION}") set(KDEPIM_LIB_SOVERSION "5") @@ -69,7 +68,6 @@ find_package(KF${KF_MAJOR_VERSION}I18n ${KF_MIN_VERSION} REQUIRED) # Find KdepimLibs Package find_package(KPim${KF_MAJOR_VERSION}Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF${KF_MAJOR_VERSION}CalendarCore ${KCALENDARCORE_LIB_VERSION} CONFIG REQUIRED) -find_package(KPim${KF_MAJOR_VERSION}CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED) find_package(KPim${KF_MAJOR_VERSION}AkonadiCalendar ${AKONADICALENDAR_LIB_VERSION} CONFIG REQUIRED) find_package(KPim${KF_MAJOR_VERSION}CalendarSupport ${CALENDARSUPPORT_LIB_VERSION} CONFIG REQUIRED) diff --git a/calendarjanitor/CMakeLists.txt b/calendarjanitor/CMakeLists.txt index 3b99cd5..f1df88e 100644 --- a/calendarjanitor/CMakeLists.txt +++ b/calendarjanitor/CMakeLists.txt @@ -16,7 +16,6 @@ target_sources(calendarjanitor PRIVATE ) target_link_libraries(calendarjanitor - KPim${KF_MAJOR_VERSION}::CalendarUtils KF${KF_MAJOR_VERSION}::CalendarCore KPim${KF_MAJOR_VERSION}::AkonadiCalendar) diff --git a/doc/konsolekalendar/index.docbook b/doc/konsolekalendar/index.docbook index 141e83c..d583d77 100644 --- a/doc/konsolekalendar/index.docbook +++ b/doc/konsolekalendar/index.docbook @@ -454,32 +454,6 @@ room with the entire staff.","&konsolekalendar;-1924621834.134" </sect2> -<sect2 id="html-format"> -<title>&HTML; Format</title> - -<para>The &HTML; export format will produce a valid -&HTML; file that can be published to the <acronym>WWW</acronym>. -This export format is not suitable for follow-on script parsing, but is -very nice for publishing calendars for easy public viewing.</para> -<!--FIXME -exports only the template without any incidence data -<para><emphasis>TODO:</emphasis> Insert screenshot here</para> ---> -</sect2> - -<sect2 id="html-month-format"> -<title><acronym>HTMLmonth</acronym> Format</title> - -<para>This format produces an &HTML; file showing -all appointments in the months specified by the date range. -This export format is not suitable for follow-on script parsing, but is -very nice for publishing calendars for easy public viewing.</para> -<!--FIXME -exports only the template without any incidence data -<para><emphasis>TODO:</emphasis> Insert screenshot here</para> ---> -</sect2> - </sect1> <sect1 id="importing"> diff --git a/konsolekalendar/CMakeLists.txt b/konsolekalendar/CMakeLists.txt index d2b5812..fd9a899 100644 --- a/konsolekalendar/CMakeLists.txt +++ b/konsolekalendar/CMakeLists.txt @@ -35,8 +35,8 @@ ecm_qt_declare_logging_category(konsolekalendar target_link_libraries(konsolekalendar Qt::DBus - KPim${KF_MAJOR_VERSION}::CalendarUtils KF${KF_MAJOR_VERSION}::CalendarCore + KF${KF_MAJOR_VERSION}::ConfigGui KPim${KF_MAJOR_VERSION}::CalendarSupport KPim${KF_MAJOR_VERSION}::AkonadiCalendar KF${KF_MAJOR_VERSION}::I18n diff --git a/konsolekalendar/examples/testkalendar.sh b/konsolekalendar/examples/testkalendar.sh index e7befe1..869653d 100644 --- a/konsolekalendar/examples/testkalendar.sh +++ b/konsolekalendar/examples/testkalendar.sh @@ -37,11 +37,6 @@ echo "################################ TEXT ##################################" COMMAND="$KONSOLEKALENDAR --view --time $HOUR:$MINUTE --date $YEAR-$MONTH-$DATE --export-type Text --file=$2" $COMMAND -echo "################################ HTML ##################################" -COMMAND="$KONSOLEKALENDAR --view --time $HOUR:$MINUTE --date $YEAR-$MONTH-$DATE --export-type HTML --file=$2" -$COMMAND - - echo "################################ CSV ##################################" COMMAND="$KONSOLEKALENDAR --view --time $HOUR:$MINUTE --date $YEAR-$MONTH-$DATE --export-type CSV --file=$2" $COMMAND diff --git a/konsolekalendar/konsolekalendar.cpp b/konsolekalendar/konsolekalendar.cpp index e02c0a5..b3f57bf 100644 --- a/konsolekalendar/konsolekalendar.cpp +++ b/konsolekalendar/konsolekalendar.cpp @@ -29,8 +29,6 @@ #include <Akonadi/Collection> #include <Akonadi/CollectionFetchJob> #include <Akonadi/CollectionFetchScope> -#include <KCalUtils/HTMLExportSettings> -#include <KCalUtils/HtmlExport> #include <QDBusInterface> #include <QDBusReply> @@ -197,123 +195,46 @@ bool KonsoleKalendar::showInstance() QTextStream ts(&f); - if (m_variables->getExportType() != ExportTypeHTML && m_variables->getExportType() != ExportTypeMonthHTML) { - if (m_variables->getAll()) { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "view all events sorted list"; - - const Event::List sortedList = calendar->events(EventSortStartDate); - qCDebug(KONSOLEKALENDAR_LOG) << "Found" << sortedList.count() << "events"; - if (!sortedList.isEmpty()) { - // The code that was here before the akonadi port was really slow with 200 events - // this is much faster: - for (const KCalendarCore::Event::Ptr &event : sortedList) { - status &= printEvent(&ts, event, event->dtStart().date()); - } - } - } else if (m_variables->isUID()) { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "view events by uid list"; - // TODO: support a list of UIDs - event = calendar->event(m_variables->getUID()); - // If this UID represents a recurring Event, - // only the first day of the Event will be printed - status = printEvent(&ts, event, event->dtStart().date()); - } else if (m_variables->isNext()) { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "Show next activity in calendar"; - - QDateTime datetime = m_variables->getStartDateTime(); - datetime = datetime.addDays(720); - - QDate dt; - for (dt = m_variables->getStartDateTime().date(); dt <= datetime.date(); dt = dt.addDays(1)) { - Event::List events = calendar->events(dt, timeZone, EventSortStartDate, SortDirectionAscending); - qCDebug(KONSOLEKALENDAR_LOG) << "2-Found" << events.count() << "events on date" << dt; - // finished here when we get the next event - if (!events.isEmpty()) { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "Got the next event"; - printEvent(&ts, events.first(), dt); - return true; - } - } - } else { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "view raw events within date range list"; - - QDate dt; - for (dt = m_variables->getStartDateTime().date(); dt <= m_variables->getEndDateTime().date() && status != false; dt = dt.addDays(1)) { - Event::List events = calendar->events(dt, timeZone, EventSortStartDate, SortDirectionAscending); - qCDebug(KONSOLEKALENDAR_LOG) << "3-Found" << events.count() << "events on date: " << dt; - status = printEventList(&ts, &events, dt); + if (m_variables->getAll()) { + qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" + << "view all events sorted list"; + + const Event::List sortedList = calendar->events(EventSortStartDate); + qCDebug(KONSOLEKALENDAR_LOG) << "Found" << sortedList.count() << "events"; + if (!sortedList.isEmpty()) { + // The code that was here before the akonadi port was really slow with 200 events + // this is much faster: + for (const KCalendarCore::Event::Ptr &event : sortedList) { + status &= printEvent(&ts, event, event->dtStart().date()); } } - } else { - QDate firstdate; - QDate lastdate; - if (m_variables->getAll()) { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "HTML view all events sorted list"; - // sort the events for this date by start date - // in order to determine the date range. - auto events = new Event::List(calendar->rawEvents(EventSortStartDate, SortDirectionAscending)); - firstdate = events->first()->dtStart().date(); - lastdate = events->last()->dtStart().date(); - } else if (m_variables->isUID()) { - // TODO - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "HTML view events by uid list"; - cout << i18n("Sorry, export to HTML by UID is not supported yet").toLocal8Bit().data() << endl; - return false; - } else { - qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" - << "HTML view raw events within date range list"; - firstdate = m_variables->getStartDateTime().date(); - lastdate = m_variables->getEndDateTime().date(); - } - - KCalUtils::HTMLExportSettings htmlSettings(QStringLiteral("Konsolekalendar")); - - // TODO: get progname and url from the values set in main - htmlSettings.setCreditName(QStringLiteral("KonsoleKalendar")); - htmlSettings.setCreditURL(QStringLiteral("https://userbase.kde.org/KonsoleKalendar")); - - htmlSettings.setExcludePrivate(true); - htmlSettings.setExcludeConfidential(true); - - htmlSettings.setEventView(false); - htmlSettings.setMonthView(false); - if (m_variables->getExportType() == ExportTypeMonthHTML) { - title = i18n("Events:"); - htmlSettings.setMonthView(true); - } else { - if (firstdate == lastdate) { - title = i18n("Events: %1", firstdate.toString(Qt::TextDate)); - } else { - title = i18n("Events: %1 - %2", firstdate.toString(Qt::TextDate), lastdate.toString(Qt::TextDate)); + } else if (m_variables->isUID()) { + qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" + << "view events by uid list"; + // TODO: support a list of UIDs + event = calendar->event(m_variables->getUID()); + // If this UID represents a recurring Event, + // only the first day of the Event will be printed + status = printEvent(&ts, event, event->dtStart().date()); + } else if (m_variables->isNext()) { + qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" + << "Show next activity in calendar"; + + QDateTime datetime = m_variables->getStartDateTime(); + datetime = datetime.addDays(720); + + QDate dt; + for (dt = m_variables->getStartDateTime().date(); dt <= datetime.date(); dt = dt.addDays(1)) { + Event::List events = calendar->events(dt, timeZone, EventSortStartDate, SortDirectionAscending); + qCDebug(KONSOLEKALENDAR_LOG) << "2-Found" << events.count() << "events on date" << dt; + // finished here when we get the next event + if (!events.isEmpty()) { + qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |" + << "Got the next event"; + printEvent(&ts, events.first(), dt); + return true; } - htmlSettings.setEventView(true); } - htmlSettings.setEventTitle(title); - htmlSettings.setEventAttendees(true); - // Not supporting Todos yet - // title = "To-Do List for " + firstdate.toString(Qt::TextDate); - // if ( firstdate != lastdate ) { - // title += " - " + lastdate.toString(Qt::TextDate); - // } - htmlSettings.setTodoListTitle(title); - htmlSettings.setTodoView(false); - // htmlSettings.setTaskCategories( false ); - // htmlSettings.setTaskAttendees( false ); - // htmlSettings.setTaskDueDate( true ); - - htmlSettings.setDateStart(QDateTime(firstdate.startOfDay())); - htmlSettings.setDateEnd(QDateTime(lastdate.startOfDay())); - - auto exp = new KCalUtils::HtmlExport(calendar.data(), &htmlSettings); - status = exp->save(&ts); - delete exp; } f.close(); } @@ -364,10 +285,6 @@ bool KonsoleKalendar::printEvent(QTextStream *ts, const Event::Ptr &event, QDate status = exports.exportAsTxtShort(ts, event, dt, sameDay); } break; - case ExportTypeHTML: - // this is handled separately for now - break; - default: // Default export-type is ExportTypeText qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::printEvent() |" << "TEXT export"; diff --git a/konsolekalendar/konsolekalendarvariables.h b/konsolekalendar/konsolekalendarvariables.h index eef10f3..50834e8 100644 --- a/konsolekalendar/konsolekalendarvariables.h +++ b/konsolekalendar/konsolekalendarvariables.h @@ -33,10 +33,6 @@ enum ExportType { ExportTypeText, /** Export as compact text */ ExportTypeTextShort, - /** Export HTML for the specified time span */ - ExportTypeHTML, - /** Export HTML for the time span on month boundaries */ - ExportTypeMonthHTML, /** Export XHTML (NOT AVAILABLE YET) */ ExportTypeXHTML, /** Export XML (NOT AVAILABLE YET) */ diff --git a/konsolekalendar/main.cpp b/konsolekalendar/main.cpp index ad76f1e..8cfaa13 100644 --- a/konsolekalendar/main.cpp +++ b/konsolekalendar/main.cpp @@ -164,9 +164,6 @@ int main(int argc, char *argv[]) cout << i18n("%1 supports these export formats:", QString::fromLatin1(progDisplay)).toLocal8Bit().data() << endl; cout << i18nc("the default export format", " %1 [Default]", QStringLiteral("Text")).toLocal8Bit().data() << endl; cout << i18nc("short text export", " %1 (like %2, but more compact)", QStringLiteral("Short"), QStringLiteral("Text")).toLocal8Bit().data() << endl; - cout << i18nc("HTML export", " %1", QStringLiteral("HTML")).toLocal8Bit().data() << endl; - cout << i18nc("HTMLmonth export", " %1 (like %2, but in a month view)", QStringLiteral("HTMLmonth"), QStringLiteral("HTML")).toLocal8Bit().data() - << endl; cout << i18nc("comma-separated values export", " %1 (Comma-Separated Values)", QStringLiteral("CSV")).toLocal8Bit().data() << endl; cout << endl; return 0; @@ -204,13 +201,7 @@ int main(int argc, char *argv[]) if (parser.isSet(QStringLiteral("export-type"))) { option = parser.value(QStringLiteral("export-type")); - if (option.toUpper() == QLatin1String("HTML")) { - qCDebug(KONSOLEKALENDAR_LOG) << "main | export-type | Export to HTML"; - variables.setExportType(ExportTypeHTML); - } else if (option.toUpper() == QLatin1String("HTMLMONTH")) { - qCDebug(KONSOLEKALENDAR_LOG) << "main | export-type | Export to HTML by Month"; - variables.setExportType(ExportTypeMonthHTML); - } else if (option.toUpper() == QLatin1String("CSV")) { + if (option.toUpper() == QLatin1String("CSV")) { qCDebug(KONSOLEKALENDAR_LOG) << "main | export-type | Export to CSV"; variables.setExportType(ExportTypeCSV); } else if (option.toUpper() == QLatin1String("TEXT")) {