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 c1a3d39c authored by Volker Krause's avatar Volker Krause

Port away from KCalPrefs::timeSpec()

parent 10b31f53
......@@ -656,8 +656,7 @@ void CalendarView::slotModifyFinished(int changeId,
if (journals.isEmpty()) {
KCalCore::Journal::Ptr journal(new KCalCore::Journal);
journal->setDtStart(
KDateTime::currentDateTime(CalendarSupport::KCalPrefs::instance()->timeSpec()));
journal->setDtStart(KDateTime::currentLocalDateTime());
QString dateStr = QLocale::system().toString(QDate::currentDate(), QLocale::LongFormat);
journal->setSummary(i18n("Journal of %1", dateStr));
......@@ -1391,8 +1390,7 @@ void CalendarView::toggleTodoCompleted(const Akonadi::Item &todoItem)
if (todo->isCompleted()) {
todo->setPercentComplete(0);
} else {
todo->setCompleted(KDateTime::currentDateTime(
CalendarSupport::KCalPrefs::instance()->timeSpec()));
todo->setCompleted(KDateTime::currentLocalDateTime());
}
mChanger->startAtomicOperation(i18n("Toggle To-do Completed"));
......@@ -2232,9 +2230,7 @@ void CalendarView::showIncidenceContext(const Akonadi::Item &item)
viewManager()->showAgendaView();
}
// just select the appropriate date
mDateNavigator->selectWeek(
incidence->dtStart().toTimeSpec(
CalendarSupport::KCalPrefs::instance()->timeSpec()).date());
mDateNavigator->selectWeek(incidence->dtStart().toLocalZone().date());
return;
} else if (CalendarSupport::hasJournal(item)) {
if (!viewManager()->currentView()->inherits("KOJournalView")) {
......
......@@ -172,20 +172,19 @@ void SearchDialog::search(const QRegExp &re)
if (m_ui->todosCheck->isChecked()) {
if (m_ui->includeUndatedTodos->isChecked()) {
KDateTime::Spec spec = CalendarSupport::KCalPrefs::instance()->timeSpec();
const KCalCore::Todo::List alltodos = m_calendarview->calendar()->todos();
for (const KCalCore::Todo::Ptr &todo : alltodos) {
Q_ASSERT(todo);
if ((!todo->hasStartDate() && !todo->hasDueDate()) || // undated
(todo->hasStartDate() &&
(todo->dtStart().toTimeSpec(spec).date() >= startDt) &&
(todo->dtStart().toTimeSpec(spec).date() <= endDt)) || //start dt in range
(todo->dtStart().toLocalZone().date() >= startDt) &&
(todo->dtStart().toLocalZone().date() <= endDt)) || //start dt in range
(todo->hasDueDate() &&
(todo->dtDue().toTimeSpec(spec).date() >= startDt) &&
(todo->dtDue().toTimeSpec(spec).date() <= endDt)) || //due dt in range
(todo->dtDue().toLocalZone().date() >= startDt) &&
(todo->dtDue().toLocalZone().date() <= endDt)) || //due dt in range
(todo->hasCompletedDate() &&
(todo->completed().toTimeSpec(spec).date() >= startDt) &&
(todo->completed().toTimeSpec(spec).date() <= endDt))) { //completed dt in range
(todo->completed().toLocalZone().date() >= startDt) &&
(todo->completed().toLocalZone().date() <= endDt))) { //completed dt in range
todos.append(todo);
}
}
......
......@@ -204,12 +204,12 @@ bool KOEventView::usesCompletedTodoPixmap(const Akonadi::Item &aitem, const QDat
if (todo->allDay()) {
time = QTime(0, 0);
} else {
time = todo->dtDue().toTimeSpec(CalendarSupport::KCalPrefs::instance()->timeSpec()).time();
time = todo->dtDue().toLocalZone().time();
}
KDateTime itemDateTime(date, time, CalendarSupport::KCalPrefs::instance()->timeSpec());
QDateTime itemDateTime(date, time, Qt::LocalTime);
return itemDateTime < todo->dtDue(false);
return itemDateTime < todo->dtDue(false).toLocalZone().dateTime();
} else {
return false;
......
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