summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-09-10 21:01:57 +0200
committerVolker Krause <[email protected]>2017-09-10 21:02:06 +0200
commit63f5b01592757a361bc2f969b9e0779430f5adf6 (patch)
treeeaa3cc8993ddd11a842f392e662fcdcc71b2b561
parent8a79563b881209fe1e7490285caf4df8afdbe1c8 (diff)
Remove the remaining KLocale usage in korgac
Also a bit more KDateTime to QDateTime porting here.
-rw-r--r--korgac/alarmdialog.cpp28
-rw-r--r--korgac/alarmdialog.h3
2 files changed, 13 insertions, 18 deletions
diff --git a/korgac/alarmdialog.cpp b/korgac/alarmdialog.cpp
index a338640..12df04d 100644
--- a/korgac/alarmdialog.cpp
+++ b/korgac/alarmdialog.cpp
@@ -49,8 +49,8 @@
#include <MailTransport/TransportManager>
#include <QUrl>
-#include <KLocale>
#include <KComboBox>
+#include <KDateTime>
#include <QHBoxLayout>
#include <KLocalizedString>
#include <KMessageBox>
@@ -91,7 +91,7 @@ public:
const Akonadi::Item mIncidence;
QDateTime mRemindAt;
QDateTime mTrigger;
- KDateTime mHappening;
+ QDateTime mHappening;
bool mNotified;
};
@@ -319,15 +319,14 @@ void AlarmDialog::addIncidence(const Akonadi::Item &incidenceitem,
item = new ReminderTreeItem(incidenceitem, mIncidenceTree);
}
item->mNotified = false;
- item->mHappening = KDateTime();
+ item->mHappening = QDateTime();
item->mRemindAt = reminderAt;
item->mTrigger = QDateTime::currentDateTime();
item->mDisplayText = displayText;
item->setText(0, cleanSummary(incidence->summary()));
QString displayStr;
- const KDateTime dateTime = triggerDateForIncidence(incidence, reminderAt,
- displayStr);
+ const auto dateTime = triggerDateForIncidence(incidence, reminderAt, displayStr);
if (incidence->type() == Incidence::TypeEvent) {
item->setIcon(0, QIcon::fromTheme(QStringLiteral("view-calendar-day")));
@@ -482,9 +481,9 @@ void AlarmDialog::suspend()
(*it)->setDisabled(true);
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
item->mRemindAt = QDateTime::currentDateTime().addSecs(unit * mSuspendSpin->value());
- item->mHappening = KDateTime(item->mRemindAt, KDateTime::Spec::LocalZone());
+ item->mHappening = item->mRemindAt;
item->mNotified = false;
- (*it)->setText(1, KLocale::global()->formatDateTime(item->mHappening));
+ (*it)->setText(1, QLocale().toString(item->mHappening, QLocale::ShortFormat));
selitem = item;
}
++it;
@@ -850,27 +849,26 @@ void AlarmDialog::accept()
}
/** static */
-KDateTime AlarmDialog::triggerDateForIncidence(const Incidence::Ptr &incidence,
+QDateTime AlarmDialog::triggerDateForIncidence(const Incidence::Ptr &incidence,
const QDateTime &reminderAt,
QString &displayStr)
{
- KDateTime result;
+ QDateTime result;
if (incidence->alarms().isEmpty()) {
return result;
}
if (incidence->recurs()) {
- result = incidence->recurrence()->getNextDateTime(
- KDateTime(reminderAt, KDateTime::Spec::LocalZone()));
+ result = incidence->recurrence()->getNextDateTime(KDateTime(reminderAt, KDateTime::Spec::LocalZone())).toLocalZone().dateTime();
}
if (!result.isValid()) {
- result = incidence->dateTime(Incidence::RoleAlarm);
+ result = incidence->dateTime(Incidence::RoleAlarm).toLocalZone().dateTime();
}
if (result.isValid()) {
- displayStr = QLocale().toString(result.toLocalZone().dateTime(), QLocale::ShortFormat);
+ displayStr = QLocale().toString(result, QLocale::ShortFormat);
}
return result;
}
@@ -890,9 +888,7 @@ void AlarmDialog::slotCalendarChanged()
// Yes, alarms can be empty, if someone edited the incidence and removed all alarms
if (!incidence->alarms().isEmpty()) {
- const KDateTime dateTime = triggerDateForIncidence(incidence,
- item->mRemindAt,
- displayStr);
+ const auto dateTime = triggerDateForIncidence(incidence, item->mRemindAt, displayStr);
const QString summary = cleanSummary(incidence->summary());
diff --git a/korgac/alarmdialog.h b/korgac/alarmdialog.h
index a1f2a86..aa6f34d 100644
--- a/korgac/alarmdialog.h
+++ b/korgac/alarmdialog.h
@@ -28,7 +28,6 @@
#include <Item>
#include <QDialog>
#include <KCalCore/Incidence>
-#include <KDateTime>
#include <QPoint>
#include <QTimer>
@@ -103,7 +102,7 @@ private:
void updateButtons();
typedef QList<ReminderTreeItem *> ReminderList;
- static KDateTime triggerDateForIncidence(const KCalCore::Incidence::Ptr &inc,
+ static QDateTime triggerDateForIncidence(const KCalCore::Incidence::Ptr &inc,
const QDateTime &reminderAt,
QString &displayStr);