Commit 2492c255 authored by David Jarvie's avatar David Jarvie

KLocale -> QLocale

parent 0b7f400e
......@@ -2,7 +2,7 @@
* alarmtext.cpp - text/email alarm text conversion
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2004,2005,2007-2013 by David Jarvie <djarvie@kde.org>
* Copyright © 2004,2005,2007-2016 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -24,11 +24,11 @@
#include "kaevent.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <QStringList>
#include <QDateTime>
#include <QLocale>
namespace
{
......@@ -164,8 +164,8 @@ void AlarmText::setTodo(const KCalCore::Todo::Ptr &todo)
if (todo->hasDueDate()) {
KDateTime due = todo->dtDue(false); // fetch the next due date
if (todo->hasStartDate() && todo->dtStart() != due) {
d->mTime = todo->allDay() ? KLocale::global()->formatDate(due.date(), KLocale::ShortDate)
: KLocale::global()->formatDateTime(due.dateTime());
d->mTime = todo->allDay() ? QLocale().toString(due.date(), QLocale::ShortFormat)
: QLocale().toString(due.dateTime(), QLocale::ShortFormat);
}
}
}
......
......@@ -2,7 +2,7 @@
* datetime.cpp - date/time with start-of-day time for date-only values
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2003,2005-2007,2009-2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2003,2005-2007,2009-2011,2016 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -21,11 +21,11 @@
*/
#include "datetime.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <ktimezone.h>
#include <QDateTime>
#include <QLocale>
namespace KAlarmCal
{
......@@ -344,7 +344,9 @@ QString DateTime::toString(const QString &format) const
QString DateTime::formatLocale(bool shortFormat) const
{
return KLocale::global()->formatDateTime(d->mDateTime, (shortFormat ? KLocale::ShortDate : KLocale::LongDate));
QLocale::FormatType format = shortFormat ? QLocale::ShortFormat : QLocale::LongFormat;
return d->mDateTime.isDateOnly() ? QLocale().toString(d->mDateTime.date(), format)
: QLocale().toString(d->mDateTime.dateTime(), format);
}
void DateTime::setStartOfDay(const QTime &sod)
......
......@@ -2,7 +2,7 @@
* karecurrence.cpp - recurrence with special yearly February 29th handling
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2005-2013 by David Jarvie <djarvie@kde.org>
* Copyright © 2005-2016 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -30,7 +30,7 @@
#include <QBitArray>
#include <QDate>
#include <KLocale>
#include <QLocale>
using namespace KCalCore;
namespace KAlarmCal
......@@ -1035,7 +1035,7 @@ Duration KARecurrence::longestInterval() const
int maxgap = 1;
// Use the user's definition of the week, starting at the
// day of the week specified by the user's locale.
const int weekStart = KLocale::global()->weekStartDay() - 1; // zero-based
const int weekStart = QLocale().firstDayOfWeek() - 1; // zero-based
for (int i = 0; i < 7; ++i) {
// Get the standard KDE day-of-week number (zero-based)
// for the day-of-week number in the user's locale.
......
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