Commit ad2c7a7e authored by Volker Krause's avatar Volker Krause

Free IncidenceEditor from KDateTime

parent d07b3bb2
......@@ -25,7 +25,7 @@ endmacro()
macro(IE_EXECUTABLE_TESTS)
foreach(_testname ${ARGN})
add_executable(${_testname} NOGUI TEST ${_testname}.cpp modeltest.cpp)
target_link_libraries(${_testname} KF5::CalendarCore Qt5::Test KF5::IncidenceEditor)
target_link_libraries(${_testname} KF5::CalendarCore Qt5::Test KF5::IncidenceEditor Qt5::Widgets)
endforeach()
endmacro()
......@@ -45,6 +45,7 @@ target_link_libraries(ktimezonecomboboxtest
KF5::CalendarCore
Qt5::Test
KF5::IncidenceEditor
KF5::Completion
)
add_executable(testindividualmaildialog testindividualmaildialog.cpp ../src/individualmaildialog.cpp)
......@@ -54,4 +55,7 @@ ecm_mark_as_test(testindividualmaildialog)
target_link_libraries(testindividualmaildialog
KF5::CalendarCore
Qt5::Test
Qt5::Widgets
KF5::WidgetsAddons
KF5::I18n
)
......@@ -22,8 +22,6 @@
#include "qtest.h"
#include <KTimeZone>
QTEST_MAIN(KTimeZoneComboBoxTest)
void KTimeZoneComboBoxTest::test_timeSpec()
......
......@@ -56,8 +56,8 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
KCalCore::Attendee::Ptr a1(new KCalCore::Attendee(QStringLiteral("fred"), QStringLiteral("fred@example.com")));
KCalCore::FreeBusy::Ptr fb1(new KCalCore::FreeBusy());
fb1->addPeriod(KDateTime(dt1), KCalCore::Duration(60 * 60));
fb1->addPeriod(KDateTime(dt2), KCalCore::Duration(60 * 60));
fb1->addPeriod(dt1, KCalCore::Duration(60 * 60));
fb1->addPeriod(dt2, KCalCore::Duration(60 * 60));
CalendarSupport::FreeBusyItem::Ptr item1(new CalendarSupport::FreeBusyItem(a1, nullptr));
item1->setFreeBusy(fb1);
......@@ -67,8 +67,8 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
KCalCore::Attendee::Ptr a2(new KCalCore::Attendee(QStringLiteral("joe"), QStringLiteral("joe@example.com")));
KCalCore::FreeBusy::Ptr fb2(new KCalCore::FreeBusy());
fb2->addPeriod(KDateTime(dt3), KCalCore::Duration(60 * 60));
fb2->addPeriod(KDateTime(dt4), KCalCore::Duration(60 * 60));
fb2->addPeriod(dt3, KCalCore::Duration(60 * 60));
fb2->addPeriod(dt4, KCalCore::Duration(60 * 60));
CalendarSupport::FreeBusyItem::Ptr item2(new CalendarSupport::FreeBusyItem(a2, nullptr));
item2->setFreeBusy(fb2);
......
......@@ -113,6 +113,12 @@ PRIVATE
KF5::Codecs
KF5::Ldap
KF5::AkonadiWidgets
KF5::IconThemes
KF5::Completion
KF5::KIOWidgets
KF5::TextWidgets
KF5::WidgetsAddons
KF5::XmlGui
)
target_include_directories(KF5IncidenceEditor INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/IncidenceEditor/;${KDE_INSTALL_INCLUDEDIR_KF5}/incidenceeditor>")
target_include_directories(KF5IncidenceEditor PUBLIC "$<BUILD_INTERFACE:${incidenceeditor_SOURCE_DIR}/src;${incidenceeditor_BINARY_DIR}/src;>")
......
This diff is collapsed.
......@@ -119,8 +119,8 @@ private:
void save(const KCalCore::Event::Ptr &event);
void save(const KCalCore::Todo::Ptr &todo);
void save(const KCalCore::Journal::Ptr &journal);
void setDateTimes(const KDateTime &start, const KDateTime &end);
void setTimes(const KDateTime &start, const KDateTime &end);
void setDateTimes(const QDateTime &start, const QDateTime &end);
void setTimes(const QDateTime &start, const QDateTime &end);
void setTimeZoneLabelEnabled(bool enable);
bool timeZonesAreLocal(const QDateTime &start, const QDateTime &end);
......@@ -140,7 +140,7 @@ private:
* We need to store the current start date/time to be able to update the end
* time appropriate when the start time changes.
*/
KDateTime mCurrentStartDateTime;
QDateTime mCurrentStartDateTime;
/// Remembers state when switching between takes whole day and timed event/to-do.
bool mTimezoneCombosWereVisibile;
......
......@@ -157,8 +157,8 @@ void IncidenceDefaultsPrivate::eventDefaults(const KCalCore::Event::Ptr &event)
const QDateTime endDT = mEndDt.isValid() ? mEndDt : startDT.addSecs(defaultDuration);
event->setDtStart(KDateTime(startDT));
event->setDtEnd(KDateTime(endDT));
event->setDtStart(startDT);
event->setDtEnd(endDT);
event->setTransparency(KCalCore::Event::Opaque);
if (KCalPrefs::instance()->defaultEventReminders()) {
......@@ -169,7 +169,7 @@ void IncidenceDefaultsPrivate::eventDefaults(const KCalCore::Event::Ptr &event)
void IncidenceDefaultsPrivate::journalDefaults(const KCalCore::Journal::Ptr &journal) const
{
const QDateTime startDT = mStartDt.isValid() ? mStartDt : QDateTime::currentDateTime();
journal->setDtStart(KDateTime(startDT));
journal->setDtStart(startDT);
journal->setAllDay(true);
}
......@@ -181,28 +181,28 @@ void IncidenceDefaultsPrivate::todoDefaults(const KCalCore::Todo::Ptr &todo) con
}
if (mEndDt.isValid()) {
todo->setDtDue(KDateTime(mEndDt), true /** first */);
todo->setDtDue(mEndDt, true /** first */);
} else if (relatedTodo && relatedTodo->hasDueDate()) {
todo->setDtDue(relatedTodo->dtDue(true), true /** first */);
todo->setAllDay(relatedTodo->allDay());
} else if (relatedTodo) {
todo->setDtDue(KDateTime());
todo->setDtDue(QDateTime());
} else {
todo->setDtDue(KDateTime(QDateTime::currentDateTime().addDays(1)), true /** first */);
todo->setDtDue(QDateTime::currentDateTime().addDays(1), true /** first */);
}
if (mStartDt.isValid()) {
todo->setDtStart(KDateTime(mStartDt));
todo->setDtStart(mStartDt);
} else if (relatedTodo && !relatedTodo->hasStartDate()) {
todo->setDtStart(KDateTime());
todo->setDtStart(QDateTime());
} else if (relatedTodo && relatedTodo->hasStartDate() &&
relatedTodo->dtStart() <= todo->dtDue()) {
todo->setDtStart(relatedTodo->dtStart());
todo->setAllDay(relatedTodo->allDay());
} else if (!mEndDt.isValid() || (QDateTime::currentDateTime() < mEndDt)) {
todo->setDtStart(KDateTime(QDateTime::currentDateTime()));
todo->setDtStart(QDateTime::currentDateTime());
} else {
todo->setDtStart(KDateTime(mEndDt.addDays(-1)));
todo->setDtStart(mEndDt.addDays(-1));
}
todo->setCompleted(false);
......
......@@ -5,7 +5,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<include>klocale.h</include>
<kcfgfile name="incidenceeditorrc"/>
<group name="AttachmentHandling">
......
......@@ -26,8 +26,6 @@
#include <KLocalizedString>
#include <QLocale>
#include <KCalCore/Utils>
using namespace IncidenceEditorNG;
enum {
......@@ -432,12 +430,12 @@ bool IncidenceRecurrence::isValid() const
// Check if the incidence will occur at least once
if (incidence->recurs()) {
// dtStart for events, dtDue for to-dos
const KDateTime referenceDate
const QDateTime referenceDate
= incidence->dateTime(KCalCore::Incidence::RoleRecurrenceStart);
if (referenceDate.isValid()) {
if (!(incidence->recurrence()->recursOn(referenceDate.date(), KCalCore::specToZone(referenceDate.timeSpec()))
|| incidence->recurrence()->getNextDateTime(KCalCore::k2q(referenceDate)).isValid())) {
if (!(incidence->recurrence()->recursOn(referenceDate.date(), referenceDate.timeZone())
|| incidence->recurrence()->getNextDateTime(referenceDate).isValid())) {
mLastErrorString = i18n("A recurring event or to-do must occur at least once. "
"Adjust the recurring parameters.");
qCDebug(INCIDENCEEDITOR_LOG) << mLastErrorString;
......
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