Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Copyright: UnionTech Software Technology Co., Ltd.
License: GPL-3.0-or-later

# Project file
Files: *.pro *.prf *.pri *.txt *.cmake
Files: *.pro *.prf *.pri *.txt *.cmake *CMakeLists.txt .tx/*
Copyright: None
License: CC0-1.0

Expand Down
15 changes: 15 additions & 0 deletions calendar-common/src/compatibledata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

#include "compatibledata.h"
#include "units.h"
#include "icalformat.h"

Check warning on line 7 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "icalformat.h" not found.

Check warning on line 7 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "icalformat.h" not found.
#include "commondef.h"

#include <QJsonObject>

Check warning on line 10 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QJsonObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 10 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonDocument>

Check warning on line 11 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QJsonDocument> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 11 in calendar-common/src/compatibledata.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonDocument> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonArray>
#include <QByteArray>
#include <QList>
Expand All @@ -22,6 +23,7 @@
*/
QJsonObject JobToObject(const DSchedule::Ptr &job)
{
// qCDebug(CommonLogger) << "JobToObject, job summary:" << (job ? job->summary() : "null");
QJsonObject obj;

obj.insert("ID", job->compatibleID());
Expand All @@ -48,15 +50,18 @@

QString DDE_Calendar::getNewTypeIDByOldTypeID(int oldTypeID)
{
qCDebug(CommonLogger) << "DDE_Calendar::getNewTypeIDByOldTypeID, oldTypeID:" << oldTypeID;
if (mTypeMap.contains(oldTypeID)) {
return mTypeMap.value(oldTypeID);
} else {
qCWarning(CommonLogger) << "Old type ID not found, returning default";
return mTypeMap.value(3);
}
}

int DDE_Calendar::getOldTypeIDByNewTypeID(const QString &newTypeID)
{
qCDebug(CommonLogger) << "DDE_Calendar::getOldTypeIDByNewTypeID, newTypeID:" << newTypeID;
int oldTypeID = 0;
QMap<int, QString>::const_iterator constIter = mTypeMap.constBegin();

Expand All @@ -66,11 +71,13 @@
break;
}
}
qCDebug(CommonLogger) << "DDE_Calendar::getOldTypeIDByNewTypeID, oldTypeID:" << oldTypeID;
return oldTypeID == 0 ? 3 : oldTypeID;
}

QString DDE_Calendar::getExternalSchedule(const DSchedule::Map &scheduleMap)
{
qCDebug(CommonLogger) << "DDE_Calendar::getExternalSchedule, map size:" << scheduleMap.size();
QString strJson;
QJsonDocument doc;
QJsonArray jsonarr;
Expand All @@ -94,6 +101,7 @@

void DDE_Calendar::setAlarmByOldRemind(const DSchedule::Ptr &schedule, const QString &remind)
{
qCDebug(CommonLogger) << "DDE_Calendar::setAlarmByOldRemind, remind:" << remind;
//提醒规则
QStringList strList = remind.split(";", Qt::SkipEmptyParts);

Expand All @@ -106,6 +114,7 @@
alarm->setDisplayAlarm(schedule->summary());

if (schedule->allDay()) {
qCDebug(CommonLogger) << "Setting alarm for all-day event";
//提前多少秒
int offset = 0;
if (strList.size() > 1) {
Expand All @@ -115,6 +124,7 @@
KCalendarCore::Duration duration(-(24 * 60 * 60 * remindNum - offset));
alarm->setStartOffset(duration);
} else {
qCDebug(CommonLogger) << "Setting alarm for timed event";
KCalendarCore::Duration duration(-(60 * remindNum));
alarm->setStartOffset(duration);
}
Expand All @@ -124,6 +134,7 @@

QString DDE_Calendar::getOldRemindByAlarm(const DSchedule::AlarmType &alarmType)
{
qCDebug(CommonLogger) << "DDE_Calendar::getOldRemindByAlarm, alarmType:" << alarmType;
QString _resultStr {""};
switch (alarmType) {
case DSchedule::Alarm_Begin:
Expand Down Expand Up @@ -171,10 +182,12 @@

DSchedule::Ptr DDE_Calendar::getScheduleByExported(const QString &scheduleStr)
{
qCDebug(CommonLogger) << "DDE_Calendar::getScheduleByExported";
QJsonParseError json_error;
QJsonDocument jsonDoc(QJsonDocument::fromJson(scheduleStr.toLocal8Bit(), &json_error));

if (json_error.error != QJsonParseError::NoError) {
qCWarning(CommonLogger) << "JSON parse error:" << json_error.errorString();
return nullptr;
}
QJsonObject rootObj = jsonDoc.object();
Expand Down Expand Up @@ -225,6 +238,7 @@

void DDE_Calendar::setRRuleByOldRRule(const DSchedule::Ptr &schedule, const QString &rrule)
{
qCDebug(CommonLogger) << "DDE_Calendar::setRRuleByOldRRule, rrule:" << rrule;
//重复规则
KCalendarCore::Recurrence *recurrence = schedule->recurrence();
KCalendarCore::ICalFormat ical;
Expand All @@ -237,6 +251,7 @@

void DDE_Calendar::setExDate(const DSchedule::Ptr &schedule, const QJsonArray &ignore)
{
qCDebug(CommonLogger) << "DDE_Calendar::setExDate, ignore count:" << ignore.size();
KCalendarCore::Recurrence *recurrence = schedule->recurrence();

foreach (auto ignoreTime, ignore) {
Expand Down
Loading
Loading