Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cb08285f authored by Volker Krause's avatar Volker Krause

Port away from Calendar::timeSpec()

parent 82c5b746
......@@ -41,6 +41,7 @@
#include <KCalCore/Event>
#include <KCalCore/FileStorage>
#include <KCalCore/Utils>
#include <Akonadi/Calendar/IncidenceChanger>
#include <AkonadiCore/Collection>
......@@ -89,9 +90,9 @@ bool KonsoleKalendarAdd::addEvent()
Event::Ptr event = Event::Ptr(new Event());
KDateTime::Spec timeSpec = m_variables->getCalendar()->timeSpec();
event->setDtStart(KDateTime(m_variables->getStartDateTime(), timeSpec));
event->setDtEnd(KDateTime(m_variables->getEndDateTime(), timeSpec));
const auto timeZone = m_variables->getCalendar()->timeZone();
event->setDtStart(KDateTime(m_variables->getStartDateTime(), KCalCore::zoneToSpec(timeZone)));
event->setDtEnd(KDateTime(m_variables->getEndDateTime(), KCalCore::zoneToSpec(timeZone)));
event->setSummary(m_variables->getSummary());
event->setAllDay(m_variables->getFloating());
event->setDescription(m_variables->getDescription());
......
......@@ -34,6 +34,7 @@
#include "konsolekalendar_debug.h"
#include <KLocalizedString>
#include <KCalCore/Utils>
#include <QEventLoop>
#include <QElapsedTimer>
......@@ -88,13 +89,13 @@ bool KonsoleKalendarChange::changeEvent()
event->startUpdates();
Akonadi::CalendarBase::Ptr calendar = m_variables->getCalendar();
KDateTime::Spec timeSpec = calendar->timeSpec();
const auto timeZone = calendar->timeZone();
if (m_variables->isStartDateTime()) {
event->setDtStart(KDateTime(m_variables->getStartDateTime(), timeSpec));
event->setDtStart(KDateTime(m_variables->getStartDateTime(), KCalCore::zoneToSpec(timeZone)));
}
if (m_variables->isEndDateTime()) {
event->setDtEnd(KDateTime(m_variables->getEndDateTime(), timeSpec));
event->setDtEnd(KDateTime(m_variables->getEndDateTime(), KCalCore::zoneToSpec(timeZone)));
}
event->setAllDay(m_variables->getFloating());
......@@ -145,14 +146,14 @@ void KonsoleKalendarChange::printSpecs(const Event::Ptr &event)
event->summary()).toLocal8Bit().data()
<< endl;
KDateTime::Spec timeSpec = m_variables->getCalendar()->timeSpec();
const auto timeZone = m_variables->getCalendar()->timeZone();
cout << i18n(" Begin: %1",
event->dtStart().toTimeSpec(timeSpec).
event->dtStart().toTimeSpec(KCalCore::zoneToSpec(timeZone)).
dateTime().toString(Qt::TextDate)).toLocal8Bit().data()
<< endl;
cout << i18n(" End: %1",
event->dtEnd().toTimeSpec(timeSpec).
event->dtEnd().toTimeSpec(KCalCore::zoneToSpec(timeZone)).
dateTime().toString(Qt::TextDate)).toLocal8Bit().data()
<< endl;
......
......@@ -38,6 +38,7 @@
#include "konsolekalendar_debug.h"
#include <KLocalizedString>
#include <QEventLoop>
#include <kcalcore/utils.h>
using namespace KCalCore;
using namespace std;
......@@ -104,13 +105,13 @@ void KonsoleKalendarDelete::printSpecs(const Event::Ptr &event)
cout << i18n(" What: %1", event->summary()).data()
<< endl;
KDateTime::Spec timeSpec = m_variables->getCalendar()->timeSpec();
const auto timeZone = m_variables->getCalendar()->timeZone();
cout << i18n(" Begin: %1",
event->dtStart().toTimeSpec(timeSpec).dateTime().toString(Qt::TextDate)).data()
event->dtStart().toTimeSpec(KCalCore::zoneToSpec(timeZone)).dateTime().toString(Qt::TextDate)).data()
<< endl;
cout << i18n(" End: %1",
event->dtEnd().toTimeSpec(timeSpec).dateTime().toString(Qt::TextDate)).data()
event->dtEnd().toTimeSpec(KCalCore::zoneToSpec(timeZone)).dateTime().toString(Qt::TextDate)).data()
<< endl;
cout << i18n(" Desc: %1",
......
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