Commit 51339e2d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

run git clang-format

parent f16bacd5
......@@ -8,16 +8,16 @@
#include <CalendarSupport/Utils>
#include <KCalendarCore/Incidence>
#include <KCalendarCore/FileStorage>
#include <KCalendarCore/Incidence>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/CollectionFetchScope>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemFetchScope>
#include <KLocalizedString>
#include <KJob>
#include <KLocalizedString>
#include <QDebug>
#include <QTimeZone>
......@@ -32,7 +32,9 @@ static void printOut(const QString &message)
void Backuper::emitFinished(bool success, const QString &message)
{
if (success) {
printOut(QLatin1Char('\n') + i18np("Backup was successful. %1 incidence was saved.", "Backup was successful. %1 incidences were saved.", m_calendar->incidences().count()));
printOut(
QLatin1Char('\n')
+ i18np("Backup was successful. %1 incidence was saved.", "Backup was successful. %1 incidences were saved.", m_calendar->incidences().count()));
} else {
printOut(message);
}
......@@ -43,7 +45,8 @@ void Backuper::emitFinished(bool success, const QString &message)
qApp->exit(success ? 0 : -1); // TODO: If we move this class to kdepimlibs, remove this
}
Backuper::Backuper(QObject *parent) : QObject(parent)
Backuper::Backuper(QObject *parent)
: QObject(parent)
, m_backupInProgress(false)
{
}
......@@ -65,8 +68,7 @@ void Backuper::backup(const QString &filename, const QList<Akonadi::Collection::
m_backupInProgress = true;
m_filename = filename;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive);
job->fetchScope().setContentMimeTypes(KCalendarCore::Incidence::mimeTypes());
connect(job, &Akonadi::CollectionFetchJob::result, this, &Backuper::onCollectionsFetched);
......
......@@ -9,11 +9,11 @@
#include "options.h"
#include <KCalendarCore/MemoryCalendar>
#include <AkonadiCore/Collection>
#include <KCalendarCore/MemoryCalendar>
#include <QObject>
#include <QList>
#include <QObject>
class KJob;
......
......@@ -9,17 +9,17 @@
#include <CalendarSupport/Utils>
#include <KCalendarCore/Attachment>
#include <KCalendarCore/Alarm>
#include <KCalendarCore/Attachment>
#include <KCalendarCore/Event>
#include <KCalendarCore/Todo>
#include <KCalendarCore/Journal>
#include <KCalendarCore/Todo>
#include <KLocalizedString>
#include <QCoreApplication>
#include <QList>
#include <QTextStream>
#include <QCoreApplication>
#define TEXT_WIDTH 75
......@@ -40,8 +40,7 @@ static void bailOut()
static bool collectionIsReadOnly(const Akonadi::Collection &collection)
{
return !(collection.rights() & Akonadi::Collection::CanChangeItem)
|| !(collection.rights() & Akonadi::Collection::CanDeleteItem);
return !(collection.rights() & Akonadi::Collection::CanChangeItem) || !(collection.rights() & Akonadi::Collection::CanDeleteItem);
}
static bool incidenceIsOld(const KCalendarCore::Incidence::Ptr &incidence)
......@@ -58,7 +57,8 @@ static bool incidenceIsOld(const KCalendarCore::Incidence::Ptr &incidence)
return datetime.isValid() && datetime.daysTo(QDateTime::currentDateTime()) > 365;
}
CalendarJanitor::CalendarJanitor(const Options &options, QObject *parent) : QObject(parent)
CalendarJanitor::CalendarJanitor(const Options &options, QObject *parent)
: QObject(parent)
, m_collectionLoader(new CollectionLoader(this))
, m_options(options)
, m_currentSanityCheck(Options::CheckNone)
......@@ -137,7 +137,10 @@ void CalendarJanitor::onModifyFinished(int changeId, const Akonadi::Item &item,
}
}
void CalendarJanitor::onDeleteFinished(int changeId, const QVector<Akonadi::Item::Id> &items, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorMessage)
void CalendarJanitor::onDeleteFinished(int changeId,
const QVector<Akonadi::Item::Id> &items,
Akonadi::IncidenceChanger::ResultCode resultCode,
const QString &errorMessage)
{
Q_UNUSED(changeId)
if (resultCode != Akonadi::IncidenceChanger::ResultCodeSuccess) {
......@@ -253,8 +256,7 @@ void CalendarJanitor::sanityCheck1()
for (const Akonadi::Item &item : qAsConst(m_itemsToProcess)) {
KCalendarCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (incidence->summary().isEmpty() && incidence->description().isEmpty()
&& incidence->attachments().isEmpty()) {
if (incidence->summary().isEmpty() && incidence->description().isEmpty() && incidence->attachments().isEmpty()) {
printFound(item);
deleteIncidence(item);
}
......@@ -511,7 +513,7 @@ void CalendarJanitor::sanityCheck8()
m_returnCode = -2;
}
endTest(/**print=*/ false);
endTest(/**print=*/false);
}
void CalendarJanitor::sanityCheck9()
......@@ -557,8 +559,7 @@ void CalendarJanitor::sanityCheck9()
}
}
endTest(true, i18n("In fix mode the RECURRING-ID property will be unset and UID changed."),
i18n("Recurrence cleared."));
endTest(true, i18n("In fix mode the RECURRING-ID property will be unset and UID changed."), i18n("Recurrence cleared."));
}
void CalendarJanitor::stripOldAlarms()
......
......@@ -11,13 +11,13 @@
#include <KCalendarCore/Incidence>
#include <Akonadi/Calendar/IncidenceChanger>
#include <Akonadi/Calendar/FetchJobCalendar>
#include <Akonadi/Calendar/IncidenceChanger>
#include <AkonadiCore/Collection>
#include <AkonadiCore/Item>
#include <QMultiMap>
#include <QObject>
#include <QString>
#include <QMultiMap>
class CollectionLoader;
......
......@@ -10,8 +10,8 @@
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/CollectionFetchScope>
#include <QString>
#include <QSet>
#include <QString>
#include <QDebug>
......@@ -22,8 +22,7 @@ CollectionLoader::CollectionLoader(QObject *parent)
void CollectionLoader::load()
{
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive);
job->fetchScope().setContentMimeTypes(KCalendarCore::Incidence::mimeTypes());
connect(job, &Akonadi::CollectionFetchJob::result, this, &CollectionLoader::onCollectionsLoaded);
......
......@@ -4,27 +4,27 @@
SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
*/
#include "backuper.h"
#include "calendarjanitor.h"
#include "options.h"
#include "backuper.h"
#include "console-version.h"
#include <KAboutData>
#include <KLocalizedString>
#include <QCoreApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QTextStream>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QString>
#include <QTextStream>
#include <qglobal.h>
#ifdef Q_OS_UNIX
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#endif
static const QString progName = QStringLiteral("calendarjanitor");
......@@ -51,12 +51,12 @@ static void silenceStderr()
{
#ifdef Q_OS_UNIX
if (qgetenv("KDE_CALENDARJANITOR_DEBUG") != "1") {
//krazy:cond=syscalls since UNIX-only code
// krazy:cond=syscalls since UNIX-only code
// Disable stderr so we can actually read what's going on
int fd = ::open("/dev/null", O_WRONLY);
::dup2(fd, 2);
::close(fd);
//krazy:endcond=syscalls
// krazy:endcond=syscalls
}
#endif
}
......@@ -76,7 +76,7 @@ int main(int argv, char *argc[])
QCommandLineOption fixOpt(QStringLiteral("fix"), i18n("Fix broken incidences"));
QCommandLineOption backupOpt(QStringLiteral("backup"), i18n("Backup your calendar"), QStringLiteral("output.ics"));
QCommandLineOption stripOldAlarmsOpt(QStringLiteral("strip-old-alarms"), i18n("Delete alarms older than 365 days"));
parser.addOptions({ colsOpt, fixOpt, backupOpt, stripOldAlarmsOpt });
parser.addOptions({colsOpt, fixOpt, backupOpt, stripOldAlarmsOpt});
aboutData.setupCommandLine(&parser);
parser.process(app);
......@@ -142,15 +142,13 @@ int main(int argv, char *argc[])
}
switch (janitorOptions.action()) {
case Options::ActionBackup:
{
case Options::ActionBackup: {
Backuper *backuper = new Backuper();
backuper->backup(backupFile, janitorOptions.collections());
break;
}
case Options::ActionScan:
case Options::ActionScanAndFix:
{
case Options::ActionScanAndFix: {
CalendarJanitor *janitor = new CalendarJanitor(janitorOptions);
janitor->start();
break;
......
......@@ -13,27 +13,21 @@
class Options
{
public:
enum SanityCheck {
CheckNone,
CheckEmptySummary, // Checks for empty summary and description. In fix mode, it deletes them.
CheckEmptyUid, // Checks for an empty UID. In fix mode, a new UID is assigned.
CheckEventDates, // Check for missing DTSTART or DTEND. New dates will be assigned.
CheckTodoDates, // Check for recurring to-dos without DTSTART. DTDUE will be assigned to DTSTART, or current date if DTDUE is also invalid.
CheckJournalDates, // Check for journals without DTSTART
CheckOrphans, // Check for orphan to-dos. Will be unparented." <disabled for now>
CheckDuplicateUIDs, // Check for duplicated UIDs. Copies will be deleted if the payload is the same. Otherwise a new UID is assigned.
CheckOrphanRecurId, // Check if incidences with recurrence id belong to an nonexistent master incidence
CheckStats, // Gathers some statistics. No fixing is done.
CheckCount // For iteration purposes. Keep at end.
CheckEmptySummary, // Checks for empty summary and description. In fix mode, it deletes them.
CheckEmptyUid, // Checks for an empty UID. In fix mode, a new UID is assigned.
CheckEventDates, // Check for missing DTSTART or DTEND. New dates will be assigned.
CheckTodoDates, // Check for recurring to-dos without DTSTART. DTDUE will be assigned to DTSTART, or current date if DTDUE is also invalid.
CheckJournalDates, // Check for journals without DTSTART
CheckOrphans, // Check for orphan to-dos. Will be unparented." <disabled for now>
CheckDuplicateUIDs, // Check for duplicated UIDs. Copies will be deleted if the payload is the same. Otherwise a new UID is assigned.
CheckOrphanRecurId, // Check if incidences with recurrence id belong to an nonexistent master incidence
CheckStats, // Gathers some statistics. No fixing is done.
CheckCount // For iteration purposes. Keep at end.
};
enum Action {
ActionNone,
ActionScan,
ActionScanAndFix,
ActionBackup
};
enum Action { ActionNone, ActionScan, ActionScanAndFix, ActionBackup };
Options();
......@@ -50,6 +44,7 @@ public:
bool stripOldAlarms() const;
void setStripOldAlarms(bool strip);
private:
QList<Akonadi::Collection::Id> m_collectionIds;
Action m_action = ActionNone;
......
......@@ -23,25 +23,25 @@
#include "konsolekalendar_debug.h"
#include <KLocalizedString>
#include <KCalUtils/HtmlExport>
#include <kcalutils/htmlexportsettings.h>
#include <AkonadiCore/AgentManager>
#include <AkonadiCore/AgentInstance>
#include <AkonadiCore/AgentInstanceCreateJob>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/AgentManager>
#include <AkonadiCore/Collection>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/CollectionFetchScope>
#include <KCalUtils/HtmlExport>
#include <kcalutils/htmlexportsettings.h>
#include <QDBusInterface>
#include <QDBusReply>
#include <QEventLoop>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include <QEventLoop>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace KCalendarCore;
using namespace std;
......@@ -65,12 +65,9 @@ bool KonsoleKalendar::importCalendar()
bool KonsoleKalendar::printCalendarList()
{
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
const QStringList mimeTypes = QStringList() << QStringLiteral("text/calendar")
<< KCalendarCore::Event::eventMimeType()
<< KCalendarCore::Todo::todoMimeType()
<< KCalendarCore::Journal::journalMimeType();
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive);
const QStringList mimeTypes = QStringList() << QStringLiteral("text/calendar") << KCalendarCore::Event::eventMimeType()
<< KCalendarCore::Todo::todoMimeType() << KCalendarCore::Journal::journalMimeType();
job->fetchScope().setContentMimeTypes(mimeTypes);
QEventLoop loop;
QObject::connect(job, &Akonadi::CollectionFetchJob::result, &loop, &QEventLoop::quit);
......@@ -87,7 +84,7 @@ bool KonsoleKalendar::printCalendarList()
cout << i18n("There are no calendars available.").toLocal8Bit().data() << endl;
} else {
cout << "--------------------------" << endl;
auto mimeTypeSet = QSet<QString>(mimeTypes.begin(), mimeTypes.end()); // set changes by run method intersect
auto mimeTypeSet = QSet<QString>(mimeTypes.begin(), mimeTypes.end()); // set changes by run method intersect
for (const Akonadi::Collection &collection : collections) {
const QStringList contentMimeTypes = collection.contentMimeTypes();
auto collectionMimeTypeSet = QSet<QString>(contentMimeTypes.begin(), contentMimeTypes.end());
......@@ -96,8 +93,7 @@ bool KonsoleKalendar::printCalendarList()
QString colId = QString::number(collection.id()).leftJustified(6, QLatin1Char(' '));
colId += QLatin1String("- ");
bool readOnly = !(collection.rights() & Akonadi::Collection::CanCreateItem
|| collection.rights() & Akonadi::Collection::CanChangeItem
bool readOnly = !(collection.rights() & Akonadi::Collection::CanCreateItem || collection.rights() & Akonadi::Collection::CanChangeItem
|| collection.rights() & Akonadi::Collection::CanDeleteItem);
QString readOnlyString = readOnly ? i18n("(Read only)") + QLatin1Char(' ') : QString();
......@@ -126,12 +122,12 @@ bool KonsoleKalendar::createAkonadiResource(const QString &icalFileUri)
QDBusInterface iface(QStringLiteral("org.freedesktop.Akonadi.Resource.") + inst.identifier(), QStringLiteral("/Settings"));
QDBusReply<void> reply = iface.call(QStringLiteral("setDisplayName"), QFileInfo(icalFileUri).baseName());
if (!reply.isValid()) {
qCWarning(KONSOLEKALENDAR_LOG) << "Could not set setting 'name': "<< reply.error().message();
qCWarning(KONSOLEKALENDAR_LOG) << "Could not set setting 'name': " << reply.error().message();
return false;
}
reply = iface.call(QStringLiteral("setPath"), icalFileUri);
if (!reply.isValid()) {
qCWarning(KONSOLEKALENDAR_LOG) << "Could not set setting 'path': "<< reply.error().message();
qCWarning(KONSOLEKALENDAR_LOG) << "Could not set setting 'path': " << reply.error().message();
return false;
}
inst.reconfigure();
......@@ -145,16 +141,13 @@ bool KonsoleKalendar::createCalendar()
const QString filename = m_variables->getCalendarFile();
if (m_variables->isDryRun()) {
cout << i18n("Create Calendar <Dry Run>: %1", filename).toLocal8Bit().data()
<< endl;
cout << i18n("Create Calendar <Dry Run>: %1", filename).toLocal8Bit().data() << endl;
} else {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::createCalendar() |"
<< "Creating calendar file: "
<< filename.toLocal8Bit().data();
<< "Creating calendar file: " << filename.toLocal8Bit().data();
if (m_variables->isVerbose()) {
cout << i18n("Create Calendar <Verbose>: %1", filename).toLocal8Bit().data()
<< endl;
cout << i18n("Create Calendar <Verbose>: %1", filename).toLocal8Bit().data() << endl;
}
status = createAkonadiResource(QStringLiteral("file://%1").arg(filename));
......@@ -173,8 +166,7 @@ bool KonsoleKalendar::showInstance()
Akonadi::CalendarBase::Ptr calendar = m_variables->getCalendar();
if (m_variables->isDryRun()) {
cout << qPrintable(i18n("View Events <Dry Run>:"))
<< endl;
cout << qPrintable(i18n("View Events <Dry Run>:")) << endl;
printSpecs();
} else {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
......@@ -185,8 +177,7 @@ bool KonsoleKalendar::showInstance()
if (!f.open(QIODevice::WriteOnly)) {
status = false;
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "unable to open export file"
<< m_variables->getExportFile();
<< "unable to open export file" << m_variables->getExportFile();
}
} else {
f.open(stdout, QIODevice::WriteOnly);
......@@ -197,15 +188,13 @@ bool KonsoleKalendar::showInstance()
<< "opened successful";
if (m_variables->isVerbose()) {
cout << i18n("View Event <Verbose>:").toLocal8Bit().data()
<< endl;
cout << i18n("View Event <Verbose>:").toLocal8Bit().data() << endl;
printSpecs();
}
QTextStream ts(&f);
if (m_variables->getExportType() != ExportTypeHTML
&& m_variables->getExportType() != ExportTypeMonthHTML) {
if (m_variables->getExportType() != ExportTypeHTML && m_variables->getExportType() != ExportTypeMonthHTML) {
if (m_variables->getAll()) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "view all events sorted list";
......@@ -222,10 +211,10 @@ bool KonsoleKalendar::showInstance()
} else if (m_variables->isUID()) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "view events by uid list";
//TODO: support a list of UIDs
// 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
// 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() |"
......@@ -235,12 +224,8 @@ bool KonsoleKalendar::showInstance()
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);
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()) {
......@@ -255,12 +240,8 @@ bool KonsoleKalendar::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);
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);
}
......@@ -272,17 +253,14 @@ bool KonsoleKalendar::showInstance()
<< "HTML view all events sorted list";
// sort the events for this date by start date
// in order to determine the date range.
Event::List *events
= new Event::List(calendar->rawEvents(EventSortStartDate,
SortDirectionAscending));
Event::List *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;
cout << i18n("Sorry, export to HTML by UID is not supported yet").toLocal8Bit().data() << endl;
return false;
} else {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
......@@ -293,10 +271,9 @@ bool KonsoleKalendar::showInstance()
KCalUtils::HTMLExportSettings htmlSettings(QStringLiteral("Konsolekalendar"));
//TODO: get progname and url from the values set in main
// TODO: get progname and url from the values set in main
htmlSettings.setCreditName(QStringLiteral("KonsoleKalendar"));
htmlSettings.setCreditURL(
QStringLiteral("https://userbase.kde.org/KonsoleKalendar"));
htmlSettings.setCreditURL(QStringLiteral("https://userbase.kde.org/KonsoleKalendar"));
htmlSettings.setExcludePrivate(true);
htmlSettings.setExcludeConfidential(true);
......@@ -308,27 +285,24 @@ bool KonsoleKalendar::showInstance()
htmlSettings.setMonthView(true);
} else {
if (firstdate == lastdate) {
title = i18n("Events: %1",
firstdate.toString(Qt::TextDate));
title = i18n("Events: %1", firstdate.toString(Qt::TextDate));
} else {
title = i18n("Events: %1 - %2",
firstdate.toString(Qt::TextDate),
lastdate.toString(Qt::TextDate));
title = i18n("Events: %1 - %2", firstdate.toString(Qt::TextDate), lastdate.toString(Qt::TextDate));
}
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);
// }
// 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.setTaskCategories( false );
// htmlSettings.setTaskAttendees( false );
// htmlSettings.setTaskDueDate( true );
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
htmlSettings.setDateStart(QDateTime(firstdate));
......@@ -338,7 +312,6 @@ bool KonsoleKalendar::showInstance()
htmlSettings.setDateEnd(QDateTime(lastdate.startOfDay()));
#endif
KCalUtils::HtmlExport *exp = new KCalUtils::HtmlExport(calendar.data(), &htmlSettings);
status = exp->save(&ts);
delete exp;
......@@ -358,9 +331,7 @@ bool KonsoleKalendar::printEventList(QTextStream *ts, Event::List *eventList, QD
Event::Ptr singleEvent;
Event::List::ConstIterator it;
for (it = eventList->constBegin();
it != eventList->constEnd() && status != false;
++it) {
for (it = eventList->constBegin(); it != eventList->constEnd() && status != false; ++it) {
singleEvent = *it;
status = printEvent(ts, singleEvent, date);
......@@ -392,14 +363,13 @@ bool KonsoleKalendar::printEvent(QTextStream *ts, const Event::Ptr &event, QDate
m_saveDate = dt;
}
status = exports.exportAsTxtShort(ts, event, dt, sameDay);
}
break;
} break;
case ExportTypeHTML:
// this is handled separately for now
break;
default:// Default export-type is ExportTypeText
default: // Default export-type is ExportTypeText
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::printEvent() |"
<< "TEXT export";
status = exports.exportAsTxt(ts, event, dt);
......@@ -449,14 +419,10 @@ bool KonsoleKalendar::isEvent(const QDateTime &startdate, const QDateTime &endda
bool found = false;
const auto timeZone = m_variables->getCalendar()->timeZone();
Event::List eventList(m_variables->getCalendar()->
rawEventsForDate(startdate.date(), timeZone,
EventSortStartDate,
SortDirectionAscending));
Event::List eventList(m_variables->getCalendar()->rawEventsForDate(startdate.date(), timeZone, EventSortStartDate, SortDirectionAscending));
for (it = eventList.constBegin(); it != eventList.constEnd(); ++it) {
event = *it;
if (event->dtEnd().toTimeZone(timeZone) == enddate
&& event->summary() == summary) {
if (event->dtEnd().toTimeZone(timeZone) == enddate && event->summary() == summary) {
found = true;
break;
}
......@@ -466,28 +432,17 @@ bool KonsoleKalendar::isEvent(const QDateTime &startdate, const QDateTime &endda
void KonsoleKalendar::printSpecs()
{