Commit c2c8f841 authored by Nicolas Fella's avatar Nicolas Fella Committed by Dimitris Kardarakos

Fix some clazy warnings

parent ecf98a84
Pipeline #6210 passed with stage
in 5 minutes and 3 seconds
......@@ -90,8 +90,8 @@ void AlarmsModel::loadAlarms()
QVector<MemoryCalendar::Ptr>::const_iterator itr = mMemoryCalendars.constBegin();
while(itr != mMemoryCalendars.constEnd())
{
QDateTime from = mPeriod["from"].value<QDateTime>();
QDateTime to = mPeriod["to"].value<QDateTime>();
QDateTime from = mPeriod["from"].toDateTime();
QDateTime to = mPeriod["to"].toDateTime();
qDebug() << "loadAlarms:\tLooking for alarms in calendar #" << cnt << ", from" << from.toString("dd.MM.yyyy hh:mm:ss") << "to" << to.toString("dd.MM.yyyy hh:mm:ss");
Alarm::List calendarAlarms;
......@@ -151,7 +151,7 @@ void AlarmsModel::setParams(const QHash<QString, QVariant>& parameters)
{
mParams = parameters;
QStringList calendarFiles = mParams["calendarFiles"].value<QStringList>();
QStringList calendarFiles = mParams["calendarFiles"].toStringList();
QVariantMap period = (mParams["period"].value<QVariant>()).value<QVariantMap>();
mCalendarFiles = calendarFiles;
......
......@@ -108,7 +108,7 @@ void CalAlarmClient::checkAlarms()
for(int i=0; i<mAlarmsModel->rowCount(); ++i)
{
QModelIndex index = mAlarmsModel->index(i, 0, QModelIndex());
mNotificationHandler->addActiveNotification(mAlarmsModel->data(index, AlarmsModel::Roles::Uid).value<QString>(), QString("%1\n%2").arg(mAlarmsModel->data(index, AlarmsModel::Roles::IncidenceStartDt).value<QDateTime>().toString("hh:mm"), mAlarmsModel->data(index, AlarmsModel::Roles::Text).value<QString>()));
mNotificationHandler->addActiveNotification(mAlarmsModel->data(index, AlarmsModel::Roles::Uid).toString(), QString("%1\n%2").arg(mAlarmsModel->data(index, AlarmsModel::Roles::IncidenceStartDt).toDateTime().toString("hh:mm"), mAlarmsModel->data(index, AlarmsModel::Roles::Text).toString()));
}
mNotificationHandler->sendNotifications();
......@@ -187,7 +187,7 @@ QStringList CalAlarmClient::dumpAlarms() const
for(int i=0; i<model->rowCount(); ++i)
{
QModelIndex index = model->index(i, 0, QModelIndex());
lst << QStringLiteral("%1: \"%2\"").arg(model->data(index, AlarmsModel::Roles::Time).value<QString>(), model->data(index, AlarmsModel::Roles::Uid).value<QString>());
lst << QStringLiteral("%1: \"%2\"").arg(model->data(index, AlarmsModel::Roles::Time).toString(), model->data(index, AlarmsModel::Roles::Uid).toString());
}
return lst;
......@@ -230,10 +230,10 @@ QString CalAlarmClient::alarmText(const QString& uid) const
for(int i=0; i < model->rowCount(); ++i)
{
QModelIndex index = model->index(i, 0, QModelIndex());
if(model->data(index, AlarmsModel::Roles::Uid).value<QString>() == uid)
if(model->data(index, AlarmsModel::Roles::Uid).toString() == uid)
{
qDebug() << "alarmText: text of" << model->data(index, AlarmsModel::Roles::Uid).value<QString>() << " is" << model->data(index, AlarmsModel::Roles::Text).value<QString>();
return model->data(index, AlarmsModel::Roles::Text).value<QString>();
qDebug() << "alarmText: text of" << model->data(index, AlarmsModel::Roles::Uid).toString() << " is" << model->data(index, AlarmsModel::Roles::Text).toString();
return model->data(index, AlarmsModel::Roles::Text).toString();
}
}
......
......@@ -34,7 +34,7 @@ int main(int argc, char **argv)
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
KAboutData aboutData(QStringLiteral("calindac"), i18n("Calindori Alarm Check Daemon"),
QStringLiteral(), i18n("Calindori Alarm Check Daemon"),
QString(), i18n("Calindori Alarm Check Daemon"),
KAboutLicense::GPL,
i18n("(c) 2019 Dimitris Kardarakos"),
QString(), QStringLiteral("https://invent.kde.org/kde/calindori"));
......
......@@ -56,7 +56,7 @@ void NotificationHandler::sendSuspendedNotifications()
QHash<QString, AlarmNotification*>::iterator suspItr = mSuspendedNotifications.begin();
while(suspItr != mSuspendedNotifications.end())
{
if(suspItr.value()->remindAt() < mPeriod["to"].value<QDateTime>())
if(suspItr.value()->remindAt() < mPeriod["to"].toDateTime())
{
qDebug() << "sendNotifications:\tSending notification for suspended alarm" << suspItr.value()->uid() << ", text is" << suspItr.value()->text();
......
......@@ -31,7 +31,7 @@ void EventController::remove(LocalCalendar *calendar, const QVariantMap &eventDa
qDebug() << "Deleting event";
MemoryCalendar::Ptr memoryCalendar = calendar->memorycalendar();
QString uid = eventData["uid"].value<QString>();
QString uid = eventData["uid"].toString();
Event::Ptr event = memoryCalendar->event(uid);
memoryCalendar->deleteEvent(event);
bool deleted = calendar->save();
......@@ -45,8 +45,8 @@ void EventController::addEdit(LocalCalendar *calendar, const QVariantMap &eventD
MemoryCalendar::Ptr memoryCalendar = calendar->memorycalendar();
QDateTime now = QDateTime::currentDateTime();
QString uid = eventData["uid"].value<QString>();
QString summary = eventData["summary"].value<QString>();
QString uid = eventData["uid"].toString();
QString summary = eventData["summary"].toString();
Event::Ptr event;
if (uid == "") {
......@@ -58,17 +58,17 @@ void EventController::addEdit(LocalCalendar *calendar, const QVariantMap &eventD
event->setUid(uid);
}
QDate startDate = eventData["startDate"].value<QDate>();
QDate startDate = eventData["startDate"].toDate();
int startHour = eventData["startHour"].value<int>();
int startMinute = eventData["startMinute"].value<int>();
QDate endDate = eventData["endDate"].value<QDate>();
QDate endDate = eventData["endDate"].toDate();
int endHour = eventData["endHour"].value<int>();
int endMinute = eventData["endMinute"].value<int>();
QDateTime startDateTime;
QDateTime endDateTime;
bool allDayFlg= eventData["allDay"].value<bool>();
bool allDayFlg= eventData["allDay"].toBool();
if(allDayFlg) {
startDateTime = QDateTime(startDate);
......@@ -81,10 +81,10 @@ void EventController::addEdit(LocalCalendar *calendar, const QVariantMap &eventD
event->setDtStart(startDateTime);
event->setDtEnd(endDateTime);
event->setDescription(eventData["description"].value<QString>());
event->setDescription(eventData["description"].toString());
event->setSummary(summary);
event->setAllDay(allDayFlg);
event->setLocation(eventData["location"].value<QString>());
event->setLocation(eventData["location"].toString());
event->clearAlarms();
QVariantList newAlarms = eventData["alarms"].value<QVariantList>();
......
......@@ -125,7 +125,7 @@ void IncidenceAlarmsModel::loadPersistentAlarms()
beginResetModel();
LocalCalendar* localCalendar = mAlarmProperties["calendar"].value<LocalCalendar*>();
QString uid = mAlarmProperties["uid"].value<QString>();
QString uid = mAlarmProperties["uid"].toString();
MemoryCalendar::Ptr memCalendar;
Incidence::Ptr alarmIncidence;
Alarm::List persistentAlarms = Alarm::List();
......@@ -162,7 +162,7 @@ QString IncidenceAlarmsModel::alarmText(const int idx) const
{
QHash<QString, QVariant> alarm = mAlarms.at(idx).value<QHash<QString, QVariant>>();
return alarm["text"].value<QString>();
return alarm["text"].toString();
}
QString IncidenceAlarmsModel::alarmStartOffsetType(const int idx) const
......@@ -200,7 +200,7 @@ QString IncidenceAlarmsModel::alarmUid(const int idx) const
{
QHash<QString, QVariant> alarm = mAlarms.at(idx).value<QHash<QString, QVariant>>();
return alarm["uid"].value<QString>();
return alarm["uid"].toString();
}
int IncidenceAlarmsModel::alarmActionType(const int idx) const
......
......@@ -33,12 +33,12 @@ void TodoController::addEdit(LocalCalendar *calendar, const QVariantMap& todo)
MemoryCalendar::Ptr memoryCalendar = calendar->memorycalendar();
Todo::Ptr vtodo;
QDateTime now = QDateTime::currentDateTime();
QString uid = todo["uid"].value<QString>();
QString summary = todo["summary"].value<QString>();
QDate startDate = todo["startDate"].value<QDate>();
QString uid = todo["uid"].toString();
QString summary = todo["summary"].toString();
QDate startDate = todo["startDate"].toDate();
int startHour = todo["startHour"].value<int>();
int startMinute = todo["startMinute"].value<int>();
bool allDayFlg= todo["allDay"].value<bool>();
bool allDayFlg= todo["allDay"].toBool();
if(uid == "")
{
......@@ -60,11 +60,11 @@ void TodoController::addEdit(LocalCalendar *calendar, const QVariantMap& todo)
}
vtodo->setDtStart(startDateTime);
vtodo->setDescription(todo["description"].value<QString>());
vtodo->setDescription(todo["description"].toString());
vtodo->setSummary(summary);
vtodo->setAllDay(allDayFlg);
vtodo->setLocation(todo["location"].value<QString>());
vtodo->setCompleted(todo["completed"].value<bool>());
vtodo->setLocation(todo["location"].toString());
vtodo->setCompleted(todo["completed"].toBool());
memoryCalendar->addTodo(vtodo);
bool merged = calendar->save();
......@@ -77,7 +77,7 @@ void TodoController::remove(LocalCalendar *calendar, const QVariantMap& todo)
qDebug() << "Deleting todo";
MemoryCalendar::Ptr memoryCalendar = calendar->memorycalendar();
QString uid = todo["uid"].value<QString>();
QString uid = todo["uid"].toString();
Todo::Ptr vtodo = memoryCalendar->todo(uid);
memoryCalendar->deleteTodo(vtodo);
......
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